[Feature][T108][GNSS][task-view-1502]GNSS API header file update
Only Configure: No
Affected branch: GSW_V1453
Affected module: GNSS
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no
Change-Id: I0255e4ac0bdc6f54a2189651e1d0aab25cd7b16f
diff --git a/mbtk/include/gsw/gsw_gnss.h b/mbtk/include/gsw/gsw_gnss.h
deleted file mode 100755
index a8acd4d..0000000
--- a/mbtk/include/gsw/gsw_gnss.h
+++ /dev/null
@@ -1,180 +0,0 @@
-#define MBTK_GNSS_IND_LOCATION (1) // 1
-#define MBTK_GNSS_IND_NMEA (1 << 1) // 2
-#define QSER_GNSS_TIMEOUT 5
-
-typedef enum{
- GSW_SWITCH_DISABLE = 0, /**< configuration switch disable :0 */
- GSW_SWITCH_ENABLE /**< configuration switch enable :1 */
-}GSW_GNSS_CONF_SWITCH;
-
-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;
-
-typedef enum{
- GSW_FREQ_1HZ = 1, /**< 1hZ */
- GSW_FREQ_2HZ = 2, /**< 2hZ */
- GSW_FREQ_5HZ = 5, /**< 5hZ */
- GSW_FREQ_10HZ = 10, /**< 10hZ */
-}gnss_freq_type;
-
-
-typedef enum{
- GSW_MODE_GPS_GLONASS = 0, /**< GPS+GLONASS */
- GSW_MODE_GPS_BEIDOU, /**< GPS+BEIDOU */
- GSW_MODE_GPS_GLONASS_BEIDOU, /**< GPS+GLONASS+BEIDOU */ /* The type does not support this type */
- GSW_MODE_GPS, /**< GPS only */
- GSW_MODE_BEIDOU, /**< BEIDOU only*/
- GSW_MODE_GLONASS, /**< GLONASS only */
- GSW_MODE_GPS_GLONASS_BEIDOU_GALILEO, /**< GPS+GLONASS+BEIDOU+GALILEO */ /* The type does not support this type */
- 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 type does not support this type */
- GSW_MODE_GNSS_END /**< init value */
-}GSW_GNSS_MODE_CONFIGURATION;
-
-
-typedef struct
-{
- /**< set to sizeof(GpsLocation) */
- size_t size;
- /**< Contains GpsLocationFlags bits. */
- unsigned short int flags;
- /**< Represents latitude in degrees. */
- double latitude;
- /**< Represents longitude in degrees. */
- double longitude;
- /**< Represents altitude in meters above the WGS 84 reference ellipsoid. */
- double altitude;
- /**< Represents speed in meters per second. */
- float speed;
- /**< Represents heading in degrees. */
- float bearing;
- /**< Represents expected accuracy in meters. */
- float accuracy;
- /**< Timestamp for the location fix. */
- long long int timestamp;
-}GSW_GNSS_LOCATION_T;
-
-typedef struct {
- GSW_GNSS_LOCATION_T legacyLocation;
- float horizontalAccuracyMeters;
- /**< Represents expected vertical position accuracy in meters
- * (68% confidence).*/
- float verticalAccuracyMeters;
- /**< Represents expected speed accuracy in meter per seconds
- * (68% confidence).*/
- float speedAccuracyMetersPerSecond;
- /**< Represents expected bearing accuracy in degrees
- * (68% confidence).*/
- float bearingAccuracyDegrees;
-}GSW_GNSS_LOCATION_EXT_T;
-
-typedef void (*gsw_gnss_location_callback_ext)(GSW_GNSS_LOCATION_EXT_T* location);
-typedef void (*gsw_gnss_nmea_callback )(const char* nmea, int length);
-
-typedef struct{
-gsw_gnss_location_callback_ext gsw_location_cb;
-gsw_gnss_nmea_callback gsw_nmea_cb;
-}gsw_gnss_cb;
-
-typedef struct{
-GSW_GNSS_MODE_CONFIGURATION start_mode;
-gnss_freq_type freq;
-gsw_gnss_cb callback;
-}gsw_gnss_init_configure_t;
-
-
-
-/**
- * @brief SDK interface to set gnss sampling frequency, support 1Hz、2Hz、5Hz、10Hz
- * @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_HAL_GNSS_MODE_CONFIGURATION
- * @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
- * @param [in] switch_op
- * @retval 0: success
- * @retval other: fail
- */
-int gsw_gnss_epo_switch(GSW_GNSS_CONF_SWITCH switch_op); /* The high-tech platform does not support this type */
-
-/**
- * @brief SDK interface to registered callback function
- * @param [in] callback
- * @retval 0: success
- * @retval other: fail
- */
-int gsw_gnss_reg_cb_group(gsw_gnss_cb callback);
-
-/**
- * @brief SDK interface to enable XTRA switch
- * @param [in] state
- * @retval 0: success
- * @retval other: fail
- */
-int gsw_gnss_xtra_is_enable(gsw_xtra_state_e state);
-
-/**
- * @brief SDK interface to delete aiding data,delete aiding data for cold start
- * @param [in] switch_op
- * @retval 0: success
- * @retval other: fail
- */
-int gsw_gnss_delete_aiding_data(unsigned int flags);
-
-/**
- * @brief init and configure gps
- * @param [in] init_configure
- * @retval 0: success
- * @retval other: fail
- */
-int gsw_gnss_init_configure_gps(gsw_gnss_init_configure_t init_configure);
-
diff --git a/mbtk/include/gsw/gsw_gnss_interface.h b/mbtk/include/gsw/gsw_gnss_interface.h
new file mode 100755
index 0000000..046ede2
--- /dev/null
+++ b/mbtk/include/gsw/gsw_gnss_interface.h
@@ -0,0 +1,242 @@
+/**
+* @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__
diff --git a/mbtk/libgsw_lib/gsw_gnss.c b/mbtk/libgsw_lib/gsw_gnss_interface.c
similarity index 97%
rename from mbtk/libgsw_lib/gsw_gnss.c
rename to mbtk/libgsw_lib/gsw_gnss_interface.c
index 6f2298b..c1ceb46 100755
--- a/mbtk/libgsw_lib/gsw_gnss.c
+++ b/mbtk/libgsw_lib/gsw_gnss_interface.c
@@ -15,7 +15,11 @@
#include <stdint.h>
#include <stdbool.h>
-#include "gsw_gnss.h"
+#include "gsw_gnss_interface.h"
+
+#define MBTK_GNSS_IND_LOCATION (1) // 1
+#define MBTK_GNSS_IND_NMEA (1 << 1) // 2
+#define QSER_GNSS_TIMEOUT 5
#ifndef LOG_ERR_LEVEL
#define LOG_ERR_LEVEL 3 /* error conditions */
@@ -107,7 +111,7 @@
} while(0)
-#define GSW_HAL_SUCCESS 0
+// #define GSW_HAL_SUCCESS 0
#define GSW_HAL_FAIL -1 //表示失败(通用性)
#define GSW_HAL_MEM_INVAILD -2 //表示入参地址为NULL
@@ -133,7 +137,7 @@
int gnss_freq = -1;
GSW_GNSS_MODE_CONFIGURATION gnss_startmode = -1;
-GSW_GNSS_CONF_SWITCH gnss_switch_op = -1;
+GSW_CONF_SWITCH gnss_switch_op = -1;
void *dlHandle_gnss;
char *lynqLib_gnss = "/lib/libmbtk_lib.so";
@@ -177,6 +181,13 @@
int64_t timestamp; /**< Timestamp for the location fix in UTC million-second base. */
} mbtk_gnss_location_info_t;
+typedef struct{
+ GSW_GNSS_MODE_CONFIGURATION start_mode;
+ gnss_freq_type freq;
+ gsw_gnss_cb callback;
+}gsw_gnss_init_configure_t;
+
+
typedef enum{
MODE_GPS = 1, /**< GPS only */
MODE_BEIDOU, /**< BEIDOU only*/
@@ -307,7 +318,7 @@
* @retval 0: success
* @retval other: fail
*/
-int gsw_gnss_epo_switch(GSW_GNSS_CONF_SWITCH switch_op)
+int gsw_gnss_epo_switch(GSW_CONF_SWITCH switch_op)
{
int ret;
if (!strated)
diff --git a/mbtk/test/libgsw_lib/gsw_gnss_test.c b/mbtk/test/libgsw_lib/gsw_gnss_test.c
index 51e550c..17f3b18 100755
--- a/mbtk/test/libgsw_lib/gsw_gnss_test.c
+++ b/mbtk/test/libgsw_lib/gsw_gnss_test.c
@@ -82,12 +82,12 @@
gsw_gnss_nmea_callback gsw_nmea_cb;
}gsw_gnss_cb;
-typedef enum{
- GSW_FREQ_1HZ = 1, /**< 1hZ */
- GSW_FREQ_2HZ = 2, /**< 2hZ */
- GSW_FREQ_5HZ = 5, /**< 5hZ */
- GSW_FREQ_10HZ = 10, /**< 10hZ */
-}gnss_freq_type;
+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;
typedef struct{
GSW_GNSS_MODE_CONFIGURATION start_mode;