pam_gnss_api.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. * ARBITRATION MODULE
  12. */
  13. #ifndef __PAM_GNSS_API_H__
  14. #define __PAM_GNSS_API_H__
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include <ctype.h>
  19. #include "at_engine.h"
  20. #include "cfw.h"
  21. #include "cfw_event.h"
  22. #include "cfw_dispatch.h"
  23. #include "at_command.h"
  24. #include "at_response.h"
  25. #include "cfw_chset.h"
  26. #include "cfw_event.h"
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #ifdef CONFIG_PAM_LTE_GNSS_WIFISCAN_SUPPORT
  31. #define GNSS_NMEA_DATA_MAX_SIZE 3072
  32. /*==============================
  33. *************FOR pam_gnss_api.c**************
  34. ==============================*/
  35. typedef struct
  36. {
  37. bool is_ok;
  38. } AT_GNSS_SLEEP_T;
  39. typedef struct
  40. {
  41. uint16_t wYear;
  42. uint16_t wMonth;
  43. uint16_t wDay;
  44. uint16_t wHour;
  45. uint16_t wMinute;
  46. uint16_t wSecond;
  47. } TimeStamp;
  48. typedef struct
  49. {
  50. float longitude; //¾­¶È
  51. float latitude; //γ¶È
  52. TimeStamp utc_time; // ÊÀ½çʱ¼ä
  53. uint32_t ttff_time; //µÚÒ»´Î¶¨Î»ËùÓÃʱ¼ä£¬µ¥Î»s
  54. uint16_t cn0;
  55. } PAM_GNSS_POSITION_INFO_IND_T;
  56. typedef enum
  57. {
  58. PAM_GNSS_SETUP_DATA_SOCKET,
  59. PAM_GNSS_RELEASE_DATA_SOCKET
  60. } PAM_GNSS_DATA_SOCKET_E;
  61. typedef struct
  62. {
  63. PAM_GNSS_DATA_SOCKET_E dataSocket_type;
  64. } PAM_GNSS_DATA_SOCKET_T;
  65. typedef struct
  66. {
  67. uint16_t length;
  68. uint16_t type; // BIT0=1--GGA, BIT1=1--GLL, BIT2=1--GSA, BIT3=1--GSV, BIT4=1--RMC, BIT5=1--VTG
  69. uint8_t nmea_data[GNSS_NMEA_DATA_MAX_SIZE]; // NMEA¸ñʽÊý¾Ý
  70. } PAM_GNSS_OUTPUT_INFO_IND_T;
  71. typedef struct
  72. {
  73. uint8_t startMode;
  74. uint8_t useAgnss;
  75. } GNSS_STARTMODE_AGNSS_T;
  76. typedef struct
  77. {
  78. uint16_t wYear;
  79. uint16_t wMonth;
  80. uint16_t wDay;
  81. uint16_t wHour;
  82. uint16_t wMinute;
  83. uint16_t wSecond;
  84. } GnssTimeStamp;
  85. /********************Defined RTOS Tick Time ***************************************/
  86. typedef struct _GNSS_SCI_TICK_TIME
  87. {
  88. uint32_t milliseconds;
  89. uint32_t second;
  90. } GNSS_SCI_TICK_TIME_T;
  91. typedef struct
  92. {
  93. float longitude; // ¾­¶È
  94. float latitude; // γ¶È
  95. float altitude; // ¸ß¶È
  96. GnssTimeStamp utc_time; // ÊÀ½çʱ¼ä
  97. uint32_t ttff_time; // µÚÒ»´Î¶¨Î»ËùÓÃʱ¼ä£¬µ¥Î»s
  98. uint8_t satellite_num; // ÎÀÐÇÊýÄ¿
  99. float speed; // ¶ÔµØËÙ¶È
  100. float course; // ¶ÔµØ·½Ïò
  101. uint16_t clockdrift;
  102. GNSS_SCI_TICK_TIME_T m_nSystemTimeStamp; // RTC or any other system time
  103. uint32_t m_nUTCTime; // second
  104. uint8_t m_nUncertaintySemiMajor;
  105. uint8_t m_nUncertaintySemiMinor;
  106. float m_nBearing; // increments of 1 measured clockwise from the North.
  107. uint16_t m_nDirection; // UP=0, Down=1
  108. float m_nHorizontalVelocity; // m/s
  109. float m_nVerticalVelocity; // m/s
  110. uint32_t fix_flag;
  111. float m_nHorizontalAccuracy;
  112. float m_nPDOP; // λÖþ«¶ÈÒò×Ó
  113. float m_nHDOP; // ˮƽ¾«¶ÈÒò×Ó
  114. float m_nVDOP; // ´¹Ö±¾«¶ÈÒò×Ó
  115. } GNSS_INFO_DATA_T;
  116. typedef struct
  117. {
  118. uint16_t m_nSatelliteIdentifier; // SV PRN
  119. uint16_t m_cn0; // 2CN0ÐÅÔë±È
  120. uint16_t m_nElevation; // Ñö½Ç
  121. uint16_t m_nAzimuth; // ·½Î»½Ç
  122. uint8_t m_IsUsed;
  123. } GNSS_SATELLITE_INFO_T;
  124. typedef struct
  125. {
  126. uint8_t satellite_num;
  127. GNSS_SATELLITE_INFO_T satellite_info[32];
  128. } GNSS_SATELLITE_INFO_LIST_T;
  129. typedef struct
  130. {
  131. GNSS_INFO_DATA_T gnss_data_info;
  132. GNSS_SATELLITE_INFO_LIST_T satellite_list_info;
  133. } GNSS_READ_INFO_CNF_T;
  134. /*******************************************************************************
  135. * Describe: This function is used to reset start gnss module.
  136. * mode: 125 cold start, 1024 hot start
  137. * return: 0 success
  138. *******************************************************************************/
  139. uint32_t LOC_GnssSetRestart(uint32_t mode);
  140. /*******************************************************************************
  141. * Describe: This function is used to Get GNSS start mode.
  142. * nUti: Asynchronous semaphore
  143. * nSim: Sim Index
  144. * pStartMode: enum START_MODE
  145. *******************************************************************************/
  146. uint32_t LOC_GnssGetStartMode(uint8_t *pStartMode, uint8_t nSim);
  147. /*******************************************************************************
  148. * Describe: This function is used to Download gnss module.
  149. * nUti: Asynchronous semaphore
  150. * nSim: Sim Index
  151. *******************************************************************************/
  152. uint32_t Loc_GnssDownload(uint8_t nSim);
  153. /*******************************************************************************
  154. * Describe: After power on and sownload GNSS module, Initialize GNSS module.
  155. * After power off GNSS module,use this function to wake up the GNSS module.
  156. * nUti: Asynchronous semaphore
  157. * nSim: Sim Index
  158. *******************************************************************************/
  159. uint32_t LOC_GnssInit(uint8_t nSim);
  160. /*******************************************************************************
  161. * Describe: This function is used to set GNSS positioning mode.
  162. * nUti: Asynchronous semaphore
  163. * nSim: Sim Index
  164. *******************************************************************************/
  165. uint32_t LOC_GnssStartMode(uint8_t nStartMode, uint8_t nSatelliteType, uint8_t nSim);
  166. /*******************************************************************************
  167. * Describe: This function is used to start GNSS positioning, under certain conditions.
  168. * nUti: Asynchronous semaphore
  169. * nSim: Sim Index
  170. * nStartType: GPS+GLONASS/GPS+BDS/GPS/BDS
  171. * nStartMode: COLD/HOT/WARM/FACTORY start mode
  172. *******************************************************************************/
  173. uint32_t LOC_GnssRun(uint8_t nSim);
  174. /*******************************************************************************
  175. * Describe: This function is used to stop GNSS positioning.
  176. * nUti: Asynchronous semaphore
  177. * nSim: Sim Index
  178. *******************************************************************************/
  179. uint32_t LOC_GnssStop(uint8_t nSim);
  180. /*******************************************************************************
  181. * Describe: This function is used to set satellite type.
  182. * nUti: Asynchronous semaphore
  183. * nSim: Sim Index
  184. * nGnssMode: GPS+GLONASS/GPS+BDS/GPS/BDS
  185. *******************************************************************************/
  186. uint32_t LOC_GnssSetMode(uint8_t nGnssMode, uint8_t nSim);
  187. /*******************************************************************************
  188. * Describe: This function is used to read satellite and positioning information from the bottom.
  189. * nUti: Asynchronous semaphore
  190. * nSim: Sim Index
  191. *******************************************************************************/
  192. uint32_t LOC_GnssReadInfo(uint8_t nSim);
  193. /*******************************************************************************
  194. * Describe: This function is used to report output NMEA format, is set from user.
  195. * nUti: Asynchronous semaphore
  196. * nSim: Sim Index
  197. * nOutputType: bit0-GGA,bit1-GLL,bit2-GSA,bit3-GSV,bit4-RMC,bit5-VTG, value 0:close autoreport
  198. * nTimeInterval: output time interval,unit /s
  199. *******************************************************************************/
  200. uint32_t LOC_GnssOutPut(uint16_t nOutputType, uint32_t nTimeInterval, uint8_t nSim);
  201. /*******************************************************************************
  202. * Describe: This function is used to put libGNSS into low power consumption mode,
  203. * LOC_GnssInit function is needed to wake up it.
  204. * nUti: Asynchronous semaphore
  205. * nSim: Sim Index
  206. *******************************************************************************/
  207. uint32_t LOC_GnssPowerOff(uint8_t nSim);
  208. /*******************************************************************************
  209. * Describe: This function is used to send naspi to libGNSS, in order to A-GNSS
  210. * using naspi to create socket.
  211. * nUti: Asynchronous semaphore
  212. * nSim: Sim Index
  213. * nCid: Activated CID
  214. * nNaspi: Network service access point identifier
  215. *******************************************************************************/
  216. uint32_t LOC_GnssSendPdpInfo(uint32_t nNsapi, uint8_t nSim);
  217. /*******************************************************************************
  218. * Describe: This function is used to notify the underlying layer to delete the
  219. * previously cached aid and data.
  220. * nUti: Asynchronous semaphore
  221. * nSim: Sim Index
  222. *******************************************************************************/
  223. uint32_t LOC_GnssDeleteAidData(uint8_t nSim);
  224. #endif //#ifdef CONFIG_PAM_LTE_GNSS_WIFISCAN_SUPPORT
  225. #endif //__PAM_GNSS_API_H__