1 /*
2  * Copyright (c) 2023 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 LOCATION_CALLBACK_ADAPTER_IMPL_H
17 #define LOCATION_CALLBACK_ADAPTER_IMPL_H
18 
19 #include "i_locator_callback.h"
20 #include "location_adapter.h"
21 #include "location.h"
22 #include "ipc_object_stub.h"
23 #include "message_option.h"
24 #include "message_parcel.h"
25 #include "iremote_stub.h"
26 
27 namespace OHOS::NWeb {
28 class LocationCallbackImpl
29     : public OHOS::IRemoteStub<OHOS::Location::ILocatorCallback> {
30 public:
31     LocationCallbackImpl(std::shared_ptr<LocationCallbackAdapter> adapter);
32     ~LocationCallbackImpl() = default;
33 
34     virtual int OnRemoteRequest(uint32_t code,
35                               OHOS::MessageParcel& data,
36                               OHOS::MessageParcel& reply,
37                               OHOS::MessageOption& option) override;
38     void OnLocationReport(
39         const std::unique_ptr<OHOS::Location::Location>& location) override;
40     void OnLocatingStatusChange(const int status) override;
41     void OnErrorReport(const int errorCode) override;
42 private:
43     std::shared_ptr<LocationCallbackAdapter> locationCallbackAdapter_;
44 };
45 }
46 
47 #endif