Files
TencentOS-tiny/components/connectivity/LoraWAN/system/gps.h
supowang f9bd2588a2 Update LoRaMac-node to Version 4.4.4,fix Security breach found by Tencent Blade Team please refer to security advisory - CVE-2020-11068
fix Security breach found by Tencent Blade Team please refer to security advisory - CVE-2020-11068
2020-05-29 11:59:05 +08:00

163 lines
3.4 KiB
C

/*!
* \file gps.h
*
* \brief GPS driver implementation
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
* ______ _
* / _____) _ | |
* ( (____ _____ ____ _| |_ _____ ____| |__
* \____ \| ___ | (_ _) ___ |/ ___) _ \
* _____) ) ____| | | || |_| ____( (___| | | |
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
* (C)2013-2017 Semtech
*
* \endcode
*
* \author Miguel Luis ( Semtech )
*
* \author Gregory Cristian ( Semtech )
*/
#ifndef __GPS_H__
#define __GPS_H__
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#include <stdbool.h>
/* Structure to handle the GPS parsed data in ASCII */
typedef struct
{
char NmeaDataType[6];
char NmeaUtcTime[11];
char NmeaDataStatus[2];
char NmeaLatitude[10];
char NmeaLatitudePole[2];
char NmeaLongitude[11];
char NmeaLongitudePole[2];
char NmeaFixQuality[2];
char NmeaSatelliteTracked[3];
char NmeaHorizontalDilution[6];
char NmeaAltitude[8];
char NmeaAltitudeUnit[2];
char NmeaHeightGeoid[8];
char NmeaHeightGeoidUnit[2];
char NmeaSpeed[8];
char NmeaDetectionAngle[8];
char NmeaDate[8];
}NmeaGpsData_t;
/*!
* \brief Initializes the handling of the GPS receiver
*/
void GpsInit( void );
/*!
* \brief Switch ON the GPS
*/
void GpsStart( void );
/*!
* \brief Switch OFF the GPS
*/
void GpsStop( void );
/*!
* Updates the GPS status
*/
void GpsProcess( void );
/*!
* \brief PPS signal handling function
*/
void GpsPpsHandler( bool *parseData );
/*!
* \brief PPS signal handling function
*
* \retval ppsDetected State of PPS signal.
*/
bool GpsGetPpsDetectedState( void );
/*!
* \brief Indicates if GPS has fix
*
* \retval hasFix
*/
bool GpsHasFix( void );
/*!
* \brief Converts the latest Position (latitude and longitude) into a binary
* number
*/
void GpsConvertPositionIntoBinary( void );
/*!
* \brief Converts the latest Position (latitude and Longitude) from ASCII into
* DMS numerical format
*/
void GpsConvertPositionFromStringToNumerical( void );
/*!
* \brief Gets the latest Position (latitude and Longitude) as two double values
* if available
*
* \param [OUT] lati Latitude value
* \param [OUT] longi Longitude value
*
* \retval status [SUCCESS, FAIL]
*/
uint8_t GpsGetLatestGpsPositionDouble ( double *lati, double *longi );
/*!
* \brief Gets the latest Position (latitude and Longitude) as two binary values
* if available
*
* \param [OUT] latiBin Latitude value
* \param [OUT] longiBin Longitude value
*
* \retval status [SUCCESS, FAIL]
*/
uint8_t GpsGetLatestGpsPositionBinary ( int32_t *latiBin, int32_t *longiBin );
/*!
* \brief Parses the NMEA sentence.
*
* \remark Only parses GPGGA and GPRMC sentences
*
* \param [IN] rxBuffer Data buffer to be parsed
* \param [IN] rxBufferSize Size of data buffer
*
* \retval status [SUCCESS, FAIL]
*/
uint8_t GpsParseGpsData( int8_t *rxBuffer, int32_t rxBufferSize );
/*!
* \brief Returns the latest altitude from the parsed NMEA sentence
*
* \retval altitude
*/
int16_t GpsGetLatestGpsAltitude( void );
/*!
* \brief Format GPS data into numeric and binary formats
*/
void GpsFormatGpsData( void );
/*!
* \brief Resets the GPS position variables
*/
void GpsResetPosition( void );
#ifdef __cplusplus
}
#endif
#endif // __GPS_H__