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 IGnssInterface.idl
32 *
33 * @brief Declares the APIs provided by the GNSS module for Start the GNSS chip, start the navigation,
34 * set the GNSS working mode, inject reference information, Delete auxiliary data, inject PGNSS data,
35 * obtain the number of GNSS cache locations, and obtain all cache locations.
36 *
37 * @since 3.2
38 * @version 1.0
39 */
40
41package ohos.hdi.location.gnss.v1_0;
42
43import ohos.hdi.location.gnss.v1_0.IGnssCallback;
44import ohos.hdi.location.gnss.v1_0.GnssTypes;
45
46/*
47 * @brief Defines the functions for performing basic operations on GNSS.
48 *
49 * The functions include  Start the GNSS chip, start the navigation,
50 * set the GNSS working mode, inject reference information, Delete auxiliary data, inject PGNSS data,
51 * obtain the number of GNSS cache locations, and obtain all cache locations.
52 *
53 * @since 3.2
54 */
55interface IGnssInterface {
56    /*
57     * @brief Setting GNSS configuration parameters.
58     *
59     * @param para Indicates GNSS configuration parameters, including basic GNSS parameters and GNSS cache
60     * function configuration parameters. For details, see {@link GnssConfigPara}.
61     * @return Returns <b>0</b> If the setting is successful; returns a negative value otherwise.
62     *
63     * @since 3.2
64     * @version 1.0
65     */
66    SetGnssConfigPara([in] struct GnssConfigPara para);
67
68    /*
69     * @brief Enable the GNSS module and transmit the callback of the upper layer to the GNSS module.
70     *
71     * @param callback Indicates Callback function sent by the upper layer to the GNSS driver. The GNSS driver returns
72     * location results and satellite status information by the callbacks. For details, see {@link IGnssCallback}.
73     * @return Returns <b>0</b> if the GNSS is successfully enabled; returns a negative value otherwise.
74     *
75     * @since 3.2
76     * @version 1.0
77     */
78    EnableGnss([in] IGnssCallback callbackObj);
79
80    /*
81     * @brief Disable the GNSS module.
82     *
83     * @return Returns <b>0</b> if the GNSS is successfully disabled; returns a negative value otherwise.
84     *
85     * @since 3.2
86     * @version 1.0
87     */
88    DisableGnss();
89
90    /*
91     * @brief Start the navigation function.
92     *
93     * @param type Indicates the GNSS startup type, which is used to distinguish between common GNSS positioning
94     * and GNSS caching function. For details, see {@link GnssStartType}.
95     * @return Returns <b>0</b> if the GNSS navigation is successfully started; returns a negative value otherwise.
96     *
97     * @since 3.2
98     * @version 1.0
99     */
100    StartGnss([in] enum GnssStartType type);
101
102    /*
103     * @brief Stop the navigation function.
104     *
105     * @param type Indicates the GNSS startup type, which is used to distinguish between common GNSS positioning
106     * and GNSS caching function. For details, see {@link GnssStartType}.
107     * @return Returns <b>0</b> if the GNSS navigation is successfully stopped; returns a negative value otherwise.
108     *
109     * @since 3.2
110     * @version 1.0
111     */
112    StopGnss([in] enum GnssStartType type);
113
114    /*
115     * @brief Inject reference information to the GNSS module.
116     *
117     * @param refInfo Indicates the GNSS reference information structure, including the reference time and reference
118     * location. For details, see {@link GnssRefInfo}.
119     * @return Returns <b>0</b> if ingestion succeeded; returns a negative value otherwise.
120     *
121     * @since 3.2
122     * @version 1.0
123     */
124    SetGnssReferenceInfo([in] struct GnssRefInfo refInfo);
125
126    /*
127     * @brief Delete the specified auxiliary data.
128     *
129     * @param data Indicates the type of auxiliary data to be deleted. For details, see {@link GnssAuxiliaryData}.
130     * @return Returns <b>0</b> if deleted successfully; returns a negative value otherwise.
131     *
132     * @since 3.2
133     * @version 1.0
134     */
135    DeleteAuxiliaryData([in] enum GnssAuxiliaryData data);
136
137    /*
138     * @brief Ingesting Predict Gnss Data.
139     *
140     * @param data Indicates Predict Gnss Data.
141     * @return Returns <b>0</b> if ingesting successfully; returns a negative value otherwise.
142     *
143     * @since 3.2
144     * @version 1.0
145     */
146    SetPredictGnssData([in] String data);
147
148    /*
149     * @brief Obtain the number of locations that can be cached by the GNSS module.
150     *
151     * @param size Indicates an output parameter used to receive the number of locations that can be
152     * cached by the GNSS module.
153     * @return Returns <b>0</b> if obtain size successfully; returns a negative value otherwise.
154     *
155     * @since 3.2
156     * @version 1.0
157     */
158    GetCachedGnssLocationsSize([out] int size);
159
160    /*
161     * @brief Request to obtain all the location information in the GNSS cache at a time and clear the cache buffer.
162     * The cache location is reported through callback.
163     *
164     * @return Returns <b>0</b> if sending request successfully; returns a negative value otherwise.
165     *
166     * @since 3.2
167     * @version 1.0
168     */
169    GetCachedGnssLocations();
170}