• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef GEOFENCE_NAPI_H
17 #define GEOFENCE_NAPI_H
18 
19 #include <list>
20 #include <string>
21 
22 #include "napi_util.h"
23 #include "geofence_request.h"
24 #ifdef NOTIFICATION_ENABLE
25 #include "notification.h"
26 #include "notification_request.h"
27 #endif
28 #include "beacon_fence.h"
29 
30 namespace OHOS {
31 namespace Location {
32 bool JsObjToGeoFenceRequest(const napi_env& env, const napi_value& object,
33     const std::shared_ptr<GeofenceRequest>& request);
34 bool ParseGnssGeofenceRequest(
35     const napi_env& env, const napi_value& value, std::shared_ptr<GeofenceRequest>& request);
36 bool GenGnssGeofenceRequest(
37     const napi_env& env, const napi_value& value, std::shared_ptr<GeofenceRequest>& reminder);
38 #ifdef NOTIFICATION_ENABLE
39 void JsObjToNotificationRequestList(const napi_env& env, const napi_value& object,
40     std::vector<std::shared_ptr<OHOS::Notification::NotificationRequest>>& notificationRequestList);
41 void GetNotificationRequestArray(const napi_env& env, const napi_value& notificationRequest,
42     std::vector<std::shared_ptr<OHOS::Notification::NotificationRequest>>& notificationRequestList);
43 #endif
44 void JsObjToGeofenceTransitionEventList(const napi_env& env, const napi_value& object,
45     std::vector<GeofenceTransitionEvent>& geofenceTransitionStatusList);
46 void GetGeofenceTransitionEventArray(const napi_env& env, const napi_value& monitorGeofenceTransition,
47     std::vector<GeofenceTransitionEvent>& geofenceTransitionStatusList);
48 #ifdef NOTIFICATION_ENABLE
49 void GenNotificationRequest(const napi_env& env, const napi_value& elementValue,
50     std::shared_ptr<OHOS::Notification::NotificationRequest>& notificationRequest);
51 #endif
52 void GeofenceTransitionToJs(const napi_env& env,
53     const GeofenceTransition geofenceTransition, napi_value& result);
54 void JsObjToGeofenceTransitionCallback(const napi_env& env, const napi_value& object,
55     sptr<LocationGnssGeofenceCallbackNapi> callbackHost);
56 napi_status SetValueBeacon(const napi_env& env, const char* fieldStr, napi_value& value, napi_value& result);
57 napi_value CreateBeaconFenceJsObj(const napi_env& env, const std::shared_ptr<BeaconFence>& beaconFence);
58 }  // namespace Location
59 }  // namespace OHOS
60 #endif // GEOFENCE_NAPI_H
61