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 
32 namespace OHOS {
33 namespace Location {
34 class GnssGeofenceAsyncContext : public AsyncContext {
35 public:
36     int code_{-1};
37     GeofenceTransition transition_{-1, GEOFENCE_TRANSITION_INIT};
38     sptr<LocationGnssGeofenceCallbackNapi> callbackHost_ = nullptr;
39     std::shared_ptr<GeofenceRequest> request_;
40     int fenceId_{-1};
41 
42     explicit GnssGeofenceAsyncContext(
43         napi_env env, napi_async_work work = nullptr, napi_deferred deferred = nullptr)
44         : AsyncContext(env, work, deferred), fenceId_(-1) {}
45 
46     GnssGeofenceAsyncContext() = delete;
47 
~GnssGeofenceAsyncContext()48     ~GnssGeofenceAsyncContext() override {}
49 };
50 }  // namespace Location
51 }  // namespace OHOS
52 #endif // GEOFENCE_ASYNC_CONTEXT_H