kumar singh
/
Dealer_20Mar
BLE Transmitter not working
Fork of Dealer_23Feb by
Diff: Lora.cpp
- Revision:
- 16:7703b9d92326
- Parent:
- 14:144ed8b74713
- Child:
- 17:758fb8454ab0
--- a/Lora.cpp Sun Feb 12 18:38:39 2017 +0000 +++ b/Lora.cpp Fri Feb 17 08:30:35 2017 +0000 @@ -5,7 +5,7 @@ //Configure Lora Packet RawSerial LORA_Module_UART(PA_0, PA_1);//USART4_TX->PA_0,USART4_RX->PA_1 - RawSerial DEBUGING_UART(PA_9, PA_10);//USART1_TX->PA_9,USART1_RX->PA_10 + RawSerial DEBUGING_UART(PA_14, PA_15);//USART1_TX->PA_9,USART1_RX->PA_10 uint8 Packet_Type_To_Send = HEARTBEAT_TYPE_PACKET; //By Default Heart Beat PAckets should be sent uint8 OBD_Protocol_Version = 0x01; @@ -27,6 +27,8 @@ CheckIN_PacketType CheckIN_Lora_Packet; //Allocate Memory for CheckIN Lora Packets Motion_PacketType Motion_Lora_Packet; //Allocate Memory for Movement Lora Packets Vehicle_Status_PacketType Vehicle_Status_Lora_Packet; //Allocate Memory for Movement Lora Packets + Near_Car_Beacon Near_Car_Beacon_Packet; + Fixed_Beacon Fixed_Beacon_Packet; //Lora AT Commands list const char* Attention = {"AT\r"}; @@ -47,7 +49,8 @@ const char* Network_Join_Status = "AT+NJS="; const char* Lora_Device_ID = "AT+DI\r"; - + #define CHECK_IN_PACKET 0x00 + #define CHECK_OUT_PACKET 0x01 uint8 Calculate_Lora_Frame_FCS(uint8* Packet_Data,uint8 Packet_Length); void Set_Up_Lora_Network_Configuration(void); @@ -121,17 +124,17 @@ Heart_Beat_Lora_Packet.OBD_Battery_Temperature = 95; //95'F, dummy data Heart_Beat_Lora_Packet.Car_Ambient_Temperature = 104; //104'F, dummy data for(i=0;i<6;i++) - Heart_Beat_Lora_Packet.Parking1_Beacon_ID[i] = (0x01+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Heart_Beat_Lora_Packet.Parking1_Beacon_Minor = 0x0000; - Heart_Beat_Lora_Packet.Parking1_Beacon_Signal_Strength = 23; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking1_Beacon_ID[i] = (0x01+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking1_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking1_Beacon_Signal_Strength = 23; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Heart_Beat_Lora_Packet.Parking2_Beacon_ID[i] = (10+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Heart_Beat_Lora_Packet.Parking2_Beacon_Minor = 0x0000; - Heart_Beat_Lora_Packet.Parking2_Beacon_Signal_Strength = 45; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking2_Beacon_ID[i] = (10+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking2_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking2_Beacon_Signal_Strength = 45; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Heart_Beat_Lora_Packet.Parking3_Beacon_ID[i] = (20+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Heart_Beat_Lora_Packet.Parking3_Beacon_Minor = 0x0000; - Heart_Beat_Lora_Packet.Parking3_Beacon_Signal_Strength = 12; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking3_Beacon_ID[i] = (20+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking3_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking3_Beacon_Signal_Strength = 12; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength Heart_Beat_Lora_Packet.FCS = 0x00; //FCS of all packets /******* Initialize Lora packet for Vehicle Status *****/ @@ -150,29 +153,29 @@ for(i=0;i<6;i++) Vehicle_Status_Lora_Packet.BLE_Adv_Beacon_ID[i] = BLE_Adv_Module_Beacon_ID[i]; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data for(i=0;i<6;i++) - Vehicle_Status_Lora_Packet.Parking1_Beacon_ID[i] = (30+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Parking1_Beacon_Minor = 0x0000; - Vehicle_Status_Lora_Packet.Parking1_Beacon_Signal_Strength = 0x07; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking1_Beacon_ID[i] = (30+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking1_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking1_Beacon_Signal_Strength = 0x07; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Vehicle_Status_Lora_Packet.Parking2_Beacon_ID[i] = (40+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Parking2_Beacon_Minor = 0x0000; - Vehicle_Status_Lora_Packet.Parking2_Beacon_Signal_Strength = 0x08; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking2_Beacon_ID[i] = (40+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking2_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking2_Beacon_Signal_Strength = 0x08; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Vehicle_Status_Lora_Packet.Parking3_Beacon_ID[i] = (50+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Parking3_Beacon_Minor = 0x0000; - Vehicle_Status_Lora_Packet.Parking3_Beacon_Signal_Strength = 0x09; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking3_Beacon_ID[i] = (50+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking3_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking3_Beacon_Signal_Strength = 0x09; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Vehicle_Status_Lora_Packet.Near_Car1_Beacon_ID[i] = (60+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Near_Car1_Beacon_Minor = 0x0000; - Vehicle_Status_Lora_Packet.Near_Car1_Beacon_Signal_Strength = 0x09; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Near_Car_Beacon_Packet.Near_Car1_Beacon_ID[i] = (60+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Near_Car_Beacon_Packet.Near_Car1_Beacon_Minor = 0x0000; + Near_Car_Beacon_Packet.Near_Car1_Beacon_Signal_Strength = 0x09; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Vehicle_Status_Lora_Packet.Near_Car2_Beacon_ID[i] = (70+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Near_Car2_Beacon_Minor = 0x0000; - Vehicle_Status_Lora_Packet.Near_Car2_Beacon_Signal_Strength = 0x09; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Near_Car_Beacon_Packet.Near_Car2_Beacon_ID[i] = (70+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Near_Car_Beacon_Packet.Near_Car2_Beacon_Minor = 0x0000; + Near_Car_Beacon_Packet.Near_Car2_Beacon_Signal_Strength = 0x09; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Vehicle_Status_Lora_Packet.Near_Car3_Beacon_ID[i] = (80+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Near_Car3_Beacon_Minor = 0x0000; - Vehicle_Status_Lora_Packet.Near_Car3_Beacon_Signal_Strength = 0x09; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Near_Car_Beacon_Packet.Near_Car3_Beacon_ID[i] = (80+i); //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Near_Car_Beacon_Packet.Near_Car3_Beacon_Minor = 0x0000; + Near_Car_Beacon_Packet.Near_Car3_Beacon_Signal_Strength = 0x09; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength Vehicle_Status_Lora_Packet.FCS = 0x00; //FCS of all packets /******* Initialize Lora packet for CheckIn *****/ @@ -184,17 +187,17 @@ for(i=0;i<3;i++) CheckIN_Lora_Packet.ODO_METER_READING[i] = 0x00; //Dummyy data, To be read using OBD for(i=0;i<6;i++) - CheckIN_Lora_Packet.Parking1_Beacon_ID[i] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - CheckIN_Lora_Packet.Parking1_Beacon_Minor = 0x0000; - CheckIN_Lora_Packet.Parking1_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking1_Beacon_ID[i] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking1_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking1_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - CheckIN_Lora_Packet.Parking2_Beacon_ID[i] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - CheckIN_Lora_Packet.Parking2_Beacon_Minor = 0x0000; - CheckIN_Lora_Packet.Parking2_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking2_Beacon_ID[i] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking2_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking2_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - CheckIN_Lora_Packet.Parking3_Beacon_ID[i] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - CheckIN_Lora_Packet.Parking3_Beacon_Minor = 0x0000; - CheckIN_Lora_Packet.Parking3_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking3_Beacon_ID[i] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking3_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking3_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength CheckIN_Lora_Packet.FCS = 0x00; //FCS of all packets /******* Initialize Lora packet for Movement *****/ @@ -202,22 +205,22 @@ Motion_Lora_Packet.Protocol_Version = OBD_Protocol_Version; Motion_Lora_Packet.Packet_Type = MOTION_PACKET_CMD; for(i=0;i<6;i++) - Motion_Lora_Packet.Parking1_Beacon_ID[i] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Motion_Lora_Packet.Parking1_Beacon_Minor = 0x0000; - Motion_Lora_Packet.Parking1_Beacon_Signal_Strength = 0x00; //Signal Strength of 1st NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking1_Beacon_ID[i] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking1_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking1_Beacon_Signal_Strength = 0x00; //Signal Strength of 1st NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Motion_Lora_Packet.Parking2_Beacon_ID[i] = 0x00; //MAC ID of 2nd NearBy Beacon Device with Highest Signal Strength,dummy data - Motion_Lora_Packet.Parking2_Beacon_Minor = 0x0000; - Motion_Lora_Packet.Parking2_Beacon_Signal_Strength = 0x00; //Signal Strength of 2nd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking2_Beacon_ID[i] = 0x00; //MAC ID of 2nd NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking2_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking2_Beacon_Signal_Strength = 0x00; //Signal Strength of 2nd NearBy Beacon Device with Highest Signal Strength for(i=0;i<6;i++) - Motion_Lora_Packet.Parking3_Beacon_ID[i] = 0x00; //MAC ID of 3rd NearBy Beacon Device with Highest Signal Strength,dummy data - Motion_Lora_Packet.Parking3_Beacon_Minor = 0x0000; - Motion_Lora_Packet.Parking3_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + Fixed_Beacon_Packet.Parking3_Beacon_ID[i] = 0x00; //MAC ID of 3rd NearBy Beacon Device with Highest Signal Strength,dummy data + Fixed_Beacon_Packet.Parking3_Beacon_Minor = 0x0000; + Fixed_Beacon_Packet.Parking3_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength Motion_Lora_Packet.Acceleration_Type = 0x00; //Type of acceleration, Vehicle Started/Vehicle Stopped/Sudden Vehicle Movement Motion_Lora_Packet.FCS = 0x00; //FCS of all packets } - + //HeartBeat Packet should be sent every 30sec void Send_HeartBeat_Packet(void) { @@ -233,20 +236,20 @@ Lora_Packet_To_Send[Pos++] = Heart_Beat_Lora_Packet.OBD_Battery_Temperature; //Get Battery Temperature Lora_Packet_To_Send[Pos++] = Heart_Beat_Lora_Packet.Car_Ambient_Temperature; //Get Ambient Temperature for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Heart_Beat_Lora_Packet.Parking1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Heart_Beat_Lora_Packet.Parking1_Beacon_Minor >> 8); //Get Parking1 Minor - Lora_Packet_To_Send[Pos++] = (Heart_Beat_Lora_Packet.Parking1_Beacon_Minor & 0xFF); //Get Parking1 Minor - Lora_Packet_To_Send[Pos++] = Heart_Beat_Lora_Packet.Parking1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking1_Beacon_Minor >> 8); //Get Parking1 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking1_Beacon_Minor & 0xFF); //Get Parking1 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Heart_Beat_Lora_Packet.Parking2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Heart_Beat_Lora_Packet.Parking2_Beacon_Minor >> 8); //Get Parking2 Minor - Lora_Packet_To_Send[Pos++] = (Heart_Beat_Lora_Packet.Parking2_Beacon_Minor & 0xFF); //Get Parking2 Minor - Lora_Packet_To_Send[Pos++] = Heart_Beat_Lora_Packet.Parking2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking2_Beacon_Minor >> 8); //Get Parking2 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking2_Beacon_Minor & 0xFF); //Get Parking2 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Heart_Beat_Lora_Packet.Parking3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Heart_Beat_Lora_Packet.Parking3_Beacon_Minor >> 8); //Get Parking3 Minor - Lora_Packet_To_Send[Pos++] = (Heart_Beat_Lora_Packet.Parking3_Beacon_Minor & 0xFF); //Get Parking3 Minor - Lora_Packet_To_Send[Pos++] = Heart_Beat_Lora_Packet.Parking3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking3_Beacon_Minor >> 8); //Get Parking3 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking3_Beacon_Minor & 0xFF); //Get Parking3 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device Lora_Packet_To_Send[Pos++] = Calculate_Lora_Frame_FCS(Lora_Packet_To_Send,Pos); //Calculate FCS of all bytes Packet_Type_To_Send = HEARTBEAT_TYPE_PACKET; Send_Lora_Packet_To_Gateway(Lora_Packet_To_Send,Pos); @@ -275,35 +278,35 @@ for(i=0;i<6;i++) Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.BLE_Adv_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Parking1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Parking1_Beacon_Minor >> 8); //Get Parking1 Minor - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Parking1_Beacon_Minor & 0xFF); //Get Parking1 Minor - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Parking1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking1_Beacon_Minor >> 8); //Get Parking1 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking1_Beacon_Minor & 0xFF); //Get Parking1 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Parking2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Parking2_Beacon_Minor >> 8); //Get Parking2 Minor - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Parking2_Beacon_Minor & 0xFF); //Get Parking2 Minor - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Parking2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking2_Beacon_Minor >> 8); //Get Parking2 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking2_Beacon_Minor & 0xFF); //Get Parking2 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Parking3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Parking3_Beacon_Minor >> 8); //Get Parking3 Minor - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Parking3_Beacon_Minor & 0xFF); //Get Parking3 Minor - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Parking3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking3_Beacon_Minor >> 8); //Get Parking3 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking3_Beacon_Minor & 0xFF); //Get Parking3 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Near_Car1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Near_Car1_Beacon_Minor >> 8); //Get Near Car1 Minor - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Near_Car1_Beacon_Minor & 0xFF); //Get Near Car1 Minor - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Near_Car1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car1_Beacon_Minor >> 8); //Get Near Car1 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car1_Beacon_Minor & 0xFF); //Get Near Car1 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Near_Car2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Near_Car2_Beacon_Minor >> 8); //Get Near Car2 Minor - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Near_Car2_Beacon_Minor & 0xFF); //Get Near Car2 Minor - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Near_Car2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car2_Beacon_Minor >> 8); //Get Near Car2 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car2_Beacon_Minor & 0xFF); //Get Near Car2 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Near_Car3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Near_Car3_Beacon_Minor >> 8); //Get Near Car3 Minor - Lora_Packet_To_Send[Pos++] = (Vehicle_Status_Lora_Packet.Near_Car3_Beacon_Minor & 0xFF); //Get Near Car3 Minor - Lora_Packet_To_Send[Pos++] = Vehicle_Status_Lora_Packet.Near_Car3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car3_Beacon_Minor >> 8); //Get Near Car3 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car3_Beacon_Minor & 0xFF); //Get Near Car3 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device Lora_Packet_To_Send[Pos++] = Calculate_Lora_Frame_FCS(Lora_Packet_To_Send,Pos); //Calculate FCS of all bytes CheckIN_Packet_Sent_Count++; Send_Lora_Packet_To_Gateway(Lora_Packet_To_Send,Pos); @@ -316,7 +319,10 @@ uint8 Pos = 0,i; Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Header; //Header of Lora Packet,0xFE Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Protocol_Version; //MSB of Motion Packet Type - Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Packet_Type; //MSB of Motion Packet Type + if(OBD_PlugIN_State) + Lora_Packet_To_Send[Pos++] = CHECK_IN_PACKET; //Check detected. Set packet type to Checkout type + else + Lora_Packet_To_Send[Pos++] = CHECK_OUT_PACKET; //Checkout detected. Set packet type to Checkout type for(i=0;i < 17;i++) Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.VIN[i]; //Get OBD_ID for(i=0;i < 3;i++) @@ -328,20 +334,20 @@ Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.OBD_Battery_Temperature; //Get Battery Temperature Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Car_Ambient_Temperature; //Get Ambient Temperature for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Parking1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (CheckIN_Lora_Packet.Parking1_Beacon_Minor >> 8); //Get Parking1 Minor - Lora_Packet_To_Send[Pos++] = (CheckIN_Lora_Packet.Parking1_Beacon_Minor & 0xFF); //Get Parking1 Minor - Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Parking1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking1_Beacon_Minor >> 8); //Get Parking1 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking1_Beacon_Minor & 0xFF); //Get Parking1 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Parking2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (CheckIN_Lora_Packet.Parking2_Beacon_Minor >> 8); //Get Parking2 Minor - Lora_Packet_To_Send[Pos++] = (CheckIN_Lora_Packet.Parking2_Beacon_Minor & 0xFF); //Get Parking2 Minor - Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Parking2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking2_Beacon_Minor >> 8); //Get Parking2 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking2_Beacon_Minor & 0xFF); //Get Parking2 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Parking3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (CheckIN_Lora_Packet.Parking3_Beacon_Minor >> 8); //Get Parking3 Minor - Lora_Packet_To_Send[Pos++] = (CheckIN_Lora_Packet.Parking3_Beacon_Minor & 0xFF); //Get Parking3 Minor - Lora_Packet_To_Send[Pos++] = CheckIN_Lora_Packet.Parking3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking3_Beacon_Minor >> 8); //Get Parking3 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking3_Beacon_Minor & 0xFF); //Get Parking3 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device Lora_Packet_To_Send[Pos++] = Calculate_Lora_Frame_FCS(Lora_Packet_To_Send,Pos); //Calculate FCS of all bytes CheckIN_Packet_Sent_Count++; Send_Lora_Packet_To_Gateway(Lora_Packet_To_Send,Pos); @@ -357,51 +363,51 @@ Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Packet_Type >> 8); //MSB of Motion Packet Type Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Packet_Type & 0xFF); //LSB of Motion Packet Type for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Parking1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Parking1_Beacon_Minor >> 8); //Get Parking1 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Parking1_Beacon_Minor & 0xFF); //Get Parking1 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Parking1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking1_Beacon_Minor >> 8); //Get Parking1 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking1_Beacon_Minor & 0xFF); //Get Parking1 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Parking2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Parking2_Beacon_Minor >> 8); //Get Parking2 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Parking2_Beacon_Minor & 0xFF); //Get Parking2 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Parking2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking2_Beacon_Minor >> 8); //Get Parking2 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking2_Beacon_Minor & 0xFF); //Get Parking2 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Parking3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Parking3_Beacon_Minor >> 8); //Get Parking3 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Parking3_Beacon_Minor & 0xFF); //Get Parking3 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Parking3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking3_Beacon_Minor >> 8); //Get Parking3 Minor + Lora_Packet_To_Send[Pos++] = (Fixed_Beacon_Packet.Parking3_Beacon_Minor & 0xFF); //Get Parking3 Minor + Lora_Packet_To_Send[Pos++] = Fixed_Beacon_Packet.Parking3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car1_Beacon_Minor >> 8); //Get Near_Car1 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car1_Beacon_Minor & 0xFF); //Get Near_Car1 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car1_Beacon_Minor >> 8); //Get Near_Car1 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car1_Beacon_Minor & 0xFF); //Get Near_Car1 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car2_Beacon_Minor >> 8); //Get Near_Car2 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car2_Beacon_Minor & 0xFF); //Get Near_Car2 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car2_Beacon_Minor >> 8); //Get Near_Car2 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car2_Beacon_Minor & 0xFF); //Get Near_Car2 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car3_Beacon_Minor >> 8); //Get Near_Car3 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car3_Beacon_Minor & 0xFF); //Get Near_Car3 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car3_Beacon_Minor >> 8); //Get Near_Car3 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car3_Beacon_Minor & 0xFF); //Get Near_Car3 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Acceleration_Type; //get Type of Acceleration for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car1_Beacon_Minor >> 8); //Get Near Car1 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car1_Beacon_Minor & 0xFF); //Get Near Car1 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car1_Beacon_ID[i]; //Get Beacon_ID of 1st nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car1_Beacon_Minor >> 8); //Get Near Car1 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car1_Beacon_Minor & 0xFF); //Get Near Car1 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car1_Beacon_Signal_Strength; //Get Signal Strength of 1st nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car2_Beacon_Minor >> 8); //Get Near Car2 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car2_Beacon_Minor & 0xFF); //Get Near Car2 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car2_Beacon_ID[i]; //Get Beacon_ID of 2nd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car2_Beacon_Minor >> 8); //Get Near Car2 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car2_Beacon_Minor & 0xFF); //Get Near Car2 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car2_Beacon_Signal_Strength; //Get Signal Strength of 2nd nearby Beacon Device for(i=0;i<6;i++) - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car3_Beacon_Minor >> 8); //Get Near Car3 Minor - Lora_Packet_To_Send[Pos++] = (Motion_Lora_Packet.Near_Car3_Beacon_Minor & 0xFF); //Get Near Car3 Minor - Lora_Packet_To_Send[Pos++] = Motion_Lora_Packet.Near_Car3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car3_Beacon_ID[i]; //Get Beacon_ID of 3rd nearby Beacon Device + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car3_Beacon_Minor >> 8); //Get Near Car3 Minor + Lora_Packet_To_Send[Pos++] = (Near_Car_Beacon_Packet.Near_Car3_Beacon_Minor & 0xFF); //Get Near Car3 Minor + Lora_Packet_To_Send[Pos++] = Near_Car_Beacon_Packet.Near_Car3_Beacon_Signal_Strength; //Get Signal Strength of 3rd nearby Beacon Device Lora_Packet_To_Send[Pos++] = Calculate_Lora_Frame_FCS(Lora_Packet_To_Send,Pos); //Calculate FCS of all bytes Motion_Packet_Sent_Count++; Send_Lora_Packet_To_Gateway(Lora_Packet_To_Send,Pos);