GPS working with LoRa code - can't transmit faster that once every 6 seconds
Dependencies: mbed LoRaWAN-lib_gps_lora SingleFrequencyLora
l86.cpp@5:850a9db98a41, 2017-11-12 (annotated)
- Committer:
- Rishin
- Date:
- Sun Nov 12 23:34:19 2017 +0000
- Revision:
- 5:850a9db98a41
- Child:
- 6:670ff1507ff4
Add RMC parsing code - untested but compiles
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rishin | 5:850a9db98a41 | 1 | #include "l86.hpp" |
Rishin | 5:850a9db98a41 | 2 | #include <string.h> |
Rishin | 5:850a9db98a41 | 3 | |
Rishin | 5:850a9db98a41 | 4 | void Parse_RMC_data(RMC_data RMC_data_parse){ |
Rishin | 5:850a9db98a41 | 5 | |
Rishin | 5:850a9db98a41 | 6 | //Local Variables |
Rishin | 5:850a9db98a41 | 7 | char RMC_message_copy[MAX_NMEA_LENGTH] = ""; |
Rishin | 5:850a9db98a41 | 8 | const char delimeter[2] = ","; |
Rishin | 5:850a9db98a41 | 9 | char *token = ""; |
Rishin | 5:850a9db98a41 | 10 | int i = 0; |
Rishin | 5:850a9db98a41 | 11 | char temp[11][12]; /* [11][12]: 11 strings, of length 12 */ |
Rishin | 5:850a9db98a41 | 12 | |
Rishin | 5:850a9db98a41 | 13 | //Copy original RMC sentence to a copy in order to not destroy message |
Rishin | 5:850a9db98a41 | 14 | strcpy(RMC_message_copy,RMC_data_parse.Message); |
Rishin | 5:850a9db98a41 | 15 | |
Rishin | 5:850a9db98a41 | 16 | //Seperated Message |
Rishin | 5:850a9db98a41 | 17 | /* get the first token */ |
Rishin | 5:850a9db98a41 | 18 | token = strtok(RMC_message_copy, delimeter); |
Rishin | 5:850a9db98a41 | 19 | |
Rishin | 5:850a9db98a41 | 20 | /* walk through other tokens */ |
Rishin | 5:850a9db98a41 | 21 | while( token != NULL ) |
Rishin | 5:850a9db98a41 | 22 | { |
Rishin | 5:850a9db98a41 | 23 | strcpy(temp[i],token); |
Rishin | 5:850a9db98a41 | 24 | i++; |
Rishin | 5:850a9db98a41 | 25 | token = strtok(NULL, delimeter); |
Rishin | 5:850a9db98a41 | 26 | } |
Rishin | 5:850a9db98a41 | 27 | |
Rishin | 5:850a9db98a41 | 28 | //Copy the message into its individual components |
Rishin | 5:850a9db98a41 | 29 | strcpy(RMC_data_parse.Message_ID,temp[0]); |
Rishin | 5:850a9db98a41 | 30 | strcpy(RMC_data_parse.UTC_Time,temp[1]); |
Rishin | 5:850a9db98a41 | 31 | strcpy(RMC_data_parse.Status,temp[2]); |
Rishin | 5:850a9db98a41 | 32 | strcpy(RMC_data_parse.Latitude,temp[3]); |
Rishin | 5:850a9db98a41 | 33 | strcpy(RMC_data_parse.N_S_Indicator,temp[4]); |
Rishin | 5:850a9db98a41 | 34 | strcpy(RMC_data_parse.Longitude,temp[5]); |
Rishin | 5:850a9db98a41 | 35 | strcpy(RMC_data_parse.E_W_Indicator,temp[6]); |
Rishin | 5:850a9db98a41 | 36 | strcpy(RMC_data_parse.Speed_Over_Ground,temp[7]); |
Rishin | 5:850a9db98a41 | 37 | strcpy(RMC_data_parse.Course_Over_Ground,temp[8]); |
Rishin | 5:850a9db98a41 | 38 | strcpy(RMC_data_parse.Date,temp[9]); |
Rishin | 5:850a9db98a41 | 39 | strcpy(RMC_data_parse.Mode,temp[10]); |
Rishin | 5:850a9db98a41 | 40 | } |