qx_supl_sdk.h 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860
  1. #ifndef QX_SUPL_SDK_H_INCLUDED
  2. #define QX_SUPL_SDK_H_INCLUDED
  3. /**
  4. * @defgroup BASIC_TYPES Primitive types
  5. * @defgroup GNSS GNSS satellite systems
  6. * @defgroup ASSISTANT Assistant data types
  7. * @defgroup QXSUPL_REQUEST QXSUPL request data
  8. * @defgroup QXSUPL_RESPONSE QXSUPL response data
  9. * @defgroup PUBLISHED Published interfaces
  10. */
  11. /**
  12. * @addtogroup GNSS
  13. * @{
  14. */
  15. /**
  16. * The max number of GPS satellites
  17. */
  18. #define MaxGpsSateNum (32)
  19. /**
  20. * The max number of GLONASS satellites
  21. */
  22. #define MaxGlnSateNum (27)
  23. /**
  24. * The max number of BDS (COMPASS) satellites
  25. */
  26. #define MaxBdsSateNum (63)
  27. #define MaxGalSateNum (36)
  28. #define MaxQzsSateNum (7)
  29. /**
  30. * Indicator for GPS satellite system of GNSS(Global Navigation Satellite System).
  31. */
  32. #define QX_GNSS_GPS (0x1 << 0)
  33. /**
  34. * Indicator for GLONASS satellite system of GNSS(Global Navigation Satellite System).
  35. */
  36. #define QX_GNSS_GLO (0x1 << 1)
  37. /**
  38. * Indicator for BDS(COMPASS) satellite system of GNSS(Global Navigation Satellite System).
  39. */
  40. #define QX_GNSS_BDS (0x1 << 2)
  41. /**
  42. * Indicator for GALILEO satellite system of GNSS(Global Navigation Satellite System).
  43. */
  44. #define QX_GNSS_GAL (0x1 << 3)
  45. /**
  46. * Indicator for QZSS satellite system of GNSS(Global Navigation Satellite System).
  47. */
  48. #define QX_GNSS_QZS (0x1 << 4)
  49. /**
  50. * @}
  51. */
  52. /**
  53. * @addtogroup ASSISTANT
  54. * @{
  55. */
  56. /**
  57. * Reference Time in request type or response data type.
  58. */
  59. #define QX_REQ_REF_TIME (0x1 << 0)
  60. /**
  61. * Reference Location in request type or response data type.
  62. */
  63. #define QX_REQ_REF_LOC (0x1 << 1)
  64. /**
  65. * GPS Ephemerides in request type or response data type.
  66. */
  67. #define QX_REQ_GPS_EPH (0x1 << 2)
  68. /**
  69. * GPS Ionosphere Model in request type or response data type.
  70. */
  71. #define QX_REQ_GPS_IONO (0x1 << 3)
  72. /**
  73. * GPS UTC Model in request type or response data type.
  74. */
  75. #define QX_REQ_GPS_UTC (0x1 << 4)
  76. /**
  77. * GPS Almanac in request type or response data type.
  78. */
  79. #define QX_REQ_GPS_ALM (0x1 << 5)
  80. /**
  81. * GLONASS Ephemerides in request type or response data type.
  82. */
  83. #define QX_REQ_GLO_EPH (0x1 << 6)
  84. /**
  85. * GLONASS UTC Model in request type or response data type.
  86. */
  87. #define QX_REQ_GLO_UTC (0x1 << 7)
  88. /**
  89. * GLONASS Almanac in request type or response data type.
  90. */
  91. #define QX_REQ_GLO_ALM (0x1 << 8)
  92. /**
  93. * GLONASS AUX data in request type or response data type.
  94. */
  95. #define QX_REQ_GLO_AUX (0x1 << 9)
  96. /**
  97. * BDS(COMPASS) Ephemerides in request type or response data type.
  98. */
  99. #define QX_REQ_BDS_EPH (0x1 << 10)
  100. /**
  101. * BDS(COMPASS) Ionosphere Model in request type or response data type.
  102. */
  103. #define QX_REQ_BDS_IONO (0x1 << 11)
  104. /**
  105. * BDS(COMPASS) UTC Model in request type or response data type.
  106. */
  107. #define QX_REQ_BDS_UTC (0x1 << 12)
  108. /**
  109. * BDS(COMPASS) Almanac in request type or response data type.
  110. */
  111. #define QX_REQ_BDS_ALM (0x1 << 13)
  112. /**
  113. * GAL Ephemerides in request type or response data type.
  114. */
  115. #define QX_REQ_GAL_EPH (0x1 << 14)
  116. /**
  117. * GAL Ionosphere Model in request type or response data type.
  118. */
  119. #define QX_REQ_GAL_IONO (0x1 << 15)
  120. /**
  121. * GAL UTC Model in request type or response data type.
  122. */
  123. #define QX_REQ_GAL_UTC (0x1 << 16)
  124. /**
  125. * GAL Almanac in request type or response data type.
  126. */
  127. #define QX_REQ_GAL_ALM (0x1 << 17)
  128. /**
  129. * QZSS Ephemerides in request type or response data type.
  130. */
  131. #define QX_REQ_QZS_EPH (0x1 << 18)
  132. /**
  133. * QZSS Ionosphere Model in request type or response data type.
  134. */
  135. #define QX_REQ_QZS_IONO (0x1 << 19)
  136. /**
  137. * QZSS UTC Model in request type or response data type.
  138. */
  139. #define QX_REQ_QZS_UTC (0x1 << 20)
  140. /**
  141. * QZSS Almanac in request type or response data type.
  142. */
  143. #define QX_REQ_QZS_ALM (0x1 << 21)
  144. /**
  145. * Special request type for only reporting data.
  146. */
  147. #define QX_REQ_REPORT_LOCATION (0xffffffffu)
  148. /**
  149. * @}
  150. */
  151. /**
  152. * @addtogroup QXSUPL_REQUEST
  153. * @{
  154. */
  155. /**
  156. * The max number of Non-CDMA Cell information to be uploaded in QXSUPL request.
  157. */
  158. #define AGNSS_MAX_NON_CDMA_CELL 10
  159. /**
  160. * The max number of CDMA Cell information to be uploaded in QXSUPL request.
  161. */
  162. #define AGNSS_MAX_CDMA_CELL 10
  163. /**
  164. * The max number of nearby WIFI information to be uploaded in QXSUPL request.
  165. */
  166. #define AGNSS_MAX_WIFI_AP 10
  167. /**
  168. * The max number of other useful information to be uploaded in QXSUPL request.
  169. */
  170. #define AGNSS_MAX_RSVD 4
  171. /**
  172. * The max number of bytes of key in the other useful information.
  173. */
  174. #define AGNSS_MAX_KEY_LEN 16
  175. /**
  176. * The max number of bytes of value in the other useful information.
  177. */
  178. #define AGNSS_MAX_VALUE_LEN 64
  179. /**
  180. * @}
  181. */
  182. /**
  183. * @addtogroup PUBLISHED
  184. * @{
  185. */
  186. /**
  187. * Check whether QXSUPL SDK api invocation succeeded.
  188. */
  189. #define QX_SUPL_SDK_SUCCEEDED(rc) ((rc) == 0)
  190. /**
  191. * @}
  192. */
  193. #ifdef __cplusplus
  194. extern "C" {
  195. #endif
  196. /**
  197. * @addtogroup BASIC_TYPES
  198. * @{
  199. */
  200. /**
  201. * signed 8 bit integer
  202. */
  203. typedef signed char S8;
  204. /**
  205. * unsigned 8 bit integer
  206. */
  207. typedef unsigned char U8;
  208. /**
  209. * signed 16 bit integer
  210. */
  211. typedef signed short S16;
  212. /**
  213. * unsigned 16 bit integer
  214. */
  215. typedef unsigned short U16;
  216. /**
  217. * signed 32 bit integer
  218. */
  219. typedef signed int S32;
  220. /**
  221. * unsigned 32 bit integer
  222. */
  223. typedef unsigned int U32;
  224. /**
  225. * signed 64 bit integer
  226. */
  227. typedef signed long long S64;
  228. /**
  229. * unsigned 64 bit integer
  230. */
  231. typedef unsigned long long U64;
  232. /**
  233. * single precision float number
  234. */
  235. typedef float FLT;
  236. /**
  237. * double precision float number
  238. */
  239. typedef double DBL;
  240. /**
  241. * @}
  242. */
  243. /**
  244. * @addtogroup QXSUPL_REQUEST
  245. * @{
  246. */
  247. /**
  248. * Enumeration of location id type.
  249. */
  250. typedef enum tagLocationIdType {
  251. /**
  252. * NONE
  253. */
  254. LOCID_TYPE_NONE = 0,
  255. /**
  256. * GSM cell.
  257. */
  258. LOCID_TYPE_GSM = (0x1 << 0),
  259. /**
  260. * WCDMA/TDSCDMA cell.
  261. */
  262. LOCID_TYPE_WCDMA_TDSCDMA = (0x1 << 1),
  263. /**
  264. * LTE cell.
  265. */
  266. LOCID_TYPE_LTE = (0x1 << 2),
  267. /**
  268. * CDMA cell.
  269. */
  270. LOCID_TYPE_CDMA = (0x1 << 3),
  271. /**
  272. * WIFI MAC Address.
  273. */
  274. LOCID_TYPE_WIFI = (0x1 << 4),
  275. /**
  276. * latitude/longitude location.
  277. */
  278. LOCID_TYPE_LLA = (0x1 << 5)
  279. } LocationIdType;
  280. /**
  281. * Location structure.
  282. */
  283. typedef struct lla_tag {
  284. /**
  285. * @note 1 means valid
  286. * @note 0 means invalid
  287. */
  288. U8 valid;
  289. /**
  290. * Uncertainty.
  291. *
  292. * @note k, real unc = 10*((1+0.1)^k-1)
  293. */
  294. U8 unc;
  295. /**
  296. * Latitude in degree unit.
  297. */
  298. DBL lat;
  299. /**
  300. * Longitude in degree unit.
  301. */
  302. DBL lon;
  303. /**
  304. * Height in meter unit.
  305. */
  306. DBL height;
  307. } LLA_t;
  308. /**
  309. * Non-CDMA cell information.
  310. */
  311. typedef struct {
  312. /**
  313. * @see tagLocationIdType
  314. */
  315. U8 cellType;
  316. /**
  317. * Mobile Country Code
  318. */
  319. U32 mcc;
  320. /**
  321. * Mobile Network Code
  322. */
  323. U32 mnc;
  324. /**
  325. * Location Area Code
  326. */
  327. U32 lac;
  328. /**
  329. * Cell Identity
  330. */
  331. U32 cid;
  332. } QX_agnss_nonCDMACell_t;
  333. /**
  334. * CDMA cell information.
  335. */
  336. typedef struct {
  337. U32 refNID;
  338. U32 refSID;
  339. U32 refBASEID;
  340. S32 refBASELAT;
  341. S32 reBASELONG;
  342. } QX_agnss_CDMACell_t;
  343. /**
  344. * WIFI AP information.
  345. */
  346. typedef struct {
  347. /**
  348. * WIFI MAC Address.
  349. *
  350. * @note It's 6 bytes length.
  351. */
  352. U8 apMacAddr[6];
  353. /**
  354. * AP signal strength at SET(SUPL Enabled Terminal).
  355. */
  356. S16 signalLevel;
  357. /**
  358. * Reserved1.
  359. */
  360. S16 rsvd1;
  361. /**
  362. * Reserved2.
  363. */
  364. S16 rsvd2;
  365. } QX_agnss_wifi_AP_t;
  366. #pragma pack(1)
  367. /**
  368. * @addtogroup QXSUPL_RESPONSE
  369. * @{
  370. */
  371. /**
  372. * Reserved data in the first sub frame.
  373. *
  374. * @see Cli_EphParameters_t::ephemSF1Rsvd
  375. */
  376. typedef struct Cli_EphSubframe1Reserved {
  377. S32 reserved1;
  378. S32 reserved2;
  379. S32 reserved3;
  380. S32 reserved4;
  381. } Cli_EphSubframe1Reserved_t;
  382. /**
  383. * GPS ephemeris parameters.
  384. *
  385. * @see Cli_NavModelOfSatellite_t::ephParameter
  386. */
  387. typedef struct Cli_EphParameters {
  388. S32 ephemCodeOnL2;
  389. S32 ephemURA;
  390. S32 ephemSVhealth;
  391. S32 ephemIODC;
  392. S32 ephemL2Pflag;
  393. Cli_EphSubframe1Reserved_t ephemSF1Rsvd;
  394. S32 ephemTgd;
  395. S32 ephemToc;
  396. S32 ephemAF2;
  397. S32 ephemAF1;
  398. S32 ephemAF0;
  399. S32 ephemCrs;
  400. S32 ephemDeltaN;
  401. S32 ephemM0;
  402. S32 ephemCuc;
  403. S64 ephemE;
  404. S32 ephemCus;
  405. S64 ephemAPowerHalf;
  406. S32 ephemToe;
  407. S32 ephemFitFlag;
  408. S32 ephemAODA;
  409. S32 ephemCic;
  410. S32 ephemOmegaA0;
  411. S32 ephemCis;
  412. S32 ephemI0;
  413. S32 ephemCrc;
  414. /**
  415. * omega.
  416. */
  417. S32 ephemW;
  418. S32 ephemOmegaADot;
  419. S32 ephemIDot;
  420. } Cli_EphParameters_t;
  421. /**
  422. * GPS ephemeris item.
  423. *
  424. * @see Cli_GpsAssistData_t::gpsEph
  425. */
  426. typedef struct Cli_NavModelOfSatellite {
  427. U32 prn;
  428. U32 gpsWeek;
  429. /**
  430. * @note gpsSecond = TOE * 16 (scaled)
  431. */
  432. U32 gpsSecond;
  433. Cli_EphParameters_t ephParameter;
  434. } Cli_NavModelOfSatellite_t;
  435. /**
  436. * Ionospheric Model.
  437. *
  438. * @note for both GPS and BDS(COMPASS).
  439. *
  440. * @see Cli_GpsAssistData_t::gpsIono
  441. * @see Cli_BdsAssistData_t::bdsIono
  442. */
  443. typedef struct Cli_IonoModelOfGps {
  444. S32 alfa0;
  445. S32 alfa1;
  446. S32 alfa2;
  447. S32 alfa3;
  448. S32 beta0;
  449. S32 beta1;
  450. S32 beta2;
  451. S32 beta3;
  452. } Cli_IonoModelOfGps_t;
  453. /**
  454. * GPS UTC Model.
  455. *
  456. * @see Cli_GpsAssistData_t::gpsUtc
  457. */
  458. typedef struct Cli_UTCModelOfGps {
  459. S32 utcA1;
  460. S32 utcA0;
  461. S32 utcTot;
  462. S32 utcWNt;
  463. S32 utcDeltaTls;
  464. S32 utcWNlsf;
  465. S32 utcDN;
  466. S32 utcDeltaTlsf;
  467. } Cli_UTCModelOfGps_t;
  468. /**
  469. * GPS Almanac parameters.
  470. *
  471. * @see Cli_AlmanacOfGps_t::AlmParams
  472. */
  473. typedef struct Cli_AlmanacParams {
  474. /*long satelliteID;*/
  475. S32 almanacE;
  476. S32 alamanacToa;
  477. S32 almanacKsii;
  478. S32 almanacOmegaDot;
  479. S32 almanacSVhealth;
  480. S32 almanacAPowerHalf;
  481. S32 almanacOmega0;
  482. S32 almanacW;
  483. S32 almanacM0;
  484. S32 almanacAF0;
  485. S32 almanacAF1;
  486. } Cli_AlmanacParams_t;
  487. /**
  488. * GPS Almanac item.
  489. *
  490. * @see Cli_GpsAssistData_t::gpsAlm
  491. */
  492. typedef struct Cli_AlmanacOfGps {
  493. /*long satelliteID;*/
  494. S32 prn;
  495. S32 alamanacWNa;
  496. S32 alamanacToa;
  497. Cli_AlmanacParams_t AlmParams;
  498. } Cli_AlmanacOfGps_t;
  499. /**
  500. * GLONASS ephemeris parameters.
  501. *
  502. * @see Cli_GlnNavModel_t::navParams
  503. */
  504. typedef struct Cli_GlnNavModelParams {
  505. /* NavModel-GLONASSecef */
  506. U8 gloEn;
  507. U8 gloP1;
  508. U8 gloP2;
  509. U8 gloM;
  510. S32 gloX;
  511. S32 gloXdot;
  512. S32 gloXdotdot;
  513. S32 gloY;
  514. S32 gloYdot;
  515. S32 gloYdotdot;
  516. S32 gloZ;
  517. S32 gloZdot;
  518. S32 gloZdotdot;
  519. /* GLONASSclockModel */
  520. S32 gloTau;
  521. S32 gloGamma;
  522. /* OPTIONAL */
  523. S32 gloDeltaTau;
  524. } Cli_GlnNavModelParams_t;
  525. /**
  526. * GLONASS ephemeris.
  527. *
  528. * @see Cli_GlnAssistData_t::glnEph
  529. */
  530. typedef struct Cli_GlnNavModel {
  531. U8 svID;
  532. /**
  533. * Bn + Ft used to construct svHealth when filling ganss assist data, page 121
  534. *
  535. * @note 3 bit.
  536. */
  537. U8 Bn;
  538. /**
  539. * @note 4 bit
  540. */
  541. U8 Ft;
  542. /**
  543. * @note 11 bit, day in 4 year
  544. */
  545. U16 NT;
  546. /**
  547. * page 122, used to construct iod when filling asssit data.
  548. */
  549. U8 tb;
  550. Cli_GlnNavModelParams_t navParams;
  551. } Cli_GlnNavModel_t;
  552. /**
  553. * GLONASS Almanac.
  554. *
  555. * @see Cli_GlnAssistData_t::glnAlm
  556. */
  557. typedef struct Cli_GlnAlmanacModel {
  558. /**
  559. * \f$N_{4}\f$
  560. * not required by ASN, added for time label
  561. */
  562. S32 N4;
  563. /** \f$N^{A}\f$ */
  564. S32 gloAlmNA;
  565. /**
  566. * \f$n^{A}\f$
  567. * Sv_ID, range 1-24, set to 0 if invalid
  568. */
  569. S32 gloAlmnA;
  570. /** \f$H_{n}^{A}\f$ */
  571. S32 gloAlmHA;
  572. /** \f$\lambda_{n}^{A}\f$ */
  573. S32 gloAlmLambdaA;
  574. /** \f$t_{\lambda_{n}^{A}}\f$ */
  575. S32 gloAlmtlambdaA;
  576. /** \f$\Delta{i_{n}^{A}}\f$ */
  577. S32 gloAlmDeltaIa;
  578. /** \f$\Delta{T_{n}^{A}}\f$ */
  579. S32 gloAlmDeltaTA;
  580. /** \f$\Delta{\dot{T}_{n}^{A}}\f$ */
  581. S32 gloAlmDeltaTdotA;
  582. /** \f$\epsilon_{n}^{A}\f$ */
  583. S32 gloAlmEpsilonA;
  584. /** \f$\omega_{n}^{A}\f$ */
  585. S32 gloAlmOmegaA;
  586. /** \f$\tau_{n}^{A}\f$ */
  587. S32 gloAlmTauA;
  588. /** \f$C_{n}^{A}\f$ */
  589. S32 gloAlmCA;
  590. /** \f$M_{n}^{A}\f$ */
  591. S32 gloAlmMA /* OPTIONAL */;
  592. } Cli_GlnAlmanacModel_t;
  593. /**
  594. * GLONASS UTC Model.
  595. *
  596. * @see Cli_GlnAssistData_t::glnUtc
  597. */
  598. typedef struct Cli_GlnUTCmodel {
  599. /** \f$n^{A}\f$ */
  600. S32 nA;
  601. /** \f$\tau_{c}\f$ */
  602. S32 tauC;
  603. /** \f$B_{1}\f$ */
  604. S32 b1;
  605. /** \f$B_{2}\f$ */
  606. S32 b2;
  607. U8 kp;
  608. } Cli_GlnUTCmodel_t;
  609. /**
  610. * GLONASS Auxiliary info.
  611. *
  612. * @see Cli_GlnAssistData_t::glnAux
  613. */
  614. typedef struct Cli_GlnAuxInfo {
  615. /** \f$N_{4}\f$ */
  616. U8 gloN4;
  617. /**
  618. * @note valid range is [-7,13]
  619. * @note 127 stands for invalid.
  620. */
  621. S8 gloChannel[MaxGlnSateNum];
  622. /**
  623. * \f$\tau_{GPS}\f$
  624. * @note 22 bits
  625. */
  626. S32 gloTauGps;
  627. } Cli_GlnAuxInfo_t;
  628. /**
  629. * BDS(COMPASS) ephemeris parameters.
  630. *
  631. * @see Cli_BdsNavModel_t::navParams
  632. */
  633. typedef struct Cli_BdsNavModelParams {
  634. /* NavModel-BDSKeplerianSet-r12 */
  635. S32 bdsURAI_r12;
  636. /** \f$t_{oe}\f$ */
  637. S32 bdsToe_r12;
  638. /** \f$\sqrt A\f$ */
  639. S64 bdsAPowerHalf_r12;
  640. /** \f$e\f$ */
  641. S64 bdsE_r12;
  642. /** \f$\omega\f$ */
  643. S32 bdsW_r12;
  644. /** \f$\Delta{n}\f$ */
  645. S32 bdsDeltaN_r12;
  646. /** \f$M_0\f$ */
  647. S32 bdsM0_r12;
  648. /** \f$\Omega_{a_0}\f$ */
  649. S32 bdsOmega0_r12;
  650. /** \f$\dot{\Omega}\f$ */
  651. S32 bdsOmegaDot_r12;
  652. /** \f$i_0\f$ */
  653. S32 bdsI0_r12;
  654. /** \f$\dot{i}\f$ */
  655. S32 bdsIDot_r12;
  656. /** \f$C_{uc}\f$ */
  657. S32 bdsCuc_r12;
  658. /** \f$C_{us}\f$ */
  659. S32 bdsCus_r12;
  660. /** \f$C_{rc}\f$ */
  661. S32 bdsCrc_r12;
  662. /** \f$C_{rs}\f$ */
  663. S32 bdsCrs_r12;
  664. /** \f$C_{ic}\f$ */
  665. S32 bdsCic_r12;
  666. /** \f$C_{is}\f$ */
  667. S32 bdsCis_r12;
  668. /* BDSClockModel-r12 */
  669. /** \f$t_{oc}\f$ */
  670. S32 bdsToc_r12;
  671. /** \f$a_{0}\f$ */
  672. S32 bdsA0_r12;
  673. /** \f$a_{1}\f$ */
  674. S32 bdsA1_r12;
  675. /** \f$a_{2}\f$ */
  676. S32 bdsA2_r12;
  677. S32 bdsTgd1_r12:12;
  678. S32 bdsTgd2_r12:12;
  679. S32 reserved:8;
  680. } Cli_BdsNavModelParams_t;
  681. /**
  682. * BDS(COMPASS) ephemeris item.
  683. *
  684. * @see @ref Cli_BdsAssistData_t::bdsEph
  685. */
  686. typedef struct Cli_BdsNavModel {
  687. U8 svID;
  688. /**
  689. * B1I Health(SatH1), 1 bit, page 121
  690. */
  691. U8 svHealth;
  692. /**
  693. * IODC and IODE used to construct iod when fill ganss assist data, page 122
  694. *
  695. * @note 5 bit, AODC
  696. */
  697. U8 IODC;
  698. /**
  699. * @note 5 bit, AODE
  700. */
  701. U8 IODE;
  702. /**
  703. * week number
  704. */
  705. U32 Week;
  706. Cli_BdsNavModelParams_t navParams;
  707. } Cli_BdsNavModel_t;
  708. /**
  709. * BDS(COMPASS) almanac parameters.
  710. *
  711. * @note refer to ASN.1 Almanac-BDSAlmanacSet-r12.
  712. * @see @ref Cli_BdsAlmanacModel_t::almParams
  713. */
  714. typedef struct Cli_BdsAlmanacParams {
  715. /**
  716. * @note OPTIONAL
  717. */
  718. S32 bdsAlmToa_r12 ;
  719. S32 bdsAlmSqrtA_r12;
  720. S32 bdsAlmE_r12;
  721. S32 bdsAlmW_r12;
  722. S32 bdsAlmM0_r12;
  723. S32 bdsAlmOmega0_r12;
  724. S32 bdsAlmOmegaDot_r12;
  725. S32 bdsAlmDeltaI_r12;
  726. S32 bdsAlmA0_r12;
  727. S32 bdsAlmA1_r12;
  728. /**
  729. * @note OPTIONAL
  730. */
  731. U16 bdsSvHealth_r12;
  732. } Cli_BdsAlmanacParams_t;
  733. /**
  734. * BDS(COMPASS) almanac.
  735. *
  736. * @see @ref Cli_BdsAssistData_t::bdsAlm
  737. */
  738. typedef struct Cli_BdsAlmanacModel {
  739. U8 svID;
  740. U16 weekNm;
  741. U32 toa;
  742. Cli_BdsAlmanacParams_t almParams;
  743. } Cli_BdsAlmanacModel_t;
  744. /**
  745. * BDS(COMPASS) UTC model
  746. *
  747. * @note refer to ASN.1 Set5-r12.
  748. * @see @ref Cli_BdsAssistData_t::bdsUtc
  749. */
  750. typedef struct Cli_BdsUtcModel {
  751. S32 utcA0_r12;
  752. S32 utcA1_r12;
  753. S32 utcDeltaTls_r12;
  754. S32 utcWNlsf_r12;
  755. S32 utcDN_r12;
  756. S32 utcDeltaTlsf_r12;
  757. } Cli_BdsUtcModel_t;
  758. /**
  759. * GALILEO ephemeris clock.
  760. *
  761. * @see @ref Cli_GalNavModel_t::clockModel
  762. */
  763. typedef struct Cli_StandardClockModel {
  764. S32 stanClockToc;
  765. S32 stanClockAF2;
  766. S32 stanClockAF1;
  767. S32 stanClockAF0;
  768. S32 stanClockTgd;
  769. S32 sisa;
  770. S32 stanModelID;
  771. } Cli_StandardClockModel_t;
  772. /**
  773. * GALILEO ephemeris orbit.
  774. *
  775. * @see @ref Cli_GalNavModel_t::orbitModel
  776. */
  777. typedef struct Cli_GalOrbitModel {
  778. S32 keplerToe;
  779. S32 keplerW;
  780. S32 keplerDeltaN;
  781. S32 keplerM0;
  782. S32 keplerOmegaDot;
  783. S64 keplerE;
  784. S32 keplerIDot;
  785. S64 keplerAPowerHalf;
  786. S32 keplerI0;
  787. S32 keplerOmega0;
  788. S32 keplerCrs;
  789. S32 keplerCis;
  790. S32 keplerCus;
  791. S32 keplerCrc;
  792. S32 keplerCic;
  793. S32 keplerCuc;
  794. } Cli_GalOrbitModel_t;
  795. /**
  796. * GALILEO ephemeris item.
  797. *
  798. * @see @ref Cli_GalAssistData_t::galEph
  799. */
  800. typedef struct Cli_GalNavModel {
  801. U8 svID;
  802. /**
  803. * E5a Data Validity Status(E5aDVS), 1 bit
  804. */
  805. S8 E5aDVS;
  806. /**
  807. * E5a Signal Health Status(E5aSHS), 2 bit
  808. */
  809. S8 E5aSHS;
  810. /**
  811. * E5b Data Validity Status(E5bDVS), 1 bit
  812. */
  813. S8 E5bDVS;
  814. /**
  815. * E5b Signal Health Status(E5bSHS), 2 bit
  816. */
  817. S8 E5bSHS;
  818. /**
  819. * E1b Data Validity Status(E1bDVS), 1 bit
  820. */
  821. S8 E1BDVS;
  822. /**
  823. * E1b Signal Health Status(E5bSHS), 2 bit
  824. */
  825. S8 E1BSHS;
  826. /**
  827. * @note 10 bit, iod
  828. */
  829. U16 IODnav;
  830. /**
  831. * @note week number
  832. */
  833. S32 week;
  834. /**
  835. * @note clock model mask.
  836. * bit0 for F/NAV, bit1 for I/NAV
  837. */
  838. U8 clockModelMask;
  839. /**
  840. * @note standard clock model
  841. * clockModel[0] for F/NAV, clockModel[1] for I/NAV
  842. */
  843. Cli_StandardClockModel_t clockModel[2];
  844. /**
  845. * @note orbit model
  846. */
  847. Cli_GalOrbitModel_t orbitModel;
  848. } Cli_GalNavModel_t;
  849. /**
  850. * GALILEO Almanac model.
  851. */
  852. typedef struct Cli_GalAlmanacModel {
  853. U8 svID;
  854. /**
  855. * @note 2 bit
  856. */
  857. S16 WNa;
  858. /**
  859. * @note 10 bit
  860. */
  861. S16 toa;
  862. /**
  863. * @note 4 bit
  864. */
  865. S16 IODa;
  866. /* parameters */
  867. S32 kepAlmanacE;
  868. S32 kepAlmanacDeltaI;
  869. S32 kepAlmanacOmegaDot;
  870. /**
  871. * REQUIRED, 4bit, E5b,E1B.
  872. */
  873. U8 kepSV_StatusINAV;
  874. /**
  875. * OPTIONAL, 2bit, E5a.
  876. *
  877. * @note negative means invalid
  878. */
  879. S8 kepSV_StatusFNAV;
  880. S32 kepAlmanacAPowerHalf;
  881. S32 kepAlmanacOmega0;
  882. S32 kepAlmanacW;
  883. S32 kepAlmanacM0;
  884. S32 kepAlmanacAF0;
  885. S32 kepAlmanacAF1;
  886. } Cli_GalAlmanacModel_t;
  887. /**
  888. * GALILEO UTC model, the same as GPS UTC model.
  889. */
  890. typedef Cli_UTCModelOfGps_t Cli_GalUtcModel_t;
  891. /**
  892. * GALILEO Ionospheric model, Nequick model.
  893. */
  894. typedef struct Cli_GalIonoModel {
  895. S16 ai0;
  896. S16 ai1;
  897. S16 ai2;
  898. /**
  899. * OPTIONAL, 1 bit.
  900. * @note negative means invalid
  901. */
  902. S8 ionoStormFlag1;
  903. /**
  904. * OPTIONAL, 1 bit.
  905. * @note negative means invalid
  906. */
  907. S8 ionoStormFlag2;
  908. /**
  909. * OPTIONAL, 1 bit.
  910. * @note negative means invalid
  911. */
  912. S8 ionoStormFlag3;
  913. /**
  914. * OPTIONAL, 1 bit.
  915. * @note negative means invalid
  916. */
  917. S8 ionoStormFlag4;
  918. /**
  919. * OPTIONAL, 1 bit.
  920. * @note negative means invalid
  921. */
  922. S8 ionoStormFlag5;
  923. } Cli_GalIonoModel_t;
  924. /**
  925. * QZSS ephemeris item.
  926. *
  927. * @see @ref Cli_qzsAssistData_t::qzsEph
  928. */
  929. typedef struct Cli_NavModelOfQzs {
  930. U32 prn;
  931. U32 qzsWeek;
  932. /**
  933. * @note qzsSecond = TOE * 16 (scaled)
  934. */
  935. U32 qzsSecond;
  936. Cli_EphParameters_t ephParameter;
  937. } Cli_NavModelOfQzs_t;
  938. /**
  939. * GPS assistant data.
  940. *
  941. * @see @ref QX_agnssdata_client_t::gpsData
  942. */
  943. typedef struct Cli_GpsAssistData {
  944. /**
  945. * The number of GPS ephemeris items.
  946. * @note range is [0, @ref MaxGpsSateNum]
  947. * @see @ref Cli_GpsAssistData_t::gpsEph
  948. */
  949. S32 numEph;
  950. Cli_NavModelOfSatellite_t gpsEph[MaxGpsSateNum];
  951. Cli_IonoModelOfGps_t gpsIono;
  952. Cli_UTCModelOfGps_t gpsUtc;
  953. /**
  954. * The number of GPS almanac items.
  955. * @note range is [0, @ref MaxGpsSateNum]
  956. * @see @ref Cli_GpsAssistData_t::gpsAlm
  957. */
  958. S32 numAlm;
  959. Cli_AlmanacOfGps_t gpsAlm[MaxGpsSateNum];
  960. } Cli_GpsAssistData_t;
  961. /**
  962. * GLONASS assistant data.
  963. *
  964. * @see @ref QX_agnssdata_client_t::glnData
  965. */
  966. typedef struct Cli_GlnAssistData {
  967. /**
  968. * The number of GLONASS ephemeris items.
  969. * @note range is [0, @ref MaxGlnSateNum]
  970. * @see @ref Cli_GlnAssistData_t::glnEph
  971. */
  972. S32 numEph;
  973. Cli_GlnNavModel_t glnEph[MaxGlnSateNum];
  974. Cli_GlnUTCmodel_t glnUtc;
  975. /**
  976. * The number of GLONASS almanac items.
  977. * @note range is [0, @ref MaxGlnSateNum]
  978. * @see @ref Cli_GlnAssistData_t::glnAlm
  979. */
  980. S32 numAlm;
  981. Cli_GlnAlmanacModel_t glnAlm[MaxGlnSateNum];
  982. Cli_GlnAuxInfo_t glnAux;
  983. } Cli_GlnAssistData_t;
  984. /**
  985. * BDS(COMPASS) assistant data
  986. *
  987. * @see @ref QX_agnssdata_client_t::bdsData
  988. */
  989. typedef struct Cli_BdsAssistData {
  990. /**
  991. * The number of BDS(COMPASS) ephemeris items.
  992. * @note range is [0, @ref MaxBdsSateNum]
  993. * @see @ref Cli_BdsAssistData_t::bdsEph
  994. */
  995. S32 numEph;
  996. Cli_BdsNavModel_t bdsEph[MaxBdsSateNum];
  997. Cli_IonoModelOfGps_t bdsIono;
  998. Cli_BdsUtcModel_t bdsUtc;
  999. /**
  1000. * The number of BDS(COMPASS) almanac items.
  1001. * @note range is [0, @ref MaxBdsSateNum]
  1002. * @see @ref Cli_BdsAssistData_t::bdsAlm
  1003. */
  1004. S32 numAlm;
  1005. Cli_BdsAlmanacModel_t bdsAlm[MaxBdsSateNum];
  1006. } Cli_BdsAssistData_t;
  1007. typedef Cli_IonoModelOfGps_t Cli_IonoModelOfQzs_t;
  1008. typedef Cli_UTCModelOfGps_t Cli_UTCModelOfQzs_t;
  1009. typedef Cli_AlmanacOfGps_t Cli_AlmanacOfQzs_t;
  1010. /**
  1011. * GALILEO assistant data
  1012. *
  1013. * @see @ref QX_agnssdata_client_t::galData
  1014. */
  1015. typedef struct Cli_GalAssistData {
  1016. /**
  1017. * The number of GALILEO ephemeris items.
  1018. * @note range is [0, @ref MaxGalSateNum]
  1019. * @see @ref Cli_GalAssistData_t::galEph
  1020. */
  1021. S32 numEph;
  1022. Cli_GalNavModel_t galEph[MaxGalSateNum];
  1023. Cli_GalIonoModel_t galIono;
  1024. Cli_GalUtcModel_t galUtc;
  1025. /**
  1026. * The number of GALILEO almanac items.
  1027. * @note range is [0, @ref MaxGalSateNum]
  1028. * @see @ref Cli_GalAssistData_t::galAlm
  1029. */
  1030. S32 numAlm;
  1031. Cli_GalAlmanacModel_t galAlm[MaxGalSateNum];
  1032. } Cli_GalAssistData_t;
  1033. /**
  1034. * QZSS assistant data
  1035. *
  1036. * @see @ref QX_agnssdata_client_t::qzsData
  1037. */
  1038. typedef struct Cli_QzsAssistData {
  1039. /**
  1040. * The number of QZSS ephemeris items.
  1041. * @note range is [0, @ref MaxQzsSateNum]
  1042. * @see @ref Cli_QzsAssistData_t::qzsEph
  1043. */
  1044. S32 numEph;
  1045. Cli_NavModelOfQzs_t qzsEph[MaxQzsSateNum];
  1046. Cli_IonoModelOfQzs_t qzsIono;
  1047. Cli_UTCModelOfQzs_t qzsUtc;
  1048. /**
  1049. * The number of QZSS almanac items.
  1050. * @note range is [0, @ref MaxQzsSateNum]
  1051. * @see @ref Cli_QzsAssistData_t::qzsAlm
  1052. */
  1053. S32 numAlm;
  1054. Cli_AlmanacOfQzs_t qzsAlm[MaxQzsSateNum];
  1055. } Cli_QzsAssistData_t;
  1056. /**
  1057. * GPS-RefTime
  1058. */
  1059. typedef struct GpsReferTimeTag {
  1060. S32 gpsTOW23b;
  1061. S32 gpsWeek;
  1062. } GpsReferTime_t;
  1063. /**
  1064. * QXSUPL response data definition.
  1065. */
  1066. typedef struct QX_agnssdata_client {
  1067. /**
  1068. * server's status code.
  1069. *
  1070. * @note 0 means normal
  1071. * @note [-63, -1] means abnormal.
  1072. */
  1073. S8 statusCode;
  1074. /**
  1075. * GNSS satellite systems bitmask set.
  1076. *
  1077. * If GPS satellite system bitmask is on, then there is some data in the
  1078. * @ref QX_agnssdata_client_t::gpsData.
  1079. * If GLONASS satellite system bitmask is on, then there is some data in the
  1080. * @ref QX_agnssdata_client_t::glnData.
  1081. * If BDS satellite system bitmask is on, then there is some data in the
  1082. * @ref QX_agnssdata_client_t::bdsData.
  1083. *
  1084. * @note Test whether it contains GPS use following code (gnss & @ref QX_GNSS_GPS) == @ref QX_GNSS_GPS
  1085. * @note Test whether it contains GLONASS use following code (gnss & @ref QX_GNSS_GLO) == @ref QX_GNSS_GLO
  1086. * @note Test whether it contains BDS use following code (gnss & @ref QX_GNSS_BDS) == @ref QX_GNSS_BDS
  1087. *
  1088. * @see @ref GNSS
  1089. */
  1090. U32 gnss;
  1091. /**
  1092. * Assit data bitmask set.
  1093. *
  1094. * @note Test whether it contains GPS ephemeris use following code (assisttype | QX_REQ_GPS_EPH) == QX_REQ_GPS_EPH.
  1095. * @attention 0xFFFFFFFF means ack msg for report location
  1096. *
  1097. * @see @ref ASSISTANT
  1098. */
  1099. U32 assisttype;
  1100. GpsReferTime_t reftime;
  1101. /**
  1102. * Current leap seconds.
  1103. *
  1104. * @attention 0 means invalid.
  1105. */
  1106. S32 leapSeconds;
  1107. /**
  1108. * Location to be assisted.
  1109. */
  1110. LLA_t location;
  1111. /**
  1112. * GPS assistant data.
  1113. *
  1114. * @note it contains ephemerides, ionosphere model, utc model and almanac.
  1115. */
  1116. Cli_GpsAssistData_t gpsData;
  1117. /**
  1118. * GLONASS assistant data.
  1119. *
  1120. * @note it contains ephemerides, utc model, almanac and aux.
  1121. */
  1122. Cli_GlnAssistData_t glnData;
  1123. /**
  1124. * BDS(COMPASS) assistant data.
  1125. *
  1126. * @note it contains ephemerides, ionosphere model, utc model and almanac.
  1127. */
  1128. Cli_BdsAssistData_t bdsData;
  1129. /**
  1130. * GALILEO assistant data.
  1131. *
  1132. * @note it contains ephemerides, ionosphere model, utc model and almanac.
  1133. */
  1134. Cli_GalAssistData_t galData;
  1135. /**
  1136. * QZSS(COMPASS) assistant data.
  1137. *
  1138. * @note it contains ephemerides, ionosphere model, utc model.
  1139. */
  1140. Cli_QzsAssistData_t qzsData;
  1141. } QX_agnssdata_client_t;
  1142. #pragma pack()
  1143. /**
  1144. * @}
  1145. */
  1146. /**
  1147. * @addtogroup PUBLISHED
  1148. * @{
  1149. */
  1150. /**
  1151. * "QX_supl_sdk_" prefixed function return values.
  1152. */
  1153. typedef enum {
  1154. /**
  1155. * Indicate succeeded.
  1156. */
  1157. QX_RET_OK = 0,
  1158. /**
  1159. * Indicate a general error.
  1160. */
  1161. QX_RET_ERR = -1,
  1162. /**
  1163. * Parameters are invalid.
  1164. */
  1165. QX_PARM_ERR = 1000,
  1166. /**
  1167. * Failed to allocate memory from heap.
  1168. */
  1169. QX_RET_SDK_MALLOC_MEM_ERROR = 1001,
  1170. /**
  1171. *invalid APPKEY
  1172. */
  1173. QX_STATUS_ILLEGAL_APP_KEY = 1015,
  1174. /**
  1175. *invalid APP SECRET
  1176. */
  1177. QX_STATUS_ILLEGAL_APP_SECRET = 1016,
  1178. /**
  1179. *invalid Device type
  1180. */
  1181. QX_STATUS_ILLEGAL_DEVICE_TYPE = 1017,
  1182. /**
  1183. *invalid Device id
  1184. */
  1185. QX_STATUS_ILLEGAL_DEVICE_ID = 1018,
  1186. /**
  1187. *NULL APPKEY
  1188. */
  1189. QXWZ_STATUS_NULL_APP_KEY = 1023,
  1190. /**
  1191. *NULL SECRET
  1192. */
  1193. QXWZ_STATUS_NULL_APP_SECRET =1024,
  1194. /**
  1195. *NULL Device type
  1196. */
  1197. QXWZ_STATUS_NULL_DEVICE_TYPE = 1025,
  1198. /**
  1199. *NULL Device id
  1200. */
  1201. QXWZ_STATUS_NULL_DEVICE_ID = 1026,
  1202. /* qxwz http return value */
  1203. /**
  1204. * Invalid HTTP url.
  1205. */
  1206. QX_RET_HTTP_URL_INVALID = 1100,
  1207. /**
  1208. * Received an abnormal HTTP response.
  1209. */
  1210. QX_RET_HTTP_RESPONSE_NOT_200 = 1101,
  1211. /**
  1212. * HTTP Response Header is incomplete.
  1213. */
  1214. QX_RET_HTTP_HEADER_IMCOMPLETE = 1102,
  1215. /**
  1216. * HTTP Response Header does not contain a "Content-Length:" item.
  1217. */
  1218. QX_RET_HTTP_CONTENT_LENGTH_MISS = 1103,
  1219. /* qxwz socket error */
  1220. /**
  1221. * Encountered a general socket error.
  1222. */
  1223. QX_RET_SOCKET_ERROR = 1200,
  1224. /**
  1225. * Can't connect to QXSUPL service.
  1226. */
  1227. QX_RET_SOCKET_CONNECT_ERROR = 1201,
  1228. /**
  1229. * Failed to send request to QXSUPL service.
  1230. */
  1231. QX_RET_SOCKET_SEND_ERROR = 1202,
  1232. /**
  1233. * Failed to receive response from QXSUPL service.
  1234. *
  1235. * @note This is not the timeout case.
  1236. */
  1237. QX_RET_SOCKET_RECV_ERROR = 1203,
  1238. /**
  1239. * Can't perform a successful I/O select operation.
  1240. */
  1241. QX_RET_SOCKET_SELECT_ERROR = 1204,
  1242. /**
  1243. * Operation on socket timeout.
  1244. */
  1245. QX_RET_SOCKET_TIMEOUT = 1205,
  1246. /**
  1247. * Can't translate QXSUPL service domain name into IP address.
  1248. */
  1249. QX_RET_SOCKET_DNS_ERROR = 1206,
  1250. /* qxwz agnss eror */
  1251. /**
  1252. * Internal AGNSS handle creation failed.
  1253. */
  1254. QX_RET_AGNSS_CREATE_ERROR = 1300,
  1255. /**
  1256. * Can't do the operation on an invalid internal AGNSS handle.
  1257. */
  1258. QX_RET_AGNSS_HANDLE_NULL = 1301,
  1259. /**
  1260. * Failed to send request to QXSUPL service with the internal AGNSS
  1261. * handle.
  1262. */
  1263. QX_RET_AGNSS_REQUEST_ERROR = 1302,
  1264. /**
  1265. * Failed to receive response from QXSUPL service with the internal
  1266. * AGNSS handle.
  1267. */
  1268. QX_RET_AGNSS_RESPONSE_ERROR = 1303,
  1269. /* qxwz sdk init error */
  1270. /**
  1271. * QXSUPL SDK Initialization failed.
  1272. */
  1273. QX_RET_SDK_INIT_ERROR = 1400,
  1274. /**
  1275. * QXSUPL SDK has not been initialized yet.
  1276. */
  1277. QX_RET_SDK_NOT_INIT = 1401,
  1278. /**
  1279. * QXSUPL SDK can't accept an invocation while the internal resource is
  1280. * not available now.
  1281. *
  1282. * @note This usually means it can be tried later.
  1283. */
  1284. QX_RET_SDK_IS_BUSY = 1402,
  1285. /**
  1286. * QXSUPL SDK has been reinitialized.
  1287. */
  1288. QX_RET_SDK_ALREADY_INITED = 1403,
  1289. /*
  1290. * request time error
  1291. */
  1292. QX_RET_AGNSS_GET_TIME_FAIL =1500,
  1293. /* qxwz sdk auth status */
  1294. /**
  1295. *parameter missing
  1296. */
  1297. QX_STATUS_OPENAPI_PARAM_MISSING = 2001,
  1298. /**
  1299. *nonexistent account
  1300. */
  1301. QX_STATUS_OPENAPI_ACCOUNT_NOT_EXIST = 2002,
  1302. /**
  1303. *duplicate account
  1304. */
  1305. QX_STATUS_OPENAPI_DUPLICATE_ACCOUNT = 2003,
  1306. /**
  1307. *incorrect passward
  1308. */
  1309. QX_STATUS_OPENAPI_INCORRECT_PASSWORD = 2004,
  1310. /**
  1311. *unactivated account
  1312. */
  1313. QX_STATUS_OPENAPI_DISABLED_ACCOUNT = 2005,
  1314. /**
  1315. *no available account
  1316. */
  1317. QX_STATUS_OPENAPI_NO_AVAILABLE_ACCOUNT = 2006,
  1318. /**
  1319. *no related POPUser
  1320. */
  1321. QX_STATUS_OPENAPI_NO_RELATED_POPUSER = 2007,
  1322. /**
  1323. *system error
  1324. */
  1325. QX_STATUS_OPENAPI_SYSTEM_ERROR = 2008,
  1326. /**
  1327. *expired account
  1328. */
  1329. QX_STATUS_OPENAPI_ACCOUNT_EXPIRED = 2010,
  1330. /**
  1331. *account is about to expire
  1332. */
  1333. QX_STATUS_OPENAPI_ACCOUNT_TOEXPIRE = 2011,
  1334. /**
  1335. *bindmode mismatch
  1336. */
  1337. QX_STATUS_OPENAPI_BINDMODEMISMATCH_EXPIRE = 2012,
  1338. /**
  1339. *incorrect parameter
  1340. */
  1341. QX_STATUS_OPENAPI_PARAMETER_ERROR = 2013,
  1342. /**
  1343. *invalid TOKEN
  1344. */
  1345. QX_STATUS_OPENAPI_INVALID_TOKEN = 2014,
  1346. /**
  1347. *not enough account
  1348. */
  1349. QX_STATUS_OPENAPI_ACCOUNT_NOT_ENOUGH = 2015,
  1350. /**
  1351. *OPENAPI Unknown error
  1352. */
  1353. QX_STATUS_OPENAPI_UNKNOWN_ERROR = 2016,
  1354. /**
  1355. * Unknown error.
  1356. */
  1357. QX_RET_UNKNOWN = 3000,
  1358. } QX_RET_VALUE;
  1359. /**
  1360. * Report data to QXWZ.
  1361. */
  1362. typedef struct tagQX_report_data {
  1363. /**
  1364. * Suggest which kind of cell information will be used for locating.
  1365. *
  1366. * @see LocationIdType
  1367. */
  1368. LocationIdType locType;
  1369. /**
  1370. * location info
  1371. */
  1372. LLA_t lla;
  1373. /**
  1374. * The number of non-CDMA cell information items.
  1375. *
  1376. * @note range is [0, @ref AGNSS_MAX_NON_CDMA_CELL]
  1377. * @see QX_report_data_t::nonCDMACell
  1378. */
  1379. U8 nonCDMACellNum;
  1380. /**
  1381. * The non-CDMA cell information array.
  1382. */
  1383. QX_agnss_nonCDMACell_t nonCDMACell[AGNSS_MAX_NON_CDMA_CELL];
  1384. /**
  1385. * The number of CDMA cell information items.
  1386. *
  1387. * @note range is [0, @ref AGNSS_MAX_CDMA_CELL]
  1388. * @see QX_report_data_t::CDMACell
  1389. */
  1390. U8 CDMACellNum;
  1391. QX_agnss_CDMACell_t CDMACell[AGNSS_MAX_CDMA_CELL];
  1392. /**
  1393. * The number of WIFI information items.
  1394. *
  1395. * @note range is [0, @ref AGNSS_MAX_WIFI_AP]
  1396. * @see QX_report_data_t::wifi_AP
  1397. */
  1398. U8 wifiApNum;
  1399. QX_agnss_wifi_AP_t wifi_AP[AGNSS_MAX_WIFI_AP];
  1400. } QX_report_data_t;
  1401. /**
  1402. * Device id type enumeration.
  1403. */
  1404. typedef enum tagDeviceIdType {
  1405. /**
  1406. * IMEI
  1407. */
  1408. DID_IMEI = 1,
  1409. /**
  1410. * IMEI
  1411. */
  1412. DID_IMSI,
  1413. /**
  1414. * MSISDN
  1415. */
  1416. DID_MSISDN,
  1417. /**
  1418. * Wifi MAC address
  1419. */
  1420. DID_WIFIMAC,
  1421. /**
  1422. * IP Address
  1423. */
  1424. DID_IPADDRESS,
  1425. /**
  1426. * User defined type.
  1427. */
  1428. DID_UDT,
  1429. /**
  1430. * Reserved types.
  1431. */
  1432. DID_RESERVED
  1433. } DeviceIdType;
  1434. /**
  1435. * Initialization parameter for QX SUPL SDK.
  1436. */
  1437. typedef struct {
  1438. /**
  1439. * The app key string.
  1440. *
  1441. * @note At most 127 ASCII characters.
  1442. */
  1443. char appKey[32];
  1444. /**
  1445. * The secret key string.
  1446. *
  1447. * @note At most 511 ASCII characters.
  1448. */
  1449. char secret[128];
  1450. /**
  1451. * The device ID string.
  1452. *
  1453. * @note At most 127 ASCII characters.
  1454. */
  1455. char deviceId[64];
  1456. /**
  1457. * The device type string.
  1458. *
  1459. * @note At most 63 ASCII characters.
  1460. */
  1461. char deviceType[64];
  1462. /**
  1463. * The type of deviceId.
  1464. *
  1465. * @see DeviceIdType
  1466. */
  1467. unsigned char idType;
  1468. /**
  1469. * Turn on or off log.
  1470. *
  1471. * @note 1 indicate enable, 0 indicate disable.
  1472. */
  1473. unsigned char logEnable;
  1474. /**
  1475. * The timeout time while agnss requesting.
  1476. *
  1477. * @note in unit of milliseconds.
  1478. */
  1479. int timeout;
  1480. /**
  1481. * The network account ID which can access the network
  1482. */
  1483. int netId;
  1484. /**
  1485. * The network interface ID which can access the network
  1486. */
  1487. unsigned long long accountId;
  1488. } QX_user_config_t;
  1489. /**
  1490. * Initialize QXSUPL SDK environment.
  1491. *
  1492. * @code
  1493. * // example
  1494. *
  1495. * QX_user_config_t cfg = {0};
  1496. *
  1497. * // set all the fields of QX_user_config_t structure.
  1498. * ... ...
  1499. *
  1500. * if (!QX_SUPL_SDK_SUCCEEDED(QX_supl_sdk_initialize(&cfg)))
  1501. * goto failure_on_initialize;
  1502. * @endcode
  1503. *
  1504. * @param[in] cfg The parameters for QX SUPL SDK initialization. It MUST NOT be NULL.
  1505. *
  1506. * @return 0 standards for success
  1507. * @return non zero value standards for failure.
  1508. * @return check @ref QX_RET_VALUE for details.
  1509. *
  1510. * @note Remember to call @ref QX_supl_sdk_release to release resources.
  1511. * @see QX_supl_sdk_release.
  1512. * @see QX_SUPL_SDK_SUCCEEDED
  1513. */
  1514. int QX_supl_sdk_initialize(QX_user_config_t const *cfg);
  1515. /**
  1516. * Release all related resources obtained by QXSUPL SDK.
  1517. *
  1518. * @code
  1519. * // example
  1520. *
  1521. * if (!QX_SUPL_SDK_SUCCEEDED(QX_supl_sdk_release()))
  1522. * goto failure_on_release;
  1523. * @endcode
  1524. *
  1525. * @return 0 standards for success
  1526. * @return non zero value standards for failure.
  1527. * @return check @ref QX_RET_VALUE for details.
  1528. *
  1529. * @see QX_supl_sdk_initialize.
  1530. * @see QX_SUPL_SDK_SUCCEEDED
  1531. */
  1532. int QX_supl_sdk_release();
  1533. /**
  1534. * Retrieve QXSUPL assistant data.
  1535. *
  1536. * This routine contains two functionality.
  1537. * 1. Retrieve cell related location.
  1538. * 2. Send cell and location binding.
  1539. *
  1540. * The first one use "QX_REQ_" prefixed macros excluding @ref QX_REQ_REPORT_LOCATION, to specify which kind of data to be retrieved.
  1541. *
  1542. * @code
  1543. * // example for retrieve positioning assistant data.
  1544. *
  1545. * U32 mask = 0;
  1546. *
  1547. * // initialize QX SUPL SDK environment.
  1548. * if (!QX_SUPL_SDK_SUCCEEDED(QX_supl_sdk_initialize(&cfg)))
  1549. * goto failure_on_initialize;
  1550. *
  1551. * // set the kind of data to be retrieved.
  1552. * mask |= QX_REQ_REF_TIME | QX_REQ_REF_LOC;
  1553. * mask |= QX_REQ_GPS_EPH | QX_REQ_GPS_IONO | QX_REQ_GPS_UTC | QX_REQ_GPS_ALM;
  1554. * mask |= QX_REQ_BDS_EPH | QX_REQ_BDS_IONO | QX_REQ_BDS_UTC | QX_REQ_BDS_ALM;
  1555. *
  1556. * // retrieve required data from QX SUPL service.
  1557. * memset(&response, 0, sizeof(response));
  1558. * if (QX_SUPL_SDK_SUCCEEDED(QX_supl_sdk_get_agnss_data(mask, &request, &response))) {
  1559. * if (response.statusCode == 0) {
  1560. * // Use response data
  1561. * }
  1562. * } else {
  1563. * // DO NOT retry with same input for multiple times in a short time.
  1564. * }
  1565. *
  1566. * // Do next round QX_supl_sdk_get_agnss_data or other thing.
  1567. * ... ...
  1568. *
  1569. * // release QX SUPL SDK environment.
  1570. * if (!QX_SUPL_SDK_SUCCEEDED(QX_supl_sdk_release()))
  1571. * goto failure_on_release;
  1572. * @endcode
  1573. *
  1574. * The second one use @ref QX_REQ_REPORT_LOCATION macro to send the cell information of the accurate location.
  1575. *
  1576. * @code
  1577. * // example for sending cell information and their accurate location to QX SUPL service.
  1578. *
  1579. * U32 mask = 0;
  1580. * QX_agnss_extra_info_t request = {0};
  1581. *
  1582. * mask = QX_REQ_REPORT_LOCATION;
  1583. *
  1584. * // location of following cells.
  1585. * request.lla.valid = 1;
  1586. * request.lla.lat = LATITUDE;
  1587. * request.lla.lon = LONGITUDE;
  1588. * request.lla.height = HEIGHT;
  1589. * request.lla.unc = 25;
  1590. *
  1591. * // cells of the same locations
  1592. * ADD_NON_CDMA_CELL(&request, LOCTYPE1, CID1, MNC1, MCC1, LAC1);
  1593. * ADD_NON_CDMA_CELL(&request, LOCTYPE2, CID2, MNC2, MCC2, LAC2);
  1594. * ... ...
  1595. * ADD_NON_CDMA_CELL(&request, LOCTYPEn, CIDn, MNCn, MCCn, LACn);
  1596. *
  1597. * if (QX_SUPL_SDK_SUCCEEDED(QX_supl_sdk_initialize(&cfg)))
  1598. * goto failure_on_initialize;
  1599. * // This should be invoked right after the first successful locating.
  1600. * // Later locating result may be ignored for reducing network communication costs.
  1601. * if (QX_SUPL_SDK_SUCCEEDED(QX_supl_sdk_get_agnss_data(mask, &request, &response))) {
  1602. * if (response.statusCode != 0) {
  1603. * LOG_WARN("Failed to send the location of cell lists!");
  1604. * }
  1605. * }
  1606. * if (QX_SUPL_SDK_SUCCEEDED(QX_supl_sdk_release()))
  1607. * goto failure_on_release;
  1608. * @endcode
  1609. *
  1610. * @param[in] requestData A bitmask set of (@ref ASSISTANT) to specify the data to be retrieved.
  1611. * @param[in] report The data to be upload to QXSUPL service.
  1612. * @param[in,out] response The data from QXSUPL service for locating.
  1613. *
  1614. * @return 0 standards for success
  1615. * @return non zero value stands for failure.
  1616. * @return check @ref QX_RET_VALUE for details.
  1617. *
  1618. * @note Remember to call @ref QX_supl_sdk_initialize before this.
  1619. * @attention It's recommended to be used in an single threaded pattern, such as a job queue plus a worker.
  1620. * @see QX_supl_sdk_initialize
  1621. * @see QX_SUPL_SDK_SUCCEEDED
  1622. */
  1623. extern int QX_supl_sdk_get_agnss_data(U32 requestData, const QX_report_data_t *report, QX_agnssdata_client_t *response);
  1624. /**
  1625. * Retrieve current version string.
  1626. *
  1627. * @code
  1628. * // example
  1629. *
  1630. * char const *ver = NULL;
  1631. * ver = QX_supl_sdk_get_version();
  1632. * // play with this readonly c style string.
  1633. * ... ...
  1634. * // The pointer may be reset to NULL or not, depending on coding style.
  1635. * ver = NULL;
  1636. * @endcode
  1637. *
  1638. * @note This function may be invoked at any time, even before the @ref QX_supl_sdk_initialize.
  1639. *
  1640. * @return The readonly null-terminated version string.
  1641. */
  1642. const char * QX_supl_sdk_get_version();
  1643. /**
  1644. * @}
  1645. */
  1646. #ifdef __cplusplus
  1647. }
  1648. #endif
  1649. #endif /* QX_SUPL_SDK_H_INCLUDED */