kumar singh
/
Dealer_23Feb
Dummy Lora Packet Sending
Fork of Dealer_18feb17 by
Diff: Lora.cpp
- Revision:
- 13:8955f2e95021
- Parent:
- 11:77e595130230
- Child:
- 14:144ed8b74713
--- a/Lora.cpp Mon Jan 30 18:31:30 2017 +0000 +++ b/Lora.cpp Sun Feb 12 02:57:25 2017 +0000 @@ -95,6 +95,8 @@ while(AT_Response_Receive_Status) Get_Lora_Response(); DEBUGING_UART.printf("Configuration saved"); + LORA_Module_UART.printf("%s",Reset_Device); //reset device + wait_ms(3500); LORA_Module_UART.printf(Attention); //Send Attention command AT_Response_Receive_Status = FAILURE; while(AT_Response_Receive_Status) @@ -114,44 +116,54 @@ Heart_Beat_Lora_Packet.Header = LORA_PACKET_HEADER; Heart_Beat_Lora_Packet.Protocol_Version = OBD_Protocol_Version; Heart_Beat_Lora_Packet.Packet_Type = HEART_BEAT_PACKET_CMD; - Heart_Beat_Lora_Packet.OBD_Battery_Voltage = 0x1234; - Heart_Beat_Lora_Packet.Car_Battery_Voltage = 0x5241; - Heart_Beat_Lora_Packet.OBD_Battery_Temperature = 0x00; - Heart_Beat_Lora_Packet.Car_Ambient_Temperature = 0x00; + Heart_Beat_Lora_Packet.OBD_Battery_Voltage = 350; //3.50V, dummy data + Heart_Beat_Lora_Packet.Car_Battery_Voltage = 1250; //12.50V, dummy data + 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] = 0x78; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Heart_Beat_Lora_Packet.Parking1_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + 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_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] = 0x12; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Heart_Beat_Lora_Packet.Parking2_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + 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_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] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Heart_Beat_Lora_Packet.Parking3_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + 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_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 *****/ Vehicle_Status_Lora_Packet.Header = LORA_PACKET_HEADER; Vehicle_Status_Lora_Packet.Protocol_Version = OBD_Protocol_Version; - Vehicle_Status_Lora_Packet.Packet_Type = CHECKIN_PACKET_CMD; + Vehicle_Status_Lora_Packet.Packet_Type = STATUS_PACKET_CMD; for(i=0;i<17;i++) - Vehicle_Status_Lora_Packet.VIN[i] = Vehicle_Identification_Number[i]; + Vehicle_Status_Lora_Packet.VIN[i] = (30+i);//Vehicle_Identification_Number[i]; for(i=0;i<3;i++) - Vehicle_Status_Lora_Packet.ODO_METER_READING[i] = 0x00; //Dummyy data, To be read using OBD - Vehicle_Status_Lora_Packet.OBD_Battery_Voltage = 0x1234; - Vehicle_Status_Lora_Packet.Car_Battery_Voltage = 0x5241; - Vehicle_Status_Lora_Packet.OBD_Battery_Temperature = 0x00; - Vehicle_Status_Lora_Packet.Car_Ambient_Temperature = 0x00; + Vehicle_Status_Lora_Packet.ODO_METER_READING[i] = 0x05; //Dummyy data, To be read using OBD + Vehicle_Status_Lora_Packet.Fuel_Level = 1050;//10.5 litre + Vehicle_Status_Lora_Packet.OBD_Battery_Voltage = 350; + Vehicle_Status_Lora_Packet.Car_Battery_Voltage = 1250; + Vehicle_Status_Lora_Packet.OBD_Battery_Temperature = 95; + Vehicle_Status_Lora_Packet.Car_Ambient_Temperature = 104; 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] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Parking1_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + 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_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_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_Signal_Strength = 0x09; //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] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Parking2_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + 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_Signal_Strength = 0x09; //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] = 0x00; //MAC ID of 1st NearBy Beacon Device with Highest Signal Strength,dummy data - Vehicle_Status_Lora_Packet.Parking3_Beacon_Signal_Strength = 0x00; //Signal Strength of 3rd NearBy Beacon Device with Highest Signal Strength + 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_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_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 *****/ @@ -188,6 +200,7 @@ Motion_Lora_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 @@ -377,7 +390,10 @@ uint8 i=0; LORA_Module_UART.printf("%s",Send_Lora_Packet);//write to serial port for sending through lora module for(i=0;i<Length;i++) + { LORA_Module_UART.putc(Command_To_Send[i]);//write to serial port for sending through lora module + DEBUGING_UART.putc(Command_To_Send[i]); + } LORA_Module_UART.printf("\r"); }