Skip to content

Commit 7dab121

Browse files
author
mhugent
committed
[FEATURE]: add classes for live GPS tracking in core
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12685 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f2c277c commit 7dab121

34 files changed

+5612
-0
lines changed

src/core/CMakeLists.txt

+26
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@
55

66
SET(QGIS_CORE_SRCS
77

8+
gps/qextserialport.cpp
9+
gps/qextserialbase.cpp
10+
gps/qgsgpsconnection.cpp
11+
gps/qgsgpsconnectionregistry.cpp
12+
gps/qgsgpstrackerthread.cpp
13+
gps/qgsnmeaconnection.cpp
14+
gps/parse.c
15+
gps/sentence.c
16+
gps/info.c
17+
gps/time.c
18+
gps/gmath.c
19+
gps/tok.c
20+
gps/context.c
21+
822
symbology-ng/qgssymbolv2.cpp
923
symbology-ng/qgssymbollayerv2.cpp
1024
symbology-ng/qgssymbollayerv2registry.cpp
@@ -130,6 +144,16 @@ SET(QGIS_CORE_SRCS
130144
spatialindex/qgsspatialindex.cpp
131145

132146
)
147+
148+
IF(WIN32)
149+
SET(QGIS_CORE_SRCS
150+
${QGIS_CORE_SRCS}
151+
gps/win_qextserialport.cpp)
152+
ELSE(WIN32)
153+
SET(QGIS_CORE_SRCS
154+
${QGIS_CORE_SRCS}
155+
gps/posix_qextserialport.cpp)
156+
ENDIF(WIN32)
133157

134158
IF (WITH_INTERNAL_SPATIALITE)
135159
IF (WIN32 OR APPLE)
@@ -206,6 +230,8 @@ composer/qgscomposeritemgroup.h
206230
composer/qgscomposershape.h
207231
composer/qgscomposition.h
208232
composer/qgslegendmodel.h
233+
gps/qgsgpsconnection.h
234+
gps/qgsnmeaconnection.h
209235
symbology/qgsmarkercatalogue.h
210236
raster/qgsrasterlayer.h
211237
)

src/core/gps/config.h

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
*
3+
* NMEA library
4+
* URL: http://nmea.sourceforge.net
5+
* Author: Tim (xtimor@gmail.com)
6+
* Licence: http://www.gnu.org/licenses/lgpl.html
7+
* $Id: config.h 17 2008-03-11 11:56:11Z xtimor $
8+
*
9+
*/
10+
11+
#ifndef __NMEA_CONFIG_H__
12+
#define __NMEA_CONFIG_H__
13+
14+
#define NMEA_VERSION ("0.5.3")
15+
#define NMEA_VERSION_MAJOR (0)
16+
#define NMEA_VERSION_MINOR (5)
17+
#define NMEA_VERSION_PATCH (3)
18+
19+
#define NMEA_CONVSTR_BUF (256)
20+
#define NMEA_TIMEPARSE_BUF (256)
21+
22+
#if defined(WINCE) || defined(UNDER_CE)
23+
# define NMEA_CE
24+
#endif
25+
26+
#if defined(WIN32) || defined(NMEA_CE)
27+
# define NMEA_WIN
28+
#else
29+
# define NMEA_UNI
30+
#endif
31+
32+
#if defined(NMEA_WIN) && (_MSC_VER >= 1400)
33+
# pragma warning(disable: 4996) /* declared deprecated */
34+
#endif
35+
36+
#if defined(_MSC_VER)
37+
# define NMEA_POSIX(x) _##x
38+
# define NMEA_INLINE __inline
39+
#else
40+
# define NMEA_POSIX(x) x
41+
# define NMEA_INLINE inline
42+
#endif
43+
44+
#if !defined(NDEBUG) && !defined(NMEA_CE)
45+
# include <assert.h>
46+
# define NMEA_ASSERT(x) assert(x)
47+
#else
48+
# define NMEA_ASSERT(x)
49+
#endif
50+
51+
#endif /* __NMEA_CONFIG_H__ */

