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