Skip to content

Commit

Permalink
gps fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jun 8, 2017
1 parent e545d44 commit 9e176fe
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 23 deletions.
3 changes: 2 additions & 1 deletion cmake_templates/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2072,7 +2072,8 @@ EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
"SIP_SKIP" \
"SIP_TRANSFER" \
"SIP_TRANSFERBACK" \
"SIP_TRANSFERTHIS"
"SIP_TRANSFERTHIS" \
"SIP_WHEN_FEATURE"

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
Expand Down
12 changes: 12 additions & 0 deletions python/core/gps/qgsgpsconnection.sip
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ class QgsGPSConnection : QObject

%TypeHeaderCode
#include "qgsgpsconnection.h"

#include <qgsgpsdconnection.h>
#include <qgsnmeaconnection.h>
%End

%ConvertToSubClassCode
if ( sipCpp->inherits( "QgsGpsdConnection" ) )
sipType = sipType_QgsGpsdConnection;
else if ( sipCpp->inherits( "QgsNMEAConnection" ) )
sipType = sipType_QgsNMEAConnection;
else
sipType = NULL;
%End
public:

Expand Down
2 changes: 2 additions & 0 deletions python/core/gps/qgsgpsconnectionregistry.sip
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Unregisters connection. The registry does no longer own the connection
:rtype: list of QgsGPSConnection
%End

private:
QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry &rh );
};

/************************************************************************
Expand Down
32 changes: 18 additions & 14 deletions python/core/gps/qgsqtlocationconnection.sip
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,8 @@



QTM_USE_NAMESPACE
%Docstring
*************************************************************************
*
This program is free software; you can redistribute it and/or modify *
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 2 of the License, or *
(at your option) any later version. *
*
**************************************************************************
%End
%Feature MOBILITY_LOCATION
%If (MOBILITY_LOCATION)

class QgsQtLocationConnection: QgsGPSConnection
{
Expand Down Expand Up @@ -49,18 +40,31 @@ Needed to make QtLocation detected
Parse available data source content
%End

void positionUpdated( const QGeoPositionInfo &info );

%If (!ANDROID)

void satellitesInViewUpdated( const QList<QGeoSatelliteInfo> &satellites );
%Docstring
Called when the position updated.
Called when the number of satellites in view is updated.
.. note::

not available in Python binding
not available in Python bindings on android
%End

void satellitesInUseUpdated( const QList<QGeoSatelliteInfo> &satellites );
%Docstring
Called when the number of satellites in use is updated.
.. note::

not available in Python bindings on android
%End

%End

};

%End // MOBILITY_LOCATION

/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
13 changes: 10 additions & 3 deletions scripts/sipify.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
my $PRIVATE_SECTION_LINE = '';
my $RETURN_TYPE = '';
my $IS_OVERRIDE = 0;
my $IF_FEATURE_CONDITION = '';
my %QFLAG_HASH;

my $LINE_COUNT = @INPUT_LINES;
Expand Down Expand Up @@ -75,7 +76,10 @@ sub write_output {
else{
$dbg_code = '';
}
push @OUTPUT, "%If ($IF_FEATURE_CONDITION)\n" if $IF_FEATURE_CONDITION ne '';
push @OUTPUT, $dbg_code.$out;
push @OUTPUT, "%End\n" if $IF_FEATURE_CONDITION ne '';
$IF_FEATURE_CONDITION = '';
}

sub dbg_info {
Expand Down Expand Up @@ -275,6 +279,11 @@ sub detect_comment_block{
next;
}

if ( $LINE =~ s/SIP_WHEN_FEATURE\(\s*(.*?)\s*\)// ){
dbg_info('found SIP_WHEN_FEATURE');
$IF_FEATURE_CONDITION = $1;
}

# Skip preprocessor stuff
if ($LINE =~ m/^\s*#/){

Expand Down Expand Up @@ -626,9 +635,7 @@ sub detect_comment_block{
}
}

if ( $LINE =~ m/\boverride\b/){
$IS_OVERRIDE = 1;
}
$IS_OVERRIDE = 1 if ( $LINE =~ m/\boverride\b/);

# keyword fixes
do {no warnings 'uninitialized';
Expand Down
3 changes: 2 additions & 1 deletion src/core/gps/qgsgpsconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ struct CORE_EXPORT QgsGPSInformation
/** \ingroup core
* Abstract base class for connection to a GPS device*/
class CORE_EXPORT QgsGPSConnection : public QObject
{
#ifdef SIP_RUN
#include <qgsgpsdconnection.h>
#include <qgsnmeaconnection.h>
#endif
{


#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
Expand Down
3 changes: 3 additions & 0 deletions src/core/gps/qgsgpsconnectionregistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class CORE_EXPORT QgsGPSConnectionRegistry
QList< QgsGPSConnection *> connectionList() const;

private:
#ifdef SIP_RUN
QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry &rh );
#endif

QSet<QgsGPSConnection *> mConnections;
};
Expand Down
23 changes: 19 additions & 4 deletions src/core/gps/qgsqtlocationconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <QtCore/QPointer>

#ifndef SIP_RUN
#if defined(HAVE_QT_MOBILITY_LOCATION )
#include <QtLocation/QGeoPositionInfoSource>
#include <QtLocation/QGeoSatelliteInfo>
Expand All @@ -35,6 +36,10 @@ QTM_USE_NAMESPACE
#include <QtPositioning/QGeoSatelliteInfo>
#include <QtPositioning/QGeoSatelliteInfoSource>
#endif
#endif

SIP_FEATURE( MOBILITY_LOCATION )
SIP_IF_FEATURE( MOBILITY_LOCATION )

/**
* \ingroup core
Expand All @@ -56,19 +61,27 @@ class CORE_EXPORT QgsQtLocationConnection: public QgsGPSConnection
void parseData();

/** Called when the position updated.
* \note not available in Python binding
* \note not available in Python bindings
*/
void positionUpdated( const QGeoPositionInfo &info );
void positionUpdated( const QGeoPositionInfo &info ) SIP_SKIP;

#ifdef SIP_RUN
SIP_IF_FEATURE( !ANDROID )
#endif

/** Called when the number of satellites in view is updated.
* \note not available in Python bindings on android
*/
void satellitesInViewUpdated( const QList<QGeoSatelliteInfo> &satellites ) SIP_SKIP;
void satellitesInViewUpdated( const QList<QGeoSatelliteInfo> &satellites );

/** Called when the number of satellites in use is updated.
* \note not available in Python bindings on android
*/
void satellitesInUseUpdated( const QList<QGeoSatelliteInfo> &satellites ) SIP_SKIP;
void satellitesInUseUpdated( const QList<QGeoSatelliteInfo> &satellites );

#ifdef SIP_RUN
SIP_END
#endif

private:
void startGPS();
Expand All @@ -80,4 +93,6 @@ class CORE_EXPORT QgsQtLocationConnection: public QgsGPSConnection

};

SIP_END // MOBILITY_LOCATION

#endif // QGSQTLOCATIONCONNECTION_H
5 changes: 5 additions & 0 deletions src/core/qgis_sip.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@
*/
#define SIP_IF_FEATURE(feature)

/*
* Will place the current line with an `%If feature` directive in sip file
*/
#define SIP_WHEN_FEATURE(feature)

/*
* Convert to subclass code
*/
Expand Down

0 comments on commit 9e176fe

Please sign in to comment.