1c5e268c6Sopenharmony_ci/*
2c5e268c6Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3c5e268c6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c5e268c6Sopenharmony_ci * you may not use this file except in compliance with the License.
5c5e268c6Sopenharmony_ci * You may obtain a copy of the License at
6c5e268c6Sopenharmony_ci *
7c5e268c6Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8c5e268c6Sopenharmony_ci *
9c5e268c6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10c5e268c6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c5e268c6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c5e268c6Sopenharmony_ci * See the License for the specific language governing permissions and
13c5e268c6Sopenharmony_ci * limitations under the License.
14c5e268c6Sopenharmony_ci */
15c5e268c6Sopenharmony_ci
16c5e268c6Sopenharmony_ci /**
17c5e268c6Sopenharmony_ci * @addtogroup HdiLpfenceGeofence
18c5e268c6Sopenharmony_ci * @{
19c5e268c6Sopenharmony_ci *
20c5e268c6Sopenharmony_ci * @brief Provides geofence APIs for the low-power fence service.
21c5e268c6Sopenharmony_ci *
22c5e268c6Sopenharmony_ci * 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.
23c5e268c6Sopenharmony_ci * 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.
24c5e268c6Sopenharmony_ci *
25c5e268c6Sopenharmony_ci * @since 4.0
26c5e268c6Sopenharmony_ci * @version 1.0
27c5e268c6Sopenharmony_ci */
28c5e268c6Sopenharmony_ci
29c5e268c6Sopenharmony_ci/**
30c5e268c6Sopenharmony_ci * @file IGeofenceCallback.idl
31c5e268c6Sopenharmony_ci *
32c5e268c6Sopenharmony_ci * @brief Defines the callbacks of the geofence module.
33c5e268c6Sopenharmony_ci *
34c5e268c6Sopenharmony_ci * @since 4.0
35c5e268c6Sopenharmony_ci * @version 1.0
36c5e268c6Sopenharmony_ci */
37c5e268c6Sopenharmony_ci
38c5e268c6Sopenharmony_ci/**
39c5e268c6Sopenharmony_ci * @brief Declares the path of the geofence module interface package.
40c5e268c6Sopenharmony_ci *
41c5e268c6Sopenharmony_ci * @since 4.0
42c5e268c6Sopenharmony_ci */
43c5e268c6Sopenharmony_cipackage ohos.hdi.location.lpfence.geofence.v1_0;
44c5e268c6Sopenharmony_ci
45c5e268c6Sopenharmony_ci/**
46c5e268c6Sopenharmony_ci * @brief Imports data types of the geofence module.
47c5e268c6Sopenharmony_ci *
48c5e268c6Sopenharmony_ci * @since 4.0
49c5e268c6Sopenharmony_ci */
50c5e268c6Sopenharmony_ciimport ohos.hdi.location.lpfence.geofence.v1_0.GeofenceTypes;
51c5e268c6Sopenharmony_ci
52c5e268c6Sopenharmony_ci/**
53c5e268c6Sopenharmony_ci * @brief Defines the callback of the geofence module.
54c5e268c6Sopenharmony_ci *
55c5e268c6Sopenharmony_ci * 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.
56c5e268c6Sopenharmony_ci * For details, see {@link ICellfenceInterface}.
57c5e268c6Sopenharmony_ci *
58c5e268c6Sopenharmony_ci * @since 4.0
59c5e268c6Sopenharmony_ci */
60c5e268c6Sopenharmony_ci[callback] interface IGeofenceCallback {
61c5e268c6Sopenharmony_ci    /**
62c5e268c6Sopenharmony_ci     * @brief Called to report the result when a geofence is added.
63c5e268c6Sopenharmony_ci     *
64c5e268c6Sopenharmony_ci     *
65c5e268c6Sopenharmony_ci     *
66c5e268c6Sopenharmony_ci     * @param res Indicates the result of the geofence addition. For details, see {@link GeofenceResult}.
67c5e268c6Sopenharmony_ci     *
68c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the callback is invoked successfully.
69c5e268c6Sopenharmony_ci     * @return Returns a negative value if the callback fails to be invoked.
70c5e268c6Sopenharmony_ci     *
71c5e268c6Sopenharmony_ci     * @since 4.0
72c5e268c6Sopenharmony_ci     */
73c5e268c6Sopenharmony_ci    OnGeofenceAddResultCb([in] struct GeofenceResult[] res);
74c5e268c6Sopenharmony_ci
75c5e268c6Sopenharmony_ci    /**
76c5e268c6Sopenharmony_ci     * @brief Called to report the result when a geofence is removed.
77c5e268c6Sopenharmony_ci     *
78c5e268c6Sopenharmony_ci     *
79c5e268c6Sopenharmony_ci     *
80c5e268c6Sopenharmony_ci     * @param res Indicates the result of the geofence removal. For details, see {@link GeofenceResult}.
81c5e268c6Sopenharmony_ci     *
82c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the callback is invoked successfully.
83c5e268c6Sopenharmony_ci     * @return Returns a negative value if the callback fails to be invoked.
84c5e268c6Sopenharmony_ci     *
85c5e268c6Sopenharmony_ci     * @since 4.0
86c5e268c6Sopenharmony_ci     */
87c5e268c6Sopenharmony_ci    OnGeofenceRemoveResultCb([in] struct GeofenceResult[] res);
88c5e268c6Sopenharmony_ci
89c5e268c6Sopenharmony_ci    /**
90c5e268c6Sopenharmony_ci     * @brief Called when the geofence status changes.
91c5e268c6Sopenharmony_ci     *
92c5e268c6Sopenharmony_ci     * This callback will be invoked to report the geofence status when the relationship between a device and a geofence changes.
93c5e268c6Sopenharmony_ci     *
94c5e268c6Sopenharmony_ci     * @param geofenceId Indicates the ID of the geofence.
95c5e268c6Sopenharmony_ci     * @param location Indicates the latest location information. For details, see {@link GeoLocationInfo}.
96c5e268c6Sopenharmony_ci     * @param transition Indicates the new geofence status. For details, see {@link GeofenceTransition}.
97c5e268c6Sopenharmony_ci     * @param timestamp Indicates the timestamp when the geofence status changes.
98c5e268c6Sopenharmony_ci     *
99c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the callback is invoked successfully.
100c5e268c6Sopenharmony_ci     * @return Returns a negative value if the callback fails to be invoked.
101c5e268c6Sopenharmony_ci     *
102c5e268c6Sopenharmony_ci     * @since 4.0
103c5e268c6Sopenharmony_ci     */
104c5e268c6Sopenharmony_ci    OnGeofenceTransitionCb([in] int geofenceId,
105c5e268c6Sopenharmony_ci                           [in] struct GeoLocationInfo location,
106c5e268c6Sopenharmony_ci                           [in] unsigned char transition,
107c5e268c6Sopenharmony_ci                           [in] long timestamp);
108c5e268c6Sopenharmony_ci
109c5e268c6Sopenharmony_ci    /**
110c5e268c6Sopenharmony_ci     * @brief Called to report the geofence information of a device.
111c5e268c6Sopenharmony_ci     *
112c5e268c6Sopenharmony_ci     *
113c5e268c6Sopenharmony_ci     *
114c5e268c6Sopenharmony_ci     * @param size Indicates the geofence usage information. For details, {@link GeofenceSize}.
115c5e268c6Sopenharmony_ci     *
116c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the callback is invoked successfully.
117c5e268c6Sopenharmony_ci     * @return Returns a negative value if the callback fails to be invoked.
118c5e268c6Sopenharmony_ci     *
119c5e268c6Sopenharmony_ci     * @since 4.0
120c5e268c6Sopenharmony_ci     */
121c5e268c6Sopenharmony_ci    OnGetGeofenceSizeCb([in] struct GeofenceSize size);
122c5e268c6Sopenharmony_ci
123c5e268c6Sopenharmony_ci    /**
124c5e268c6Sopenharmony_ci     * @brief Called to report the base station offline database data.
125c5e268c6Sopenharmony_ci     *
126c5e268c6Sopenharmony_ci     *
127c5e268c6Sopenharmony_ci     *
128c5e268c6Sopenharmony_ci     * @param req Indicates the base station offline database data to request. For details, see {@link RequestCellDb}.
129c5e268c6Sopenharmony_ci     *
130c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the callback is invoked successfully.
131c5e268c6Sopenharmony_ci     * @return Returns a negative value if the callback fails to be invoked.
132c5e268c6Sopenharmony_ci     *
133c5e268c6Sopenharmony_ci     * @since 4.0
134c5e268c6Sopenharmony_ci     */
135c5e268c6Sopenharmony_ci    OnGeofenceRequestCellDb([in] struct RequestCellDb req);
136c5e268c6Sopenharmony_ci
137c5e268c6Sopenharmony_ci    /**
138c5e268c6Sopenharmony_ci     * @brief Called to report the latest device location information.
139c5e268c6Sopenharmony_ci     *
140c5e268c6Sopenharmony_ci     *
141c5e268c6Sopenharmony_ci     *
142c5e268c6Sopenharmony_ci     * @param locSource Indicates the source of the location information. For details, see {@link GeofenceLocSource}.
143c5e268c6Sopenharmony_ci     * @param location Indicates the latest location information. For details, see {@link GeoLocationInfo}.
144c5e268c6Sopenharmony_ci     *
145c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the callback is invoked successfully.
146c5e268c6Sopenharmony_ci     * @return Returns a negative value if the callback fails to be invoked.
147c5e268c6Sopenharmony_ci     *
148c5e268c6Sopenharmony_ci     * @since 4.0
149c5e268c6Sopenharmony_ci     */
150c5e268c6Sopenharmony_ci    OnGetCurrentLocationCb([in] int locSource,
151c5e268c6Sopenharmony_ci                         [in] struct GeoLocationInfo location);
152c5e268c6Sopenharmony_ci
153c5e268c6Sopenharmony_ci    /**
154c5e268c6Sopenharmony_ci     * @brief Called when the low-power fence service is reset.
155c5e268c6Sopenharmony_ci     *
156c5e268c6Sopenharmony_ci     *
157c5e268c6Sopenharmony_ci     *
158c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the callback is invoked successfully.
159c5e268c6Sopenharmony_ci     * @return Returns a negative value if the callback fails to be invoked.
160c5e268c6Sopenharmony_ci     *
161c5e268c6Sopenharmony_ci     * @since 4.0
162c5e268c6Sopenharmony_ci     */
163c5e268c6Sopenharmony_ci    OnGeofenceReset();
164c5e268c6Sopenharmony_ci}
165c5e268c6Sopenharmony_ci/** @} */
166