forked from vshymanskyy/TinyGSM
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/** | ||
* @file TinyGsmGPS_EX.tpp | ||
* @author Lewis He ([email protected]) | ||
* @license MIT | ||
* @copyright Copyright (c) 2023 Shenzhen Xin Yuan Electronic Technology Co., Ltd | ||
* @date 2024-12-10 | ||
* | ||
*/ | ||
#ifndef SRC_TINYGSMGPS_EX_H_ | ||
#define SRC_TINYGSMGPS_EX_H_ | ||
|
||
#include "TinyGsmCommon.h" | ||
|
||
#define TINY_GSM_MODEM_HAS_GPS_EX | ||
|
||
class GPSInfo { | ||
public: | ||
// The rang is 0-255, unit is second. after set <time> will report the | ||
// GNSS information every the seconds. | ||
// The function will take effect immediately. | ||
|
||
|
||
uint8_t isFix; // Fix mode,2=2D fix,3=3D fix | ||
uint16_t gps_satellite_num; // GPS satellite visible numbers | ||
uint16_t beidou_satellite_num; // BEIDOU satellite visible numbers | ||
uint16_t glonass_satellite_num; // GLONASS satellite visible numbers | ||
uint16_t galileo_satellite_num; // GALILEO satellite visible numbers | ||
double latitude; // Latitude of current position.Output format is dd.ddddd | ||
char NS_indicator; // N/S Indicator, N=north or S=south. | ||
double longitude; // Longitude of current position. Output format is ddd.ddddd | ||
char EW_indicator; // E/W Indicator, E=east or W=west. | ||
// Date. Output format is ddmmyy. | ||
uint16_t year; | ||
uint8_t month; | ||
uint8_t day; | ||
// UTC Time. Output format is hhmmss.ss. | ||
uint8_t hour; | ||
uint8_t minute; | ||
uint8_t second; | ||
float altitude; // MSL Altitude. Unit is meters. | ||
float speed; // Speed Over Ground. Unit is knots. | ||
float course; // Course. Degrees.F | ||
float PDOP; // Position Dilution Of Precision. | ||
float HDOP; // Horizontal Dilution Of Precision. | ||
float VDOP; // Vertical Dilution Of Precision. | ||
}; | ||
|
||
template <class modemType> | ||
class TinyGsmGPSEx { | ||
public: | ||
/* | ||
* GPS/GNSS/GLONASS enhancement functions | ||
*/ | ||
bool getGPS_Ex(GPSInfo& info) { | ||
return thisModem().getGPS_ExImpl(info); | ||
} | ||
|
||
bool gpsColdStart() { | ||
return thisModem().gpsColdStartImpl(info); | ||
} | ||
|
||
bool gpsWarmStart() { | ||
return thisModem().gpsWarmStartImpl(info); | ||
} | ||
|
||
bool gpsHotStart() { | ||
return thisModem().gpsHotStartImpl(info); | ||
} | ||
|
||
/* | ||
* CRTP Helper | ||
*/ | ||
protected: | ||
inline const modemType& thisModem() const { | ||
return static_cast<const modemType&>(*this); | ||
} | ||
inline modemType& thisModem() { | ||
return static_cast<modemType&>(*this); | ||
} | ||
|
||
/* | ||
* GPS/GNSS/GLONASS enhancement functions | ||
*/ | ||
bool getGPS_ExImpl(GPSInfo& info) TINY_GSM_ATTR_NOT_IMPLEMENTED; | ||
bool gpsColdStartImpl() TINY_GSM_ATTR_NOT_IMPLEMENTED; | ||
bool gpsWarmStartImpl() TINY_GSM_ATTR_NOT_IMPLEMENTED; | ||
bool gpsHotStartImpl() TINY_GSM_ATTR_NOT_IMPLEMENTED; | ||
}; | ||
|
||
|
||
#endif // SRC_TINYGSMGPS_EX_H_ |