Index: trunk/firmware/sources/saigd/nmealib++/nmeaCode.cpp =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/nmeaCode.cpp b/trunk/firmware/sources/saigd/nmealib++/nmeaCode.cpp --- a/trunk/firmware/sources/saigd/nmealib++/nmeaCode.cpp (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/nmeaCode.cpp (revision 116) @@ -26,17 +26,17 @@ // TODO Auto-generated destructor stub } -virtual void nmeaCode::code_init() { -} -virtual int nmeaCode::code_gen(char *buff, int buff_sz) { - return 0; +bool nmeaCode::nmea_code_set(const char* cd) { + size_t sz = strlen(cd); + codebuff = new char[sz]; + strcpy(codebuff, cd); + return true; } -virtual int nmeaCode::code_parse(const char *buff, int buff_sz) { - return 0; +bool nmeaCode::nmea_code_get(char* cd) { + return true; } - //////////////////////////////////////////////////////////////////////////////////////// Index: trunk/firmware/sources/saigd/nmealib++/nmeaCode.h =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/nmeaCode.h b/trunk/firmware/sources/saigd/nmealib++/nmeaCode.h --- a/trunk/firmware/sources/saigd/nmealib++/nmeaCode.h (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/nmeaCode.h (revision 116) @@ -15,14 +15,11 @@ nmeaCode(char* name=nullptr); virtual ~nmeaCode(); - virtual void code_init(void); - virtual int code_gen(char *buff, int buff_sz);// TODO para generator - virtual int code_parse(const char *buff, int buff_sz);// TODO para parser - - - + bool nmea_code_set(const char* cd); + bool nmea_code_get(char* cd); private: + size_t size; const char codename[8]; const int type; char *codebuff; Index: trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.cpp =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.cpp b/trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.cpp --- a/trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.cpp (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.cpp (revision 116) @@ -20,7 +20,7 @@ } -virtual int nmeaGenerator::code_info2nmea(const nmeaInfo *info, nmeaCode* code) +virtual int nmeaGenerator::nmea_gen_info2code(const nmeaInfo *info, nmeaCode* code) { return 1; } @@ -34,7 +34,7 @@ { int RetVal = 1; int smask = info->smask; - info->code_init_INFO(); + info->nmea_info_init_INFO(); info->smask = smask; info->lat = NMEA_DEF_LAT; @@ -184,7 +184,7 @@ while(code) { - code_info2nmea(info, code) + nmea_gen_info2code(info, code) gen_count += code->code_gen(buff + gen_count, buff_sz - gen_count); code += 1; if(buff_sz - gen_count <= 0) Index: trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.h =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.h b/trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.h --- a/trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.h (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/nmeaGenerator.h (revision 116) @@ -40,7 +40,7 @@ virtual ~nmeaGenerator(); - virtual int code_info2nmea(const nmeaInfo *info, nmeaCode* code); + virtual int nmea_gen_info2code(const nmeaInfo *info, nmeaCode* code); int nmea_gen_init(nmeaInfo *info); int nmea_gen_loop(nmeaInfo *info); Index: trunk/firmware/sources/saigd/nmealib++/nmeaInfo.cpp =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/nmeaInfo.cpp b/trunk/firmware/sources/saigd/nmealib++/nmeaInfo.cpp --- a/trunk/firmware/sources/saigd/nmealib++/nmeaInfo.cpp (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/nmeaInfo.cpp (revision 116) @@ -17,15 +17,15 @@ // TODO Auto-generated destructor stub } -void nmeaInfo::code_init_INFO() -{ - - code_time_now(); +void nmeaInfo::nmea_info_init_INFO() +{ + + nmea_info_time_now(); sig = NMEA_SIG_BAD; fix = NMEA_FIX_BAD; } -static void nmeaInfo::code_time_now() { +static void nmeaInfo::nmea_info_time_now() { time_t lt; struct tm *tt; @@ -44,7 +44,7 @@ /** * \brief Convert position from INFO to radians position */ -void nmeaInfo::code_info2pos(nmeaPOS *pos) { +void nmeaInfo::nmea_info_info2pos(nmeaPOS *pos) { pos->lat = code_ndeg2radian(lat); pos->lon = code_ndeg2radian(lon); } @@ -52,7 +52,7 @@ /** * \brief Convert radians position to INFOs position */ -void nmeaInfo::code_pos2info(const nmeaPOS *pos) { +void nmeaInfo::nmea_info_pos2info(const nmeaPOS *pos) { lat = code_radian2ndeg(pos->lat); lon = code_radian2ndeg(pos->lon); } @@ -116,7 +116,7 @@ int nmeaInfo::nmea_igen_static_loop() { - code_time_now(); + nmea_info_time_now(); return 1; }; @@ -173,7 +173,7 @@ double deg = 360 / (count?count:1); double srt = (count?(satinfo.sat[0].azimuth):0) + 5; - code_time_now(); + nmea_info_time_now(); for(it = 0; it < count; ++it) { @@ -247,9 +247,9 @@ if(speed < 1) speed = 1; - code_info2pos(&crd); + nmea_info_info2pos(&crd); code_move_horz(&crd, &crd, direction, speed / 3600); - code_pos2info(&crd); + nmea_info_pos2info(&crd); declination = direction; Index: trunk/firmware/sources/saigd/nmealib++/nmeaInfo.h =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/nmeaInfo.h b/trunk/firmware/sources/saigd/nmealib++/nmeaInfo.h --- a/trunk/firmware/sources/saigd/nmealib++/nmeaInfo.h (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/nmeaInfo.h (revision 116) @@ -47,22 +47,22 @@ public: nmeaInfo(); virtual ~nmeaInfo(); - void code_init_INFO(); - static void code_time_now(); - void code_info2pos(nmeaPOS *pos); - void code_pos2info(const nmeaPOS *pos); + void nmea_info_init_INFO(); + static void nmea_info_time_now(); + void nmea_info_info2pos(nmeaPOS *pos); + void nmea_info_pos2info(const nmeaPOS *pos); - int nmea_igen_noise_init(); - int nmea_igen_noise_loop(); - int nmea_igen_noise_reset(); - int nmea_igen_static_loop(); - int nmea_igen_static_reset(); - int nmea_igen_static_init(); - int nmea_igen_rotate_loop(); - int nmea_igen_rotate_reset(); - int nmea_igen_rotate_init(); - int nmea_igen_pos_rmove_init(); - int nmea_igen_pos_rmove_loop(); + int nmea_info_noise_init(); + int nmea_info_noise_loop(); + int nmea_info_noise_reset(); + int nmea_info_static_loop(); + int nmea_info_static_reset(); + int nmea_info_static_init(); + int nmea_info_rotate_loop(); + int nmea_info_rotate_reset(); + int nmea_info_rotate_init(); + int nmea_info_pos_rmove_init(); + int nmea_info_pos_rmove_loop(); private: int smask; /**< Mask specifying types of packages from which data have been obtained */ @@ -78,6 +78,14 @@ double speed; /**< Speed over the ground in kilometers/hour */ double direction; /**< Track angle in degrees True */ double declination; /**< Magnetic variation degrees (Easterly var. subtracts from true course) */ + char ns; + char ew; + double satinuse; + char elv_units; + double diff; + char diff_units; + double dgps_age; + double dgps_sid; nmeaSATINFO satinfo; /**< Satellites information */ }; Index: trunk/firmware/sources/saigd/nmealib++/nmeaParser.h =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/nmeaParser.h b/trunk/firmware/sources/saigd/nmealib++/nmeaParser.h --- a/trunk/firmware/sources/saigd/nmealib++/nmeaParser.h (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/nmeaParser.h (revision 116) @@ -31,7 +31,7 @@ int nmea_parser_buff_clear(void); int nmea_parser_queue_clear(void); - virtual void code_2info(nmeaCode* code, nmeaInfo* info); + virtual void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); private: void *top_node; @@ -43,4 +43,78 @@ int nmea_parser_real_push(const char *buff, int buff_sz); }; + +class nmeaGPALMParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +//codigos NMEA que se pueden enviar al receptor GPS GARMIN +class nmeaPGRMIParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaPGRMCParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaPGRMC1Parser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaPGRMOParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + + +//Codigos NMEA que puede transmitir el receptor GNSS + +class nmeaGPGGAParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaGPGSAParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaGPGSVParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaGPRMCParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaGPVTGParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaGPGLLParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +//codigos de propiedad de GARMIN +class nmeaPGRMEParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaPGRMFParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaPGRMMParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaPGRMTParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaPGRMVParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + +class nmeaPGRMBParser:nmeaParser { + void nmea_parser_code2info(nmeaCode* code, nmeaInfo* info); +}; + #endif /* NMEALIB_NMEALIB___NMEAPARSER_H_ */ Index: trunk/firmware/sources/saigd/nmealib++/utils.cpp =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/utils.cpp b/trunk/firmware/sources/saigd/nmealib++/utils.cpp --- a/trunk/firmware/sources/saigd/nmealib++/utils.cpp (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/utils.cpp (revision 116) @@ -13,7 +13,7 @@ * \fn code_degree2radian * \brief Convert degree to radian */ -double code_degree2radian(double val) { +double nmea_utils_degree2radian(double val) { return (val * code_PI180); } @@ -21,14 +21,14 @@ * \fn code_radian2degree * \brief Convert radian to degree */ -double code_radian2degree(double val) { +double nmea_utils_radian2degree(double val) { return (val / code_PI180); } /** * \brief Convert NDEG (NMEA degree) to fractional degree */ -double code_ndeg2degree(double val) { +double nmea_utils_ndeg2degree(double val) { double deg = ((int)(val / 100)); val = deg + (val - deg * 100) / 60; return val; @@ -37,7 +37,7 @@ /** * \brief Convert fractional degree to NDEG (NMEA degree) */ -double code_degree2ndeg(double val) { +double nmea_utils_degree2ndeg(double val) { double int_part; double fra_part; fra_part = modf(val, &int_part); @@ -50,29 +50,29 @@ * \brief Convert NDEG (NMEA degree) to radian */ double code_ndeg2radian(double val) { - return code_degree2radian(code_ndeg2degree(val)); + return nmea_utils_degree2radian(nmea_utils_ndeg2degree(val)); } /** * \fn code_radian2ndeg * \brief Convert radian to NDEG (NMEA degree) */ -double code_radian2ndeg(double val) { - return code_degree2ndeg(code_radian2degree(val)); +double nmea_utils_radian2ndeg(double val) { + return nmea_utils_degree2ndeg(nmea_utils_radian2degree(val)); } /** * \brief Calculate PDOP (Position Dilution Of Precision) factor */ -double code_calc_pdop(double hdop, double vdop) { +double nmea_utils_calc_pdop(double hdop, double vdop) { return sqrt(pow(hdop, 2) + pow(vdop, 2)); } -double code_dop2meters(double dop) { +double nmea_utils_dop2meters(double dop) { return (dop * code_DOP_FACTOR); } -double code_meters2dop(double meters) { +double nmea_utils_meters2dop(double meters) { return (meters / code_DOP_FACTOR); } @@ -80,7 +80,7 @@ * \brief Calculate distance between two points * \return Distance in meters */ -double code_distance( +double nmea_utils_distance( const nmeaPOS *from_pos, /**< From position in radians */ const nmeaPOS *to_pos /**< To position in radians */ ) @@ -99,7 +99,7 @@ * http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf * \return Distance in meters */ -double code_distance_ellipsoid( +double nmea_utils_distance_ellipsoid( const nmeaPOS *from_pos, /**< From position in radians */ const nmeaPOS *to_pos, /**< To position in radians */ double *from_azimuth, /**< (O) azimuth at "from" position in radians */ @@ -214,7 +214,7 @@ /** * \brief Horizontal move of point position */ -int code_move_horz( +int nmea_utils_move_horz( const nmeaPOS *start_pos, /**< Start position in radians */ nmeaPOS *end_pos, /**< Result position in radians */ double azimuth, /**< Azimuth (degree) [0, 359] */ @@ -225,7 +225,7 @@ int RetVal = 1; distance /= code_EARTHRADIUS_KM; /* Angular distance covered on earth's surface */ - azimuth = code_degree2radian(azimuth); + azimuth = nmea_utils_degree2radian(azimuth); end_pos->lat = asin( sin(p1.lat) * cos(distance) + cos(p1.lat) * sin(distance) * cos(azimuth)); @@ -247,7 +247,7 @@ * The algorithm is described here: * http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf */ -int code_move_horz_ellipsoid( +int nmea_utils_move_horz_ellipsoid( const nmeaPOS *start_pos, /**< Start position in radians */ nmeaPOS *end_pos, /**< (O) Result position in radians */ double azimuth, /**< Azimuth in radians */ @@ -358,7 +358,7 @@ /** * \brief Calculate control sum of binary buffer */ -int code_calc_crc(const char *buff, int buff_sz) +int nmea_utils_calc_crc(const char *buff, int buff_sz) { int chsum = 0, it; @@ -372,7 +372,7 @@ /** * \brief Convert string to number */ -int code_atoi(const char *str, int str_sz, int radix) +int nmea_utils_atoi(const char *str, int str_sz, int radix) { char *tmp_ptr; char buff[NMEA_CONVSTR_BUF]; @@ -391,7 +391,7 @@ /** * \brief Convert string to fraction number */ -double code_atof(const char *str, int str_sz) +double nmea_utils_atof(const char *str, int str_sz) { char *tmp_ptr; char buff[NMEA_CONVSTR_BUF]; @@ -410,7 +410,7 @@ /** * \brief Formating string (like standart printf) with CRC tail (*CRC) */ -int code_printf(char *buff, int buff_sz, const char *format, ...) +int nmea_utils_printf(char *buff, int buff_sz, const char *format, ...) { int retval, add = 0; va_list arg_ptr; @@ -426,7 +426,7 @@ { add = NMEA_POSIX(snprintf)( buff + retval, buff_sz - retval, "*%02x\r\n", - code_calc_crc(buff + 1, retval - 1)); + nmea_utils_calc_crc(buff + 1, retval - 1)); } retval += add; @@ -445,7 +445,7 @@ /** * \brief Analyse string (specificate for NMEA sentences) */ -int code_scanf(const char *buff, int buff_sz, const char *format, ...) +int nmea_utils_scanf(const char *buff, int buff_sz, const char *format, ...) { const char *beg_tok; const char *end_buf = buff + buff_sz; @@ -481,7 +481,7 @@ { tok_type = NMEA_TOKS_TYPE; if(format > beg_fmt) - width = code_atoi(beg_fmt, (int)(format - beg_fmt), 10); + width = nmea_utils_atoi(beg_fmt, (int)(format - beg_fmt), 10); } case NMEA_TOKS_TYPE: beg_tok = buff; @@ -534,7 +534,7 @@ case 'E': parg_target = (void *)va_arg(arg_ptr, double *); if(width && 0 != (parg_target)) - *((double *)parg_target) = code_atof(beg_tok, width); + *((double *)parg_target) = nmea_utils_atof(beg_tok, width); break; }; @@ -549,20 +549,20 @@ { case 'd': case 'i': - snum = code_atoi(beg_tok, width, 10); + snum = nmea_utils_atoi(beg_tok, width, 10); memcpy(parg_target, &snum, sizeof(int)); break; case 'u': - unum = code_atoi(beg_tok, width, 10); + unum = nmea_utils_atoi(beg_tok, width, 10); memcpy(parg_target, &unum, sizeof(unsigned int)); break; case 'x': case 'X': - unum = code_atoi(beg_tok, width, 16); + unum = nmea_utils_atoi(beg_tok, width, 16); memcpy(parg_target, &unum, sizeof(unsigned int)); break; case 'o': - unum = code_atoi(beg_tok, width, 8); + unum = nmea_utils_atoi(beg_tok, width, 8); memcpy(parg_target, &unum, sizeof(unsigned int)); break; default: @@ -581,7 +581,7 @@ } -double nmeaGenerator::nmea_random(double min, double max) +double nmea_utils_random(double min, double max) { static double rand_max = RAND_MAX; double rand_val = rand(); Index: trunk/firmware/sources/saigd/nmealib++/utils.h =================================================================== diff --git a/trunk/firmware/sources/saigd/nmealib++/utils.h b/trunk/firmware/sources/saigd/nmealib++/utils.h --- a/trunk/firmware/sources/saigd/nmealib++/utils.h (revision 115) +++ b/trunk/firmware/sources/saigd/nmealib++/utils.h (revision 116) @@ -10,29 +10,29 @@ #include "nmea_defs.h" -double code_degree2radian(double val); -double code_radian2degree(double val); -double code_ndeg2degree(double val); -double code_degree2ndeg(double val); -double code_ndeg2radian(double val); -double code_radian2ndeg(double val); -double code_calc_pdop(double hdop, double vdop); -double code_dop2meters(double dop); -double code_meters2dop(double meters); -double code_distance(const nmeaPOS *from_pos, const nmeaPOS *to_pos); -double code_distance_ellipsoid(const nmeaPOS *from_pos, const nmeaPOS *to_pos, +double nmea_utils_degree2radian(double val); +double nmea_utils_radian2degree(double val); +double nmea_utils_ndeg2degree(double val); +double nmea_utils_degree2ndeg(double val); +double nmea_utils_ndeg2radian(double val); +double nmea_utils_radian2ndeg(double val); +double nmea_utils_calc_pdop(double hdop, double vdop); +double nmea_utils_dop2meters(double dop); +double nmea_utils_meters2dop(double meters); +double nmea_utils_distance(const nmeaPOS *from_pos, const nmeaPOS *to_pos); +double nmea_utils_distance_ellipsoid(const nmeaPOS *from_pos, const nmeaPOS *to_pos, double *from_azimuth, double *to_azimuth); -int code_move_horz(const nmeaPOS *start_pos, nmeaPOS *end_pos, +int nmea_utils_move_horz(const nmeaPOS *start_pos, nmeaPOS *end_pos, double azimuth, double distance); -int code_move_horz_ellipsoid(const nmeaPOS *start_pos, nmeaPOS *end_pos, +int nmea_utils_move_horz_ellipsoid(const nmeaPOS *start_pos, nmeaPOS *end_pos, double azimuth, double distance, double *end_azimuth ); -int code_calc_crc(const char *buff, int buff_sz); -int code_atoi(const char *str, int str_sz, int radix); -double code_atof(const char *str, int str_sz); -int code_printf(char *buff, int buff_sz, const char *format, ...); -int code_scanf(const char *buff, int buff_sz, const char *format, ...); +int nmea_utils_calc_crc(const char *buff, int buff_sz); +int nmea_utils_atoi(const char *str, int str_sz, int radix); +double nmea_utils_atof(const char *str, int str_sz); +int nmea_utils_printf(char *buff, int buff_sz, const char *format, ...); +int nmea_utils_scanf(const char *buff, int buff_sz, const char *format, ...); -double nmea_random(double min, double max); +double nmea_utils_random(double min, double max); #endif /* NMEALIB___UTILS_H_ */