some work done, but i need to test it in a regular C program..
This commit is contained in:
@@ -5,14 +5,49 @@
|
||||
* Author: Christian Lind Vie Madsen
|
||||
*/
|
||||
|
||||
#include "cm_nmea_decoder.h"
|
||||
#include <string.h>
|
||||
#define MAX_NMEA_MSG_TYPES 2
|
||||
const char *nmea_msg_types[MAX_NMEA_MSG_TYPES] = {"$GPGLL", "$GPGFF"};
|
||||
typedef int (*nmeaDecoder_Evt_fpt)(cm_nmea_msg_t *inst, char *str);
|
||||
|
||||
static int sGPGLL_decode(char *str){
|
||||
|
||||
//Move pointer until we meet a "," or NULL!
|
||||
while((*str != ",") && (*str != NULL)) str++;
|
||||
}
|
||||
|
||||
|
||||
nmeaDecoder_Evt_fpt nmea_decodeFuncs[1] = {
|
||||
|
||||
};
|
||||
|
||||
static int sNMEA_getMsgType(char *str){
|
||||
|
||||
for(int i = 0; i < (MAX_NMEA_MSG_TYPES-1); i++){
|
||||
|
||||
if(strcmp(nmea_msg_types[i], str)) return i;
|
||||
};
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cm_nmea_characterDecode(char in){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// This function returns the message type, so the user knows which message has been decoded!
|
||||
int cm_nmea_stringDecode(char *str){
|
||||
|
||||
// Find which type of message we need to decode.
|
||||
int nmea_msg_idx = sNMEA_getMsgType(str);
|
||||
|
||||
// Check if we found a valid NMEA message.
|
||||
if(nmea_msg_idx == -1) return nmea_msg_idx;
|
||||
|
||||
// Use the correct function to decode!
|
||||
if(nmea_msg_idx >= 0) nmea_msg_types[nmea_msg](str);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user