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 HdiLpfenceCellfence
18 * @{
19 *
20 * @brief Provides cell fence APIs for low-power fence services.
21 *
22 * You can use the APIs to add or remove cell fences and obtain cell fence information of a device.
23 * The cell fence module is used to determine whether a device reaches a comparatively large area, so that subsequent services, for example, pushing the scenic spot introduction to tourists, can be implemented.
24 *
25 * @since 4.0
26 * @version 1.0
27 */
28
29/**
30 * @file ICellfenceInterface.idl
31 *
32 * @brief Declares the APIs provided by the cell fence module.
33 * You can use the APIs to add or remove cell fences and obtain cell fence information of a device.
34 * @since 4.0
35 * @version 1.0
36 */
37
38/**
39 * @brief Declares the path of the cell fence module interface package.
40 *
41 * @since 4.0
42 */
43package ohos.hdi.location.lpfence.cellfence.v1_0;
44
45/**
46 * @brief Imports the data types of the cell fence module.
47 *
48 * @since 4.0
49 */
50import ohos.hdi.location.lpfence.cellfence.v1_0.CellfenceTypes;
51
52/**
53 * @brief Imports the callback definitions of the cell fence module.
54 *
55 * @since 4.0
56 */
57import ohos.hdi.location.lpfence.cellfence.v1_0.ICellfenceCallback;
58
59/**
60 * @brief Defines APIs for basic cell fence operations.
61 *
62 * You can use the APIs to register or unregister a callback, add or remove cell fences, obtain the cell fence information of a device.
63 */
64interface ICellfenceInterface {
65    /**
66     * @brief Registers a callback.
67     *
68     * Before enabling the cell fencing feature, you need to register the callback to report the cell fence status when the relationship between a cell fence and a device changes.
69     *
70     * @param callbackObj Indicates the callback to register, which needs to be registered only once. For details, see {@link ICellfenceCallback}.
71     *
72     * @return Returns <b>0</b> if the operation is successful.
73     * @return Returns a negative value if the operation fails.
74     *
75     * @since 4.0
76     * @version 1.0
77     */
78    RegisterCellfenceCallback([in] ICellfenceCallback callbackObj);
79
80    /**
81     * @brief Unregisters a callback.
82     *
83     * When the cell fencing feature is no longer required or the registered callback needs to be changed, you need to unregister the callback.
84     *
85     * @param callbackObj Indicates the callback to unregister, which needs to be unregistered only once. For details, see {@link ICellfenceCallback}.
86     *
87     * @return Returns <b>0</b> if the operation is successful.
88     * @return Returns a negative value if the operation fails.
89     *
90     * @since 4.0
91     * @version 1.0
92     */
93    UnregisterCellfenceCallback([in] ICellfenceCallback callbackObj);
94
95    /**
96     * @brief Adds cell fences.
97     *
98     * Multiple cell fences can be added at a time. A cell fence contains information about multiple base stations.
99     *
100     * @param cellfence Indicates information about the cell fences to add. For details, see {@link CellfenceRequest}.
101     *
102     * @return Returns <b>0</b> if the operation is successful.
103     * @return Returns a negative value if the operation fails.
104     *
105     * @since 4.0
106     * @version 1.0
107     */
108    AddCellfences([in] struct CellfenceRequest[] cellfence);
109
110    /**
111     * @brief Removes cell fences.
112     *
113     * Multiple cell fences can be removed at a time.
114     *
115     * @param cellfenceId Indicates the cell fence ID. For details, see {@link CellfenceRequest}.
116     *
117     * @return Returns <b>0</b> if the operation is successful.
118     * @return Returns a negative value if the operation fails.
119     *
120     * @since 4.0
121     * @version 1.0
122     */
123    RemoveCellfences([in] int[] cellfenceId);
124
125    /**
126     * @brief Obtains the cell fence information, including the number of cell fences supported by and added for this device.
127     *
128     * The cell fence information is returned by the {@link OnGetWifenceSizeCb} callback.
129     *
130     * @return Returns <b>0</b> if the operation is successful.
131     * @return Returns a negative value if the operation fails.
132     *
133     * @since 4.0
134     * @version 1.0
135     */
136    GetCellfenceSize();
137}
138/** @} */
139