gps_extended_c.h 96 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450
  1. /* Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
  2. *
  3. * Redistribution and use in source and binary forms, with or without
  4. * modification, are permitted provided that the following conditions are
  5. * met:
  6. * * Redistributions of source code must retain the above copyright
  7. * notice, this list of conditions and the following disclaimer.
  8. * * Redistributions in binary form must reproduce the above
  9. * copyright notice, this list of conditions and the following
  10. * disclaimer in the documentation and/or other materials provided
  11. * with the distribution.
  12. * * Neither the name of The Linux Foundation nor the names of its
  13. * contributors may be used to endorse or promote products derived
  14. * from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  17. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  20. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  23. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  24. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  25. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  26. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. /*
  29. Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  30. Redistribution and use in source and binary forms, with or without
  31. modification, are permitted (subject to the limitations in the
  32. disclaimer below) provided that the following conditions are met:
  33. * Redistributions of source code must retain the above copyright
  34. notice, this list of conditions and the following disclaimer.
  35. * Redistributions in binary form must reproduce the above
  36. copyright notice, this list of conditions and the following
  37. disclaimer in the documentation and/or other materials provided
  38. with the distribution.
  39. * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
  40. contributors may be used to endorse or promote products derived
  41. from this software without specific prior written permission.
  42. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  43. GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
  44. HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
  45. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  46. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  47. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  48. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  49. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  50. GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  51. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  52. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  53. OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  54. IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  55. */
  56. #ifndef GPS_EXTENDED_C_H
  57. #define GPS_EXTENDED_C_H
  58. #include <ctype.h>
  59. #include <stdbool.h>
  60. #include <stdlib.h>
  61. #include <string.h>
  62. #include <loc_gps.h>
  63. #include <LocationAPI.h>
  64. struct timespec32_t {
  65. uint32_t tv_sec; /* seconds */
  66. uint32_t tv_nsec; /* and nanoseconds */
  67. };
  68. /**
  69. * @file
  70. * @brief C++ declarations for GPS types
  71. */
  72. #ifdef __cplusplus
  73. extern "C" {
  74. #endif /* __cplusplus */
  75. #define GNSS_INVALID_JAMMER_IND 0x7FFFFFFF
  76. /** Position source is ULP */
  77. #define ULP_LOCATION_IS_FROM_HYBRID 0x0001
  78. /** Position source is GNSS only */
  79. #define ULP_LOCATION_IS_FROM_GNSS 0x0002
  80. /** Position is from a Geofence Breach Event */
  81. #define ULP_LOCATION_IS_FROM_GEOFENCE 0X0004
  82. /** Position is from Hardware FLP */
  83. #define ULP_LOCATION_IS_FROM_HW_FLP 0x0008
  84. /** Position is from NLP */
  85. #define ULP_LOCATION_IS_FROM_NLP 0x0010
  86. /** Position is from external DR solution*/
  87. #define ULP_LOCATION_IS_FROM_EXT_DR 0X0020
  88. /** Raw GNSS position fixes */
  89. #define ULP_LOCATION_IS_FROM_GNSS_RAW 0X0040
  90. typedef uint32_t LocSvInfoSource;
  91. /** SVinfo source is GNSS/DR */
  92. #define ULP_SVINFO_IS_FROM_GNSS ((LocSvInfoSource)0x0001)
  93. /** Raw SVinfo from GNSS */
  94. #define ULP_SVINFO_IS_FROM_DR ((LocSvInfoSource)0x0002)
  95. #define ULP_MIN_INTERVAL_INVALID 0xffffffff
  96. #define ULP_MAX_NMEA_STRING_SIZE 201
  97. /*Emergency SUPL*/
  98. #define LOC_GPS_NI_TYPE_EMERGENCY_SUPL 4
  99. #define LOC_AGPS_CERTIFICATE_MAX_LENGTH 2000
  100. #define LOC_AGPS_CERTIFICATE_MAX_SLOTS 10
  101. /* TBM Threshold for tracking in background power mode : in millis */
  102. #define TRACKING_TBM_THRESHOLD_MILLIS 480000
  103. /** Maximum number of satellites in an ephemeris report. */
  104. #define GNSS_EPHEMERIS_LIST_MAX_SIZE_V02 32
  105. typedef uint32_t LocPosTechMask;
  106. #define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000)
  107. #define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001)
  108. #define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002)
  109. #define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004)
  110. #define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008)
  111. #define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010)
  112. #define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020)
  113. #define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040)
  114. #define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080)
  115. #define LOC_POS_TECH_MASK_PPE ((LocPosTechMask)0x00000100)
  116. #define LOC_POS_TECH_MASK_VEH ((LocPosTechMask)0x00000200)
  117. #define LOC_POS_TECH_MASK_VIS ((LocPosTechMask)0x00000400)
  118. #define LOC_POS_TECH_MASK_INS ((LocPosTechMask)0x00000800)
  119. #define LOC_POS_TECH_MASK_PDR ((LocPosTechMask)0x00001000)
  120. #define LOC_POS_TECH_MASK_PROPAGATED ((LocPosTechMask)0x00002000)
  121. enum loc_registration_mask_status {
  122. LOC_REGISTRATION_MASK_ENABLED,
  123. LOC_REGISTRATION_MASK_DISABLED,
  124. LOC_REGISTRATION_MASK_SET
  125. };
  126. /* The entries in the following enum should mimic the entries in qmiLocSupportedFeatureEnumT_v02
  127. in location_service_v02.h */
  128. typedef enum {
  129. /**< Support ODCPI version 2 feature */
  130. LOC_SUPPORTED_FEATURE_ODCPI_2_V02 = 0,
  131. /**< Support Wifi AP data inject version 2 feature */
  132. LOC_SUPPORTED_FEATURE_WIFI_AP_DATA_INJECT_2_V02,
  133. /**< Support debug NMEA feature */
  134. LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02,
  135. /**< Support GNSS Only position reports */
  136. LOC_SUPPORTED_FEATURE_GNSS_ONLY_POSITION_REPORT,
  137. /**< Support FDCL */
  138. LOC_SUPPORTED_FEATURE_FDCL,
  139. /**< Support constellation enablement */
  140. LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02,
  141. /**< Support AGPM feature */
  142. LOC_SUPPORTED_FEATURE_AGPM_V02,
  143. /**< Support XTRA integrity */
  144. LOC_SUPPORTED_FEATURE_XTRA_INTEGRITY,
  145. /**< Support FDCL V2 */
  146. LOC_SUPPORTED_FEATURE_FDCL_2,
  147. /**< Support location privacy */
  148. LOC_SUPPORTED_FEATURE_LOCATION_PRIVACY,
  149. /**< Support NAVIC constellation */
  150. LOC_SUPPORTED_FEATURE_NAVIC,
  151. /**< Support measurements correction */
  152. LOC_SUPPORTED_FEATURE_MEASUREMENTS_CORRECTION,
  153. /**< Support Robust Location feature */
  154. LOC_SUPPORTED_FEATURE_ROBUST_LOCATION,
  155. /**< Support precise location dgnss */
  156. LOC_SUPPORTED_FEATURE_EDGNSS,
  157. /**< Support the multiband GNSS configuration feature */
  158. LOC_SUPPORTED_FEATURE_MULTIBAND_CONFIG,
  159. /**< Support the configuration for DSDA */
  160. LOC_SUPPORTED_FEATURE_DSDA_CONFIGURATION,
  161. /**< Support the Multiple Attribution Apps(UTH clients Lock control) feature */
  162. LOC_SUPPORTED_FEATURE_MULTIPLE_ATTRIBUTION_APPS,
  163. LOC_SUPPORTED_FEATURE_QMI_FLP_NLP_SOURCE, /**< Support the FLP, NLP Z-Source provider feature */
  164. } loc_supported_feature_enum;
  165. typedef struct {
  166. /** set to sizeof(UlpLocation) */
  167. uint32_t size;
  168. LocGpsLocation gpsLocation;
  169. /* Provider indicator for HYBRID or GPS */
  170. uint16_t position_source;
  171. LocPosTechMask tech_mask;
  172. bool unpropagatedPosition;
  173. } UlpLocation;
  174. typedef struct {
  175. /** set to sizeof(UlpNmea) */
  176. uint32_t size;
  177. char nmea_str[ULP_MAX_NMEA_STRING_SIZE];
  178. unsigned int len;
  179. } UlpNmea;
  180. /** AGPS type */
  181. typedef int8_t AGpsExtType;
  182. #define LOC_AGPS_TYPE_INVALID -1
  183. #define LOC_AGPS_TYPE_ANY 0
  184. #define LOC_AGPS_TYPE_SUPL 1
  185. #define LOC_AGPS_TYPE_C2K 2
  186. #define LOC_AGPS_TYPE_WWAN_ANY 3
  187. #define LOC_AGPS_TYPE_WIFI 4
  188. #define LOC_AGPS_TYPE_SUPL_ES 5
  189. /** SSID length */
  190. #define SSID_BUF_SIZE (32+1)
  191. typedef int16_t AGpsBearerType;
  192. #define AGPS_APN_BEARER_INVALID 0
  193. #define AGPS_APN_BEARER_IPV4 1
  194. #define AGPS_APN_BEARER_IPV6 2
  195. #define AGPS_APN_BEARER_IPV4V6 3
  196. typedef uint32_t LocApnTypeMask;
  197. /**< Denotes APN type for Default/Internet traffic */
  198. #define LOC_APN_TYPE_MASK_DEFAULT ((LocApnTypeMask)0x00000001)
  199. /**< Denotes APN type for IP Multimedia Subsystem */
  200. #define LOC_APN_TYPE_MASK_IMS ((LocApnTypeMask)0x00000002)
  201. /**< Denotes APN type for Multimedia Messaging Service */
  202. #define LOC_APN_TYPE_MASK_MMS ((LocApnTypeMask)0x00000004)
  203. /**< Denotes APN type for Dial Up Network */
  204. #define LOC_APN_TYPE_MASK_DUN ((LocApnTypeMask)0x00000008)
  205. /**< Denotes APN type for Secure User Plane Location */
  206. #define LOC_APN_TYPE_MASK_SUPL ((LocApnTypeMask)0x00000010)
  207. /**< Denotes APN type for High Priority Mobile Data */
  208. #define LOC_APN_TYPE_MASK_HIPRI ((LocApnTypeMask)0x00000020)
  209. /**< Denotes APN type for over the air administration */
  210. #define LOC_APN_TYPE_MASK_FOTA ((LocApnTypeMask)0x00000040)
  211. /**< Denotes APN type for Carrier Branded Services */
  212. #define LOC_APN_TYPE_MASK_CBS ((LocApnTypeMask)0x00000080)
  213. /**< Denotes APN type for Initial Attach */
  214. #define LOC_APN_TYPE_MASK_IA ((LocApnTypeMask)0x00000100)
  215. /**< Denotes APN type for emergency */
  216. #define LOC_APN_TYPE_MASK_EMERGENCY ((LocApnTypeMask)0x00000200)
  217. typedef uint32_t AGpsTypeMask;
  218. #define AGPS_ATL_TYPE_SUPL ((AGpsTypeMask)0x00000001)
  219. #define AGPS_ATL_TYPE_SUPL_ES ((AGpsTypeMask)0x00000002)
  220. #define AGPS_ATL_TYPE_WWAN ((AGpsTypeMask)0x00000004)
  221. typedef struct {
  222. void* statusV4Cb;
  223. AGpsTypeMask atlType;
  224. } AgpsCbInfo;
  225. typedef struct {
  226. void* visibilityControlCb;
  227. void* isInEmergencySession;
  228. } NfwCbInfo;
  229. /** GPS extended callback structure. */
  230. typedef struct {
  231. /** set to sizeof(LocGpsCallbacks) */
  232. uint32_t size;
  233. loc_gps_set_capabilities set_capabilities_cb;
  234. loc_gps_acquire_wakelock acquire_wakelock_cb;
  235. loc_gps_release_wakelock release_wakelock_cb;
  236. loc_gps_create_thread create_thread_cb;
  237. loc_gps_request_utc_time request_utc_time_cb;
  238. } GpsExtCallbacks;
  239. /** Callback to report the xtra server url to the client.
  240. * The client should use this url when downloading xtra unless overwritten
  241. * in the gps.conf file
  242. */
  243. typedef void (* report_xtra_server)(const char*, const char*, const char*);
  244. /** Callback structure for the XTRA interface. */
  245. typedef struct {
  246. loc_gps_xtra_download_request download_request_cb;
  247. loc_gps_create_thread create_thread_cb;
  248. report_xtra_server report_xtra_server_cb;
  249. } GpsXtraExtCallbacks;
  250. /** Represents the status of AGPS. */
  251. typedef struct {
  252. /** set to sizeof(AGpsExtStatus) */
  253. uint32_t size;
  254. AGpsExtType type;
  255. LocAGpsStatusValue status;
  256. uint32_t ipv4_addr;
  257. struct sockaddr_storage addr;
  258. char ssid[SSID_BUF_SIZE];
  259. char password[SSID_BUF_SIZE];
  260. } AGpsExtStatus;
  261. /** Callback with AGPS status information.
  262. * Can only be called from a thread created by create_thread_cb.
  263. */
  264. typedef void (* agps_status_extended)(AGpsExtStatus* status);
  265. /** Callback structure for the AGPS interface. */
  266. typedef struct {
  267. agps_status_extended status_cb;
  268. loc_gps_create_thread create_thread_cb;
  269. } AGpsExtCallbacks;
  270. typedef void (*loc_ni_notify_callback)(LocGpsNiNotification *notification, bool esEnalbed);
  271. /** GPS NI callback structure. */
  272. typedef struct
  273. {
  274. /**
  275. * Sends the notification request from HAL to GPSLocationProvider.
  276. */
  277. loc_ni_notify_callback notify_cb;
  278. } GpsNiExtCallbacks;
  279. typedef enum loc_server_type {
  280. LOC_AGPS_CDMA_PDE_SERVER,
  281. LOC_AGPS_CUSTOM_PDE_SERVER,
  282. LOC_AGPS_MPC_SERVER,
  283. LOC_AGPS_SUPL_SERVER,
  284. LOC_AGPS_MO_SUPL_SERVER
  285. } LocServerType;
  286. typedef enum loc_position_mode_type {
  287. LOC_POSITION_MODE_INVALID = -1,
  288. LOC_POSITION_MODE_STANDALONE = 0,
  289. LOC_POSITION_MODE_MS_BASED,
  290. LOC_POSITION_MODE_MS_ASSISTED,
  291. LOC_POSITION_MODE_RESERVED_1,
  292. LOC_POSITION_MODE_RESERVED_2,
  293. LOC_POSITION_MODE_RESERVED_3,
  294. LOC_POSITION_MODE_RESERVED_4,
  295. LOC_POSITION_MODE_RESERVED_5
  296. } LocPositionMode;
  297. /**
  298. * @brief Minimum allowed value for fix interval.
  299. *
  300. * This value is a sanity limit in GPS framework. The hardware has own internal
  301. * limits that may not match this value
  302. *
  303. * @sa GPS_DEFAULT_FIX_INTERVAL_MS
  304. */
  305. #define GPS_MIN_POSSIBLE_FIX_INTERVAL_MS 100
  306. /**
  307. * @brief Default value for fix interval.
  308. *
  309. * This value is used by default whenever appropriate.
  310. *
  311. * @sa GPS_MIN_POSSIBLE_FIX_INTERVAL_MS
  312. */
  313. #define GPS_DEFAULT_FIX_INTERVAL_MS 1000
  314. /** Flags to indicate which values are valid in a GpsLocationExtended. */
  315. typedef uint64_t GpsLocationExtendedFlags;
  316. /** GpsLocationExtended has valid pdop, hdop, vdop. */
  317. #define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001
  318. /** GpsLocationExtended has valid altitude mean sea level. */
  319. #define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL 0x0002
  320. /** UlpLocation has valid magnetic deviation. */
  321. #define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004
  322. /** UlpLocation has valid mode indicator. */
  323. #define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008
  324. /** GpsLocationExtended has valid vertical uncertainty */
  325. #define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010
  326. /** GpsLocationExtended has valid speed uncertainty */
  327. #define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020
  328. /** GpsLocationExtended has valid heading uncertainty */
  329. #define GPS_LOCATION_EXTENDED_HAS_BEARING_UNC 0x0040
  330. /** GpsLocationExtended has valid horizontal reliability */
  331. #define GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY 0x0080
  332. /** GpsLocationExtended has valid vertical reliability */
  333. #define GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY 0x0100
  334. /** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Major Axis) */
  335. #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MAJOR 0x0200
  336. /** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Minor Axis) */
  337. #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR 0x0400
  338. /** GpsLocationExtended has valid Elliptical Horizontal Uncertainty Azimuth */
  339. #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH 0x0800
  340. /** GpsLocationExtended has valid gnss sv used in position data */
  341. #define GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA 0x1000
  342. /** GpsLocationExtended has valid navSolutionMask */
  343. #define GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK 0x2000
  344. /** GpsLocationExtended has valid LocPosTechMask */
  345. #define GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK 0x4000
  346. /** GpsLocationExtended has valid LocSvInfoSource */
  347. #define GPS_LOCATION_EXTENDED_HAS_SV_SOURCE_INFO 0x8000
  348. /** GpsLocationExtended has valid position dynamics data */
  349. #define GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA 0x10000
  350. /** GpsLocationExtended has GPS Time */
  351. #define GPS_LOCATION_EXTENDED_HAS_GPS_TIME 0x20000
  352. /** GpsLocationExtended has Extended Dilution of Precision */
  353. #define GPS_LOCATION_EXTENDED_HAS_EXT_DOP 0x40000
  354. /** GpsLocationExtended has North standard deviation */
  355. #define GPS_LOCATION_EXTENDED_HAS_NORTH_STD_DEV 0x80000
  356. /** GpsLocationExtended has East standard deviation*/
  357. #define GPS_LOCATION_EXTENDED_HAS_EAST_STD_DEV 0x100000
  358. /** GpsLocationExtended has North Velocity */
  359. #define GPS_LOCATION_EXTENDED_HAS_NORTH_VEL 0x200000
  360. /** GpsLocationExtended has East Velocity */
  361. #define GPS_LOCATION_EXTENDED_HAS_EAST_VEL 0x400000
  362. /** GpsLocationExtended has up Velocity */
  363. #define GPS_LOCATION_EXTENDED_HAS_UP_VEL 0x800000
  364. /** GpsLocationExtended has North Velocity Uncertainty */
  365. #define GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC 0x1000000
  366. /** GpsLocationExtended has East Velocity Uncertainty */
  367. #define GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC 0x2000000
  368. /** GpsLocationExtended has up Velocity Uncertainty */
  369. #define GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC 0x4000000
  370. /** GpsLocationExtended has Clock Bias */
  371. #define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS 0x8000000
  372. /** GpsLocationExtended has Clock Bias std deviation*/
  373. #define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS_STD_DEV 0x10000000
  374. /** GpsLocationExtended has Clock drift*/
  375. #define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT 0x20000000
  376. /** GpsLocationExtended has Clock drift std deviation**/
  377. #define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT_STD_DEV 0x40000000
  378. /** GpsLocationExtended has leap seconds **/
  379. #define GPS_LOCATION_EXTENDED_HAS_LEAP_SECONDS 0x80000000
  380. /** GpsLocationExtended has time uncertainty **/
  381. #define GPS_LOCATION_EXTENDED_HAS_TIME_UNC 0x100000000
  382. /** GpsLocationExtended has heading rate **/
  383. #define GPS_LOCATION_EXTENDED_HAS_HEADING_RATE 0x200000000
  384. /** GpsLocationExtended has multiband signals **/
  385. #define GPS_LOCATION_EXTENDED_HAS_MULTIBAND 0x400000000
  386. /** GpsLocationExtended has sensor calibration confidence */
  387. #define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_CONFIDENCE 0x800000000
  388. /** GpsLocationExtended has sensor calibration status */
  389. #define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_STATUS 0x1000000000
  390. /** GpsLocationExtended has the engine type that produced this
  391. * position, the bit mask will only be set when there are two
  392. * or more position engines running in the system */
  393. #define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE 0x2000000000
  394. /** GpsLocationExtended has the engine mask that indicates the
  395. * set of engines contribute to the fix. */
  396. #define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK 0x4000000000
  397. /** GpsLocationExtended has dgnss correction source */
  398. #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x8000000000
  399. /** GpsLocationExtended has dgnss correction source ID */
  400. #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_ID 0x10000000000
  401. /** GpsLocationExtended has dgnss constellation usage */
  402. #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CONSTELLATION_USAGE 0x20000000000
  403. /** GpsLocationExtended has dgnss ref station Id */
  404. #define GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID 0x40000000000
  405. /** GpsLocationExtended has dgnss data age */
  406. #define GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE 0x80000000000
  407. /** GpsLocationExtended has the conformityIndex computed from
  408. * robust location feature. */
  409. #define GPS_LOCATION_EXTENDED_HAS_CONFORMITY_INDEX 0x100000000000
  410. /** GpsLocationExtended has the llaVRPased. */
  411. #define GPS_LOCATION_EXTENDED_HAS_LLA_VRP_BASED 0x200000000000
  412. /** GpsLocationExtended has the velocityVRPased. */
  413. #define GPS_LOCATION_EXTENDED_HAS_ENU_VELOCITY_LLA_VRP_BASED 0x400000000000
  414. /** GpsLocationExtended has drSolutionStatusMask. */
  415. #define GPS_LOCATION_EXTENDED_HAS_DR_SOLUTION_STATUS_MASK 0x800000000000
  416. /** GpsLocationExtended has altitudeAssumed. */
  417. #define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_ASSUMED 0x1000000000000
  418. #define GPS_LOCATION_EXTENDED_HAS_SYSTEM_TICK 0x2000000000000
  419. /** GpsLocationExtended has system tick unc. */
  420. #define GPS_LOCATION_EXTENDED_HAS_SYSTEM_TICK_UNC 0x4000000000000
  421. typedef uint32_t LocNavSolutionMask;
  422. /* Bitmask to specify whether SBAS ionospheric correction is used */
  423. #define LOC_NAV_MASK_SBAS_CORRECTION_IONO ((LocNavSolutionMask)0x0001)
  424. /* Bitmask to specify whether SBAS fast correction is used */
  425. #define LOC_NAV_MASK_SBAS_CORRECTION_FAST ((LocNavSolutionMask)0x0002)
  426. /**< Bitmask to specify whether SBAS long-tem correction is used */
  427. #define LOC_NAV_MASK_SBAS_CORRECTION_LONG ((LocNavSolutionMask)0x0004)
  428. /**< Bitmask to specify whether SBAS integrity information is used */
  429. #define LOC_NAV_MASK_SBAS_INTEGRITY ((LocNavSolutionMask)0x0008)
  430. /**< Bitmask to specify whether Position Report is DGNSS corrected */
  431. #define LOC_NAV_MASK_DGNSS_CORRECTION ((LocNavSolutionMask)0x0010)
  432. /**< Bitmask to specify whether Position Report is RTK corrected */
  433. #define LOC_NAV_MASK_RTK_CORRECTION ((LocNavSolutionMask)0x0020)
  434. /**< Bitmask to specify whether Position Report is PPP corrected */
  435. #define LOC_NAV_MASK_PPP_CORRECTION ((LocNavSolutionMask)0x0040)
  436. /**< Bitmask to specify whether Position Report is RTK fixed corrected */
  437. #define LOC_NAV_MASK_RTK_FIXED_CORRECTION ((LocNavSolutionMask)0x0080)
  438. /**< Bitmask specifying whether only SBAS corrected SVs are used for the fix */
  439. #define LOC_NAV_MASK_ONLY_SBAS_CORRECTED_SV_USED ((LocNavSolutionMask)0x0100)
  440. typedef uint32_t LocPosDataMask;
  441. /* Bitmask to specify whether Navigation data has Forward Acceleration */
  442. #define LOC_NAV_DATA_HAS_LONG_ACCEL ((LocPosDataMask)0x0001)
  443. /* Bitmask to specify whether Navigation data has Sideward Acceleration */
  444. #define LOC_NAV_DATA_HAS_LAT_ACCEL ((LocPosDataMask)0x0002)
  445. /* Bitmask to specify whether Navigation data has Vertical Acceleration */
  446. #define LOC_NAV_DATA_HAS_VERT_ACCEL ((LocPosDataMask)0x0004)
  447. /* Bitmask to specify whether Navigation data has Heading Rate */
  448. #define LOC_NAV_DATA_HAS_YAW_RATE ((LocPosDataMask)0x0008)
  449. /* Bitmask to specify whether Navigation data has Body pitch */
  450. #define LOC_NAV_DATA_HAS_PITCH ((LocPosDataMask)0x0010)
  451. /* Bitmask to specify whether Navigation data has Forward Acceleration Unc */
  452. #define LOC_NAV_DATA_HAS_LONG_ACCEL_UNC ((LocPosDataMask)0x0020)
  453. /* Bitmask to specify whether Navigation data has Sideward Acceleration Unc*/
  454. #define LOC_NAV_DATA_HAS_LAT_ACCEL_UNC ((LocPosDataMask)0x0040)
  455. /* Bitmask to specify whether Navigation data has Vertical Acceleration Unc*/
  456. #define LOC_NAV_DATA_HAS_VERT_ACCEL_UNC ((LocPosDataMask)0x0080)
  457. /* Bitmask to specify whether Navigation data has Heading Rate Unc*/
  458. #define LOC_NAV_DATA_HAS_YAW_RATE_UNC ((LocPosDataMask)0x0100)
  459. /* Bitmask to specify whether Navigation data has Body pitch Unc*/
  460. #define LOC_NAV_DATA_HAS_PITCH_UNC ((LocPosDataMask)0x0200)
  461. typedef uint32_t GnssAdditionalSystemInfoMask;
  462. /* Bitmask to specify whether Tauc is valid */
  463. #define GNSS_ADDITIONAL_SYSTEMINFO_HAS_TAUC ((GnssAdditionalSystemInfoMask)0x0001)
  464. /* Bitmask to specify whether leapSec is valid */
  465. #define GNSS_ADDITIONAL_SYSTEMINFO_HAS_LEAP_SEC ((GnssAdditionalSystemInfoMask)0x0002)
  466. /** GPS PRN Range */
  467. #define GPS_SV_PRN_MIN 1
  468. #define GPS_SV_PRN_MAX 32
  469. #define GLO_SV_PRN_MIN 65
  470. #define GLO_SV_PRN_MAX 96
  471. #define SBAS_SV_PRN_MIN 120
  472. #define SBAS_SV_PRN_MAX 191
  473. #define QZSS_SV_PRN_MIN 193
  474. #define QZSS_SV_PRN_MAX 197
  475. #define BDS_SV_PRN_MIN 201
  476. #define BDS_SV_PRN_MAX 263
  477. #define GAL_SV_PRN_MIN 301
  478. #define GAL_SV_PRN_MAX 336
  479. #define NAVIC_SV_PRN_MIN 401
  480. #define NAVIC_SV_PRN_MAX 414
  481. #define GLO_SV_PRN_SLOT_UNKNOWN 255
  482. /* Checking svIdOneBase can be set to the corresponding bit in mask */
  483. #define svFitsMask(mask, svIdOneBase) \
  484. ((svIdOneBase) >= 1 && (svIdOneBase) <= (sizeof(mask) << 3))
  485. /* Setting svIdOneBase specific bit in the mask if the bit offset fits */
  486. #define setSvMask(mask, svIdOneBase) \
  487. if (svFitsMask(mask, svIdOneBase)) mask |= (1ULL << ((svIdOneBase) - 1))
  488. #define isValInRangeInclusive(val, min, max) ((val) >= (min) && (val) <= (max))
  489. #define isGloSlotUnknown(val) ((val) == GLO_SV_PRN_SLOT_UNKNOWN)
  490. typedef enum {
  491. LOC_RELIABILITY_NOT_SET = 0,
  492. LOC_RELIABILITY_VERY_LOW = 1,
  493. LOC_RELIABILITY_LOW = 2,
  494. LOC_RELIABILITY_MEDIUM = 3,
  495. LOC_RELIABILITY_HIGH = 4
  496. }LocReliability;
  497. typedef enum {
  498. LOC_IN_EMERGENCY_UNKNOWN = 0,
  499. LOC_IN_EMERGENCY_SET = 1,
  500. LOC_IN_EMERGENCY_NOT_SET = 2
  501. }LocInEmergency;
  502. typedef struct {
  503. struct timespec32_t apTimeStamp;
  504. /*boottime received from pps-ktimer*/
  505. float apTimeStampUncertaintyMs;
  506. /* timestamp uncertainty in milli seconds */
  507. }Gnss_ApTimeStampStructType;
  508. typedef struct {
  509. uint64_t gps_sv_used_ids_mask;
  510. uint64_t glo_sv_used_ids_mask;
  511. uint64_t gal_sv_used_ids_mask;
  512. uint64_t bds_sv_used_ids_mask;
  513. uint64_t qzss_sv_used_ids_mask;
  514. uint64_t navic_sv_used_ids_mask;
  515. } GnssSvUsedInPosition;
  516. typedef struct {
  517. uint64_t gps_l1ca_sv_used_ids_mask; // GPS L1CA
  518. uint64_t gps_l1c_sv_used_ids_mask; // GPS L1C
  519. uint64_t gps_l2_sv_used_ids_mask; // GPS L2
  520. uint64_t gps_l5_sv_used_ids_mask; // GPS L5
  521. uint64_t glo_g1_sv_used_ids_mask; // GLO G1
  522. uint64_t glo_g2_sv_used_ids_mask; // GLO G2
  523. uint64_t gal_e1_sv_used_ids_mask; // GAL E1
  524. uint64_t gal_e5a_sv_used_ids_mask; // GAL E5A
  525. uint64_t gal_e5b_sv_used_ids_mask; // GAL E5B
  526. uint64_t bds_b1i_sv_used_ids_mask; // BDS B1I
  527. uint64_t bds_b1c_sv_used_ids_mask; // BDS B1C
  528. uint64_t bds_b2i_sv_used_ids_mask; // BDS B2I
  529. uint64_t bds_b2ai_sv_used_ids_mask; // BDS B2AI
  530. uint64_t qzss_l1ca_sv_used_ids_mask; // QZSS L1CA
  531. uint64_t qzss_l1s_sv_used_ids_mask; // QZSS L1S
  532. uint64_t qzss_l2_sv_used_ids_mask; // QZSS L2
  533. uint64_t qzss_l5_sv_used_ids_mask; // QZSS L5
  534. uint64_t sbas_l1_sv_used_ids_mask; // SBAS L1
  535. uint64_t bds_b2aq_sv_used_ids_mask; // BDS B2AQ
  536. } GnssSvMbUsedInPosition;
  537. /* Body Frame parameters */
  538. typedef struct {
  539. /** Contains Body frame LocPosDataMask bits. */
  540. uint32_t bodyFrameDatamask;
  541. /* Forward Acceleration in body frame (m/s2)*/
  542. float longAccel;
  543. /** Uncertainty of Forward Acceleration in body frame */
  544. float longAccelUnc;
  545. /* Sideward Acceleration in body frame (m/s2)*/
  546. float latAccel;
  547. /** Uncertainty of Side-ward Acceleration in body frame */
  548. float latAccelUnc;
  549. /* Vertical Acceleration in body frame (m/s2)*/
  550. float vertAccel;
  551. /** Uncertainty of Vertical Acceleration in body frame */
  552. float vertAccelUnc;
  553. /* Heading Rate (Radians/second) */
  554. float yawRate;
  555. /** Uncertainty of Heading Rate */
  556. float yawRateUnc;
  557. /* Body pitch (Radians) */
  558. float pitch;
  559. /** Uncertainty of Body pitch */
  560. float pitchRadUnc;
  561. }LocPositionDynamics;
  562. typedef struct {
  563. /** Position dilution of precision.
  564. Range: 1 (highest accuracy) to 50 (lowest accuracy) */
  565. float PDOP;
  566. /** Horizontal dilution of precision.
  567. Range: 1 (highest accuracy) to 50 (lowest accuracy) */
  568. float HDOP;
  569. /** Vertical dilution of precision.
  570. Range: 1 (highest accuracy) to 50 (lowest accuracy) */
  571. float VDOP;
  572. /** geometric dilution of precision.
  573. Range: 1 (highest accuracy) to 50 (lowest accuracy) */
  574. float GDOP;
  575. /** time dilution of precision.
  576. Range: 1 (highest accuracy) to 50 (lowest accuracy) */
  577. float TDOP;
  578. }LocExtDOP;
  579. /* GPS Time structure */
  580. typedef struct {
  581. /**< Current GPS week as calculated from midnight, Jan. 6, 1980. \n
  582. - Units: Weeks */
  583. uint16_t gpsWeek;
  584. /**< Amount of time into the current GPS week. \n
  585. - Units: Milliseconds */
  586. uint32_t gpsTimeOfWeekMs;
  587. }GPSTimeStruct;
  588. typedef uint8_t CarrierPhaseAmbiguityType;
  589. #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_NONE ((CarrierPhaseAmbiguityType)0)
  590. #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FLOAT ((CarrierPhaseAmbiguityType)1)
  591. #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FIXED ((CarrierPhaseAmbiguityType)2)
  592. typedef enum {
  593. LOC_DGNSS_CORR_SOURCE_TYPE_INVALID = 0, /**< Invalid DGNSS correction source type \n */
  594. LOC_DGNSS_CORR_SOURCE_TYPE_RTCM = 1, /**< DGNSS correction source type RTCM \n */
  595. LOC_DGNSS_CORR_SOURCE_TYPE_3GPP = 2, /**< DGNSS correction source type 3GPP \n */
  596. }LocDgnssCorrectionSourceType;
  597. typedef uint16_t GnssMeasUsageStatusBitMask;
  598. /** Used in fix */
  599. #define GNSS_MEAS_USED_IN_PVT ((GnssMeasUsageStatusBitMask)0x00000001ul)
  600. /** Measurement is Bad */
  601. #define GNSS_MEAS_USAGE_STATUS_BAD_MEAS ((GnssMeasUsageStatusBitMask)0x00000002ul)
  602. /** Measurement has too low C/N */
  603. #define GNSS_MEAS_USAGE_STATUS_CNO_TOO_LOW ((GnssMeasUsageStatusBitMask)0x00000004ul)
  604. /** Measurement has too low elevation */
  605. #define GNSS_MEAS_USAGE_STATUS_ELEVATION_TOO_LOW ((GnssMeasUsageStatusBitMask)0x00000008ul)
  606. /** No ephemeris available for this measurement */
  607. #define GNSS_MEAS_USAGE_STATUS_NO_EPHEMERIS ((GnssMeasUsageStatusBitMask)0x00000010ul)
  608. /** No corrections available for the measurement */
  609. #define GNSS_MEAS_USAGE_STATUS_NO_CORRECTIONS ((GnssMeasUsageStatusBitMask)0x00000020ul)
  610. /** Corrections has timed out for the measurement */
  611. #define GNSS_MEAS_USAGE_STATUS_CORRECTION_TIMEOUT ((GnssMeasUsageStatusBitMask)0x00000040ul)
  612. /** Measurement is unhealthy */
  613. #define GNSS_MEAS_USAGE_STATUS_UNHEALTHY ((GnssMeasUsageStatusBitMask)0x00000080ul)
  614. /** Configuration is disabled for this measurement */
  615. #define GNSS_MEAS_USAGE_STATUS_CONFIG_DISABLED ((GnssMeasUsageStatusBitMask)0x00000100ul)
  616. /** Measurement not used for other reasons */
  617. #define GNSS_MEAS_USAGE_STATUS_OTHER ((GnssMeasUsageStatusBitMask)0x00000200ul)
  618. /** Flags to indicate valid fields in epMeasUsageInfo */
  619. typedef uint16_t GnssMeasUsageInfoValidityMask;
  620. #define GNSS_PSEUDO_RANGE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000001ul)
  621. #define GNSS_DOPPLER_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000002ul)
  622. #define GNSS_CARRIER_PHASE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000004ul)
  623. #define GNSS_CARRIER_PHASE_AMBIGUITY_TYPE_VALID ((GnssMeasUsageInfoValidityMask)0x00000008ul)
  624. typedef uint16_t GnssSvPolyStatusMask;
  625. #define GNSS_SV_POLY_SRC_ALM_CORR_V02 ((GnssSvPolyStatusMask)0x01)
  626. #define GNSS_SV_POLY_GLO_STR4_V02 ((GnssSvPolyStatusMask)0x02)
  627. #define GNSS_SV_POLY_DELETE_V02 ((GnssSvPolyStatusMask)0x04)
  628. #define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02 ((GnssSvPolyStatusMask)0x08)
  629. typedef uint16_t GnssSvPolyStatusMaskValidity;
  630. #define GNSS_SV_POLY_SRC_ALM_CORR_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x01)
  631. #define GNSS_SV_POLY_GLO_STR4_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x02)
  632. #define GNSS_SV_POLY_DELETE_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x04)
  633. #define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x08)
  634. typedef struct {
  635. /** Specifies GNSS signal type
  636. Mandatory Field*/
  637. GnssSignalTypeMask gnssSignalType;
  638. /** Specifies GNSS Constellation Type
  639. Mandatory Field*/
  640. Gnss_LocSvSystemEnumType gnssConstellation;
  641. /** Unique SV Identifier.
  642. * SV Range for supported constellation is specified as below:
  643. * - For GPS: 1 to 32
  644. * - For GLONASS: 65 to 96
  645. * - For SBAS: 120 to 158 and 183 to 191
  646. * - For QZSS: 193 to 197
  647. * - For BDS: 201 to 263
  648. * - For GAL: 301 to 336
  649. * - For NAVIC: 401 to 414 */
  650. uint16_t gnssSvId;
  651. /** GLONASS frequency number + 7.
  652. Valid only for a GLONASS system and
  653. is to be ignored for all other systems.
  654. Range: 1 to 14 */
  655. uint8_t gloFrequency;
  656. /** Carrier phase ambiguity type. */
  657. CarrierPhaseAmbiguityType carrierPhaseAmbiguityType;
  658. /** Validity mask */
  659. GnssMeasUsageStatusBitMask measUsageStatusMask;
  660. /** Specifies measurement usage status
  661. Mandatory Field*/
  662. GnssMeasUsageInfoValidityMask validityMask;
  663. /** Computed pseudorange residual.
  664. Unit: Meters */
  665. float pseudorangeResidual;
  666. /** Computed doppler residual.
  667. Unit: Meters/sec*/
  668. float dopplerResidual;
  669. /** Computed carrier phase residual.
  670. Unit: Cycles*/
  671. float carrierPhaseResidual;
  672. /** Carrier phase ambiguity value.
  673. Unit: Cycles*/
  674. float carrierPhasAmbiguity;
  675. } GpsMeasUsageInfo;
  676. /** Represents gps location extended. */
  677. typedef struct {
  678. /** set to sizeof(GpsLocationExtended) */
  679. uint32_t size;
  680. /** Contains GpsLocationExtendedFlags bits. */
  681. uint64_t flags;
  682. /** Contains the Altitude wrt mean sea level */
  683. float altitudeMeanSeaLevel;
  684. /** Contains Position Dilusion of Precision. */
  685. float pdop;
  686. /** Contains Horizontal Dilusion of Precision. */
  687. float hdop;
  688. /** Contains Vertical Dilusion of Precision. */
  689. float vdop;
  690. /** Contains Magnetic Deviation. */
  691. float magneticDeviation;
  692. /** vertical uncertainty in meters
  693. * confidence level is at 68% */
  694. float vert_unc;
  695. /** horizontal speed uncertainty in m/s
  696. * confidence level is at 68% */
  697. float speed_unc;
  698. /** heading uncertainty in degrees (0 to 359.999)
  699. * confidence level is at 68% */
  700. float bearing_unc;
  701. /** horizontal reliability. */
  702. LocReliability horizontal_reliability;
  703. /** vertical reliability. */
  704. LocReliability vertical_reliability;
  705. /** Horizontal Elliptical Uncertainty (Semi-Major Axis)
  706. * Confidence level is at 39% */
  707. float horUncEllipseSemiMajor;
  708. /** Horizontal Elliptical Uncertainty (Semi-Minor Axis)
  709. * Confidence level is at 39% */
  710. float horUncEllipseSemiMinor;
  711. /** Elliptical Horizontal Uncertainty Azimuth */
  712. float horUncEllipseOrientAzimuth;
  713. Gnss_ApTimeStampStructType timeStamp;
  714. /** Gnss sv used in position data */
  715. GnssSvUsedInPosition gnss_sv_used_ids;
  716. /** Gnss sv used in position data for multiband */
  717. GnssSvMbUsedInPosition gnss_mb_sv_used_ids;
  718. /** Nav solution mask to indicate sbas corrections */
  719. LocNavSolutionMask navSolutionMask;
  720. /** Position technology used in computing this fix */
  721. LocPosTechMask tech_mask;
  722. /** SV Info source used in computing this fix */
  723. LocSvInfoSource sv_source;
  724. /** Body Frame Dynamics: 4wayAcceleration and pitch set with validity */
  725. GnssLocationPositionDynamics bodyFrameData;
  726. /** GPS Time */
  727. GPSTimeStruct gpsTime;
  728. GnssSystemTime gnssSystemTime;
  729. /** Dilution of precision associated with this position*/
  730. LocExtDOP extDOP;
  731. /** North standard deviation.
  732. Unit: Meters */
  733. float northStdDeviation;
  734. /** East standard deviation.
  735. Unit: Meters */
  736. float eastStdDeviation;
  737. /** North Velocity.
  738. Unit: Meters/sec */
  739. float northVelocity;
  740. /** East Velocity.
  741. Unit: Meters/sec */
  742. float eastVelocity;
  743. /** Up Velocity.
  744. Unit: Meters/sec */
  745. float upVelocity;
  746. /** North Velocity standard deviation.
  747. * Unit: Meters/sec.
  748. * Confidence level is at 68% */
  749. float northVelocityStdDeviation;
  750. /** East Velocity standard deviation.
  751. * Unit: Meters/sec
  752. * Confidence level is at 68% */
  753. float eastVelocityStdDeviation;
  754. /** Up Velocity standard deviation
  755. * Unit: Meters/sec
  756. * Confidence level is at 68% */
  757. float upVelocityStdDeviation;
  758. /** Estimated clock bias. Unit: Nano seconds */
  759. float clockbiasMeter;
  760. /** Estimated clock bias std deviation. Unit: Nano seconds */
  761. float clockBiasStdDeviationMeter;
  762. /** Estimated clock drift. Unit: Meters/sec */
  763. float clockDrift;
  764. /** Estimated clock drift std deviation. Unit: Meters/sec */
  765. float clockDriftStdDeviation;
  766. /** Number of valid reference stations. Range:[0-4] */
  767. uint8_t numValidRefStations;
  768. /** Reference station(s) number */
  769. uint16_t referenceStation[4];
  770. /** Number of measurements received for use in fix.
  771. Shall be used as maximum index in-to svUsageInfo[].
  772. Set to 0, if svUsageInfo reporting is not supported.
  773. Range: 0-EP_GNSS_MAX_MEAS */
  774. uint8_t numOfMeasReceived;
  775. /** Measurement Usage Information */
  776. GpsMeasUsageInfo measUsageInfo[GNSS_SV_MAX];
  777. /** Leap Seconds */
  778. uint8_t leapSeconds;
  779. /** Time uncertainty in milliseconds,
  780. * SPE engine: confidence level is 99%
  781. * all other engines: confidence level is not specified */
  782. float timeUncMs;
  783. /** Heading Rate is in NED frame.
  784. Range: 0 to 359.999. 946
  785. Unit: Degrees per Seconds */
  786. float headingRateDeg;
  787. /** Sensor calibration confidence percent. Range: 0 - 100 */
  788. uint8_t calibrationConfidence;
  789. DrCalibrationStatusMask calibrationStatus;
  790. /** location engine type. When the fix. when the type is set to
  791. LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
  792. reports from all engines running on the system (e.g.:
  793. DR/SPE/PPE). To check which location engine contributes to
  794. the fused output, check for locOutputEngMask. */
  795. LocOutputEngineType locOutputEngType;
  796. /** when loc output eng type is set to fused, this field
  797. indicates the set of engines contribute to the fix. */
  798. PositioningEngineMask locOutputEngMask;
  799. /** DGNSS Correction Source for position report: RTCM, 3GPP
  800. * etc. */
  801. LocDgnssCorrectionSourceType dgnssCorrectionSourceType;
  802. /** If DGNSS is used, the SourceID is a 32bit number identifying
  803. * the DGNSS source ID */
  804. uint32_t dgnssCorrectionSourceID;
  805. /** If DGNSS is used, which constellation was DGNSS used for to
  806. * produce the pos report. */
  807. GnssConstellationTypeMask dgnssConstellationUsage;
  808. /** If DGNSS is used, DGNSS Reference station ID used for
  809. * position report */
  810. uint16_t dgnssRefStationId;
  811. /** If DGNSS is used, DGNSS data age in milli-seconds */
  812. uint32_t dgnssDataAgeMsec;
  813. /** When robust location is enabled, this field
  814. * will how well the various input data considered for
  815. * navigation solution conform to expectations.
  816. * Range: 0 (least conforming) to 1 (most conforming) */
  817. float conformityIndex;
  818. GnssLocationPositionDynamicsExt bodyFrameDataExt;
  819. /** VRR-based latitude/longitude/altitude */
  820. LLAInfo llaVRPBased;
  821. /** VRR-based east, north, and up velocity */
  822. float enuVelocityVRPBased[3];
  823. DrSolutionStatusMask drSolutionStatusMask;
  824. /** When this field is valid, it will indicates whether altitude
  825. * is assumed or calculated.
  826. * false: Altitude is calculated.
  827. * true: Altitude is assumed; there may not be enough
  828. * satellites to determine the precise altitude. */
  829. bool altitudeAssumed;
  830. /** System Tick at GPS Time */
  831. uint64_t systemTick;
  832. /** Uncertainty for System Tick at GPS Time in milliseconds */
  833. float systemTickUnc;
  834. } GpsLocationExtended;
  835. // struct that contains complete position info from engine
  836. typedef struct {
  837. UlpLocation location;
  838. GpsLocationExtended locationExtended;
  839. enum loc_sess_status sessionStatus;
  840. } EngineLocationInfo;
  841. // Nmea sentence types mask
  842. typedef uint32_t NmeaSentenceTypesMask;
  843. #define LOC_NMEA_MASK_GGA_V02 ((NmeaSentenceTypesMask)0x00000001) /**< Enable GGA type */
  844. #define LOC_NMEA_MASK_RMC_V02 ((NmeaSentenceTypesMask)0x00000002) /**< Enable RMC type */
  845. #define LOC_NMEA_MASK_GSV_V02 ((NmeaSentenceTypesMask)0x00000004) /**< Enable GSV type */
  846. #define LOC_NMEA_MASK_GSA_V02 ((NmeaSentenceTypesMask)0x00000008) /**< Enable GSA type */
  847. #define LOC_NMEA_MASK_VTG_V02 ((NmeaSentenceTypesMask)0x00000010) /**< Enable VTG type */
  848. #define LOC_NMEA_MASK_PQXFI_V02 ((NmeaSentenceTypesMask)0x00000020) /**< Enable PQXFI type */
  849. #define LOC_NMEA_MASK_PSTIS_V02 ((NmeaSentenceTypesMask)0x00000040) /**< Enable PSTIS type */
  850. #define LOC_NMEA_MASK_GLGSV_V02 ((NmeaSentenceTypesMask)0x00000080) /**< Enable GLGSV type */
  851. #define LOC_NMEA_MASK_GNGSA_V02 ((NmeaSentenceTypesMask)0x00000100) /**< Enable GNGSA type */
  852. #define LOC_NMEA_MASK_GNGNS_V02 ((NmeaSentenceTypesMask)0x00000200) /**< Enable GNGNS type */
  853. #define LOC_NMEA_MASK_GARMC_V02 ((NmeaSentenceTypesMask)0x00000400) /**< Enable GARMC type */
  854. #define LOC_NMEA_MASK_GAGSV_V02 ((NmeaSentenceTypesMask)0x00000800) /**< Enable GAGSV type */
  855. #define LOC_NMEA_MASK_GAGSA_V02 ((NmeaSentenceTypesMask)0x00001000) /**< Enable GAGSA type */
  856. #define LOC_NMEA_MASK_GAVTG_V02 ((NmeaSentenceTypesMask)0x00002000) /**< Enable GAVTG type */
  857. #define LOC_NMEA_MASK_GAGGA_V02 ((NmeaSentenceTypesMask)0x00004000) /**< Enable GAGGA type */
  858. #define LOC_NMEA_MASK_PQGSA_V02 ((NmeaSentenceTypesMask)0x00008000) /**< Enable PQGSA type */
  859. #define LOC_NMEA_MASK_PQGSV_V02 ((NmeaSentenceTypesMask)0x00010000) /**< Enable PQGSV type */
  860. #define LOC_NMEA_MASK_DEBUG_V02 ((NmeaSentenceTypesMask)0x00020000) /**< Enable DEBUG type */
  861. #define LOC_NMEA_MASK_GPDTM_V02 ((NmeaSentenceTypesMask)0x00040000) /**< Enable GPDTM type */
  862. #define LOC_NMEA_MASK_GNGGA_V02 ((NmeaSentenceTypesMask)0x00080000) /**< Enable GNGGA type */
  863. #define LOC_NMEA_MASK_GNRMC_V02 ((NmeaSentenceTypesMask)0x00100000) /**< Enable GNRMC type */
  864. #define LOC_NMEA_MASK_GNVTG_V02 ((NmeaSentenceTypesMask)0x00200000) /**< Enable GNVTG type */
  865. #define LOC_NMEA_MASK_GAGNS_V02 ((NmeaSentenceTypesMask)0x00400000) /**< Enable GAGNS type */
  866. #define LOC_NMEA_MASK_GBGGA_V02 ((NmeaSentenceTypesMask)0x00800000) /**< Enable GBGGA type */
  867. #define LOC_NMEA_MASK_GBGSA_V02 ((NmeaSentenceTypesMask)0x01000000) /**< Enable GBGSA type */
  868. #define LOC_NMEA_MASK_GBGSV_V02 ((NmeaSentenceTypesMask)0x02000000) /**< Enable GBGSV type */
  869. #define LOC_NMEA_MASK_GBRMC_V02 ((NmeaSentenceTypesMask)0x04000000) /**< Enable GBRMC type */
  870. #define LOC_NMEA_MASK_GBVTG_V02 ((NmeaSentenceTypesMask)0x08000000) /**< Enable GBVTG type */
  871. #define LOC_NMEA_MASK_GQGSV_V02 ((NmeaSentenceTypesMask)0x10000000) /**< Enable GQGSV type */
  872. #define LOC_NMEA_MASK_GIGSV_V02 ((NmeaSentenceTypesMask)0x20000000) /**< Enable GIGSV type */
  873. #define LOC_NMEA_MASK_GNDTM_V02 ((NmeaSentenceTypesMask)0x40000000) /**< Enable GNDTM type */
  874. #define LOC_NMEA_MASK_TAGBLOCK_V02 ((NmeaSentenceTypesMask)0x80000000) /**< Enable TAGBLOCK type */
  875. // all bitmasks of general supported NMEA sentenses - debug is not part of this
  876. #define LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK (LOC_NMEA_MASK_GGA_V02 | LOC_NMEA_MASK_RMC_V02 | \
  877. LOC_NMEA_MASK_GSV_V02 | LOC_NMEA_MASK_GSA_V02 | LOC_NMEA_MASK_VTG_V02 | \
  878. LOC_NMEA_MASK_PQXFI_V02 | LOC_NMEA_MASK_PSTIS_V02 | LOC_NMEA_MASK_GLGSV_V02 | \
  879. LOC_NMEA_MASK_GNGSA_V02 | LOC_NMEA_MASK_GNGNS_V02 | LOC_NMEA_MASK_GARMC_V02 | \
  880. LOC_NMEA_MASK_GAGSV_V02 | LOC_NMEA_MASK_GAGSA_V02 | LOC_NMEA_MASK_GAVTG_V02 | \
  881. LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02 | \
  882. LOC_NMEA_MASK_GPDTM_V02 | LOC_NMEA_MASK_GNGGA_V02 | LOC_NMEA_MASK_GNRMC_V02 | \
  883. LOC_NMEA_MASK_GNVTG_V02 | LOC_NMEA_MASK_GAGNS_V02 | LOC_NMEA_MASK_GBGGA_V02 | \
  884. LOC_NMEA_MASK_GBGSA_V02 | LOC_NMEA_MASK_GBGSV_V02 | LOC_NMEA_MASK_GBRMC_V02 | \
  885. LOC_NMEA_MASK_GBVTG_V02 | LOC_NMEA_MASK_GQGSV_V02 | LOC_NMEA_MASK_GIGSV_V02 | \
  886. LOC_NMEA_MASK_GNDTM_V02)
  887. typedef enum {
  888. LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0,
  889. LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
  890. LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
  891. LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
  892. LOC_ENG_IF_REQUEST_SENDER_ID_MODEM,
  893. LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN
  894. } loc_if_req_sender_id_e_type;
  895. #define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
  896. #define MAX_APN_LEN 100
  897. // This will be overridden by the individual adapters
  898. // if necessary.
  899. #define DEFAULT_IMPL(rtv) \
  900. { \
  901. LOC_LOGD("%s: default implementation invoked", __func__); \
  902. return rtv; \
  903. }
  904. enum loc_api_adapter_err {
  905. LOC_API_ADAPTER_ERR_SUCCESS = 0,
  906. LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1,
  907. LOC_API_ADAPTER_ERR_UNSUPPORTED = 2,
  908. LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4,
  909. LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5,
  910. LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6,
  911. LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7,
  912. LOC_API_ADAPTER_ERR_TIMEOUT = 8,
  913. LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9,
  914. LOC_API_ADAPTER_ERR_INTERNAL = 10,
  915. /* equating engine down to phone offline, as they are the same errror */
  916. LOC_API_ADAPTER_ERR_ENGINE_DOWN = LOC_API_ADAPTER_ERR_PHONE_OFFLINE,
  917. LOC_API_ADAPTER_ERR_FAILURE = 101,
  918. LOC_API_ADAPTER_ERR_UNKNOWN
  919. };
  920. enum loc_api_adapter_event_index {
  921. LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type
  922. LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report
  923. LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate
  924. LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate
  925. LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request
  926. LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request
  927. LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server
  928. LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl
  929. LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state
  930. LOC_API_ADAPTER_REQUEST_WIFI, //
  931. LOC_API_ADAPTER_SENSOR_STATUS, //
  932. LOC_API_ADAPTER_REQUEST_TIME_SYNC, //
  933. LOC_API_ADAPTER_REPORT_SPI, //
  934. LOC_API_ADAPTER_REPORT_NI_GEOFENCE, //
  935. LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, //
  936. LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, //
  937. LOC_API_ADAPTER_PEDOMETER_CTRL, //
  938. LOC_API_ADAPTER_MOTION_CTRL, //
  939. LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA, // Wifi ap data
  940. LOC_API_ADAPTER_BATCH_FULL, // Batching on full
  941. LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix
  942. LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, //
  943. LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, // GNSS Measurement Report
  944. LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, // GNSS SV Polynomial Report
  945. LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request
  946. LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request
  947. LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report
  948. LOC_API_ADAPTER_REQUEST_TIMEZONE, // Timezone injection request
  949. LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report
  950. LOC_API_ADAPTER_REQUEST_SRN_DATA, // request srn data from AP
  951. LOC_API_ADAPTER_REQUEST_POSITION_INJECTION, // Position injection request
  952. LOC_API_ADAPTER_BATCH_STATUS, // batch status
  953. LOC_API_ADAPTER_FDCL_SERVICE_REQ, // FDCL service request
  954. LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION, // Unpropagated Position report
  955. LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ, // BS observation data request
  956. LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT, // GNSS SV Ephemeris Report
  957. LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event
  958. LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT, // GNSS SV nHz measurement report
  959. LOC_API_ADAPTER_EVENT_REPORT_INFO, // Event report info
  960. LOC_API_ADAPTER_LATENCY_INFORMATION_REPORT, // Latency information report
  961. LOC_API_ADAPTER_EVENT_MAX
  962. };
  963. #define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_POSITION)
  964. #define LOC_API_ADAPTER_BIT_SATELLITE_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_SATELLITE)
  965. #define LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_NMEA_1HZ)
  966. #define LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_NMEA_POSITION)
  967. #define LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST (1ULL<<LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY)
  968. #define LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST (1ULL<<LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA)
  969. #define LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST (1ULL<<LOC_API_ADAPTER_REQUEST_LOCATION_SERVER)
  970. #define LOC_API_ADAPTER_BIT_IOCTL_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_IOCTL)
  971. #define LOC_API_ADAPTER_BIT_STATUS_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_STATUS)
  972. #define LOC_API_ADAPTER_BIT_REQUEST_WIFI (1ULL<<LOC_API_ADAPTER_REQUEST_WIFI)
  973. #define LOC_API_ADAPTER_BIT_SENSOR_STATUS (1ULL<<LOC_API_ADAPTER_SENSOR_STATUS)
  974. #define LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC (1ULL<<LOC_API_ADAPTER_REQUEST_TIME_SYNC)
  975. #define LOC_API_ADAPTER_BIT_REPORT_SPI (1ULL<<LOC_API_ADAPTER_REPORT_SPI)
  976. #define LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE (1ULL<<LOC_API_ADAPTER_REPORT_NI_GEOFENCE)
  977. #define LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT (1ULL<<LOC_API_ADAPTER_GEOFENCE_GEN_ALERT)
  978. #define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH (1ULL<<LOC_API_ADAPTER_REPORT_GENFENCE_BREACH)
  979. #define LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT (1ULL<<LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT)
  980. #define LOC_API_ADAPTER_BIT_PEDOMETER_CTRL (1ULL<<LOC_API_ADAPTER_PEDOMETER_CTRL)
  981. #define LOC_API_ADAPTER_BIT_MOTION_CTRL (1ULL<<LOC_API_ADAPTER_MOTION_CTRL)
  982. #define LOC_API_ADAPTER_BIT_REQUEST_WIFI_AP_DATA (1ULL<<LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA)
  983. #define LOC_API_ADAPTER_BIT_BATCH_FULL (1ULL<<LOC_API_ADAPTER_BATCH_FULL)
  984. #define LOC_API_ADAPTER_BIT_BATCHED_POSITION_REPORT (1ULL<<LOC_API_ADAPTER_BATCHED_POSITION_REPORT)
  985. #define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT (1ULL<<LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT)
  986. #define LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT (1ULL<<LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT)
  987. #define LOC_API_ADAPTER_BIT_GDT_UPLOAD_BEGIN_REQ (1ULL<<LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ)
  988. #define LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ (1ULL<<LOC_API_ADAPTER_GDT_UPLOAD_END_REQ)
  989. #define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT (1ULL<<LOC_API_ADAPTER_GNSS_MEASUREMENT)
  990. #define LOC_API_ADAPTER_BIT_REQUEST_TIMEZONE (1ULL<<LOC_API_ADAPTER_REQUEST_TIMEZONE)
  991. #define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_DWELL (1ULL<<LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT)
  992. #define LOC_API_ADAPTER_BIT_REQUEST_SRN_DATA (1ULL<<LOC_API_ADAPTER_REQUEST_SRN_DATA)
  993. #define LOC_API_ADAPTER_BIT_POSITION_INJECTION_REQUEST (1ULL<<LOC_API_ADAPTER_REQUEST_POSITION_INJECTION)
  994. #define LOC_API_ADAPTER_BIT_BATCH_STATUS (1ULL<<LOC_API_ADAPTER_BATCH_STATUS)
  995. #define LOC_API_ADAPTER_BIT_FDCL_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_FDCL_SERVICE_REQ)
  996. #define LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION)
  997. #define LOC_API_ADAPTER_BIT_BS_OBS_DATA_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ)
  998. #define LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT (1ULL<<LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT)
  999. #define LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO (1ULL<<LOC_API_ADAPTER_LOC_SYSTEM_INFO)
  1000. #define LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT (1ULL<<LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT)
  1001. #define LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO (1ULL<<LOC_API_ADAPTER_EVENT_REPORT_INFO)
  1002. #define LOC_API_ADAPTER_BIT_LATENCY_INFORMATION (1ULL<<LOC_API_ADAPTER_LATENCY_INFORMATION_REPORT)
  1003. typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T;
  1004. typedef enum loc_api_adapter_msg_to_check_supported {
  1005. LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING, // Batching 1.0
  1006. LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH, // Geofence Batched Breach
  1007. LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING, // DBT 2.0
  1008. LOC_API_ADAPTER_MESSAGE_ADAPTIVE_LOCATION_BATCHING, // Batching 1.5
  1009. LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING, // Batching 2.0
  1010. LOC_API_ADAPTER_MESSAGE_UPDATE_TBF_ON_THE_FLY, // Updating Tracking TBF On The Fly
  1011. LOC_API_ADAPTER_MESSAGE_OUTDOOR_TRIP_BATCHING, // Outdoor Trip Batching
  1012. LOC_API_ADAPTER_MESSAGE_MAX
  1013. } LocCheckingMessagesID;
  1014. typedef int IzatDevId_t;
  1015. typedef uint32_t LOC_GPS_LOCK_MASK;
  1016. #define isGpsLockNone(lock) ((lock) == 0)
  1017. #define isGpsLockMO(lock) ((lock) & ((LOC_GPS_LOCK_MASK)1))
  1018. #define isGpsLockMT(lock) ((lock) & ((LOC_GPS_LOCK_MASK)2))
  1019. #define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3)
  1020. /* ***********************************************
  1021. ** Satellite Measurement and Satellite Polynomial
  1022. ** structure definitions
  1023. ** ***********************************************
  1024. */
  1025. #define GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE 12
  1026. #define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE 3
  1027. #define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE 9
  1028. #define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE 4
  1029. /** Max number of GNSS SV measurement */
  1030. #define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 128
  1031. enum ulp_gnss_sv_measurement_valid_flags{
  1032. ULP_GNSS_SV_MEAS_GPS_TIME = 0,
  1033. ULP_GNSS_SV_MEAS_PSUEDO_RANGE,
  1034. ULP_GNSS_SV_MEAS_MS_IN_WEEK,
  1035. ULP_GNSS_SV_MEAS_SUB_MSEC,
  1036. ULP_GNSS_SV_MEAS_CARRIER_PHASE,
  1037. ULP_GNSS_SV_MEAS_DOPPLER_SHIFT,
  1038. ULP_GNSS_SV_MEAS_CNO,
  1039. ULP_GNSS_SV_MEAS_LOSS_OF_LOCK,
  1040. ULP_GNSS_SV_MEAS_MAX_VALID_FLAGS
  1041. };
  1042. #define ULP_GNSS_SV_MEAS_BIT_GPS_TIME (1<<ULP_GNSS_SV_MEAS_GPS_TIME)
  1043. #define ULP_GNSS_SV_MEAS_BIT_PSUEDO_RANGE (1<<ULP_GNSS_SV_MEAS_PSUEDO_RANGE)
  1044. #define ULP_GNSS_SV_MEAS_BIT_MS_IN_WEEK (1<<ULP_GNSS_SV_MEAS_MS_IN_WEEK)
  1045. #define ULP_GNSS_SV_MEAS_BIT_SUB_MSEC (1<<ULP_GNSS_SV_MEAS_SUB_MSEC)
  1046. #define ULP_GNSS_SV_MEAS_BIT_CARRIER_PHASE (1<<ULP_GNSS_SV_MEAS_CARRIER_PHASE)
  1047. #define ULP_GNSS_SV_MEAS_BIT_DOPPLER_SHIFT (1<<ULP_GNSS_SV_MEAS_DOPPLER_SHIFT)
  1048. #define ULP_GNSS_SV_MEAS_BIT_CNO (1<<ULP_GNSS_SV_MEAS_CNO)
  1049. #define ULP_GNSS_SV_MEAS_BIT_LOSS_OF_LOCK (1<<ULP_GNSS_SV_MEAS_LOSS_OF_LOCK)
  1050. #define ULP_GNSS_SV_POLY_BIT_GLO_FREQ (0x000000001)
  1051. #define ULP_GNSS_SV_POLY_BIT_T0 (0x000000002)
  1052. #define ULP_GNSS_SV_POLY_BIT_IODE (0x000000004)
  1053. #define ULP_GNSS_SV_POLY_BIT_FLAG (0x000000008)
  1054. #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZ0 (0x000000010)
  1055. #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZN (0x000000020)
  1056. #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_OTHER (0x000000040)
  1057. #define ULP_GNSS_SV_POLY_BIT_SV_POSUNC (0x000000080)
  1058. #define ULP_GNSS_SV_POLY_BIT_IONODELAY (0x000000100)
  1059. #define ULP_GNSS_SV_POLY_BIT_IONODOT (0x000000200)
  1060. #define ULP_GNSS_SV_POLY_BIT_SBAS_IONODELAY (0x000000400)
  1061. #define ULP_GNSS_SV_POLY_BIT_SBAS_IONODOT (0x000000800)
  1062. #define ULP_GNSS_SV_POLY_BIT_TROPODELAY (0x000001000)
  1063. #define ULP_GNSS_SV_POLY_BIT_ELEVATION (0x000002000)
  1064. #define ULP_GNSS_SV_POLY_BIT_ELEVATIONDOT (0x000004000)
  1065. #define ULP_GNSS_SV_POLY_BIT_ELEVATIONUNC (0x000008000)
  1066. #define ULP_GNSS_SV_POLY_BIT_VELO_COEFF (0x000010000)
  1067. #define ULP_GNSS_SV_POLY_BIT_ENHANCED_IOD (0x000020000)
  1068. #define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L1CA (0x000040000)
  1069. #define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L2C (0x000080000)
  1070. #define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5I5 (0x000100000)
  1071. #define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5Q5 (0x000200000)
  1072. #define ULP_GNSS_SV_POLY_BIT_GPS_TGD (0x000400000)
  1073. #define ULP_GNSS_SV_POLY_BIT_GLO_TGD_G1G2 (0x000800000)
  1074. #define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B1 (0x001000000)
  1075. #define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2 (0x002000000)
  1076. #define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2A (0x004000000)
  1077. #define ULP_GNSS_SV_POLY_BIT_BDS_ISC_B2A (0x008000000)
  1078. #define ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5A (0x010000000)
  1079. #define ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5B (0x020000000)
  1080. #define ULP_GNSS_SV_POLY_BIT_NAVIC_TGD_L5 (0x040000000)
  1081. #define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B1C (0x080000000)
  1082. #define ULP_GNSS_SV_POLY_BIT_BDS_ISC_B1C (0x100000000)
  1083. typedef enum
  1084. {
  1085. GNSS_LOC_FREQ_SOURCE_INVALID = 0,
  1086. /**< Source of the frequency is invalid */
  1087. GNSS_LOC_FREQ_SOURCE_EXTERNAL = 1,
  1088. /**< Source of the frequency is from external injection */
  1089. GNSS_LOC_FREQ_SOURCE_PE_CLK_REPORT = 2,
  1090. /**< Source of the frequency is from Navigation engine */
  1091. GNSS_LOC_FREQ_SOURCE_UNKNOWN = 3
  1092. /**< Source of the frequency is unknown */
  1093. } Gnss_LocSourceofFreqEnumType;
  1094. typedef struct
  1095. {
  1096. uint32_t size;
  1097. float clockDrift;
  1098. /**< Receiver clock Drift \n
  1099. - Units: meter per sec \n
  1100. */
  1101. float clockDriftUnc;
  1102. /**< Receiver clock Drift uncertainty \n
  1103. - Units: meter per sec \n
  1104. */
  1105. Gnss_LocSourceofFreqEnumType sourceOfFreq;
  1106. }Gnss_LocRcvrClockFrequencyInfoStructType;
  1107. typedef struct
  1108. {
  1109. uint32_t size;
  1110. uint8_t leapSec;
  1111. /**< GPS time leap second delta to UTC time \n
  1112. - Units: sec \n
  1113. */
  1114. uint8_t leapSecUnc;
  1115. /**< Uncertainty for GPS leap second \n
  1116. - Units: sec \n
  1117. */
  1118. }Gnss_LeapSecondInfoStructType;
  1119. typedef enum
  1120. {
  1121. GNSS_LOC_SYS_TIME_BIAS_VALID = 0x01,
  1122. /**< System time bias valid */
  1123. GNSS_LOC_SYS_TIME_BIAS_UNC_VALID = 0x02,
  1124. /**< System time bias uncertainty valid */
  1125. }Gnss_LocInterSystemBiasValidMaskType;
  1126. typedef struct
  1127. {
  1128. uint32_t size;
  1129. uint32_t validMask;
  1130. /* Validity mask as per Gnss_LocInterSystemBiasValidMaskType */
  1131. float timeBias;
  1132. /**< System-1 to System-2 Time Bias \n
  1133. - Units: msec \n
  1134. */
  1135. float timeBiasUnc;
  1136. /**< System-1 to System-2 Time Bias uncertainty \n
  1137. - Units: msec \n
  1138. */
  1139. } Gnss_InterSystemBiasStructType;
  1140. typedef struct {
  1141. uint32_t size;
  1142. uint8_t systemRtc_valid;
  1143. /**< Validity indicator for System RTC */
  1144. uint64_t systemRtcMs;
  1145. /**< Platform system RTC value \n
  1146. - Units: msec \n
  1147. */
  1148. }Gnss_LocGnssTimeExtStructType;
  1149. typedef enum
  1150. {
  1151. GNSS_LOC_MEAS_STATUS_NULL = 0x00000000,
  1152. /**< No information state */
  1153. GNSS_LOC_MEAS_STATUS_SM_VALID = 0x00000001,
  1154. /**< Code phase is known */
  1155. GNSS_LOC_MEAS_STATUS_SB_VALID = 0x00000002,
  1156. /**< Sub-bit time is known */
  1157. GNSS_LOC_MEAS_STATUS_MS_VALID = 0x00000004,
  1158. /**< Satellite time is known */
  1159. GNSS_LOC_MEAS_STATUS_BE_CONFIRM = 0x00000008,
  1160. /**< Bit edge is confirmed from signal */
  1161. GNSS_LOC_MEAS_STATUS_VELOCITY_VALID = 0x00000010,
  1162. /**< Satellite Doppler measured */
  1163. GNSS_LOC_MEAS_STATUS_VELOCITY_FINE = 0x00000020,
  1164. /**< TRUE: Fine Doppler measured, FALSE: Coarse Doppler measured */
  1165. GNSS_LOC_MEAS_STATUS_LP_VALID = 0x00000040,
  1166. /**< TRUE/FALSE -- Lock Point is valid/invalid */
  1167. GNSS_LOC_MEAS_STATUS_LP_POS_VALID = 0x00000080,
  1168. /**< TRUE/FALSE -- Lock Point is positive/negative */
  1169. GNSS_LOC_MEAS_STATUS_FROM_RNG_DIFF = 0x00000200,
  1170. /**< Range update from Satellite differences */
  1171. GNSS_LOC_MEAS_STATUS_FROM_VE_DIFF = 0x00000400,
  1172. /**< Doppler update from Satellite differences */
  1173. GNSS_LOC_MEAS_STATUS_DONT_USE_X = 0x00000800,
  1174. /**< Don't use measurement if bit is set */
  1175. GNSS_LOC_MEAS_STATUS_DONT_USE_M = 0x00001000,
  1176. /**< Don't use measurement if bit is set */
  1177. GNSS_LOC_MEAS_STATUS_DONT_USE_D = 0x00002000,
  1178. /**< Don't use measurement if bit is set */
  1179. GNSS_LOC_MEAS_STATUS_DONT_USE_S = 0x00004000,
  1180. /**< Don't use measurement if bit is set */
  1181. GNSS_LOC_MEAS_STATUS_DONT_USE_P = 0x00008000,
  1182. /**< Don't use measurement if bit is set */
  1183. GNSS_LOC_MEAS_STATUS_GNSS_FRESH_MEAS = 0x08000000
  1184. /**< TRUE -- Fresh GNSS measurement observed in last second */
  1185. }Gnss_LocSvMeasStatusMaskType;
  1186. typedef struct
  1187. {
  1188. uint32_t size;
  1189. uint32_t svMs;
  1190. /**< Satellite time milisecond.\n
  1191. For GPS, BDS, GAL range of 0 thru (604800000-1) \n
  1192. For GLONASS range of 0 thru (86400000-1) \n
  1193. Valid when PD_LOC_MEAS_STATUS_MS_VALID bit is set in measurement status \n
  1194. Note: All SV times in the current measurement block are alredy propagated to common reference time epoch. \n
  1195. - Units: msec \n
  1196. */
  1197. float svSubMs;
  1198. /**<Satellite time sub-millisecond. \n
  1199. Total SV Time = svMs + svSubMs \n
  1200. - Units: msec \n
  1201. */
  1202. float svTimeUncMs;
  1203. /**< Satellite Time uncertainty \n
  1204. - Units: msec \n
  1205. */
  1206. float dopplerShift;
  1207. /**< Satellite Doppler \n
  1208. - Units: meter per sec \n
  1209. */
  1210. float dopplerShiftUnc;
  1211. /**< Satellite Doppler uncertainty\n
  1212. - Units: meter per sec \n
  1213. */
  1214. }Gnss_LocSVTimeSpeedStructType;
  1215. typedef enum
  1216. {
  1217. GNSS_SV_STATE_IDLE = 0,
  1218. GNSS_SV_STATE_SEARCH = 1,
  1219. GNSS_SV_STATE_SEARCH_VERIFY = 2,
  1220. GNSS_SV_STATE_BIT_EDGE = 3,
  1221. GNSS_SV_STATE_VERIFY_TRACK = 4,
  1222. GNSS_SV_STATE_TRACK = 5,
  1223. GNSS_SV_STATE_RESTART = 6,
  1224. GNSS_SV_STATE_DPO_TRACK = 7
  1225. } Gnss_LocSVStateEnumType;
  1226. typedef enum
  1227. {
  1228. GNSS_LOC_SVINFO_MASK_HAS_EPHEMERIS = 0x01,
  1229. /**< Ephemeris is available for this SV */
  1230. GNSS_LOC_SVINFO_MASK_HAS_ALMANAC = 0x02
  1231. /**< Almanac is available for this SV */
  1232. }Gnss_LocSvInfoMaskT;
  1233. typedef enum
  1234. {
  1235. GNSS_LOC_SV_SRCH_STATUS_IDLE = 1,
  1236. /**< SV is not being actively processed */
  1237. GNSS_LOC_SV_SRCH_STATUS_SEARCH = 2,
  1238. /**< The system is searching for this SV */
  1239. GNSS_LOC_SV_SRCH_STATUS_TRACK = 3
  1240. /**< SV is being tracked */
  1241. }Gnss_LocSvSearchStatusEnumT;
  1242. typedef uint32_t LocSvDgnssMeasStatusMask;
  1243. #define LOC_MASK_DGNSS_EPOCH_TIME_VALID 0x1 /**< DGNSS Epoch time is valid */
  1244. #define LOC_MASK_DGNSS_MEAS_STATUS_PR_VALID 0x2 /**< Pseudo Range correction is valid */
  1245. #define LOC_MASK_DGNSS_MEAS_STATUS_PRR_VALID 0x4 /**< Pseudo Range rate correction is valid */
  1246. typedef struct {
  1247. LocSvDgnssMeasStatusMask dgnssMeasStatus;
  1248. /**< Bitmask indicating the DGNSS SV measurement status. */
  1249. uint32_t diffDataEpochTimeMsec;
  1250. /**< Age of differential data in Milli Seconds with respect to the Measurement time. */
  1251. float prCorrMeters;
  1252. /**< Pseudo Range correction in meters. */
  1253. float prrCorrMetersPerSec;
  1254. /**< Pseudo Range rate correction in meters per second. */
  1255. } Gnss_LocDgnssSVMeasurement;
  1256. typedef struct
  1257. {
  1258. uint32_t size;
  1259. Gnss_LocSvSystemEnumType gnssSystem;
  1260. // 0 signal type mask indicates invalid value
  1261. GnssSignalTypeMask gnssSignalTypeMask;
  1262. uint16_t gnssSvId;
  1263. /** Unique SV Identifier.
  1264. * For SV Range of supported constellation, please refer to the
  1265. * comment section of gnssSvId in GpsMeasUsageInfo.
  1266. */
  1267. uint8_t gloFrequency;
  1268. /**< GLONASS frequency number + 7 \n
  1269. Valid only for GLONASS System \n
  1270. Shall be ignored for all other systems \n
  1271. - Range: 1 to 14 \n
  1272. */
  1273. Gnss_LocSvSearchStatusEnumT svStatus;
  1274. /**< Satellite search state \n
  1275. @ENUM()
  1276. */
  1277. bool healthStatus_valid;
  1278. /**< SV Health Status validity flag\n
  1279. - 0: Not valid \n
  1280. - 1: Valid \n
  1281. */
  1282. uint8_t healthStatus;
  1283. /**< Health status.
  1284. \begin{itemize1}
  1285. \item Range: 0 to 1; 0 = unhealthy, \n 1 = healthy, 2 = unknown
  1286. \vspace{-0.18in} \end{itemize1}
  1287. */
  1288. Gnss_LocSvInfoMaskT svInfoMask;
  1289. /**< Indicates whether almanac and ephemeris information is available. \n
  1290. @MASK()
  1291. */
  1292. uint64_t measurementStatus;
  1293. /**< Bitmask indicating SV measurement status.
  1294. Valid bitmasks: \n
  1295. If any MSB bit in 0xFFC0000000000000 DONT_USE is set, the measurement
  1296. must not be used by the client.
  1297. @MASK()
  1298. */
  1299. uint16_t CNo;
  1300. /**< Carrier to Noise ratio \n
  1301. - Units: 0.1 dBHz \n
  1302. */
  1303. uint16_t gloRfLoss;
  1304. /**< GLONASS Rf loss reference to Antenna. \n
  1305. - Units: dB, Scale: 0.1 \n
  1306. */
  1307. bool lossOfLock;
  1308. /**< Loss of signal lock indicator \n
  1309. - 0: Signal in continuous track \n
  1310. - 1: Signal not in track \n
  1311. */
  1312. int16_t measLatency;
  1313. /**< Age of the measurement. Positive value means measurement precedes ref time. \n
  1314. - Units: msec \n
  1315. */
  1316. Gnss_LocSVTimeSpeedStructType svTimeSpeed;
  1317. /**< Unfiltered SV Time and Speed information
  1318. */
  1319. float dopplerAccel;
  1320. /**< Satellite Doppler Accelertion\n
  1321. - Units: Hz/s \n
  1322. */
  1323. bool multipathEstValid;
  1324. /**< Multipath estimate validity flag\n
  1325. - 0: Multipath estimate not valid \n
  1326. - 1: Multipath estimate valid \n
  1327. */
  1328. float multipathEstimate;
  1329. /**< Estimate of multipath in measurement\n
  1330. - Units: Meters \n
  1331. */
  1332. bool fineSpeedValid;
  1333. /**< Fine speed validity flag\n
  1334. - 0: Fine speed not valid \n
  1335. - 1: Fine speed valid \n
  1336. */
  1337. float fineSpeed;
  1338. /**< Carrier phase derived speed \n
  1339. - Units: m/s \n
  1340. */
  1341. bool fineSpeedUncValid;
  1342. /**< Fine speed uncertainty validity flag\n
  1343. - 0: Fine speed uncertainty not valid \n
  1344. - 1: Fine speed uncertainty valid \n
  1345. */
  1346. float fineSpeedUnc;
  1347. /**< Carrier phase derived speed \n
  1348. - Units: m/s \n
  1349. */
  1350. bool carrierPhaseValid;
  1351. /**< Carrier Phase measurement validity flag\n
  1352. - 0: Carrier Phase not valid \n
  1353. - 1: Carrier Phase valid \n
  1354. */
  1355. double carrierPhase;
  1356. /**< Carrier phase measurement [L1 cycles] \n
  1357. */
  1358. bool cycleSlipCountValid;
  1359. /**< Cycle slup count validity flag\n
  1360. - 0: Not valid \n
  1361. - 1: Valid \n
  1362. */
  1363. uint8_t cycleSlipCount;
  1364. /**< Increments when a CSlip is detected */
  1365. bool svDirectionValid;
  1366. /**< Validity flag for SV direction */
  1367. float svAzimuth;
  1368. /**< Satellite Azimuth
  1369. - Units: radians \n
  1370. */
  1371. float svElevation;
  1372. /**< Satellite Elevation
  1373. - Units: radians \n
  1374. */
  1375. uint64_t validMeasStatusMask;
  1376. /**< Bitmask indicating SV measurement status Validity.
  1377. Valid bitmasks: \n
  1378. If any MSB bit in 0xFFC0000000000000 DONT_USE is set, the measurement
  1379. must not be used by the client.
  1380. @MASK()
  1381. */
  1382. bool carrierPhaseUncValid;
  1383. /**< Validity flag for SV direction */
  1384. float carrierPhaseUnc;
  1385. /** < DGNSS Measurements Report for SVs */
  1386. Gnss_LocDgnssSVMeasurement dgnssSvMeas;
  1387. } Gnss_SVMeasurementStructType;
  1388. typedef uint64_t GpsSvMeasHeaderFlags;
  1389. #define GNSS_SV_MEAS_HEADER_HAS_LEAP_SECOND 0x000000001
  1390. #define GNSS_SV_MEAS_HEADER_HAS_CLOCK_FREQ 0x000000002
  1391. #define GNSS_SV_MEAS_HEADER_HAS_AP_TIMESTAMP 0x000000004
  1392. #define GNSS_SV_MEAS_HEADER_HAS_GPS_GLO_INTER_SYSTEM_BIAS 0x000000008
  1393. #define GNSS_SV_MEAS_HEADER_HAS_GPS_BDS_INTER_SYSTEM_BIAS 0x000000010
  1394. #define GNSS_SV_MEAS_HEADER_HAS_GPS_GAL_INTER_SYSTEM_BIAS 0x000000020
  1395. #define GNSS_SV_MEAS_HEADER_HAS_BDS_GLO_INTER_SYSTEM_BIAS 0x000000040
  1396. #define GNSS_SV_MEAS_HEADER_HAS_GAL_GLO_INTER_SYSTEM_BIAS 0x000000080
  1397. #define GNSS_SV_MEAS_HEADER_HAS_GAL_BDS_INTER_SYSTEM_BIAS 0x000000100
  1398. #define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME 0x000000200
  1399. #define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME 0x000000400
  1400. #define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME 0x000000800
  1401. #define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME 0x000001000
  1402. #define GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME 0x000002000
  1403. #define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME_EXT 0x000004000
  1404. #define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME_EXT 0x000008000
  1405. #define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME_EXT 0x000010000
  1406. #define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME_EXT 0x000020000
  1407. #define GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME_EXT 0x000040000
  1408. #define GNSS_SV_MEAS_HEADER_HAS_GPSL1L5_TIME_BIAS 0x000080000
  1409. #define GNSS_SV_MEAS_HEADER_HAS_GALE1E5A_TIME_BIAS 0x000100000
  1410. #define GNSS_SV_MEAS_HEADER_HAS_BDSB1IB2A_TIME_BIAS 0x000200000
  1411. #define GNSS_SV_MEAS_HEADER_HAS_GPS_NAVIC_INTER_SYSTEM_BIAS 0x000400000
  1412. #define GNSS_SV_MEAS_HEADER_HAS_GAL_NAVIC_INTER_SYSTEM_BIAS 0x000800000
  1413. #define GNSS_SV_MEAS_HEADER_HAS_GLO_NAVIC_INTER_SYSTEM_BIAS 0x001000000
  1414. #define GNSS_SV_MEAS_HEADER_HAS_BDS_NAVIC_INTER_SYSTEM_BIAS 0x002000000
  1415. #define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME 0x004000000
  1416. #define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME_EXT 0x008000000
  1417. #define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x010000000
  1418. #define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_ID 0x020000000
  1419. #define GNSS_SV_MEAS_HEADER_HAS_DGNSS_REF_STATION_ID 0x040000000
  1420. #define GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS 0x080000000
  1421. #define GNSS_SV_MEAS_HEADER_HAS_GPSL1L2C_TIME_BIAS 0x100000000
  1422. #define GNSS_SV_MEAS_HEADER_HAS_GLOG1G2_TIME_BIAS 0x200000000
  1423. #define GNSS_SV_MEAS_HEADER_HAS_BDSB1IB1C_TIME_BIAS 0x400000000
  1424. #define GNSS_SV_MEAS_HEADER_HAS_GALE1E5B_TIME_BIAS 0x800000000
  1425. #define GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS_UNC 0x1000000000
  1426. typedef struct
  1427. {
  1428. uint32_t size;
  1429. // see defines in GNSS_SV_MEAS_HEADER_HAS_XXX_XXX
  1430. uint64_t flags;
  1431. Gnss_LeapSecondInfoStructType leapSec;
  1432. Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */
  1433. Gnss_ApTimeStampStructType apBootTimeStamp;
  1434. Gnss_InterSystemBiasStructType gpsGloInterSystemBias;
  1435. Gnss_InterSystemBiasStructType gpsBdsInterSystemBias;
  1436. Gnss_InterSystemBiasStructType gpsGalInterSystemBias;
  1437. Gnss_InterSystemBiasStructType bdsGloInterSystemBias;
  1438. Gnss_InterSystemBiasStructType galGloInterSystemBias;
  1439. Gnss_InterSystemBiasStructType galBdsInterSystemBias;
  1440. Gnss_InterSystemBiasStructType gpsNavicInterSystemBias;
  1441. Gnss_InterSystemBiasStructType galNavicInterSystemBias;
  1442. Gnss_InterSystemBiasStructType gloNavicInterSystemBias;
  1443. Gnss_InterSystemBiasStructType bdsNavicInterSystemBias;
  1444. Gnss_InterSystemBiasStructType gpsL1L5TimeBias;
  1445. Gnss_InterSystemBiasStructType galE1E5aTimeBias;
  1446. Gnss_InterSystemBiasStructType bdsB1iB2aTimeBias;
  1447. Gnss_InterSystemBiasStructType gpsL1L2cTimeBias;
  1448. Gnss_InterSystemBiasStructType gloG1G2TimeBias;
  1449. Gnss_InterSystemBiasStructType bdsB1iB1cTimeBias;
  1450. Gnss_InterSystemBiasStructType galE1E5bTimeBias;
  1451. GnssSystemTimeStructType gpsSystemTime;
  1452. GnssSystemTimeStructType galSystemTime;
  1453. GnssSystemTimeStructType bdsSystemTime;
  1454. GnssSystemTimeStructType qzssSystemTime;
  1455. GnssSystemTimeStructType navicSystemTime;
  1456. GnssGloTimeStructType gloSystemTime;
  1457. /** GPS system RTC time information. */
  1458. Gnss_LocGnssTimeExtStructType gpsSystemTimeExt;
  1459. /** GAL system RTC time information. */
  1460. Gnss_LocGnssTimeExtStructType galSystemTimeExt;
  1461. /** BDS system RTC time information. */
  1462. Gnss_LocGnssTimeExtStructType bdsSystemTimeExt;
  1463. /** QZSS system RTC time information. */
  1464. Gnss_LocGnssTimeExtStructType qzssSystemTimeExt;
  1465. /** GLONASS system RTC time information. */
  1466. Gnss_LocGnssTimeExtStructType gloSystemTimeExt;
  1467. /** NAVIC system RTC time information. */
  1468. Gnss_LocGnssTimeExtStructType navicSystemTimeExt;
  1469. /** Receiver tick at frame count */
  1470. uint64_t refCountTicks;
  1471. float refCountTicksUnc;
  1472. /** DGNSS corrections source type RTCM, 3GPP etc, if DGNSS was
  1473. * used for these measurements. */
  1474. LocDgnssCorrectionSourceType dgnssCorrectionSourceType;
  1475. /** DGNSS SourceID: 32bit number identifying the DGNSS source
  1476. * ID, if DGNSS was used for these measurements. */
  1477. uint32_t dgnssCorrectionSourceID;
  1478. /** DGNSS Ref station ID: 32bit number identifying the DGNSS
  1479. * ref station ID, if DGNSS was used for these measurements. */
  1480. uint16_t dgnssRefStationId;
  1481. } GnssSvMeasurementHeader;
  1482. typedef struct {
  1483. uint32_t size;
  1484. bool isNhz;
  1485. GnssSvMeasurementHeader svMeasSetHeader;
  1486. uint32_t svMeasCount;
  1487. Gnss_SVMeasurementStructType svMeas[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE];
  1488. } GnssSvMeasurementSet;
  1489. typedef struct {
  1490. uint32_t size; // set to sizeof(GnssMeasurements)
  1491. GnssSvMeasurementSet gnssSvMeasurementSet;
  1492. GnssMeasurementsNotification gnssMeasNotification;
  1493. } GnssMeasurements;
  1494. typedef enum
  1495. {
  1496. GNSS_SV_POLY_COEFF_VALID = 0x01,
  1497. /**< SV position in orbit coefficients are valid */
  1498. GNSS_SV_POLY_IONO_VALID = 0x02,
  1499. /**< Iono estimates are valid */
  1500. GNSS_SV_POLY_TROPO_VALID = 0x04,
  1501. /**< Tropo estimates are valid */
  1502. GNSS_SV_POLY_ELEV_VALID = 0x08,
  1503. /**< Elevation, rate, uncertainty are valid */
  1504. GNSS_SV_POLY_SRC_ALM_CORR = 0x10,
  1505. /**< Polynomials based on XTRA */
  1506. GNSS_SV_POLY_SBAS_IONO_VALID = 0x20,
  1507. /**< SBAS IONO and rate are valid */
  1508. GNSS_SV_POLY_GLO_STR4 = 0x40
  1509. /**< GLONASS String 4 has been received */
  1510. } Gnss_SvPolyStatusMaskType;
  1511. typedef struct {
  1512. uint32_t size;
  1513. uint16_t gnssSvId;
  1514. /** Unique SV Identifier.
  1515. * For SV Range of supported constellation, please refer to the
  1516. * comment section of gnssSvId in GpsMeasUsageInfo.
  1517. */
  1518. int8_t freqNum;
  1519. /** Freq index, only valid if u_SysInd is GLO */
  1520. GnssSvPolyStatusMaskValidity svPolyStatusMaskValidity;
  1521. GnssSvPolyStatusMask svPolyStatusMask;
  1522. uint64_t is_valid;
  1523. uint16_t iode;
  1524. /* Ephemeris reference time
  1525. GPS:Issue of Data Ephemeris used [unitless].
  1526. GLO: Tb 7-bit, refer to ICD02
  1527. */
  1528. double T0;
  1529. /* Reference time for polynominal calculations
  1530. GPS: Secs in week.
  1531. GLO: Full secs since Jan/01/96
  1532. */
  1533. double polyCoeffXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE];
  1534. /* C0X, C0Y, C0Z */
  1535. double polyCoefXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE];
  1536. /* C1X, C2X ... C2Z, C3Z */
  1537. float polyCoefOther[GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE];
  1538. /* C0T, C1T, C2T, C3T */
  1539. float svPosUnc; /* SV position uncertainty [m]. */
  1540. float ionoDelay; /* Ionospheric delay at d_T0 [m]. */
  1541. float ionoDot; /* Iono delay rate [m/s]. */
  1542. float sbasIonoDelay;/* SBAS Ionospheric delay at d_T0 [m]. */
  1543. float sbasIonoDot; /* SBAS Iono delay rate [m/s]. */
  1544. float tropoDelay; /* Tropospheric delay [m]. */
  1545. float elevation; /* Elevation [rad] at d_T0 */
  1546. float elevationDot; /* Elevation rate [rad/s] */
  1547. float elevationUnc; /* SV elevation [rad] uncertainty */
  1548. double velCoef[GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE];
  1549. /* Coefficients of velocity poly */
  1550. uint32_t enhancedIOD; /* Enhanced Reference Time */
  1551. float gpsIscL1ca;
  1552. float gpsIscL2c;
  1553. float gpsIscL5I5;
  1554. float gpsIscL5Q5;
  1555. float gpsTgd;
  1556. float gloTgdG1G2;
  1557. float bdsTgdB1;
  1558. float bdsTgdB2;
  1559. float bdsTgdB2a;
  1560. float bdsIscB2a;
  1561. float galBgdE1E5a;
  1562. float galBgdE1E5b;
  1563. float navicTgdL5;
  1564. float bdsTgdB1c;
  1565. float bdsIscB1c;
  1566. } GnssSvPolynomial;
  1567. typedef enum {
  1568. GNSS_EPH_ACTION_UPDATE_SRC_UNKNOWN_V02 = 0, /**<Update ephemeris. Source of ephemeris is unknown */
  1569. GNSS_EPH_ACTION_UPDATE_SRC_OTA_V02 = 1, /**<Update ephemeris. Source of ephemeris is OTA */
  1570. GNSS_EPH_ACTION_UPDATE_SRC_NETWORK_V02 = 2, /**<Update ephemeris. Source of ephemeris is Network */
  1571. GNSS_EPH_ACTION_UPDATE_MAX_V02 = 999, /**<Max value for update ephemeris action. DO NOT USE */
  1572. GNSS_EPH_ACTION_DELETE_SRC_UNKNOWN_V02 = 1000, /**<Delete previous ephemeris from unknown source */
  1573. GNSS_EPH_ACTION_DELETE_SRC_NETWORK_V02 = 1001, /**<Delete previous ephemeris from network */
  1574. GNSS_EPH_ACTION_DELETE_SRC_OTA_V02 = 1002, /**<Delete previous ephemeris from OTA */
  1575. GNSS_EPH_ACTION_DELETE_MAX_V02 = 1999, /**<Max value for delete ephemeris action. DO NOT USE */
  1576. } GnssEphAction;
  1577. typedef enum {
  1578. GAL_EPH_SIGNAL_SRC_UNKNOWN_V02 = 0, /**< GALILEO signal is unknown */
  1579. GAL_EPH_SIGNAL_SRC_E1B_V02 = 1, /**< GALILEO signal is E1B */
  1580. GAL_EPH_SIGNAL_SRC_E5A_V02 = 2, /**< GALILEO signal is E5A */
  1581. GAL_EPH_SIGNAL_SRC_E5B_V02 = 3, /**< GALILEO signal is E5B */
  1582. } GalEphSignalSource;
  1583. typedef struct {
  1584. uint16_t gnssSvId;
  1585. /** Unique SV Identifier.
  1586. * For SV Range of supported constellation, please refer to the
  1587. * comment section of gnssSvId in GpsMeasUsageInfo.
  1588. */
  1589. GnssEphAction updateAction;
  1590. /**< Specifies the action and source of ephemeris. \n
  1591. - Type: int32 enum */
  1592. uint16_t IODE;
  1593. /**< Issue of data ephemeris used (unit-less). \n
  1594. GPS: IODE 8 bits.\n
  1595. BDS: AODE 5 bits. \n
  1596. GAL: SIS IOD 10 bits. \n
  1597. - Type: uint16
  1598. - Units: Unit-less */
  1599. double aSqrt;
  1600. /**< Square root of semi-major axis. \n
  1601. - Type: double
  1602. - Units: Square Root of Meters */
  1603. double deltaN;
  1604. /**< Mean motion difference from computed value. \n
  1605. - Type: double
  1606. - Units: Radians/Second */
  1607. double m0;
  1608. /**< Mean anomaly at reference time. \n
  1609. - Type: double
  1610. - Units: Radians */
  1611. double eccentricity;
  1612. /**< Eccentricity . \n
  1613. - Type: double
  1614. - Units: Unit-less */
  1615. double omega0;
  1616. /**< Longitude of ascending node of orbital plane at the weekly epoch. \n
  1617. - Type: double
  1618. - Units: Radians */
  1619. double i0;
  1620. /**< Inclination angle at reference time. \n
  1621. - Type: double
  1622. - Units: Radians */
  1623. double omega;
  1624. /**< Argument of Perigee. \n
  1625. - Type: double
  1626. - Units: Radians */
  1627. double omegaDot;
  1628. /**< Rate of change of right ascension. \n
  1629. - Type: double
  1630. - Units: Radians/Second */
  1631. double iDot;
  1632. /**< Rate of change of inclination angle. \n
  1633. - Type: double
  1634. - Units: Radians/Second */
  1635. double cUc;
  1636. /**< Amplitude of the cosine harmonic correction term to the argument of latitude. \n
  1637. - Type: double
  1638. - Units: Radians */
  1639. double cUs;
  1640. /**< Amplitude of the sine harmonic correction term to the argument of latitude. \n
  1641. - Type: double
  1642. - Units: Radians */
  1643. double cRc;
  1644. /**< Amplitude of the cosine harmonic correction term to the orbit radius. \n
  1645. - Type: double
  1646. - Units: Meters */
  1647. double cRs;
  1648. /**< Amplitude of the sine harmonic correction term to the orbit radius. \n
  1649. - Type: double
  1650. - Units: Meters */
  1651. double cIc;
  1652. /**< Amplitude of the cosine harmonic correction term to the angle of inclination. \n
  1653. - Type: double
  1654. - Units: Radians */
  1655. double cIs;
  1656. /**< Amplitude of the sine harmonic correction term to the angle of inclination. \n
  1657. - Type: double
  1658. - Units: Radians */
  1659. uint32_t toe;
  1660. /**< Reference time of ephemeris. \n
  1661. - Type: uint32
  1662. - Units: Seconds */
  1663. uint32_t toc;
  1664. /**< Clock data reference time of week. \n
  1665. - Type: uint32
  1666. - Units: Seconds */
  1667. double af0;
  1668. /**< Clock bias correction coefficient. \n
  1669. - Type: double
  1670. - Units: Seconds */
  1671. double af1;
  1672. /**< Clock drift coefficient. \n
  1673. - Type: double
  1674. - Units: Seconds/Second */
  1675. double af2;
  1676. /**< Clock drift rate correction coefficient. \n
  1677. - Type: double
  1678. - Units: Seconds/Seconds^2 */
  1679. } GnssEphCommon;
  1680. /* GPS Navigation Model Info */
  1681. typedef struct {
  1682. GnssEphCommon commonEphemerisData;
  1683. /**< Common ephemeris data. */
  1684. uint8_t signalHealth;
  1685. /**< Signal health. \n
  1686. Bit 0 : L5 Signal Health. \n
  1687. Bit 1 : L2 Signal Health. \n
  1688. Bit 2 : L1 Signal Health. \n
  1689. - Type: uint8
  1690. - Values: 3 bit mask of signal health, where set bit indicates unhealthy signal */
  1691. uint8_t URAI;
  1692. /**< User Range Accuracy Index. \n
  1693. - Type: uint8
  1694. - Units: Unit-less */
  1695. uint8_t codeL2;
  1696. /**< Indicates which codes are commanded ON for the L2 channel (2-bits). \n
  1697. - Type: uint8
  1698. Valid Values: \n
  1699. - 00 : Reserved
  1700. - 01 : P code ON
  1701. - 10 : C/A code ON */
  1702. uint8_t dataFlagL2P;
  1703. /**< L2 P-code indication flag. \n
  1704. - Type: uint8
  1705. - Value 1 indicates that the Nav data stream was commanded OFF on the P-code of the L2 channel. */
  1706. double tgd;
  1707. /**< Time of group delay. \n
  1708. - Type: double
  1709. - Units: Seconds */
  1710. uint8_t fitInterval;
  1711. /**< Indicates the curve-fit interval used by the CS. \n
  1712. - Type: uint8
  1713. Valid Values:
  1714. - 0 : Four hours
  1715. - 1 : Greater than four hours */
  1716. uint16_t IODC;
  1717. /**< Issue of Data, Clock. \n
  1718. - Type: uint16
  1719. - Units: Unit-less */
  1720. } GpsEphemeris;
  1721. /* GLONASS Navigation Model Info */
  1722. typedef struct {
  1723. uint16_t gnssSvId;
  1724. /**< GNSS SV ID.
  1725. - Type: uint16
  1726. - Range: 65 to 96 if known. When the slot number to SV ID mapping is unknown, set to 255 */
  1727. GnssEphAction updateAction;
  1728. /**< Specifies the action and source of ephemeris. \n
  1729. - Type: int32 enum */
  1730. uint8_t bnHealth;
  1731. /**< SV health flags. \n
  1732. - Type: uint8
  1733. Valid Values: \n
  1734. - 0 : Healthy
  1735. - 1 : Unhealthy */
  1736. uint8_t lnHealth;
  1737. /**< Ln SV health flags. GLONASS-M. \n
  1738. - Type: uint8
  1739. Valid Values: \n
  1740. - 0 : Healthy
  1741. - 1 : Unhealthy */
  1742. uint8_t tb;
  1743. /**< Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. \n
  1744. - Type: uint8
  1745. - Units: Unit-less */
  1746. uint8_t ft;
  1747. /**< SV accuracy index. \n
  1748. - Type: uint8
  1749. - Units: Unit-less */
  1750. uint8_t gloM;
  1751. /**< GLONASS-M flag. \n
  1752. - Type: uint8
  1753. Valid Values: \n
  1754. - 0 : GLONASS
  1755. - 1 : GLONASS-M */
  1756. uint8_t enAge;
  1757. /**< Characterizes "Age" of current information. \n
  1758. - Type: uint8
  1759. - Units: Days */
  1760. uint8_t gloFrequency;
  1761. /**< GLONASS frequency number + 8. \n
  1762. - Type: uint8
  1763. - Range: 1 to 14
  1764. */
  1765. uint8_t p1;
  1766. /**< Time interval between two adjacent values of tb parameter. \n
  1767. - Type: uint8
  1768. - Units: Minutes */
  1769. uint8_t p2;
  1770. /**< Flag of oddness ("1") or evenness ("0") of the value of tb \n
  1771. for intervals 30 or 60 minutes. \n
  1772. - Type: uint8 */
  1773. float deltaTau;
  1774. /**< Time difference between navigation RF signal transmitted in L2 sub-band \n
  1775. and aviation RF signal transmitted in L1 sub-band. \n
  1776. - Type: floating point
  1777. - Units: Seconds */
  1778. double position[3];
  1779. /**< Satellite XYZ position. \n
  1780. - Type: array of doubles
  1781. - Units: Meters */
  1782. double velocity[3];
  1783. /**< Satellite XYZ velocity. \n
  1784. - Type: array of doubles
  1785. - Units: Meters/Second */
  1786. double acceleration[3];
  1787. /**< Satellite XYZ sola-luni acceleration. \n
  1788. - Type: array of doubles
  1789. - Units: Meters/Second^2 */
  1790. float tauN;
  1791. /**< Satellite clock correction relative to GLONASS time. \n
  1792. - Type: floating point
  1793. - Units: Seconds */
  1794. float gamma;
  1795. /**< Relative deviation of predicted carrier frequency value \n
  1796. from nominal value at the instant tb. \n
  1797. - Type: floating point
  1798. - Units: Unit-less */
  1799. double toe;
  1800. /**< Complete ephemeris time, including N4, NT and Tb. \n
  1801. [(N4-1)*1461 + (NT-1)]*86400 + tb*900 \n
  1802. - Type: double
  1803. - Units: Seconds */
  1804. uint16_t nt;
  1805. /**< Current date, calendar number of day within four-year interval. \n
  1806. Starting from the 1-st of January in a leap year. \n
  1807. - Type: uint16
  1808. - Units: Days */
  1809. } GlonassEphemeris;
  1810. /* BDS Navigation Model Info */
  1811. typedef struct {
  1812. GnssEphCommon commonEphemerisData;
  1813. /**< Common ephemeris data. */
  1814. uint8_t svHealth;
  1815. /**< Satellite health information applied to both B1 and B2 (SatH1). \n
  1816. - Type: uint8
  1817. Valid Values: \n
  1818. - 0 : Healthy
  1819. - 1 : Unhealthy */
  1820. uint8_t AODC;
  1821. /**< Age of data clock. \n
  1822. - Type: uint8
  1823. - Units: Hours */
  1824. double tgd1;
  1825. /**< Equipment group delay differential on B1 signal. \n
  1826. - Type: double
  1827. - Units: Nano-Seconds */
  1828. double tgd2;
  1829. /**< Equipment group delay differential on B2 signal. \n
  1830. - Type: double
  1831. - Units: Nano-Seconds */
  1832. uint8_t URAI;
  1833. /**< User range accuracy index (4-bits). \n
  1834. - Type: uint8
  1835. - Units: Unit-less */
  1836. } BdsEphemeris;
  1837. /* GALIELO Navigation Model Info */
  1838. typedef struct {
  1839. GnssEphCommon commonEphemerisData;
  1840. /**< Common ephemeris data. */
  1841. GalEphSignalSource dataSourceSignal;
  1842. /**< Galileo Signal Source. \n
  1843. Valid Values: \n
  1844. - GAL_EPH_SIGNAL_SRC_UNKNOWN (0) -- GALILEO signal is unknown
  1845. - GAL_EPH_SIGNAL_SRC_E1B (1) -- GALILEO signal is E1B
  1846. - GAL_EPH_SIGNAL_SRC_E5A (2) -- GALILEO signal is E5A
  1847. - GAL_EPH_SIGNAL_SRC_E5B (3) -- GALILEO signal is E5B */
  1848. uint8_t sisIndex;
  1849. /**< Signal-in-space index for dual frequency E1-E5b/E5a depending on dataSignalSource. \n
  1850. - Type: uint8
  1851. - Units: Unit-less */
  1852. double bgdE1E5a;
  1853. /**< E1-E5a Broadcast group delay from F/Nav (E5A). \n
  1854. - Type: double
  1855. - Units: Seconds */
  1856. double bgdE1E5b;
  1857. /**< E1-E5b Broadcast group delay from I/Nav (E1B or E5B). \n
  1858. For E1B or E5B signal, both bgdE1E5a and bgdE1E5b are valid. \n
  1859. For E5A signal, only bgdE1E5a is valid. \n
  1860. Signal source identified using dataSignalSource. \n
  1861. - Type: double
  1862. - Units: Seconds */
  1863. uint8_t svHealth;
  1864. /**< SV health status of signal identified by dataSourceSignal. \n
  1865. - Type: uint8
  1866. Valid Values: \n
  1867. - 0 : Healthy
  1868. - 1 : Unhealthy */
  1869. } GalileoEphemeris;
  1870. /** GPS Navigation model for each SV */
  1871. typedef struct {
  1872. uint16_t numOfEphemeris;
  1873. GpsEphemeris gpsEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
  1874. } GpsEphemerisResponse;
  1875. /** GLONASS Navigation model for each SV */
  1876. typedef struct {
  1877. uint16_t numOfEphemeris;
  1878. GlonassEphemeris gloEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
  1879. } GlonassEphemerisResponse;
  1880. /** BDS Navigation model for each SV */
  1881. typedef struct {
  1882. uint16_t numOfEphemeris;
  1883. BdsEphemeris bdsEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
  1884. } BdsEphemerisResponse;
  1885. /** GALILEO Navigation model for each SV */
  1886. typedef struct {
  1887. uint16_t numOfEphemeris;
  1888. GalileoEphemeris galEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
  1889. } GalileoEphemerisResponse;
  1890. /** QZSS Navigation model for each SV */
  1891. typedef struct {
  1892. uint16_t numOfEphemeris;
  1893. GpsEphemeris qzssEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
  1894. } QzssEphemerisResponse;
  1895. typedef struct {
  1896. /** Indicates GNSS Constellation Type
  1897. Mandatory field */
  1898. Gnss_LocSvSystemEnumType gnssConstellation;
  1899. /** GPS System Time of the ephemeris report */
  1900. bool isSystemTimeValid;
  1901. GnssSystemTimeStructType systemTime;
  1902. union {
  1903. /** GPS Ephemeris */
  1904. GpsEphemerisResponse gpsEphemeris;
  1905. /** GLONASS Ephemeris */
  1906. GlonassEphemerisResponse glonassEphemeris;
  1907. /** BDS Ephemeris */
  1908. BdsEphemerisResponse bdsEphemeris;
  1909. /** GALILEO Ephemeris */
  1910. GalileoEphemerisResponse galileoEphemeris;
  1911. /** QZSS Ephemeris */
  1912. QzssEphemerisResponse qzssEphemeris;
  1913. } ephInfo;
  1914. } GnssSvEphemerisReport;
  1915. typedef struct {
  1916. /** GPS System Time of the iono model report */
  1917. bool isSystemTimeValid;
  1918. GnssSystemTimeStructType systemTime;
  1919. /** Indicates GNSS Constellation Type */
  1920. Gnss_LocSvSystemEnumType gnssConstellation;
  1921. float alpha0;
  1922. /**< Klobuchar Model Parameter Alpha 0.
  1923. - Type: float
  1924. - Unit: Seconds
  1925. */
  1926. float alpha1;
  1927. /**< Klobuchar Model Parameter Alpha 1.
  1928. - Type: float
  1929. - Unit: Seconds / Semi-Circle
  1930. */
  1931. float alpha2;
  1932. /**< Klobuchar Model Parameter Alpha 2.
  1933. - Type: float
  1934. - Unit: Seconds / Semi-Circle^2
  1935. */
  1936. float alpha3;
  1937. /**< Klobuchar Model Parameter Alpha 3.
  1938. - Type: float
  1939. - Unit: Seconds / Semi-Circle^3
  1940. */
  1941. float beta0;
  1942. /**< Klobuchar Model Parameter Beta 0.
  1943. - Type: float
  1944. - Unit: Seconds
  1945. */
  1946. float beta1;
  1947. /**< Klobuchar Model Parameter Beta 1.
  1948. - Type: float
  1949. - Unit: Seconds / Semi-Circle
  1950. */
  1951. float beta2;
  1952. /**< Klobuchar Model Parameter Beta 2.
  1953. - Type: float
  1954. - Unit: Seconds / Semi-Circle^2
  1955. */
  1956. float beta3;
  1957. /**< Klobuchar Model Parameter Beta 3.
  1958. - Type: float
  1959. - Unit: Seconds / Semi-Circle^3
  1960. */
  1961. } GnssKlobucharIonoModel;
  1962. typedef struct {
  1963. /** GPS System Time of the report */
  1964. bool isSystemTimeValid;
  1965. GnssSystemTimeStructType systemTime;
  1966. GnssAdditionalSystemInfoMask validityMask;
  1967. double tauC;
  1968. int8_t leapSec;
  1969. } GnssAdditionalSystemInfo;
  1970. /* Various Short Range Node Technology type*/
  1971. typedef enum {
  1972. SRN_AP_DATA_TECH_TYPE_NONE,
  1973. SRN_AP_DATA_TECH_TYPE_BT,
  1974. SRN_AP_DATA_TECH_TYPE_BTLE,
  1975. SRN_AP_DATA_TECH_TYPE_NFC,
  1976. SRN_AP_DATA_TECH_TYPE_MOBILE_CODE,
  1977. SRN_AP_DATA_TECH_TYPE_OTHER
  1978. } Gnss_SrnTech;
  1979. /* Mac Address type requested by modem */
  1980. typedef enum {
  1981. SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_INVALID, /* No valid mac address type send */
  1982. SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_PUBLIC, /* SRN AP MAC Address type PUBLIC */
  1983. SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_PRIVATE, /* SRN AP MAC Address type PRIVATE */
  1984. SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_OTHER, /* SRN AP MAC Address type OTHER */
  1985. }Gnss_Srn_MacAddr_Type;
  1986. typedef struct
  1987. {
  1988. uint32_t size;
  1989. Gnss_SrnTech srnTechType; /* SRN Technology type in request */
  1990. bool srnRequest; /* scan - start(true) or stop(false) */
  1991. bool e911Mode; /* If in E911 emergency */
  1992. Gnss_Srn_MacAddr_Type macAddrType; /* SRN AP MAC Address type */
  1993. } GnssSrnDataReq;
  1994. /* Provides the current GNSS SV Type configuration to the client.
  1995. * This is fetched via direct call to GNSS Adapter bypassing
  1996. * Location API */
  1997. typedef std::function<void(
  1998. const GnssSvTypeConfig& config
  1999. )> GnssSvTypeConfigCallback;
  2000. /*
  2001. * Represents the status of AGNSS augmented to support IPv4.
  2002. */
  2003. struct AGnssExtStatusIpV4 {
  2004. AGpsExtType type;
  2005. LocApnTypeMask apnTypeMask;
  2006. LocAGpsStatusValue status;
  2007. /*
  2008. * 32-bit IPv4 address.
  2009. */
  2010. uint32_t ipV4Addr;
  2011. LocSubId subId;
  2012. };
  2013. /*
  2014. * Represents the status of AGNSS augmented to support IPv6.
  2015. */
  2016. struct AGnssExtStatusIpV6 {
  2017. AGpsExtType type;
  2018. LocApnTypeMask apnTypeMask;
  2019. LocAGpsStatusValue status;
  2020. /*
  2021. * 128-bit IPv6 address.
  2022. */
  2023. uint8_t ipV6Addr[16];
  2024. };
  2025. /*
  2026. * Represents the the Nfw Notification structure
  2027. */
  2028. #define GNSS_MAX_NFW_APP_STRING_LEN 64
  2029. #define GNSS_MAX_NFW_STRING_LEN 20
  2030. typedef enum {
  2031. GNSS_NFW_CTRL_PLANE = 0,
  2032. GNSS_NFW_SUPL = 1,
  2033. GNSS_NFW_IMS = 10,
  2034. GNSS_NFW_SIM = 11,
  2035. GNSS_NFW_OTHER_PROTOCOL_STACK = 100
  2036. } GnssNfwProtocolStack;
  2037. typedef enum {
  2038. GNSS_NFW_CARRIER = 0,
  2039. GNSS_NFW_OEM = 10,
  2040. GNSS_NFW_MODEM_CHIPSET_VENDOR = 11,
  2041. GNSS_NFW_GNSS_CHIPSET_VENDOR = 12,
  2042. GNSS_NFW_OTHER_CHIPSET_VENDOR = 13,
  2043. GNSS_NFW_AUTOMOBILE_CLIENT = 20,
  2044. GNSS_NFW_OTHER_REQUESTOR = 100
  2045. } GnssNfwRequestor;
  2046. typedef enum {
  2047. GNSS_NFW_REJECTED = 0,
  2048. GNSS_NFW_ACCEPTED_NO_LOCATION_PROVIDED = 1,
  2049. GNSS_NFW_ACCEPTED_LOCATION_PROVIDED = 2,
  2050. } GnssNfwResponseType;
  2051. typedef struct {
  2052. char proxyAppPackageName[GNSS_MAX_NFW_APP_STRING_LEN];
  2053. GnssNfwProtocolStack protocolStack;
  2054. char otherProtocolStackName[GNSS_MAX_NFW_STRING_LEN];
  2055. GnssNfwRequestor requestor;
  2056. char requestorId[GNSS_MAX_NFW_STRING_LEN];
  2057. GnssNfwResponseType responseType;
  2058. bool inEmergencyMode;
  2059. bool isCachedLocation;
  2060. } GnssNfwNotification;
  2061. typedef uint16_t GnssMeasurementCorrectionsCapabilitiesMask;
  2062. typedef enum {
  2063. GNSS_MEAS_CORR_LOS_SATS = 1 << 0,
  2064. GNSS_MEAS_CORR_EXCESS_PATH_LENGTH = 1 << 1,
  2065. GNSS_MEAS_CORR_REFLECTING_PLANE = 1 << 2,
  2066. } GnssMeasurementCorrectionsCapabilities;
  2067. /* Represents GNSS NMEA Report Rate Configuration */
  2068. typedef enum {
  2069. GNSS_NMEA_REPORT_RATE_UNKNOWN = 0,
  2070. GNSS_NMEA_REPORT_RATE_1HZ = 1,
  2071. GNSS_NMEA_REPORT_RATE_NHZ = 2
  2072. } GnssNMEARptRate;
  2073. /* ODCPI Request Info */
  2074. enum OdcpiRequestType {
  2075. ODCPI_REQUEST_TYPE_START,
  2076. ODCPI_REQUEST_TYPE_STOP
  2077. };
  2078. struct OdcpiRequestInfo {
  2079. uint32_t size;
  2080. OdcpiRequestType type;
  2081. uint32_t tbfMillis;
  2082. bool isEmergencyMode;
  2083. bool isCivicAddressRequired;
  2084. };
  2085. struct EngineServiceInfo {
  2086. bool ppeIntEnabled; // flag to indicate whether internal ppe is enabled
  2087. };
  2088. /* Callback to send ODCPI request to framework */
  2089. typedef std::function<void(const OdcpiRequestInfo& request)> OdcpiRequestCallback;
  2090. /* ODCPI callback priorities*/
  2091. enum OdcpiPrioritytype {
  2092. ODCPI_HANDLER_PRIORITY_LOW,
  2093. ODCPI_HANDLER_PRIORITY_HIGH
  2094. };
  2095. /*
  2096. * Callback with AGNSS(IpV4) status information.
  2097. *
  2098. * @param status Will be of type AGnssExtStatusIpV4.
  2099. */
  2100. typedef void (*AgnssStatusIpV4Cb)(AGnssExtStatusIpV4 status);
  2101. /*
  2102. * Callback with AGNSS(IpV6) status information.
  2103. *
  2104. * @param status Will be of type AGnssExtStatusIpV6.
  2105. */
  2106. typedef void (*AgnssStatusIpV6Cb)(AGnssExtStatusIpV6 status);
  2107. /*
  2108. * Callback with NFW information.
  2109. */
  2110. typedef void(*NfwStatusCb)(GnssNfwNotification notification);
  2111. typedef bool(*IsInEmergencySession)(void);
  2112. enum AntennaInfoStatus {
  2113. ANTENNA_INFO_SUCCESS = 0,
  2114. ANTENNA_INFO_ERROR_ALREADY_INIT = 1,
  2115. ANTENNA_INFO_ERROR_GENERIC = 2
  2116. };
  2117. /*
  2118. * Callback with Measurement corrections information.
  2119. */
  2120. typedef void(*measCorrSetCapabilitiesCb)(GnssMeasurementCorrectionsCapabilitiesMask capabilities);
  2121. /*
  2122. * Callback with AGNSS(IpV6) status information.
  2123. *
  2124. * @param status Will be of type AGnssExtStatusIpV6.
  2125. */
  2126. typedef void (*AgnssStatusIpV6Cb)(AGnssExtStatusIpV6 status);
  2127. /*
  2128. * Callback with Antenna information.
  2129. */
  2130. typedef void(*antennaInfoCb)(std::vector<GnssAntennaInformation> gnssAntennaInformations);
  2131. typedef struct {
  2132. uint32_t size; // set to sizeof
  2133. uint64_t elapsedRealTime; // in ns
  2134. uint64_t elapsedRealTimeUnc; // in ns
  2135. double totalEnergyMilliJoule;
  2136. } GnssPowerStatistics;
  2137. /*
  2138. * Callback with Power indication.
  2139. */
  2140. typedef void(*powerIndicationCb)(GnssPowerStatistics gnssPowerStatistics);
  2141. /* Constructs for interaction with loc_net_iface library */
  2142. typedef void (*LocAgpsOpenResultCb)(bool isSuccess, AGpsExtType agpsType, const char* apn,
  2143. AGpsBearerType bearerType, void* userDataPtr);
  2144. typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr);
  2145. /* Shared resources of LocIpc */
  2146. #define LOC_IPC_HAL "/dev/socket/location/socket_hal"
  2147. #define LOC_IPC_XTRA "/dev/socket/location/xtra/socket_xtra"
  2148. #define LOC_IPC_DGNSS "/dev/socket/location/dgnss/socket_dgnss"
  2149. #define SOCKET_DIR_LOCATION "/dev/socket/location/"
  2150. #define SOCKET_DIR_EHUB "/dev/socket/location/ehub/"
  2151. #define SOCKET_TO_LOCATION_HAL_DAEMON "/dev/socket/loc_client/hal_daemon"
  2152. #define SOCKET_LOC_CLIENT_DIR "/dev/socket/loc_client/"
  2153. #define EAP_LOC_CLIENT_DIR "/data/vendor/location/extap_locclient/"
  2154. #define LOC_CLIENT_NAME_PREFIX "toclient"
  2155. // Please note that the socket name for all location hal daemon client need
  2156. // to start with LOC_CLIENT_NAME_PREFIX so that upon hal daemon restarts,
  2157. // every client can get the notification that hal daemon has restarted.
  2158. #define LOC_INTAPI_NAME_PREFIX LOC_CLIENT_NAME_PREFIX "_intapi"
  2159. typedef uint64_t NetworkHandle;
  2160. #define NETWORK_HANDLE_UNKNOWN ~0
  2161. #define MAX_NETWORK_HANDLES 10
  2162. #ifdef __cplusplus
  2163. }
  2164. #endif /* __cplusplus */
  2165. #endif /* GPS_EXTENDED_C_H */