Developer World
Spresense Arduino Library v3.2.0-77d75a4
SpGnss Class Reference

GNSS controller. More...

#include <GNSS.h>

Collaboration diagram for SpGnss:

Public Member Functions

 SpGnss ()
 Create SpGnss object.
 
 ~SpGnss ()
 Destroy SpGnss object.
 
int begin (void)
 Activate GNSS device. More...
 
int begin (Stream &debugOut)
 Activate GNSS device. More...
 
int end (void)
 Inactivate GNSS device. More...
 
int start (SpStartMode mode=HOT_START)
 Start positioning. More...
 
int stop (void)
 Stop positioning. More...
 
int isUpdate (void)
 Check position information is updated and return immediately. More...
 
int waitUpdate (long timeout=-1)
 Wait for position information to be updated. More...
 
void getNavData (SpNavData *navData)
 Get updated positioning information from GNSS. More...
 
unsigned long getPositionDataSize (void)
 
unsigned long getPositionData (char *pBinaryBuffer)
 
unsigned long getPositionData (GnssPositionData *pData)
 
int setPosition (double latitude, double longitude, double altitude=0)
 Set the current position for hot start. More...
 
int setTime (SpGnssTime *time)
 Set the current time for hot start. More...
 
int setInterval (long interval=1)
 Set the pos interval time. More...
 
int setInterval (SpIntervalFreq interval)
 Set the pos interval time. More...
 
int isSelecting (SpSatelliteType sattype)
 Returns whether the specified satellite system is selecting. More...
 
int select (SpSatelliteType sattype)
 Add specified satellite system to selection for positioning. More...
 
int deselect (SpSatelliteType sattype)
 Remove specified satellite system to selection for positioning. More...
 
int isGps (void)
 [Obsolete] Returns whether GPS is used as satellite system More...
 
int useGps (void)
 [Obsolete] Use GPS for positioning More...
 
int unuseGps (void)
 [Obsolete] Unuse GPS for positioning More...
 
int isGlonass (void)
 [Obsolete] Returns whether Glonass is used as satellite system More...
 
int useGlonass (void)
 [Obsolete] Use Glonass for positioning More...
 
int unuseGlonass (void)
 [Obsolete] Unuse Glonass for positioning More...
 
void setDebugMode (SpPrintLevel level)
 Set debug mode. More...
 
int saveEphemeris (void)
 Save the data stored in the backup RAM to Flash. More...
 
int removeEphemeris (void)
 Remove the backup data stored in the Flash. More...
 
void * getDCReport (void)
 Get the QZQSM DC report data. More...
 
void start1PPS (void)
 Start 1PPS output. More...
 
void stop1PPS (void)
 Stop 1PPS output. More...
 

Public Attributes

friend SpNavData
 

Protected Member Functions

unsigned long inquireSatelliteType (void)
 

Static Protected Member Functions

static void printMessage (SpPrintLevel level, const char *str)
 

Protected Attributes

int fd_
 
unsigned long SatelliteSystem
 
SpNavData NavData
 

Static Protected Attributes

static Stream & DebugOut
 
static SpPrintLevel DebugPrintLevel
 

Detailed Description

GNSS controller.

You can control GNSS devices by operating SpGnss objects instantiated in your app.

Member Function Documentation

◆ begin() [1/2]

int SpGnss::begin ( void  )

Activate GNSS device.

Power on GNSS hardware block, and change to the state where parameter setting and positioning start can be performed.

Returns
0 if success, -1 if failure

◆ begin() [2/2]

int SpGnss::begin ( Stream &  debugOut)
inline

Activate GNSS device.

Power on GNSS hardware block, and change to the state where parameter setting and positioning start can be performed.

Parameters
[in]debugOutdebug out stream instead of Serial
Returns
0 if success, -1 if failure

◆ end()

int SpGnss::end ( void  )

Inactivate GNSS device.

Power off GNSS hardware block.

Returns
0 if success, -1 if failure

◆ start()

int SpGnss::start ( SpStartMode  mode = HOT_START)

Start positioning.

Parameters
[in]modeset start mode(SpStartMode)
Returns
0 if success, -1 if failure

If not specified mode, force set to hot start mode.

◆ stop()

int SpGnss::stop ( void  )

Stop positioning.

Power off most of the hardware and change it to the idling state.

Returns
0 if success, -1 if failure

◆ isUpdate()

int SpGnss::isUpdate ( void  )

Check position information is updated and return immediately.

Returns
1 enable, 0 disable

Returns 1 if position information is updated.

◆ waitUpdate()

int SpGnss::waitUpdate ( long  timeout = -1)

Wait for position information to be updated.

Calling this function will block until GNSS positioning information is updated.

