1/*
2 * Copyright (c) 2023 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 HdiLpfenceGeofence
18 * @{
19 *
20 * @brief Provides geofence APIs for the low-power fence service.
21 *
22 * You can use the APIs to add circle or polygon geofences, remove geofences, obtain relationship between a device and a geofence, and obtain the geographical location of a device. The geofence module can work continuously even when the AP is in sleep mode.
23 * The geofencing feature is used to determine whether a device reaches a specific geographical location, so that subsequent services, such as switching to the appropriate access card and pushing customized messages, can be implemented.
24 *
25 * @since 4.0
26 * @version 1.0
27 */
28
29/**
30 * @file IGeofenceCallback.idl
31 *
32 * @brief Defines the callbacks of the geofence module.
33 *
34 * @since 4.0
35 * @version 1.0
36 */
37
38/**
39 * @brief Declares the path of the geofence module interface package.
40 *
41 * @since 4.0
42 */
43package ohos.hdi.location.lpfence.geofence.v1_0;
44
45/**
46 * @brief Imports data types of the geofence module.
47 *
48 * @since 4.0
49 */
50import ohos.hdi.location.lpfence.geofence.v1_0.GeofenceTypes;
51
52/**
53 * @brief Defines the callback of the geofence module.
54 *
55 * Before enabling the geofencing feature, you need to register the callback to report the geofence status when the relationship between a geofence and a device changes.
56 * For details, see {@link ICellfenceInterface}.
57 *
58 * @since 4.0
59 */
60[callback] interface IGeofenceCallback {
61    /**
62     * @brief Called to report the result when a geofence is added.
63     *
64     *
65     *
66     * @param res Indicates the result of the geofence addition. For details, see {@link GeofenceResult}.
67     *
68     * @return Returns <b>0</b> if the callback is invoked successfully.
69     * @return Returns a negative value if the callback fails to be invoked.
70     *
71     * @since 4.0
72     */
73    OnGeofenceAddResultCb([in] struct GeofenceResult[] res);
74
75    /**
76     * @brief Called to report the result when a geofence is removed.
77     *
78     *
79     *
80     * @param res Indicates the result of the geofence removal. For details, see {@link GeofenceResult}.
81     *
82     * @return Returns <b>0</b> if the callback is invoked successfully.
83     * @return Returns a negative value if the callback fails to be invoked.
84     *
85     * @since 4.0
86     */
87    OnGeofenceRemoveResultCb([in] struct GeofenceResult[] res);
88
89    /**
90     * @brief Called when the geofence status changes.
91     *
92     * This callback will be invoked to report the geofence status when the relationship between a device and a geofence changes.
93     *
94     * @param geofenceId Indicates the ID of the geofence.
95     * @param location Indicates the latest location information. For details, see {@link GeoLocationInfo}.
96     * @param transition Indicates the new geofence status. For details, see {@link GeofenceTransition}.
97     * @param timestamp Indicates the timestamp when the geofence status changes.
98     *
99     * @return Returns <b>0</b> if the callback is invoked successfully.
100     * @return Returns a negative value if the callback fails to be invoked.
101     *
102     * @since 4.0
103     */
104    OnGeofenceTransitionCb([in] int geofenceId,
105                           [in] struct GeoLocationInfo location,
106                           [in] unsigned char transition,
107                           [in] long timestamp);
108
109    /**
110     * @brief Called to report the geofence information of a device.
111     *
112     *
113     *
114     * @param size Indicates the geofence usage information. For details, {@link GeofenceSize}.
115     *
116     * @return Returns <b>0</b> if the callback is invoked successfully.
117     * @return Returns a negative value if the callback fails to be invoked.
118     *
119     * @since 4.0
120     */
121    OnGetGeofenceSizeCb([in] struct GeofenceSize size);
122
123    /**
124     * @brief Called to report the base station offline database data.
125     *
126     *
127     *
128     * @param req Indicates the base station offline database data to request. For details, see {@link RequestCellDb}.
129     *
130     * @return Returns <b>0</b> if the callback is invoked successfully.
131     * @return Returns a negative value if the callback fails to be invoked.
132     *
133     * @since 4.0
134     */
135    OnGeofenceRequestCellDb([in] struct RequestCellDb req);
136
137    /**
138     * @brief Called to report the latest device location information.
139     *
140     *
141     *
142     * @param locSource Indicates the source of the location information. For details, see {@link GeofenceLocSource}.
143     * @param location Indicates the latest location information. For details, see {@link GeoLocationInfo}.
144     *
145     * @return Returns <b>0</b> if the callback is invoked successfully.
146     * @return Returns a negative value if the callback fails to be invoked.
147     *
148     * @since 4.0
149     */
150    OnGetCurrentLocationCb([in] int locSource,
151                         [in] struct GeoLocationInfo location);
152
153    /**
154     * @brief Called when the low-power fence service is reset.
155     *
156     *
157     *
158     * @return Returns <b>0</b> if the callback is invoked successfully.
159     * @return Returns a negative value if the callback fails to be invoked.
160     *
161     * @since 4.0
162     */
163    OnGeofenceReset();
164}
165/** @} */
166