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 HdiLpfenceWififence 18 * @{ 19 * 20 * @brief Provides Wi-Fi fence APIs for the low-power fence service. 21 * 22 * You can use the APIs provided by this module to add or remove Wi-Fi fences, obtain Wi-Fi fence information of a device, and obtain the relationship between a device and a Wi-Fi fence. 23 * The Wi-Fi fence feature is used to determine whether a device is in a specific indoor location, for example, an area at home or a store in a shopping mall. 24 * 25 * @since 4.0 26 * @version 1.0 27 */ 28 29/** 30 * @file IWififenceInterface.idl 31 * 32 * @brief Declares the callbacks for the Wi-Fi fence module. 33 * 34 * @since 4.0 35 * @version 1.0 36 */ 37 38/** 39 * @brief Declares the path of the Wi-Fi fence module interface package. 40 * 41 * @since 4.0 42 */ 43package ohos.hdi.location.lpfence.wififence.v1_0; 44 45/** 46 * @brief Imports data types of the Wi-Fi fence module. 47 * 48 * @since 4.0 49 */ 50import ohos.hdi.location.lpfence.wififence.v1_0.WififenceTypes; 51 52/** 53 * @brief Imports callbacks of the Wi-Fi fence module. 54 * 55 * @since 4.0 56 */ 57import ohos.hdi.location.lpfence.wififence.v1_0.IWififenceCallback; 58 59/** 60 * @brief Provides APIs for basic Wi-Fi fence operations. 61 * 62 * You can use the APIs to register or unregister a callback, add or remove Wi-Fi fences, obtain Wi-Fi fence information of a device, and determine whether a device is in a specific location. 63 */ 64interface IWififenceInterface { 65 /** 66 * @brief Registers a callback. 67 * 68 * Before enabling the Wi-Fi fence feature, you need to register a callback to report the Wi-Fi fence status when the status changes. 69 * 70 * @param callbackObj Indicates the callback to register, which needs to be registered only once. For details, see {@link IWififenceCallback}. 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 RegisterWififenceCallback([in] IWififenceCallback callbackObj); 79 80 /** 81 * @brief Unregisters a callback. 82 * 83 * When the Wi-Fi fence 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 IWififenceCallback}. 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 UnregisterWififenceCallback([in] IWififenceCallback callbackObj); 94 95 /** 96 * @brief Adds Wi-Fi fences. 97 * 98 * Multiple Wi-Fi fences can be added at a time. A Wi-Fi fence contains multiple groups of MAC addresses. 99 * 100 * @param wififence Indicates information about the Wi-Fi fences to add. For details, see {@link WififenceRequest}. 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 AddWififences([in] struct WififenceRequest[] wififence); 109 110 /** 111 * @brief Removes Wi-Fi fences. 112 * 113 * Multiple Wi-Fi fences can be removed at a time. 114 * 115 * @param wififenceId Indicates the IDs of the Wi-Fi fences to remove. For details, see {@link WififenceRequest}. 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 RemoveWififences([in] int[] wififenceId); 124 125 /** 126 * @brief Obtains the relationship between a Wi-Fi fence and this device. 127 * 128 * For details about the relationships between a device and a Wi-Fi fence, see {@link WififenceTransition}. 129 * 130 * @param wififenceId Indicates the ID of the Wi-Fi fence. 131 * 132 * @return Returns the information obtained if the operation is successful. For details, see {@link WififenceTransition}. 133 * @return Returns a negative value if the operation fails. 134 * 135 * @since 4.0 136 * @version 1.0 137 */ 138 GetWififenceStatus([in] int wififenceId); 139 140 /** 141 * @brief Obtains the Wi-Fi fence information for this device. 142 * 143 * You can use this API to obtain information about the maximum number of Wi-Fi fences allowed for and the number of Wi-Fi fences added to a device. The information obtained is returned by {@link OnGetWifenceSizeCb}. 144 * 145 * @return Returns <b>0</b> if the operation is successful. 146 * @return Returns a negative value if the operation fails. 147 * 148 * @since 4.0 149 * @version 1.0 150 */ 151 GetWififenceSize(); 152} 153/** @} */ 154