| /** | |
| * @file : gsw_gnss_interface.h | |
| * @brief : gnss function | |
| * @date : 2022-07-05 | |
| * @author : gaofeng6122 | |
| * @version : v1.0 | |
| * @copyright Copyright(C) 2022,Gosuncnwelink | |
| */ | |
| #ifndef __GSW_GNSS_INTERFACE__H__ | |
| #define __GSW_GNSS_INTERFACE__H__ | |
| /*********************************************************************************************/ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <pthread.h> | |
| #include <stddef.h> | |
| #include "gsw_hal_errcode.h" | |
| typedef enum { | |
| GNSS_FREQ_1HZ = 1, /**< 1Hz */ | |
| GNSS_FREQ_2HZ = 2, /**< 2Hz */ | |
| GNSS_FREQ_5HZ = 5, /**< 5Hz */ | |
| GNSS_FREQ_10HZ = 10, /**< 10Hz */ | |
| } gnss_freq_type; | |
| #define GNSS_OK GSW_HAL_SUCCESS | |
| #define GNSS_ERROR GSW_HAL_NORMAL_FAIL | |
| typedef struct | |
| { | |
| size_t size; /**< set to sizeof(GpsLocation) */ | |
| unsigned short int flags; /**< Contains GpsLocationFlags bits. */ | |
| double latitude; /**< Represents latitude in degrees. */ | |
| double longitude; /**< Represents longitude in degrees. */ | |
| double altitude; /**< Represents altitude in meters above the WGS 84 reference ellipsoid. */ | |
| float speed; /**< Represents speed in meters per second. */ | |
| float bearing; /**< Represents heading in degrees. */ | |
| float accuracy; /**< Represents expected accuracy in meters. */ | |
| long long int timestamp; /**< Timestamp for the location fix. */ | |
| }GSW_GNSS_LOCATION_T; | |
| typedef struct { | |
| GSW_GNSS_LOCATION_T legacyLocation; | |
| float horizontalAccuracyMeters; /**< horizontal position accuracy in meters (68% confidence)*/ | |
| float verticalAccuracyMeters; /**< vertical position accuracy in meters (68% confidence)*/ | |
| float speedAccuracyMetersPerSecond;/**< speed accuracy in meter per seconds (68% confidence)*/ | |
| float bearingAccuracyDegrees; /**< bearing accuracy in degrees (68% confidence)*/ | |
| }GSW_GNSS_LOCATION_EXT_T; | |
| typedef enum{ | |
| GSW_MODE_GPS_GLONASS = 0, /**< GPS+GLONASS */ | |
| GSW_MODE_GPS_BEIDOU, /**< GPS+BEIDOU */ | |
| GSW_MODE_GPS_GLONASS_BEIDOU, /**< GPS+GLONASS+BEIDOU */ | |
| GSW_MODE_GPS, /**< GPS only */ | |
| GSW_MODE_BEIDOU, /**< BEIDOU only*/ /* The high-tech platform does not support this type */ | |
| GSW_MODE_GLONASS, /**< GLONASS only */ /* The high-tech platform does not support this type */ | |
| GSW_MODE_GPS_GLONASS_BEIDOU_GALILEO, /**< GPS+GLONASS+BEIDOU+GALILEO */ | |
| GSW_MODE_GPS_GALILEO, /**< GPS+GALILEO */ | |
| GSW_MODE_GPS_GLONASS_GALILEO, /**< GPS+GLONASS+GALILEO */ | |
| GSW_MODE_GPS_GALILEO_ONLY, /**< GPS or GALILEO only */ | |
| GSW_MODE_GPS_GLONASS_BEIDOU_GALILEO_NAVIC, /**< GPS+GLONASS+BEIDOU+GALILEO+NAVIC */ /* The high-tech platform does not support this type */ | |
| GSW_MODE_GNSS_END /**< init value */ | |
| }GSW_GNSS_MODE_CONFIGURATION; | |
| typedef enum{ | |
| GSW_SWITCH_DISABLE = 0, /**< configuration switch disable :0 */ | |
| GSW_SWITCH_ENABLE /**< configuration switch enable :1 */ | |
| }GSW_CONF_SWITCH; | |
| typedef enum | |
| { | |
| GSW_LOC_DELETE_EPHEMERIS = (1 << 0), /**< Delete ephemeris data. */ | |
| GSW_LOC_DELETE_ALMANAC = (1 << 1), /**< Delete almanac data. */ | |
| GSW_LOC_DELETE_POSITION = (1 << 2), /**< Delete position data. */ | |
| GSW_LOC_DELETE_TIME = (1 << 3), /**< Delete time data. */ | |
| GSW_LOC_DELETE_IONO = (1 << 4), /**< Delete IONO data. */ | |
| GSW_LOC_DELETE_UTC = (1 << 5), /**< Delete UTC data. */ | |
| GSW_LOC_DELETE_HEALTH = (1 << 6), /**< Delete health data. */ | |
| GSW_LOC_DELETE_SVDIR = (1 << 7), /**< Delete SVDIR data. */ | |
| GSW_LOC_DELETE_SVSTEER = (1 << 8), /**< Delete SVSTEER data. */ | |
| GSW_LOC_DELETE_SADATA = (1 << 9), /**< Delete SA data. */ | |
| GSW_LOC_DELETE_RTI = (1 << 10), /**< Delete RTI data. */ | |
| GSW_LOC_DELETE_CELLDB_INFO = (1 << 11), /**< Delete cell DB information. */ | |
| GSW_LOC_DELETE_ALL = 0xFFFFFFFF, /**< Delete all location data. */ | |
| } GSW_AIDING_DATA_E; | |
| /* Callback function registered to gnss location | |
| * Note:don`t use blocking function inside callback functions */ | |
| typedef void (*gsw_gnss_location_callback_ext)(GSW_GNSS_LOCATION_EXT_T* location); | |
| /* Callback function registered to gnss nmea | |
| * Note:don`t use blocking function inside callback functions */ | |
| typedef void (* gsw_gnss_nmea_callback)(const char* nmea, int length); | |
| typedef struct | |
| { | |
| gsw_gnss_location_callback_ext gsw_location_cb; /**< location callback */ | |
| gsw_gnss_nmea_callback gsw_nmea_cb; /**< nmea callback */ | |
| }gsw_gnss_cb; | |
| typedef enum | |
| { | |
| GSW_XTRA_STATE_MIN = 0, | |
| GSW_XTRA_STATE_DISBALE = GSW_XTRA_STATE_MIN, | |
| GSW_XTRA_STATE_ENABLE, | |
| GSW_XTRA_STATE_MAX | |
| } gsw_xtra_state_e; | |
| /** | |
| * @brief SDK interface to set gnss sampling frequency | |
| * @details E02 and E06 unused | |
| * @param [in] freq | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_set_freq(int freq); | |
| /** | |
| * @brief SDK interface to initialization gnss | |
| * | |
| * @param | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_init(void); | |
| /** | |
| * @brief SDK interface to start gnss | |
| * @param | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_start(void); | |
| /** | |
| * @brief SDK interface to stop gnss | |
| * @param | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_stop(void); | |
| /** | |
| * @brief SDK interface to de initialization gnss | |
| * @param | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_deinit(void); | |
| /** | |
| * @brief SDK interface to set gnss start mode,specific mode refreence GSW_GNSS_MODE_CONFIGURATION | |
| * @details E02 and E06 unused | |
| * | |
| * @param [in] start_mode | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_set_start_mode(GSW_GNSS_MODE_CONFIGURATION start_mode); | |
| /** | |
| * @brief SDK interface to set EPO switch if open or close | |
| * @details E02 and E06 unused | |
| * | |
| * @param [in] switch_op | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_epo_switch(GSW_CONF_SWITCH switch_op); | |
| /** | |
| * @brief SDK interface to delete aiding data,delete aiding data for cold start | |
| * @details E02 and E06 unused | |
| * | |
| * @param [in] flags | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_delete_aiding_data(unsigned int flags); | |
| /** | |
| * @brief load the dynamic link library.this interface must be called before other interface | |
| * @details E02 and E06 unused | |
| * | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_add_lib(void); /* The high-tech platform does not support this type */ | |
| /** | |
| * @brief SDK interface to registered callback function | |
| * @details E02 and E06 unused | |
| * | |
| * @param [in] callback | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_reg_cb_group(gsw_gnss_cb callback); | |
| /** | |
| * @brief check xtra support or not | |
| * @details E02 and E06 unused | |
| * | |
| * @param [in] state | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_xtra_is_enable(gsw_xtra_state_e state); | |
| /** | |
| * @brief to get current gps information function | |
| * @details only for E02 and E06 | |
| * | |
| * @param [out] GSW_GNSS_LOCATION_T | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_get_current_location(GSW_GNSS_LOCATION_T* location_info); | |
| /** | |
| * @brief to get current modem nmea data tail type | |
| * @details E02 and E06 unused | |
| * | |
| * @param [out] tail_type | |
| * @param [in] len | |
| * @retval 0: success | |
| * @retval other: fail | |
| */ | |
| int gsw_gnss_get_tail_nmea_type(char *tail_type, int len); | |
| #endif //__GSW_GNSS_INTERFACE__H__ |