ql_gnss.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. 
  2. /*================================================================
  3. Copyright (c) 2021, Quectel Wireless Solutions Co., Ltd. All rights reserved.
  4. Quectel Wireless Solutions Proprietary and Confidential.
  5. =================================================================*/
  6. /*=================================================================
  7. EDIT HISTORY FOR MODULE
  8. This section contains comments describing changes made to the module.
  9. Notice that changes are listed in reverse chronological order.
  10. WHEN WHO WHAT, WHERE, WHY
  11. ------------ ------- -------------------------------------------------------------------------------
  12. =================================================================*/
  13. #ifndef QL_GNSS_H
  14. #define QL_GNSS_H
  15. #include "ql_api_common.h"
  16. #include "ql_api_osi.h"
  17. #include "ql_uart.h"
  18. #include "time.h"
  19. #include <time.h>
  20. #include "ql_api_datacall.h"
  21. #include "ctype.h"
  22. #include "quec_customer_cfg.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /*===========================================================================
  27. * Typedef
  28. ===========================================================================*/
  29. typedef void (*ql_gnss_callback)(const ql_event_t *event);
  30. typedef void (*ql_gnss_coexist_callback)(uint32 ind_type, void *ctx);
  31. typedef char nmea_cardinal_t;
  32. /* Number of item types; unsigned integer. */
  33. typedef unsigned int dsat_num_item_type;
  34. typedef unsigned char boolean;
  35. extern const unsigned char quec_GPS_NMEATYPE_table[];
  36. extern const unsigned char quec_GLONASS_NMEATYPE_table[];
  37. extern const unsigned char quec_GALILEO_NMEATYPE_table[];
  38. extern const unsigned char quec_BEIDOU_NMEATYPE_table[];
  39. extern const unsigned char quec_GNSS_NMEATYPE_table[];
  40. #ifdef CONFIG_QUEC_PROJECT_FEATURE_HD_GNSS
  41. extern const unsigned char hd_gnss_uart;
  42. extern const ql_hd_gnss_moudle_e moudle_def;
  43. #endif
  44. /*===========================================================================
  45. * Macro Definition
  46. ===========================================================================*/
  47. #define ql_isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
  48. #define ARRAY_LENGTH(a) (sizeof a / sizeof (a[0]))
  49. #define QL_GNSS_ERRCODE_BASE (QL_COMPONENT_BSP_GNSS<<16)
  50. #define QUEC_GPS_RECBUF_LEN_MAX 3072 //增大buffer,unisoc 8850 底层all nmea语句改为一次event上报
  51. #define NMEA_END_CHAR_1 '\r'
  52. #define NMEA_END_CHAR_2 '\n'
  53. #define jmin(a, b) (((a) > (b)) ? (b) : (a))
  54. #define jmax(a, b) (((a) > (b)) ? (a) : (b))
  55. /* nmea gsv packet define */
  56. #define NMEA_GPGSV_TOTAL_MSGS 0
  57. #define NMEA_GPGSV_MSG_NR 1
  58. #define NMEA_GPGSV_SATS 2
  59. #define NMEA_GPGSV_SAT_INFO_NR1 3
  60. #define NMEA_GPGSV_SAT_INFO_ELEV1 4
  61. #define NMEA_GPGSV_SAT_INFO_AZIMUTH1 5
  62. #define NMEA_GPGSV_SAT_INFO_SNR1 6
  63. #define NMEA_GPGSV_SAT_INFO_NR2 7
  64. #define NMEA_GPGSV_SAT_INFO_ELEV2 8
  65. #define NMEA_GPGSV_SAT_INFO_AZIMUTH2 9
  66. #define NMEA_GPGSV_SAT_INFO_SNR2 10
  67. #define NMEA_GPGSV_SAT_INFO_NR3 11
  68. #define NMEA_GPGSV_SAT_INFO_ELEV3 12
  69. #define NMEA_GPGSV_SAT_INFO_AZIMUTH3 13
  70. #define NMEA_GPGSV_SAT_INFO_SNR3 14
  71. #define NMEA_GPGSV_SAT_INFO_NR4 15
  72. #define NMEA_GPGSV_SAT_INFO_ELEV4 16
  73. #define NMEA_GPGSV_SAT_INFO_AZIMUTH4 17
  74. #define NMEA_GPGSV_SAT_INFO_SNR4 18
  75. #define NMEA_GPGSV_SAT_INFO_SIGID 19
  76. #define NMEA_MAX_LENGTH (82)
  77. #define NMEA_CARDINAL_DIR_NORTH (nmea_cardinal_t) 'N'
  78. #define NMEA_CARDINAL_DIR_EAST (nmea_cardinal_t) 'E'
  79. #define NMEA_CARDINAL_DIR_SOUTH (nmea_cardinal_t) 'S'
  80. #define NMEA_CARDINAL_DIR_WEST (nmea_cardinal_t) 'W'
  81. #define NMEA_CARDINAL_DIR_UNKNOWN (nmea_cardinal_t) '\0'
  82. #define NMEA_PREFIX_LENGTH (5)
  83. #define NMEA_TIME_FORMAT "%H%M%S"
  84. #define NMEA_TIME_FORMAT_LEN 6
  85. #define NMEA_DATE_FORMAT "%d%m%y"
  86. #define NMEA_DATE_FORMAT_LEN 6
  87. #define KNOTS_CONVERSION_FACTOR (1.852)
  88. #define QL_GSV_MAX_SATS (160) //160(5*8*4,gps gl ga gb gnss)*(max 8 line gsv)*(one gsv has 4 sat)
  89. /* Value indexes */
  90. #define NMEA_GPRMC_TIME 0
  91. #define NMEA_GPRMC_STATUS 1
  92. #define NMEA_GPRMC_LATITUDE 2
  93. #define NMEA_GPRMC_LATITUDE_CARDINAL 3
  94. #define NMEA_GPRMC_LONGITUDE 4
  95. #define NMEA_GPRMC_LONGITUDE_CARDINAL 5
  96. #define NMEA_GPRMC_SPEED 6
  97. #define NMEA_GPRMC_COURSE 7
  98. #define NMEA_GPRMC_DATE 8
  99. /*nmea gga packet define*/
  100. //2,3,4,5,6,7
  101. #define NMEA_GPGGA_UTC 0
  102. #define NMEA_GPGGA_LATITUDE 1
  103. #define NMEA_GPGGA_LATITUDE_CARDINAL 2
  104. #define NMEA_GPGGA_LONGITUDE 3
  105. #define NMEA_GPGGA_LONGITUDE_CARDINAL 4
  106. #define NMEA_GPGGA_QUALITY 5
  107. #define NMEA_GPGGA_SATELLITES_TRACKED 6
  108. #define NMEA_GPGGA_HDOP 7
  109. #define NMEA_GPGGA_ALTITUDE 8
  110. /*nmea gsa packet define*/
  111. #define NMEA_GPGSA_MODE 0
  112. #define NMEA_GPGSA_NAVMODE 1
  113. #define NMEA_GPGSA_PDOP 14
  114. #define NMEA_GPGSA_HDOP 15
  115. #define NMEA_GPGSA_VDOP 16
  116. #define NMEA_GPGSA_systemID 17
  117. /*===========================================================================
  118. * Enum
  119. ===========================================================================*/
  120. typedef enum {
  121. NMEA_UNKNOWN,
  122. NMEA_RMC,
  123. NMEA_GGA,
  124. NMEA_GSA,
  125. NMEA_GSV,
  126. NMEA_VTG,
  127. NMEA_TXT,
  128. } nmea_type;
  129. typedef enum {
  130. SAT_UNKNOWN,
  131. SAT_GPS,
  132. SAT_GLONASS,
  133. SAT_GALILEO,
  134. SAT_BDS,
  135. SAT_MULSYS
  136. } satellite_type;
  137. typedef enum {
  138. PORT_NONE,
  139. PORT_USBNMEA,
  140. PORT_UARTDEBUG,
  141. PORT_MAX,
  142. } nmea_outport_row;
  143. typedef enum {
  144. QGPS_PROTO_NMEA_SRC_GGA, /* GPGGA */
  145. QGPS_PROTO_NMEA_SRC_GLL, /* GPGGA */
  146. QGPS_PROTO_NMEA_SRC_GSA, /* GPGSA GNGSA PQGSA */
  147. QGPS_PROTO_NMEA_SRC_GSV, /* GPGSV GLGSV GAGSV PQGSV */
  148. QGPS_PROTO_NMEA_SRC_RMC, /* GPRMC */
  149. QGPS_PROTO_NMEA_SRC_VTG, /* GPVTG */
  150. QGPS_PROTO_NMEA_SRC_ZDA, /* GPVTG */
  151. QGPS_PROTO_NMEA_SRC_GST, /* GPVTG */
  152. QGPS_PROTO_NMEA_SRC_MAX,
  153. } qgps_proto_nmea_src_e_type;
  154. typedef enum
  155. {
  156. QL_GNSS_SUCCESS = QL_SUCCESS,
  157. QL_GNSS_EXECUTE_ERR = 1|QL_GNSS_ERRCODE_BASE,
  158. QL_GNSS_INVALID_PARAM_ERR,
  159. QL_GNSS_NOT_SUPPORT_ERR,
  160. QL_GNSS_UART_SET_ERR,
  161. QL_GNSS_CB_NULL_ERR,
  162. QL_GNSS_ALREADY_OPEN,
  163. QL_GNSS_NVM_WRITE_ERR,
  164. QL_GNSS_NEMA_PARSE_ERR,
  165. QL_GNSS_PARAM_NULL_ERR, //传入的参数为NULL
  166. QL_GNSS_LOCK_EXE_ERR,
  167. QL_GNSS_ALREADY_CLOSE,
  168. QL_GNSS_SYS_INIT_ERR = 30|QL_GNSS_ERRCODE_BASE, //初始化失败
  169. QL_GNSS_SYS_MODE_ERR, //冷热启动模式通知错误
  170. QL_GNSS_SYS_AGPS_ONGOING, //agps 正在进行中
  171. QL_GNSS_SYS_AGPS_ERR, //agps 执行失败
  172. QL_GNSS_SYS_START_RF_SERVICE_ERR, //申请RF资源失败
  173. QL_GNSS_SYS_MODE_CONVER_ERR, //冷启动转化为热启动失败
  174. QL_GNSS_SYS_ABORT_INVALID, //LTE通知GNSS关闭失败
  175. QL_GNSS_SYS_RECOVERY_INVALID, //LTE通知GNSS恢复失败
  176. QL_GNSS_SYS_FIX_ERR, //定位失败
  177. QL_GNSS_SYS_CLOSE_ERR, //关闭gnss失败
  178. }ql_errcode_gnss;
  179. /**
  180. * GNSS switch select
  181. */
  182. typedef enum
  183. {
  184. GNSS_DISABLE,
  185. GNSS_ENABLE,
  186. GNSS_RESET
  187. }ql_GnssSW;
  188. typedef enum
  189. {
  190. AUTO_GNSS_DISABLE,
  191. AUTO_GNSS_ENABLE
  192. }ql_AutoGnssSW;
  193. typedef enum
  194. {
  195. AGPS_GNSS_DISABLE,
  196. AGPS_GNSS_ENABLE
  197. }ql_AGPSGnssSW;
  198. typedef enum
  199. {
  200. GNSS_CLOSE, //关闭
  201. GNSS_INIT, //初始化
  202. GNSS_MODE_IND, //冷热启动模式通知
  203. GNSS_AGPS_REQ, //AGPS申请
  204. GNSS_MODE_CONVER, //冷热启模式转换
  205. GNSS_ABORT_FROM_LTE, //LTE通知GNSS关闭
  206. GNSS_RECOVERY_FROM_LTE, //LTE通知GNSS恢复
  207. GNSS_START_RF_SERVICE, //启用RF资源
  208. GNSS_POSITIONING, //定位中
  209. GNSS_FIX, //fix
  210. GNSS_FIRMWARE_UPDATE, //固件更新
  211. GNSS_STATE_MAX,
  212. }ql_GnssState;
  213. typedef enum
  214. {
  215. GNSS_PRIORITY_GROUP_0 = 0, //0:gnss cold > lte signal > gnss hot > lte data
  216. GNSS_PRIORITY_GROUP_1, //1:gnss cold > lte signal > lte data > gnss hot
  217. GNSS_PRIORITY_GROUP_2, //2:gnss cold > gnss hot > lte signal > lte data
  218. GNSS_PRIORITY_GROUP_3, //3:lte signal > lte data > gnss cold > gnss hot
  219. GNSS_PRIORITY_GROUP_MAX
  220. }ql_gnss_lte_priority_e;
  221. typedef enum
  222. {
  223. GNSS_START_COLD = 0,
  224. GNSS_START_HOT,
  225. GNSS_START_WARM,
  226. GNSS_START_MAX
  227. }ql_gnss_startmode_e;
  228. typedef enum
  229. {
  230. QUEC_GNSS_UNKNOW_TYPE,
  231. QUEC_GNSS_RESET_TYPE, //复位
  232. QUEC_GNSS_BAUD_SET, //配置串口波特率
  233. QUEC_GNSS_CFGSYS, //配置导航系统
  234. QUEC_GNSS_SYS_SAVE, //保存波特率及nmea配置
  235. QUEC_GNSS_INFO, //查询软硬件版本号
  236. }quec_hd_gnss_cmd;
  237. typedef enum
  238. {
  239. HD_GPS_UNKNOW,
  240. HD_GPS_ACK_CMD=0x01,
  241. HD_GPS_NAK_CMD=0x02,
  242. HD_GPS_INFO_CMD=0x03
  243. }quec_hd_gnss_cmd_resp;
  244. /*===========================================================================
  245. * data struct
  246. ===========================================================================*/
  247. typedef struct ql_gnss_data_struct {
  248. /*是否有效定位*/
  249. unsigned char valid;
  250. /*经度*/
  251. double longitude;
  252. /*经度E(东经)或W(西经)*/
  253. unsigned char longitude_cardinal;
  254. /*纬度*/
  255. double latitude;
  256. /*纬度N(北纬)或S(南纬)*/
  257. unsigned char latitude_cardinal;
  258. /*hdop精度*/
  259. float hdop;
  260. /*phop精度*/
  261. float pdop;
  262. /*航向 0-360*/
  263. double heading;
  264. /*速度 km/h*/
  265. float gps_speed;
  266. /*信号强度,max=5, data from avg_snr*/
  267. unsigned char gps_signal;
  268. /*最大信号值 db*/
  269. unsigned int max_cnr;
  270. unsigned int max_cnr2;
  271. /*最小信号值 db*/
  272. unsigned int min_cnr;
  273. /*平均信号值 db*/
  274. unsigned int avg_cnr;
  275. /*信号值数组*/
  276. unsigned int cnrs[QL_GSV_MAX_SATS];
  277. unsigned int cnrs_index;
  278. /*定位卫星数量*/
  279. unsigned int satellites_num;
  280. /*海拔高度*/
  281. float altitude;
  282. /*固件版本号*/
  283. char fwver[32];
  284. /*定位日期*/
  285. struct tm time;
  286. /*定位时间*/
  287. unsigned int UTC;
  288. /*当前定位质量*/
  289. unsigned char quality;
  290. /*定位模式*/
  291. unsigned char navmode;
  292. }ql_gnss_data_t;
  293. struct nmea_s{
  294. satellite_type sat_type;
  295. nmea_type type;
  296. void *data;
  297. };
  298. /* GPS position struct */
  299. struct nmea_position{
  300. double minutes;
  301. int degrees;
  302. nmea_cardinal_t cardinal;
  303. };
  304. /* nmea rmc packet define */
  305. struct nmea_gprmc_s{
  306. /*1: valid, 0: invalid*/
  307. int valid;
  308. struct nmea_position longitude;
  309. struct nmea_position latitude;
  310. double course;
  311. double speed;
  312. struct tm time;
  313. } ;
  314. struct nmea_sat_info {
  315. /* PRN */
  316. int nr;
  317. /*elevation of satellite*/
  318. int elevation;
  319. /*azimuth of satellite*/
  320. int azimuth;
  321. /*Signal Noise Ratio*/
  322. int snr;
  323. };
  324. struct nmea_gpgsv_s {
  325. int cur_sats;
  326. int sig_id;
  327. /*total msg count*/
  328. int total_msgs;
  329. /*current msg index*/
  330. int msg_nr;
  331. /*total satellite count*/
  332. int total_sats;
  333. /*satellites info*/
  334. struct nmea_sat_info sats[4];
  335. };
  336. struct nmea_gpgga_s{
  337. struct nmea_position longitude;
  338. struct nmea_position latitude;
  339. unsigned char quality;
  340. unsigned int satellites_tracked;
  341. double hdop;
  342. double altitude;
  343. double time;
  344. };
  345. struct nmea_gpgsa_s {
  346. unsigned char mode;
  347. unsigned char navmode;
  348. double pdop;
  349. double hdop;
  350. double vdop;
  351. unsigned int systemid;
  352. };
  353. typedef struct {
  354. boolean nmeasrc_enable;
  355. qgps_proto_nmea_src_e_type gnss_nmea_sentence_type;
  356. /* GGA */
  357. struct
  358. {
  359. uint8 gp_gga_nmea_len; /* GPGGA */
  360. char *gp_gga_sent;
  361. }gga_sentences[5]; /* gpgga glgga gagga pqgga gngga */
  362. /* GSA */
  363. struct
  364. {
  365. uint8 gp_gsa_nmea_len;
  366. char *gp_gsa_sent;
  367. }gsa_sentences[5]; /* gpgsa glgsa gagsa pqgsa gngsa */
  368. /* GSV */
  369. struct
  370. {
  371. uint8 gp_gsv_nmea_len[8];
  372. char *gp_gsv_sent[8];
  373. uint8 cur_gsv_line;
  374. }gsv_sentences[5]; /* gpgsv glgsv gagsv pqgsv gngsv*/
  375. /* RMC */
  376. struct
  377. {
  378. uint8 gp_rmc_nmea_len; /* GPRMC */
  379. char *gp_rmc_sent;
  380. }rmc_sentences[5]; /* gprmc glrmc garmc pqrmc gnrmc*/
  381. /* VTG */
  382. struct
  383. {
  384. uint8 gp_vtg_nmea_len; /* GPVTG */
  385. char *gp_vtg_sent;
  386. }vtg_sentences[5]; /* gpvtg glvtg gavtg pqvtg gnvtg*/
  387. } nmeasrc_sentences;
  388. typedef struct {
  389. boolean nmeasrc_enable;
  390. qgps_proto_nmea_src_e_type gnss_nmea_sentence_type;
  391. uint32 gnss_nmea_sys_type;
  392. uint32 gps_gp_nmea_type;
  393. uint32 gps_gl_nmea_type;
  394. uint32 gps_ga_nmea_type;
  395. uint32 gps_beidou_nmea_type;
  396. uint32 gnss_nmea_type;
  397. uint32 gps_beidou_nmea_format;
  398. } nmeasrc_sentences_cfg;
  399. typedef struct
  400. {
  401. uint16 year;
  402. unsigned char month;
  403. unsigned char day_of_week;
  404. unsigned char day;
  405. unsigned char hour;
  406. unsigned char minute;
  407. unsigned char second;
  408. uint16 millisecond;
  409. } loc_calendar_time_s_type;
  410. typedef struct
  411. {
  412. dsat_num_item_type gnssmode; //
  413. dsat_num_item_type fixmaxtime; //最大超时重��?
  414. dsat_num_item_type fixmaxdist; // 定位精度
  415. dsat_num_item_type b_fixcount_flag;
  416. dsat_num_item_type fixcount; // count of fs
  417. dsat_num_item_type fixrate; //fs per/s
  418. }quec_gps_config;
  419. typedef struct
  420. {
  421. boolean outport_en;
  422. nmea_outport_row type;
  423. unsigned char out_channel;
  424. }quec_gps_outport_config;
  425. typedef struct
  426. {
  427. bool agpsflag;
  428. bool agps_assist_data_valid;
  429. int64_t local_last_time_min;
  430. uint8 profile_inx;
  431. uint8 ip_version;
  432. char agps_url[100];
  433. char agpsvendorID[30];
  434. char agpsmodelID[30];
  435. char agpspassWord[30];
  436. char agps_apn[APN_LEN_MAX];
  437. }quec_agps_cfg_t;
  438. //GNSS配置信息结构体,目前只有nmeasrc_sentences_cfg成员
  439. typedef struct
  440. {
  441. nmeasrc_sentences_cfg nmea_cfg;
  442. }ql_gnss_cfg_s;
  443. typedef struct
  444. {
  445. uint16_t length;
  446. uint16_t type; // BIT0=1--GGA, BIT1=1--GLL, BIT2=1--GSA, BIT3=1--GSV, BIT4=1--RMC, BIT5=1--VTG
  447. uint8_t data[QUEC_GPS_RECBUF_LEN_MAX]; // NMEA DATA
  448. } ql_gnss_output_info_ind_t;
  449. typedef struct
  450. {
  451. ql_GnssState state; //gnss当前状态
  452. ql_errcode_gnss errcode; //执行错误码
  453. }ql_gnss_state_ind_t;
  454. typedef struct
  455. {
  456. // TelAtParserID atp_index;
  457. // uint32 atHandle;
  458. quec_hd_gnss_cmd cmd_id;
  459. unsigned char* cmd_data;
  460. char cmd_len;
  461. quec_hd_gnss_cmd_resp resp_type;
  462. }QGPS_CMD_TYPE;
  463. typedef struct
  464. {
  465. uint32 ind_type;
  466. ql_uart_port_number_e port;
  467. uint32 size;
  468. }ql_gnss_callback_s;//gnss回调函数参数结构体
  469. typedef void (*ql_gnss_callback_ex)(ql_gnss_callback_s *callback_s);
  470. extern nmeasrc_sentences nmea_handle;
  471. /*===========================================================================
  472. * Functions declaration
  473. ===========================================================================*/
  474. /**
  475. * @brief GNSS function switch
  476. * @param gnss_sw : GNSS function enable/disable
  477. * @return
  478. * QL_GNSS_INVALID_PARAM_ERR
  479. * QL_GNSS_ALREADY_CLOSE
  480. * QL_GNSS_ALREADY_OPEN
  481. * QL_GNSS_SUCCESS
  482. */
  483. ql_errcode_gnss ql_gnss_switch(ql_GnssSW gnss_sw);
  484. /**
  485. * @brief GNSS auto start gnss cfg
  486. * @param gnss_sw : GNSS auto start enable/disable
  487. * @return
  488. * QL_GNSS_INVALID_PARAM_ERR
  489. * QL_GNSS_LOCK_EXE_ERR
  490. * QL_GNSS_EXECUTE_ERR
  491. * QL_GNSS_SUCCESS
  492. */
  493. ql_errcode_gnss ql_auto_gnss_cfg(ql_AutoGnssSW autoflag);
  494. /**
  495. * @brief user's GNSS callback register
  496. * @param gnss_cb : set callback by user
  497. * @return
  498. * QL_GNSS_CB_NULL_ERR
  499. * QL_GNSS_SUCCESS
  500. */
  501. ql_errcode_gnss ql_gnss_callback_register(ql_gnss_callback gnss_cb);
  502. /**
  503. * @brief user's GNSS callback register
  504. * @param gnss_cb : set callback by user
  505. * @return
  506. * QL_GNSS_CB_NULL_ERR
  507. * QL_GNSS_SUCCESS
  508. */
  509. ql_errcode_gnss ql_gnss_callback_register_ex(ql_gnss_callback_ex gnss_cb);
  510. /**
  511. * @brief GNSS nmea infomation get
  512. * @param pbuff : point for nmea info
  513. * @param len : length for nmea info
  514. * @return
  515. * QL_GNSS_INVALID_PARAM_ERR
  516. * QL_GNSS_SUCCESS
  517. */
  518. ql_errcode_gnss ql_gnss_nmea_get(ql_uart_port_number_e uart_port,unsigned char *pbuff, uint32 len);
  519. /**
  520. * @brief GNSS state info get
  521. * @param NULL
  522. * @return
  523. * ql_GnssState
  524. */
  525. ql_GnssState ql_gnss_state_info_get(void);
  526. /**
  527. * @brief GNSS agps cfg
  528. * @param gnssagpsflag:GNSS agps enable/disable
  529. * @return
  530. * QL_GNSS_INVALID_PARAM_ERR
  531. * QL_GNSS_LOCK_EXE_ERR
  532. * QL_GNSS_EXECUTE_ERR
  533. * QL_GNSS_SUCCESS
  534. */
  535. ql_errcode_gnss ql_gnss_agps_cfg(ql_AGPSGnssSW gnssagpsflag);
  536. /**
  537. * @brief GNSS agps param cfg
  538. * @param profile: agps httpdowmload profile
  539. * URL: agps httpdowmload URL is NULL
  540. * vendorID:agps httpdowmload vendorID is NULL
  541. * modelID: agps httpdowmload modelID is NULL
  542. * password:agps httpdowmload password is NULL
  543. * @return
  544. * QL_GNSS_INVALID_PARAM_ERR
  545. QL_GNSS_SUCCESS
  546. * @note
  547. * EN: After AGPS feature is enabled, the PDP context specified by <profile> is maybe de-activated.
  548. * So, please do not use the same PDP context with other applications at the same time,
  549. * preventing the application from abnormal network disconnection and need restarting a data call.
  550. * 中文: 启用 AGPS 功能后,<profile>指定的PDP上下文可能将去激活。
  551. * 因此,AGPS 功能不可与其他应用同时共用同一个<profile>,否则可能产生网络应用异常断开,需要重新拨号。
  552. */
  553. ql_errcode_gnss ql_gnss_agps_param_cfg(uint8 profile,const char *URL,const char *vendorID,const char *modelID,const char *password);
  554. /**
  555. * @brief GNSS agps param cfg ex
  556. * @param agpscfg_ex: agps httpdowmload Configuration parameter structure pointer
  557. * @return
  558. * QL_GNSS_INVALID_PARAM_ERR
  559. QL_GNSS_SUCCESS
  560. */
  561. ql_errcode_gnss ql_gnss_agps_param_cfg_ex(quec_agps_cfg_t *agpscfg_ex);
  562. /**
  563. * @brief GNSS agps param get
  564. * @param agpscfg_ex: agps httpdowmload parameter structure pointer
  565. * @return
  566. * QL_GNSS_INVALID_PARAM_ERR
  567. QL_GNSS_EXECUTE_ERR
  568. QL_GNSS_SUCCESS
  569. */
  570. ql_errcode_gnss ql_gnss_agps_get_cfg(quec_agps_cfg_t *agpscfg_ex);
  571. /**
  572. * @brief GNSS sys_type cfg
  573. * @param sys_type:
  574. GNSS定位的卫星系统。默认值:5。
  575. 0 单GPS
  576. 1 GPS + BeiDou + Galileo + GLONASS混合定位
  577. 2 GPS + BeiDou + GLONASS混合定位
  578. 3 GPS + GLONASS + Galileo混合定位
  579. 4 GPS + GLONASS混合定位
  580. 5 GPS + BeiDou + Galileo混合定位
  581. 6 GPS + Galileo混合定位
  582. 7 单BeiDou
  583. * @return
  584. * QL_GNSS_INVALID_PARAM_ERR
  585. * QL_GNSS_LOCK_EXE_ERR
  586. * QL_GNSS_EXECUTE_ERR
  587. * QL_GNSS_NOT_SUPPORT_ERR
  588. * QL_GNSS_SUCCESS
  589. */
  590. ql_errcode_gnss ql_gnss_sys_type_cfg(uint32 sys_type);
  591. /*****************************************************************
  592. * Function: ql_gnss_get_cfg
  593. *
  594. * Description: 获取gnss的配置信息
  595. *
  596. * Parameters:
  597. * gnss_cfg [out] 获取的配置信息
  598. *
  599. * Return:
  600. * QL_GNSS_PARAM_NULL_ERR
  601. * QL_GNSS_LOCK_EXE_ERR
  602. * QL_GNSS_SUCCESS
  603. *
  604. *****************************************************************/
  605. ql_errcode_gnss ql_gnss_get_cfg(ql_gnss_cfg_s * gnss_cfg);
  606. /*****************************************************************
  607. * Function: ql_gnss_lte_priority_set
  608. *
  609. * Description: gnss 与 lte 的共存优先级设置, 仅在GNSS关闭状态下可配置, 不需重新启动
  610. *
  611. * Parameters:
  612. * priority [in] 优先级设置
  613. * GNSS_PRIORITY_GROUP_0 : gnss cold > lte signal > gnss hot > lte data
  614. * GNSS_PRIORITY_GROUP_1 : gnss cold > lte signal > lte data > gnss hot
  615. * GNSS_PRIORITY_GROUP_2 : gnss cold > gnss hot > lte signal > lte data
  616. * GNSS_PRIORITY_GROUP_3 : lte signal > lte data > gnss cold > gnss hot
  617. *
  618. * Return:
  619. * QL_GNSS_INVALID_PARAM_ERR
  620. * QL_GNSS_EXECUTE_ERR
  621. * QL_GNSS_ALREADY_OPEN
  622. * QL_GNSS_LOCK_EXE_ERR
  623. * QL_GNSS_SUCCESS
  624. *
  625. *****************************************************************/
  626. ql_errcode_gnss ql_gnss_lte_priority_set(ql_gnss_lte_priority_e priority);
  627. /*****************************************************************
  628. * Function: ql_gnss_lte_priority_get
  629. *
  630. * Description: 获取 gnss 与 lte 的共存优先级
  631. *
  632. * Parameters:
  633. * priority [out] 获取优先级
  634. * GNSS_PRIORITY_GROUP_0 : gnss cold > lte signal > gnss hot > lte data
  635. * GNSS_PRIORITY_GROUP_1 : gnss cold > lte signal > lte data > gnss hot
  636. * GNSS_PRIORITY_GROUP_2 : gnss cold > gnss hot > lte signal > lte data
  637. * GNSS_PRIORITY_GROUP_3 : lte signal > lte data > gnss cold > gnss hot
  638. *
  639. * Return:
  640. * QL_GNSS_INVALID_PARAM_ERR
  641. * QL_GNSS_EXECUTE_ERR
  642. * QL_GNSS_LOCK_EXE_ERR
  643. * QL_GNSS_SUCCESS
  644. *
  645. *****************************************************************/
  646. ql_errcode_gnss ql_gnss_lte_priority_get(ql_gnss_lte_priority_e *priority);
  647. /**
  648. * @brief user's GNSS coexist callback register
  649. * @param gnss_cb : set callback by user
  650. * @return
  651. * QL_GNSS_CB_NULL_ERR
  652. * QL_GNSS_LOCK_EXE_ERR
  653. * QL_GNSS_SUCCESS
  654. */
  655. ql_errcode_gnss ql_gnss_coexist_callback_register(ql_gnss_coexist_callback gnss_cb);
  656. #ifdef __cplusplus
  657. } /*"C" */
  658. #endif
  659. #endif /* QL_GNSS_H */