• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/*
17 * @addtogroup HdiGnss
18 * @{
19 *
20 * @brief Provides unified APIs for gnss services to access gnss drivers.
21 *
22 * A gnss service can obtain a gnss driver object or agent and then call APIs provided by this object or agent to
23 * access gnss devices, thereby Start the GNSS chip, start the navigation,
24 * set the GNSS working mode, inject reference information, obtain the positioning result, obtain the nmea,
25 * obtain the satellite status information, and obtain the cache location information.
26 *
27 * @since 3.2
28 */
29
30/*
31 * @file GnssTypes.idl
32 *
33 * @brief Defines the data structure used by the agnss module..
34 *
35 * @since 3.2
36 * @version 1.0
37 */
38
39package ohos.hdi.location.gnss.v1_0;
40
41/*
42 * @brief Defines the GNSS working mode.
43 *
44 * Defines the enumerated values of the GNSS working mode.
45 *
46 * @since 3.2
47 */
48enum GnssWorkingMode
49{
50    /* GNSS standalone (no assistance) */
51    GNSS_WORKING_MODE_STANDALONE = 1,
52
53    /* AGNSS MS-Based mode */
54    GNSS_WORKING_MODE_MS_BASED = 2,
55
56    /* AGPS MS-Assisted mode */
57    GNSS_WORKING_MODE_MS_ASSISTED = 3
58};
59
60/*
61 * @brief Defines the GNSS startup type.
62 *
63 * Defines the enumerated value of the GNSS startup type, which is used to distinguish between common GNSS positioning
64 * and GNSS caching(The bottom-layer buffer location is not reported, location is reported only after the upper-layer
65 * request or the bottom-layer FIFO is full).
66 *
67 * @since 3.2
68 */
69enum GnssStartType {
70    GNSS_START_TYPE_NORMAL = 1,
71    GNSS_START_TYPE_GNSS_CACHE = 2,
72};
73
74/*
75 * @brief Defines the gnss reference information type.
76 *
77 * The reference information includes the reference time, reference location, and best location.
78 *
79 * @since 3.2
80 */
81enum GnssRefInfoType {
82    GNSS_REF_INFO_TIME = 1,
83    GNSS_REF_INFO_LOCATION = 2,
84    GNSS_REF_INFO_BEST_LOCATION = 3,
85};
86
87/*
88 * @brief Defines the type of auxiliary data to be deleted.
89 *
90 * @since 3.2
91 */
92enum GnssAuxiliaryData {
93    GNSS_AUXILIARY_DATA_EPHEMERIS    = 1,
94    GNSS_AUXILIARY_DATA_ALMANAC      = 2,
95    GNSS_AUXILIARY_DATA_POSITION     = 4,
96    GNSS_AUXILIARY_DATA_TIME         = 8,
97    GNSS_AUXILIARY_DATA_IONO         = 16,
98    GNSS_AUXILIARY_DATA_UTC          = 32,
99    GNSS_AUXILIARY_DATA_HEALTH       = 64,
100    GNSS_AUXILIARY_DATA_SVDIR        = 128,
101    GNSS_AUXILIARY_DATA_SVSTEER      = 256,
102    GNSS_AUXILIARY_DATA_SADATA       = 512,
103    GNSS_AUXILIARY_DATA_RTI          = 1024,
104    GNSS_AUXILIARY_DATA_CELLDB_INFO  = 32768,
105    GNSS_AUXILIARY_DATA_ALL          = 65535
106};
107
108/*
109 * @brief Defines the enumerated values of the working status of the GNSS module.
110 *
111 * @since 3.2
112 */
113enum GnssWorkingStatus {
114    /* GNSS status unknown. */
115    GNSS_STATUS_NONE           = 0,
116
117    /* Navigation started. */
118    GNSS_STATUS_SESSION_BEGIN  = 1,
119
120    /* Navigation stoped. */
121    GNSS_STATUS_SESSION_END    = 2,
122
123    /* The GNSS chip is started, but the navigation is not started.. */
124    GNSS_STATUS_ENGINE_ON      = 3,
125
126    /* The GNSS chip is powered off. */
127    GNSS_STATUS_ENGINE_OFF     = 4
128};
129
130/*
131 * @brief Defines the GNSS capability.
132 *
133 * @since 3.2
134 */
135enum GnssCapabilities {
136    /* GNSS supports MS-Based AGNSS mode */
137    GNSS_CAP_SUPPORT_MSB = 1,
138
139    /* GNSS supports MS-Assisted AGNSS mode */
140    GNSS_CAP_SUPPORT_MSA = 2,
141
142    /* GNSS supports Geofencing  */
143    GNSS_CAP_SUPPORT_GEOFENCING = 4,
144
145    /* GNSS supports Measurements for at least GPS. */
146    GNSS_CAP_SUPPORT_MEASUREMENTS = 8,
147
148    /* GNSS supports Navigation Messages */
149    GNSS_CAP_SUPPORT_NAV_MESSAGES = 16,
150
151    /* GNSS supports location caching */
152    GNSS_CAP_SUPPORT_GNSS_CACHE = 32,
153};
154
155/*
156 * @brief Defines the GNSS satellite type.
157 *
158 * @since 3.2
159 */
160enum GnssConstellationType {
161    GNSS_CONSTELLATION_UNKNOWN = 0,
162
163    /* Global Positioning System. */
164    GNSS_CONSTELLATION_GPS     = 1,
165
166    /* Satellite-Based Augmentation System. */
167    GNSS_CONSTELLATION_SBAS    = 2,
168
169    /* Global Navigation Satellite System. */
170    GNSS_CONSTELLATION_GLONASS = 3,
171
172    /* Quasi-Zenith Satellite System. */
173    GNSS_CONSTELLATION_QZSS    = 4,
174
175    /* BeiDou Navigation Satellite System. */
176    GNSS_CONSTELLATION_BEIDOU  = 5,
177
178    /* Galileo Navigation Satellite System. */
179    GNSS_CONSTELLATION_GALILEO = 6,
180
181    /* Indian Regional Navigation Satellite System. */
182    GNSS_CONSTELLATION_IRNSS   = 7,
183};
184
185/*
186 * @brief Indicates the information contained in the satellite status information.
187 *
188 * @since 3.2
189 */
190enum SatellitesStatusFlag {
191    SATELLITES_STATUS_NONE                  = 0,
192    SATELLITES_STATUS_HAS_EPHEMERIS_DATA    = 1,
193    SATELLITES_STATUS_HAS_ALMANAC_DATA      = 2,
194    SATELLITES_STATUS_USED_IN_FIX           = 4,
195    SATELLITES_STATUS_HAS_CARRIER_FREQUENCY = 8
196};
197
198/*
199 * @brief Defines the satellite status information structure reported by the GNSS chip.
200 *
201 * @since 3.2
202 */
203struct SatelliteStatusInfo {
204    unsigned int satellitesNumber;
205
206    /* Pseudo-random or satellite ID number for the satellite. */
207    short[] satelliteIds;
208
209    /* Defines the constellation of the given SV. */
210    enum GnssConstellationType[] constellation;
211
212    /* Carrier-to-noise density in dB-Hz. */
213    float[] carrierToNoiseDensitys;
214
215    /* Elevation of SV in degrees. */
216    float[] elevation;
217
218    /* Azimuth of SV in degrees. */
219    float[] azimuths;
220
221    /* Carrier frequency of the signal tracked. */
222    float[] carrierFrequencies;
223
224    enum SatellitesStatusFlag flags;
225};
226
227/*
228 * @brief Defines basic GNSS configuration information.
229 *
230 * @since 3.2
231 */
232struct GnssBasicConfig {
233    /* min interval between locations in ms */
234    unsigned int minInterval;
235
236    /* expected accuracy in meters */
237    unsigned int accuracy;
238
239    /* time required for locating the first time in ms */
240    unsigned int firstFixTime;
241
242    boolean isPeriodicPositioning;
243
244    enum GnssWorkingMode gnssMode;
245};
246
247/*
248 * @brief Defines the configuration information of the GNSS cache function.
249 *
250 * @since 3.2
251 */
252struct GnssCachingConfig {
253    /* min interval between locations in ms */
254    unsigned int interval;
255
256    /* If the value is true, the cached locations are reported
257     * and the AP is woken up after the FIFO is full.
258     */
259    boolean fifoFullNotify;
260};
261
262/*
263 * @brief Defines the GNSS configuration information structure, including common GNSS configuration
264 * parameters and GNSS cache configuration parameters.
265 *
266 * @since 3.2
267 */
268struct GnssConfigPara {
269    struct GnssBasicConfig gnssBasic;
270    struct GnssCachingConfig gnssCaching;
271};
272
273/*
274 * @brief Defines the GNSS reference time.
275 *
276 * @since 3.2
277 */
278struct GnssRefTime {
279    long timeMs;
280    long timeReferenceMs;
281    int uncertainty;
282};
283
284/*
285 * @brief Defines the GNSS reference location.
286 *
287 * @since 3.2
288 */
289struct GnssRefLocation {
290    double latitude;
291    double longitude;
292    float accuracy;
293};
294
295/*
296 * @brief Defines the GNSS positioning result structure.
297 *
298 * @since 3.2
299 */
300struct LocationInfo {
301    double latitude;
302    double longitude;
303    double altitude;
304    float accuracy;
305    float speed;
306    double direction;
307    long timeStamp;
308    long timeSinceBoot;
309};
310
311/*
312 * @brief Defines the GNSS reference information structure, including the reference time and reference location.
313 *
314 * @since 3.2
315 */
316struct GnssRefInfo {
317    enum GnssRefInfoType type;
318    struct GnssRefTime time;
319    struct GnssRefLocation location;
320    struct LocationInfo best_location;
321};