[Feature][T106][task-view-595]Adjust the code of gnss

Only Configure :No
Affected branch: master
Affected module: gnss
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I6fafa69cdd65695096d2a2a75ed53f1dd95afc44
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
index dd600c2..287b0ba 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
@@ -46,7 +46,7 @@
 

     if [ -d "${WORKONSRC}" ] ; then

         install -d ${D}${includedir}/

-        cp -raf ${SRC-DIR}/include/ ${D}${includedir}/

+        cp -raf ${SRC-DIR}/include/lynq_qser_gnss.h ${D}${includedir}/

     fi

     if [ "${MOBILETEK_GNSS_UPDATE_ENABLE}" = "yes" ]; then

         install -d ${D}/data/gnss_update

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
index ed70d21..8208056 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
@@ -3,31 +3,20 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-struct mbtk_gnss_handle_t
-{
-    int dev_fd;
-    pthread_t  uart_pthread;
-    pthread_t  gnss_pthread;
-    gnss_handler_func_t gnss_handler_func;
-    int mode; // 0 - stop, 1 - single, 2 - periodic, 3 - start
-    pthread_mutex_t _cond_mutex;
-    int reset_state;
-    int inited;
-    ring_buffer_t ring_buffer;
-    int getap_status;
-    char *rb;
 
-#if TTFF_TEST
-    pthread_t ttff_pid;
-    int location_state;
-#endif
-    /********************
-    save handle's adr
-    phandle = &handle
-    handle  = mbtk_gnss_handle
-    *********************/
-    uint32_t *phandle; // handle's adr
-};
+typedef enum
+{
+    E_MT_LOC_MSG_ID_LOCATION_INFO = 1,          /**<  pv_data = &QL_LOC_LOCATION_INFO_T  */
+    E_MT_LOC_MSG_ID_NMEA_INFO = 3,              /**<  pv_data = &QL_LOC_NMEA_INFO_T  */
+}e_msg_id_t; //0,2reserve
+
+typedef void (*gnss_handler_func_t)
+(
+        uint32_t    h_loc,
+        e_msg_id_t  e_msg_id,
+        void        *pv_data,
+        void        *context_ptr
+);
 
 typedef struct 
 {
@@ -78,7 +67,7 @@
 };
 
 
-#endif
+
 typedef struct 
 {
     uint32_t year; // 大于1980
@@ -129,7 +118,8 @@
 int qser_Gnss_injectEphemeris(uint32_t h_gnss);
 int qser_Gnss_download_tle();
 int qser_Gnss_injectEphemeris_withpath(uint32_t h_gnss, char *path);
+
 #ifdef __cplusplus
 }
 #endif
-
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
index 5602ffe..6e0c903 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
@@ -4,10 +4,13 @@
 #define __MBTK_GNSS_H__
 #include <sc_bsp.h>
 #include "ringbuffer.h"
+#include "lynq_qser_gnss.h"
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+
+
 /*
 GGA: GNSS 定位数据
 $GNGGA,,,,,,0,00,99.99,,,,,,*56
@@ -132,13 +135,7 @@
     char crc;
 };
 
-typedef uint32_t gnss_client_handle_type;
 
-typedef enum
-{
-    E_MT_LOC_MSG_ID_LOCATION_INFO = 1,          /**<  pv_data = &QL_LOC_LOCATION_INFO_T  */
-    E_MT_LOC_MSG_ID_NMEA_INFO = 3,              /**<  pv_data = &QL_LOC_NMEA_INFO_T  */
-}e_msg_id_t;  //0,2reserve
 
 #define     QL_LOC_MAX_SEVER_ADDR_LENGTH    255 /**  Maximum generic server address length for the host name. */
 typedef struct 
@@ -157,13 +154,33 @@
     E_QL_LOC_STATUS_ENGINE_OFF      = 4, /**<  GPS is powered off.  */
 }E_QL_LOC_STATUS_VALUE_T;
 
-typedef void (*gnss_handler_func_t)
-(
-        uint32_t    h_loc,
-        e_msg_id_t  e_msg_id,
-        void        *pv_data,
-        void        *context_ptr
-        );
+struct mbtk_gnss_handle_t
+{
+    int dev_fd;
+    pthread_t  uart_pthread;
+    pthread_t  gnss_pthread;
+    gnss_handler_func_t gnss_handler_func;
+    int mode; // 0 - stop, 1 - single, 2 - periodic, 3 - start
+    pthread_mutex_t _cond_mutex;
+    int reset_state;
+    int inited;
+    ring_buffer_t ring_buffer;
+    int getap_status;
+    char *rb;
+    e_msg_id_t e_msg_id;
+    
+#if TTFF_TEST
+    pthread_t ttff_pid;
+    int location_state;
+#endif
+    /********************
+    存储handle的地址指针
+    phandle = &handle
+    handle  = mbtk_gnss_handle
+    *********************/
+    uint32_t *phandle; // handle的地址指针
+};
+
 
 struct mopen_location_info_t
 {
@@ -325,7 +342,6 @@
 int mopen_gnss_print_version(uint32 h_gnss);
 int lynq_gnss_client_init(uint32 *ph_gnss);
 int lynq_gnss_client_deinit(uint32 h_gnss);
-int mopen_gnss_add_rx_msg_handler(uint32 h_gnss, gnss_handler_func_t handler_ptr);
 int mopen_gnss_set_mode(uint32 h_gnss, int mode);
 int mopen_gnss_set_system_config(uint32 h_gnss, int mode);
 int mopen_gnss_set_nema_config(uint32 h_gnss, int mode);
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
index 360011b..0706884 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
@@ -102,32 +102,7 @@
     }   
 }
 
-struct mbtk_gnss_handle_t
-{
-    int dev_fd;
-    pthread_t  uart_pthread;
-    pthread_t  gnss_pthread;
-    gnss_handler_func_t gnss_handler_func;
-    int mode; // 0 - stop, 1 - single, 2 - periodic, 3 - start
-    pthread_mutex_t _cond_mutex;
-    int reset_state;
-    int inited;
-    ring_buffer_t ring_buffer;
-    int getap_status;
-    char *rb;
-    e_msg_id_t e_msg_id;
-    
-#if TTFF_TEST
-    pthread_t ttff_pid;
-    int location_state;
-#endif
-    /********************
-    存储handle的地址指针
-    phandle = &handle
-    handle  = mbtk_gnss_handle
-    *********************/
-    uint32_t *phandle; // handle的地址指针
-};
+
 #if TTFF_TEST
 struct mbtk_gnss_ttff_t
 {
@@ -1412,18 +1387,6 @@
     return 0;
 }
 
-int mopen_gnss_add_rx_msg_handler(uint32 h_gnss, gnss_handler_func_t handler_ptr)
-{
-    struct mbtk_gnss_handle_t *gnss_handle = (struct mbtk_gnss_handle_t *)h_gnss;
-    if(0 == h_gnss && NULL == handler_ptr)
-    {
-        printf("%s handler invalid.\n", __func__);
-        return -1;
-    }
-    gnss_handle->gnss_handler_func = handler_ptr;
-    return 0;
-}
-
 #define AGNSS_TLE_FILE  "/mnt/userdata/agnss_tle"
 
 static void http_data_cb_func(