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 CellfenceTypes.idl 31 * 32 * @brief Defines the data types used by the cell fence module. 33 * 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 Enumerates the location relationships between a device and a cell fence. 47 * 48 * @since 4.0 49 */ 50enum CellfenceTransition { 51 /** The device is within the cell fence. */ 52 FENCE_ENTER = 0, 53 /** The device is out of the cell fence. */ 54 FENCE_EXIT = 3, 55}; 56 57/** 58 * @brief Defines the struct of the cell fence information. 59 * 60 * @since 4.0 61 */ 62struct CellfenceInfo { 63 /** Location area code (LAC) of the base station. */ 64 unsigned int lac; 65 /** Cell ID. */ 66 unsigned long cellId; 67}; 68 69/** 70 * @brief Defines the struct for a cell fence to add. 71 * 72 * @since 4.0 73 */ 74struct CellfenceRequest { 75 /** ID of the cell fence to add. A cell fence with the same ID cannot be added repeatedly. */ 76 int cellfenceId; 77 /** Cell fence information. For details, see {@Link CellfenceInfo}. */ 78 struct CellfenceInfo[] cellInfo; 79}; 80 81/** 82 * @brief Defines the struct for the relationship between a device and a cell fence. 83 * 84 * @since 4.0 85 */ 86struct CellfenceStatus { 87 /** Cell fence ID. */ 88 int cellfenceId; 89 /** Location relationship between the device and the cell fence. For details, see {@Link CellfenceTransition}. */ 90 unsigned short status; 91}; 92 93/** 94 * @brief Defines the struct for the cell fence information of a device. 95 * 96 * @since 4.0 97 */ 98struct CellfenceSize { 99 /** Maximum number of cell fences supported by the device. */ 100 unsigned int maxNum; 101 /** Number of cell fences added for the device. */ 102 unsigned int usedNum; 103}; 104/** @} */ 105