QT -= guiTARGET = QNmeaLibTEMPLATE = libVERSION = 1.0.0DEFINES += QNMEALIB_LIBRARYSOURCES += \ src/tok.c \ src/time.c \ src/sentence.c \ src/parser.c \ src/parse.c \ src/info.c \ src/gmath.c \ src/generator.c \ src/generate.c \ src/context.cHEADERS +=\ QNmeaLib_global.h \ include/nmea/units.h \ include/nmea/tok.h \ include/nmea/time.h \ include/nmea/sentence.h \ include/nmea/parser.h \ include/nmea/parse.h \ include/nmea/nmea.h \ include/nmea/info.h \ include/nmea/gmath.h \ include/nmea/generator.h \ include/nmea/generate.h \ include/nmea/context.h \ include/nmea/config.hsymbian { MMP_RULES += EXPORTUNFROZEN TARGET.UID3 = 0xED4313FA TARGET.CAPABILITY = TARGET.EPOCALLOWDLLDATA = 1 addFiles.sources = QNmeaLib.dll addFiles.path = !:/sys/bin DEPLOYMENT += addFiles}unix:!symbian { maemo5 { target.path = /opt/usr/lib } else { target.path = /usr/lib } INSTALLS += target}
/* * * NMEA library * URL: http://nmea.sourceforge.net * Author: Tim (xtimor@gmail.com) * Licence: http://www.gnu.org/licenses/lgpl.html * $Id: generator.h 4 2007-08-27 13:11:03Z xtimor $ * */#ifndef __NMEA_GENERATOR_H__#define __NMEA_GENERATOR_H__#include "info.h"#ifdef __cplusplusextern "C" {#endif/* * high level */struct _nmeaGENERATOR;enum nmeaGENTYPE{ NMEA_GEN_NOISE = 0, NMEA_GEN_STATIC, NMEA_GEN_ROTATE, NMEA_GEN_SAT_STATIC, NMEA_GEN_SAT_ROTATE, NMEA_GEN_POS_RANDMOVE, NMEA_GEN_LAST};struct _nmeaGENERATOR * nmea_create_generator(int type, nmeaINFO *info);void nmea_destroy_generator(struct _nmeaGENERATOR *gen);int nmea_generate_from( char *buff, int buff_sz, /* buffer */ nmeaINFO *info, /* source info */ struct _nmeaGENERATOR *gen, /* generator */ int generate_mask /* mask of sentence`s (e.g. GPGGA | GPGSA) */ );/* * low level */typedef int (*nmeaNMEA_GEN_INIT)(struct _nmeaGENERATOR *gen, nmeaINFO *info);typedef int (*nmeaNMEA_GEN_LOOP)(struct _nmeaGENERATOR *gen, nmeaINFO *info);typedef int (*nmeaNMEA_GEN_RESET)(struct _nmeaGENERATOR *gen, nmeaINFO *info);typedef int (*nmeaNMEA_GEN_DESTROY)(struct _nmeaGENERATOR *gen);typedef struct _nmeaGENERATOR{ void *gen_data; nmeaNMEA_GEN_INIT init_call; nmeaNMEA_GEN_LOOP loop_call; nmeaNMEA_GEN_RESET reset_call; nmeaNMEA_GEN_DESTROY destroy_call; struct _nmeaGENERATOR *next;} nmeaGENERATOR;int nmea_gen_init(nmeaGENERATOR *gen, nmeaINFO *info);int nmea_gen_loop(nmeaGENERATOR *gen, nmeaINFO *info);int nmea_gen_reset(nmeaGENERATOR *gen, nmeaINFO *info);void nmea_gen_destroy(nmeaGENERATOR *gen);void nmea_gen_add(nmeaGENERATOR *to, nmeaGENERATOR *gen);#ifdef __cplusplus}#endif#endif /* __NMEA_GENERATOR_H__ */
QT += coreQT -= guiTARGET = TestLibCONFIG += consoleCONFIG -= app_bundleTEMPLATE = appSOURCES += main.cppwin32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lQNmeaLib1else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lQNmeaLib1delse:symbian: LIBS += -lQNmeaLib1else:unix: LIBS += -L$$PWD/lib/ -lQNmeaLib1INCLUDEPATH += $$PWD/includeDEPENDPATH += $$PWD/include
#include <QtCore/QCoreApplication>#include <nmea.h>#include <string.h>int main(int argc, char *argv[]){ QCoreApplication a(argc, argv); const char *buff[] = { "$GPRMC,173843,A,3349.896,N,11808.521,W,000.0,360.0,230108,013.4,E*69\r\n", "$GPGGA,111609.14,5001.27,N,3613.06,E,3,08,0.0,10.2,M,0.0,M,0.0,0000*70\r\n", "$GPGSV,2,1,08,01,05,005,80,02,05,050,80,03,05,095,80,04,05,140,80*7f\r\n", "$GPGSV,2,2,08,05,05,185,80,06,05,230,80,07,05,275,80,08,05,320,80*71\r\n", "$GPGSA,A,3,01,02,03,04,05,06,07,08,00,00,00,00,0.0,0.0,0.0*3a\r\n", "$GPRMC,111609.14,A,5001.27,N,3613.06,E,11.2,0.0,261206,0.0,E*50\r\n", "$GPVTG,217.5,T,208.8,M,000.00,N,000.01,K*4C\r\n" }; int it; nmeaINFO info; nmeaPARSER parser; nmea_zero_INFO(&info); nmea_parser_init(&parser); for(it = 0; it < 6; ++it) nmea_parse(&parser, buff[it], (int)strlen(buff[it]), &info); nmea_parser_destroy(&parser); return a.exec();}
QT += coreQT -= guiTARGET = TestLibCONFIG += consoleCONFIG -= app_bundleTEMPLATE = appSOURCES += main.cppLIBS += -L$$PWD/lib/ -lQNmeaLibINCLUDEPATH += $$PWD/includeDEPENDPATH += $$PWD/include
TEMPLATE = lib
LIBS += -L$$PWD/lib/NmeaLib.a -lm