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