Skip to content

Commit

Permalink
[FEATURE]: add classes for live GPS tracking in core
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@12685 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 7, 2010
1 parent 670bb0d commit 426e3b3
Show file tree
Hide file tree
Showing 34 changed files with 5,612 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -5,6 +5,20 @@

SET(QGIS_CORE_SRCS

gps/qextserialport.cpp
gps/qextserialbase.cpp
gps/qgsgpsconnection.cpp
gps/qgsgpsconnectionregistry.cpp
gps/qgsgpstrackerthread.cpp
gps/qgsnmeaconnection.cpp
gps/parse.c
gps/sentence.c
gps/info.c
gps/time.c
gps/gmath.c
gps/tok.c
gps/context.c

symbology-ng/qgssymbolv2.cpp
symbology-ng/qgssymbollayerv2.cpp
symbology-ng/qgssymbollayerv2registry.cpp
Expand Down Expand Up @@ -130,6 +144,16 @@ SET(QGIS_CORE_SRCS
spatialindex/qgsspatialindex.cpp

)

IF(WIN32)
SET(QGIS_CORE_SRCS
${QGIS_CORE_SRCS}
gps/win_qextserialport.cpp)
ELSE(WIN32)
SET(QGIS_CORE_SRCS
${QGIS_CORE_SRCS}
gps/posix_qextserialport.cpp)
ENDIF(WIN32)

IF (WITH_INTERNAL_SPATIALITE)
IF (WIN32 OR APPLE)
Expand Down Expand Up @@ -206,6 +230,8 @@ composer/qgscomposeritemgroup.h
composer/qgscomposershape.h
composer/qgscomposition.h
composer/qgslegendmodel.h
gps/qgsgpsconnection.h
gps/qgsnmeaconnection.h
symbology/qgsmarkercatalogue.h
raster/qgsrasterlayer.h
)
Expand Down
51 changes: 51 additions & 0 deletions src/core/gps/config.h
@@ -0,0 +1,51 @@
/*
*
* NMEA library
* URL: http://nmea.sourceforge.net
* Author: Tim (xtimor@gmail.com)
* Licence: http://www.gnu.org/licenses/lgpl.html
* $Id: config.h 17 2008-03-11 11:56:11Z xtimor $
*
*/

#ifndef __NMEA_CONFIG_H__
#define __NMEA_CONFIG_H__

#define NMEA_VERSION ("0.5.3")
#define NMEA_VERSION_MAJOR (0)
#define NMEA_VERSION_MINOR (5)
#define NMEA_VERSION_PATCH (3)

#define NMEA_CONVSTR_BUF (256)
#define NMEA_TIMEPARSE_BUF (256)

#if defined(WINCE) || defined(UNDER_CE)
# define NMEA_CE
#endif

#if defined(WIN32) || defined(NMEA_CE)
# define NMEA_WIN
#else
# define NMEA_UNI
#endif

#if defined(NMEA_WIN) && (_MSC_VER >= 1400)
# pragma warning(disable: 4996) /* declared deprecated */
#endif

#if defined(_MSC_VER)
# define NMEA_POSIX(x) _##x
# define NMEA_INLINE __inline
#else
# define NMEA_POSIX(x) x
# define NMEA_INLINE inline
#endif

#if !defined(NDEBUG) && !defined(NMEA_CE)
# include <assert.h>
# define NMEA_ASSERT(x) assert(x)
#else
# define NMEA_ASSERT(x)
#endif

#endif /* __NMEA_CONFIG_H__ */
68 changes: 68 additions & 0 deletions src/core/gps/context.c
@@ -0,0 +1,68 @@
/*
*
* NMEA library
* URL: http://nmea.sourceforge.net
* Author: Tim (xtimor@gmail.com)
* Licence: http://www.gnu.org/licenses/lgpl.html
* $Id: context.c 17 2008-03-11 11:56:11Z xtimor $
*
*/

#include "context.h"

#include <string.h>
#include <stdarg.h>
#include <stdio.h>

nmeaPROPERTY * nmea_property()
{
static nmeaPROPERTY prop =
{
0, 0, NMEA_DEF_PARSEBUFF
};

return &prop;
}

void nmea_trace( const char *str, ... )
{
int size;
va_list arg_list;
char buff[NMEA_DEF_PARSEBUFF];
nmeaTraceFunc func = nmea_property()->trace_func;

if ( func )
{
va_start( arg_list, str );
size = NMEA_POSIX( vsnprintf )( &buff[0], NMEA_DEF_PARSEBUFF - 1, str, arg_list );
va_end( arg_list );

if ( size > 0 )
( *func )( &buff[0], size );
}
}

void nmea_trace_buff( const char *buff, int buff_size )
{
nmeaTraceFunc func = nmea_property()->trace_func;
if ( func && buff_size )
( *func )( buff, buff_size );
}

void nmea_error( const char *str, ... )
{
int size;
va_list arg_list;
char buff[NMEA_DEF_PARSEBUFF];
nmeaErrorFunc func = nmea_property()->error_func;

if ( func )
{
va_start( arg_list, str );
size = NMEA_POSIX( vsnprintf )( &buff[0], NMEA_DEF_PARSEBUFF - 1, str, arg_list );
va_end( arg_list );

if ( size > 0 )
( *func )( &buff[0], size );
}
}
45 changes: 45 additions & 0 deletions src/core/gps/context.h
@@ -0,0 +1,45 @@
/*
*
* NMEA library
* URL: http://nmea.sourceforge.net
* Author: Tim (xtimor@gmail.com)
* Licence: http://www.gnu.org/licenses/lgpl.html
* $Id: context.h 4 2007-08-27 13:11:03Z xtimor $
*
*/

#ifndef __NMEA_CONTEXT_H__
#define __NMEA_CONTEXT_H__

#include "config.h"

#define NMEA_DEF_PARSEBUFF (1024)
#define NMEA_MIN_PARSEBUFF (256)

#ifdef __cplusplus
extern "C"
{
#endif

typedef void ( *nmeaTraceFunc )( const char *str, int str_size );
typedef void ( *nmeaErrorFunc )( const char *str, int str_size );

typedef struct _nmeaPROPERTY
{
nmeaTraceFunc trace_func;
nmeaErrorFunc error_func;
int parse_buff_size;

} nmeaPROPERTY;

nmeaPROPERTY * nmea_property();

void nmea_trace( const char *str, ... );
void nmea_trace_buff( const char *buff, int buff_size );
void nmea_error( const char *str, ... );

#ifdef __cplusplus
}
#endif

#endif /* __NMEA_CONTEXT_H__ */

0 comments on commit 426e3b3

Please sign in to comment.