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 
29 namespace OHOS {
30 namespace Location {
31 bool JsObjToGeoFenceRequest(const napi_env& env, const napi_value& object,
32     const std::shared_ptr<GeofenceRequest>& request);
33 bool ParseGnssGeofenceRequest(
34     const napi_env& env, const napi_value& value, std::shared_ptr<GeofenceRequest>& request);
35 bool GenGnssGeofenceRequest(
36     const napi_env& env, const napi_value& value, std::shared_ptr<GeofenceRequest>& reminder);
37 #ifdef NOTIFICATION_ENABLE
38 void JsObjToNotificationRequestList(const napi_env& env, const napi_value& object,
39     std::vector<OHOS::Notification::NotificationRequest>& notificationRequestList);
40 void GetNotificationRequestArray(const napi_env& env, const napi_value& notificationRequest,
41     std::vector<OHOS::Notification::NotificationRequest>& notificationRequestList);
42 #endif
43 void JsObjToGeofenceTransitionEventList(const napi_env& env, const napi_value& object,
44     std::vector<GeofenceTransitionEvent>& geofenceTransitionStatusList);
45 void GetGeofenceTransitionEventArray(const napi_env& env, const napi_value& monitorGeofenceTransition,
46     std::vector<GeofenceTransitionEvent>& geofenceTransitionStatusList);
47 #ifdef NOTIFICATION_ENABLE
48 void GenNotificationRequest(const napi_env& env, const napi_value& elementValue,
49     OHOS::Notification::NotificationRequest& notificationRequest);
50 #endif
51 void GeofenceTransitionToJs(const napi_env& env,
52     const GeofenceTransition geofenceTransition, napi_value& result);
53 void JsObjToGeofenceTransitionCallback(const napi_env& env, const napi_value& object,
54     sptr<LocationGnssGeofenceCallbackNapi> callbackHost);
55 }  // namespace Location
56 }  // namespace OHOS
57 #endif // GEOFENCE_NAPI_H
58