a22a2330创建于 2024年5月29日历史提交
/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * @addtogroup HdiGeofence
 * @{
 *
 * @brief Provides unified APIs for the GNSS geofence service.
 *
 * A gnss service module can use the interfaces of this module to add fences, and delete fences, and monitor
 * fence status changes.
 *
 * @since 5.0
 */

/*
 * @file IGeofenceCallback.idl
 *
 * @brief Define callback interfaces for reporting whether the geofence service is available, and reporting
 * geofence events, and reporting geofence operation results.
 *
 * @since 5.0
 * @version 2.0
 */

package ohos.hdi.location.geofence.v2_0;

import ohos.hdi.location.geofence.v2_0.GeofenceTypes;

/*
 * @brief Defines the geofence callback interface for reporting geofence service availability, geofence events,
 * and geofence operation results.
 *
 * @since 5.0
 */
[callback] interface IGeofenceCallback {
    /*
     * @brief Report whether the geofence service is available.
     *
     * @param isAvailable Indicates whether the geofence service is available.
     * @return Returns <b>0</b> if reporting is successed; returns a negative value otherwise.
     *
     * @since 5.0
     * @version 2.0
     */
    ReportGeofenceAvailability([in] boolean isAvailable);

    /*
     * @brief Report of fence entry and exit events.
     *
     * @param fenceIndex Indicates geofence ID, this geofence ID is unique.
     * @param location Indicates current Location. For details, see {@link Location}.
     * @param event Indicates name of the currently report event. For details, see {@link GeofenceEvent}.
     * @param timestamp Indicates timestamp when the geofence event is reported. Milliseconds since January 1, 1970.
     * @return Returns <b>0</b> if reporting is successed; returns a negative value otherwise.
     *
     * @since 5.0
     * @version 2.0
     */
    ReportGeofenceEvent([in] int fenceIndex,
                        [in] struct LocationInfo location,
                        [in] enum GeofenceEvent event,
                        [in] long timestamp);

    /*
     * @brief Report the fence operation result.
     *
     * @param fenceIndex Indicates geofence ID, this geofence ID is unique.
     * @param type Indicates geofence operation type. For details, see {@link GeofenceOperateType}.
     * @param result Indicates geofence operation result. For details, see {@link GeofenceOperateResult}.
     * @return Returns <b>0</b> if reporting is successed; returns a negative value otherwise.
     *
     * @since 5.0
     * @version 2.0
     */
    ReportGeofenceOperateResult([in] int fenceIndex,
                            [in] enum GeofenceOperateType type,
                            [in] enum GeofenceOperateResult result);
}
/** @} */