1 /*
2 * Copyright (c) 2024 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 #ifdef HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE
16 #include "geofence_event_callback.h"
17 #include "location_log.h"
18 #include "gnss_ability.h"
19
20 #include "common_utils.h"
21
22 namespace OHOS {
23 namespace Location {
ReportGeofenceAvailability(bool isAvailable)24 int32_t GeofenceEventCallback::ReportGeofenceAvailability(bool isAvailable)
25 {
26 return 0;
27 }
28
ReportGeofenceEvent(int32_t fenceIndex,const HDI::Location::Geofence::V2_0::LocationInfo & location,GeofenceEvent event,int64_t timestamp)29 int32_t GeofenceEventCallback::ReportGeofenceEvent(int32_t fenceIndex,
30 const HDI::Location::Geofence::V2_0::LocationInfo& location, GeofenceEvent event, int64_t timestamp)
31 {
32 LBSLOGD(GNSS, "ReportGeofenceEvent enter");
33 auto gnssAbility = GnssAbility::GetInstance();
34 if (gnssAbility == nullptr) {
35 LBSLOGE(GNSS, "gnssAbility is nullptr");
36 return -1;
37 }
38 gnssAbility->ReportGeofenceEvent(fenceIndex, event);
39 return 0;
40 }
41
ReportGeofenceOperateResult(int32_t fenceIndex,GeofenceOperateType type,GeofenceOperateResult result)42 int32_t GeofenceEventCallback::ReportGeofenceOperateResult(
43 int32_t fenceIndex, GeofenceOperateType type, GeofenceOperateResult result)
44 {
45 LBSLOGD(GNSS, "ReportGeofenceOperateResult enter");
46 auto gnssAbility = GnssAbility::GetInstance();
47 if (gnssAbility == nullptr) {
48 LBSLOGE(GNSS, "gnssAbility is nullptr");
49 return -1;
50 }
51 gnssAbility->ReportGeofenceOperationResult(fenceIndex, type, result);
52 return 0;
53 }
54 } // namespace Location
55 } // namespace OHOS
56 #endif
57