BLE Transmitter not working

Fork of Dealer_23Feb by kumar singh

Revision:
20:f812f85cf97e
Parent:
16:7703b9d92326
Child:
21:a5fb0ae94dc6
--- a/Beacon.cpp	Tue Feb 21 06:27:13 2017 +0000
+++ b/Beacon.cpp	Tue Feb 21 13:33:29 2017 +0000
@@ -36,6 +36,8 @@
 */
 
 unsigned char SET_UUID[21] = {0x41,0x54,0xFF,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D};
+unsigned char SET_VIRTUAL_PACKET_UUID[23] = {0x01,0x01,0x41,0x54,0x01,0x01,0x02,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x0D};
+unsigned char SET_VIRTUAL_PACKET_UUID1[23] = {0x41,0x54,0xFF,0xF1,0x02,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x02,0x0B,0x0C,0x05,0x0E,0x0F,0x0D};
 unsigned char SET_MAJOR[7] = {0x41,0x54,0xFF,0xF2,0x00,0x00,0x0D};           
 unsigned char SET_MINOR[7] = {0x41,0x54,0xFF,0xF3,0x00,0x00,0x0D};
 unsigned char SET_MEASURED_POWER[6] = {0x41,0x54,0xFF,0xF4,0x00,0x0D};
@@ -48,6 +50,9 @@
 unsigned char SET_CLOSE_BEACON[8] = {0x41,0x54,0x63,0x6C,0x6F,0x73,0x65,0x0D};
 unsigned char READ_BEACON_MAC_ID[6] = {0x52,0x44,0x6D,0x61,0x63,0x0D};
 
+unsigned char SOFT_REBOOT1[15] = {0x01,0x0B,0x41,0x54,0xFF,0xFF,0x6D,0x69,0x6E,0x65,0x77,0x31,0x32,0x33,0x0D};
+unsigned char SOFT_REBOOT2[15] = {0x41,0x54,0xFF,0xFF,0x6D,0x69,0x6E,0x65,0x77,0x31,0x32,0x33,0x0D};
+
 void Process_Beacon_Command_Received(unsigned char* Command_Received);
 void Change_Beacon_Parameter(unsigned char* Beacon_Parameter_To_Set);
 void Get_Beacon_Response(void);
@@ -57,16 +62,23 @@
 void Process_Beacon_Command_Received(unsigned char* Command_Received)
 {
     static unsigned char Temp_Pos,Start_Position,End_Position,Data_Length;
-    Start_Position = 0x04;
+    Start_Position = 0x02;
     Temp_Pos = 0x02;
     if((Command_Received[0] == SET_BEACON_UUID_CMD0) && (Command_Received[1] == SET_BEACON_UUID_CMD1))   //Check if command is receievd for setting UUID
     {
+        DEBUG_UART2.printf("Setting UUID");
         Data_Length = 16;
         End_Position = (Start_Position + Data_Length);
         for(;Start_Position < End_Position;Start_Position++)
+        {
             SET_UUID[Start_Position] = Command_Received[Temp_Pos++];
-        DEBUG_UART2.printf("%s",SET_UUID);
-        Change_Beacon_Parameter(SET_UUID);
+            //DEBUG_UART2.putc(SET_UUID[Start_Position]);
+            //DEBUG_UART2.printf("%s",SET_UUID);
+            
+            
+        }
+        Change_Beacon_Parameter(SET_VIRTUAL_PACKET_UUID1);
+        DEBUG_UART2.printf("UUID Set");
     }
     else if((Command_Received[0] == SET_SET_MAJOR_CMD0) && (Command_Received[1] == SET_SET_MAJOR_CMD1))  //Check if command is received for Setting Major
     {
@@ -137,7 +149,8 @@
     else if((Command_Received[0] == SET_SOFT_REBOOT_CMD0) && (Command_Received[1] == SET_SOFT_REBOOT_CMD1))  //Check if command is received for Stopping beacon and go to sleep mode
     {
         DEBUG_UART2.printf("%s",SOFT_REBOOT);
-        Beacon_Module_UART.printf("%s",SOFT_REBOOT);     //Soft Reboot Beacon Module
+        Beacon_Module_UART.printf("%s",SOFT_REBOOT2);     //Soft Reboot Beacon Module
+         DEBUG_UART2.printf("Beacon Device Resetted");
     }
 }  
     
@@ -145,6 +158,7 @@
 {
     Beacon_Module_UART.printf("%s",Beacon_Parameter_To_Set);    
     Beacon_Module_UART.printf("%s",SOFT_REBOOT);     //Every Ibeacon command must be followed by Soft reset command in order to make the changes take place instantly
+     DEBUG_UART2.printf("%s",Beacon_Parameter_To_Set);
 }
 
 void Initialize_Beacon_Module(void)