src/core/gps/context.c

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
*
3+
* NMEA library
4+
* URL: http://nmea.sourceforge.net
5+
* Author: Tim (xtimor@gmail.com)
6+
* Licence: http://www.gnu.org/licenses/lgpl.html
7+
* $Id: context.c 17 2008-03-11 11:56:11Z xtimor $
8+
*
9+
*/
10+
11+
#include "context.h"
12+
13+
#include <string.h>
14+
#include <stdarg.h>
15+
#include <stdio.h>
16+
17+
nmeaPROPERTY * nmea_property()
18+
{
19+
static nmeaPROPERTY prop =
20+
{
21+
0, 0, NMEA_DEF_PARSEBUFF
22+
};
23+
24+
return &prop;
25+
}
26+
27+
void nmea_trace( const char *str, ... )
28+
{
29+
int size;
30+
va_list arg_list;
31+
char buff[NMEA_DEF_PARSEBUFF];
32+
nmeaTraceFunc func = nmea_property()->trace_func;
33+
34+
if ( func )
35+
{
36+
va_start( arg_list, str );
37+
size = NMEA_POSIX( vsnprintf )( &buff[0], NMEA_DEF_PARSEBUFF - 1, str, arg_list );
38+
va_end( arg_list );
39+
40+
if ( size > 0 )
41+
( *func )( &buff[0], size );
42+
}
43+
}
44+
45+
void nmea_trace_buff( const char *buff, int buff_size )
46+
{
47+
nmeaTraceFunc func = nmea_property()->trace_func;
48+
if ( func && buff_size )
49+
( *func )( buff, buff_size );
50+
}
51+
52+
void nmea_error( const char *str, ... )
53+
{
54+
int size;
55+
va_list arg_list;
56+
char buff[NMEA_DEF_PARSEBUFF];
57+
nmeaErrorFunc func = nmea_property()->error_func;
58+
59+
if ( func )
60+
{
61+
va_start( arg_list, str );
62+
size = NMEA_POSIX( vsnprintf )( &buff[0], NMEA_DEF_PARSEBUFF - 1, str, arg_list );
63+
va_end( arg_list );
64+
65+
if ( size > 0 )
66+
( *func )( &buff[0], size );
67+
}
68+
}

src/core/gps/context.h

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
*
3+
* NMEA library
4+
* URL: http://nmea.sourceforge.net
5+
* Author: Tim (xtimor@gmail.com)
6+
* Licence: http://www.gnu.org/licenses/lgpl.html
7+
* $Id: context.h 4 2007-08-27 13:11:03Z xtimor $
8+
*
9+
*/
10+
11+
#ifndef __NMEA_CONTEXT_H__
12+
#define __NMEA_CONTEXT_H__
13+
14+
#include "config.h"
15+
16+
#define NMEA_DEF_PARSEBUFF (1024)
17+
#define NMEA_MIN_PARSEBUFF (256)
18+
19+
#ifdef __cplusplus
20+
extern "C"
21+
{
22+
#endif
23+
24+
typedef void ( *nmeaTraceFunc )( const char *str, int str_size );
25+
typedef void ( *nmeaErrorFunc )( const char *str, int str_size );
26+
27+
typedef struct _nmeaPROPERTY
28+
{
29+
nmeaTraceFunc trace_func;
30+
nmeaErrorFunc error_func;
31+
int parse_buff_size;
32+
33+
} nmeaPROPERTY;
34+
35+
nmeaPROPERTY * nmea_property();
36+
37+
void nmea_trace( const char *str, ... );
38+
void nmea_trace_buff( const char *buff, int buff_size );
39+
void nmea_error( const char *str, ... );
40+
41+
#ifdef __cplusplus
42+
}
43+
#endif
44+
45+
#endif /* __NMEA_CONTEXT_H__ */

0 commit comments

Comments
 (0)