Parameters
[in]timeouttimeout of waiting [sec]
Returns
1 enable, 0 disable

Returns 1 if position information is updated. If not specified timeout, wait forever.

◆ getNavData()

void SpGnss::getNavData ( SpNavData navData)

Get updated positioning information from GNSS.

This function copies the updated information to the specified navData. Instantiate the navData object specified by argument in app, and specified navData to argument by the pointer address.

Parameters
[out]navDataincludes latest positioning information
Returns
none

Give NavData the address of the object instantiated in your app as an argument. The latest position information when the function is called is stored into this object.

◆ setPosition()

int SpGnss::setPosition ( double  latitude,
double  longitude,
double  altitude = 0 
)

Set the current position for hot start.

In order to perform Hot start, set the approximate current position. The position held inside the GNSS device is overwritten.

Parameters
[in]latitudeLatitude of current position
[in]longitudeLongitude of current position
[in]altitudeAltitude of current position
Returns
0 if success, -1 if failure

◆ setTime()

int SpGnss::setTime ( SpGnssTime time)

Set the current time for hot start.

In order to perform Hot start, set the approximate current time. The time held inside the GNSS device is overwritten.

Parameters
[in]timecurrent time(SpGnssTime)
Returns
0 if success, -1 if failure

◆ setInterval() [1/2]

int SpGnss::setInterval ( long  interval = 1)

Set the pos interval time.

Set interval of POS operation.

Parameters
[in]intervalInterval time[sec]
Returns
0 if success, -1 if failure

◆ setInterval() [2/2]

int SpGnss::setInterval ( SpIntervalFreq  interval)

Set the pos interval time.

Set interval of POS operation.

Parameters
[in]intervalInterval frequency
Returns
0 if success, -1 if failure

◆ isSelecting()

int SpGnss::isSelecting ( SpSatelliteType  sattype)

Returns whether the specified satellite system is selecting.

Returns whether satellite system specified as argument is selecting as the satellite used for positioning.

Parameters
[in]sattypeType of satellite system
Returns
1 selected, 0 not selected

◆ select()

int SpGnss::select ( SpSatelliteType  sattype)

Add specified satellite system to selection for positioning.

GPS is selected by default. In addition to this, it is able to select Glonass or QZSS L1 / CA as the positioning satellite system, SBAS or QZSS L1S as the positioning augmentation system.

Parameters
[in]sattypeType of satellite system
Returns
0 if success, negative if failure

◆ deselect()

int SpGnss::deselect ( SpSatelliteType  sattype)

Remove specified satellite system to selection for positioning.

Do not use the specified satellite system for positioning.

Parameters
[in]sattypetype of satellite system
Returns
0 if success, negative if failure

◆ isGps()

int SpGnss::isGps ( void  )
inline

[Obsolete] Returns whether GPS is used as satellite system

This function is obsolete. Replace with isSelecting.

◆ useGps()

int SpGnss::useGps ( void  )
inline

[Obsolete] Use GPS for positioning

This function is obsolete. Replace with select.

◆ unuseGps()

int SpGnss::unuseGps ( void  )
inline

[Obsolete] Unuse GPS for positioning

This function is obsolete. Replace with deselect.

◆ isGlonass()

int SpGnss::isGlonass ( void  )
inline

[Obsolete] Returns whether Glonass is used as satellite system

This function is obsolete. Replace with isSelecting.

◆ useGlonass()

int SpGnss::useGlonass ( void  )
inline

[Obsolete] Use Glonass for positioning

This function is obsolete. Replace with select.

◆ unuseGlonass()

int SpGnss::unuseGlonass ( void  )
inline

[Obsolete] Unuse Glonass for positioning

This function is obsolete. Replace with deselect.

◆ setDebugMode()

void SpGnss::setDebugMode ( SpPrintLevel  level)

Set debug mode.

Print debug messages about GNSS controlling and positioning if not set 0 to argument.

Parameters
[in]leveldebug mode
Returns
none

◆ saveEphemeris()

int SpGnss::saveEphemeris ( void  )

Save the data stored in the backup RAM to Flash.

Returns
0 if success, -1 if failure

◆ removeEphemeris()

int SpGnss::removeEphemeris ( void  )

Remove the backup data stored in the Flash.

Returns
0 if success, -1 if failure

◆ getDCReport()

void * SpGnss::getDCReport ( void  )

Get the QZQSM DC report data.

Returns
the pointer to DC Report structure if valid, otherwise NULL

◆ start1PPS()

void SpGnss::start1PPS ( void  )

Start 1PPS output.

Returns
none

◆ stop1PPS()

void SpGnss::stop1PPS ( void  )

Stop 1PPS output.

Returns
none

The documentation for this class was generated from the following file: