1/* 2 * Copyright (c) 2022 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 HdiGeofence 18 * @{ 19 * 20 * @brief Provides unified APIs for the GNSS geofence service. 21 * 22 * A gnss service module can use the interfaces of this module to add fences, and delete fences, and monitor 23 * fence status changes. 24 * 25 * @since 3.2 26 */ 27 28/* 29 * @file IGeofenceCallback.idl 30 * 31 * @brief Define callback interfaces for reporting whether the geofence service is available, and reporting 32 * geofence events, and reporting geofence operation results. 33 * 34 * @since 3.2 35 * @version 1.0 36 */ 37 38package ohos.hdi.location.geofence.v1_0; 39 40import ohos.hdi.location.geofence.v1_0.GeofenceTypes; 41 42/* 43 * @brief Defines the geofence callback interface for reporting geofence service availability, geofence events, 44 * and geofence operation results. 45 * 46 * @since 3.2 47 */ 48[callback] interface IGeofenceCallback { 49 /* 50 * @brief Report whether the geofence service is available. 51 * 52 * @param isAvailable Indicates whether the geofence service is available. 53 * @return Returns <b>0</b> if reporting is successed; returns a negative value otherwise. 54 * 55 * @since 3.2 56 * @version 1.0 57 */ 58 ReportGeofenceAvailability([in] boolean isAvailable); 59 60 /* 61 * @brief Report of fence entry and exit events. 62 * 63 * @param fenceIndex Indicates geofence ID, this geofence ID is unique. 64 * @param location Indicates current Location. For details, see {@link Location}. 65 * @param event Indicates name of the currently report event. For details, see {@link GeofenceEvent}. 66 * @param timestamp Indicates timestamp when the geofence event is reported. Milliseconds since January 1, 1970. 67 * @return Returns <b>0</b> if reporting is successed; returns a negative value otherwise. 68 * 69 * @since 3.2 70 * @version 1.0 71 */ 72 ReportGeofenceEvent([in] int fenceIndex, 73 [in] struct LocationInfo location, 74 [in] enum GeofenceEvent event, 75 [in] long timestamp); 76 77 /* 78 * @brief Report the fence operation result. 79 * 80 * @param fenceIndex Indicates geofence ID, this geofence ID is unique. 81 * @param type Indicates geofence operation type. For details, see {@link GeofenceOperateType}. 82 * @param result Indicates geofence operation result. For details, see {@link GeofenceOperateResult}. 83 * @return Returns <b>0</b> if reporting is successed; returns a negative value otherwise. 84 * 85 * @since 3.2 86 * @version 1.0 87 */ 88 ReportGeofenceOperateResult([in] int fenceIndex, 89 [in] enum GeofenceOperateType type, 90 [in] enum GeofenceOperateResult result); 91} 92