1 /* 2 * Copyright (C) 2022 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 LOCATOR_CALLBACK_PROXY_H 17 #define LOCATOR_CALLBACK_PROXY_H 18 19 #include "iremote_object.h" 20 #include "iremote_proxy.h" 21 #include "iremote_stub.h" 22 23 #include "message_parcel.h" 24 #include "message_option.h" 25 26 #include "i_locator_callback.h" 27 #include "location.h" 28 29 namespace OHOS { 30 namespace Location { 31 class LocatorCallbackProxy : public IRemoteProxy<ILocatorCallback> { 32 public: 33 explicit LocatorCallbackProxy(const sptr<IRemoteObject> &impl); 34 ~LocatorCallbackProxy() = default; 35 void OnLocationReport(const std::unique_ptr<Location>& location) override; 36 void OnLocatingStatusChange(const int status) override; 37 void OnErrorReport(const int errorCode) override; 38 private: 39 static inline BrokerDelegator<LocatorCallbackProxy> delegator_; 40 }; 41 42 class LocatorCallbackStub : public IRemoteStub<ILocatorCallback> { 43 public: 44 int32_t OnRemoteRequest(uint32_t code, 45 MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 46 void OnLocationReport(const std::unique_ptr<Location>& location) override; 47 void OnLocatingStatusChange(const int status) override; 48 void OnErrorReport(const int errorCode) override; 49 }; 50 } // namespace Location 51 } // namespace OHOS 52 #endif // LOCATOR_CALLBACK_PROXY_H 53