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_ASYNC_CONTEXT_H 17 #define GEOFENCE_ASYNC_CONTEXT_H 18 19 #include <list> 20 #include <string> 21 22 #include "message_parcel.h" 23 #include "napi/native_api.h" 24 25 #include "async_context.h" 26 #include "constant_definition.h" 27 #include "location_log.h" 28 #include "location_gnss_geofence_callback_napi.h" 29 #include "geofence_definition.h" 30 #include "geofence_request.h" 31 #include "beacon_fence_request.h" 32 #include "beacon_fence.h" 33 34 namespace OHOS { 35 namespace Location { 36 class GnssGeofenceAsyncContext : public AsyncContext { 37 public: 38 int code_{-1}; 39 std::shared_ptr<BeaconFence> beaconFence_; 40 GeofenceTransition transition_{-1, GEOFENCE_TRANSITION_INIT, beaconFence_}; 41 sptr<LocationGnssGeofenceCallbackNapi> callbackHost_ = nullptr; 42 std::shared_ptr<GeofenceRequest> request_; 43 std::shared_ptr<BeaconFenceRequest> beaconRequest_; 44 int fenceId_{-1}; 45 bool clearBeaconFence_ = false; 46 47 explicit GnssGeofenceAsyncContext( 48 napi_env env, napi_async_work work = nullptr, napi_deferred deferred = nullptr) AsyncContext(env,work,deferred)49 : AsyncContext(env, work, deferred), fenceId_(-1) {} 50 51 GnssGeofenceAsyncContext() = delete; 52 ~GnssGeofenceAsyncContext()53 ~GnssGeofenceAsyncContext() override {} 54 }; 55 } // namespace Location 56 } // namespace OHOS 57 #endif // GEOFENCE_ASYNC_CONTEXT_H