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_PROXY_H 17 #define LOCATOR_PROXY_H 18 19 #include "iremote_broker.h" 20 #include "iremote_object.h" 21 #include "iremote_proxy.h" 22 #include "iremote_stub.h" 23 #include "constant_definition.h" 24 #include "i_cached_locations_callback.h" 25 #include "i_locator.h" 26 #include "i_locator_callback.h" 27 #include "location.h" 28 #include "request_config.h" 29 #include "satellite_status.h" 30 31 namespace OHOS { 32 namespace Location { 33 class LocatorProxy : public IRemoteProxy<ILocator> { 34 public: 35 explicit LocatorProxy(const sptr<IRemoteObject> &impl); 36 ~LocatorProxy() = default; 37 void UpdateSaAbility() override; 38 int GetSwitchState() override; 39 void EnableAbility(bool isEnabled) override; 40 void RegisterSwitchCallback(const sptr<IRemoteObject> &callback, pid_t uid) override; 41 void UnregisterSwitchCallback(const sptr<IRemoteObject> &callback) override; 42 void RegisterGnssStatusCallback(const sptr<IRemoteObject> &callback, pid_t uid) override; 43 void UnregisterGnssStatusCallback(const sptr<IRemoteObject> &callback) override; 44 void RegisterNmeaMessageCallback(const sptr<IRemoteObject> &callback, pid_t uid) override; 45 void UnregisterNmeaMessageCallback(const sptr<IRemoteObject> &callback) override; 46 int StartLocating(std::unique_ptr<RequestConfig>& requestConfig, 47 sptr<ILocatorCallback>& callback, std::string bundleName, pid_t pid, pid_t uid) override; 48 int StopLocating(sptr<ILocatorCallback>& callback) override; 49 int GetCacheLocation(MessageParcel &data, MessageParcel &replay) override; 50 int IsGeoConvertAvailable(MessageParcel &data, MessageParcel &replay) override; 51 int GetAddressByCoordinate(MessageParcel &data, MessageParcel &replay) override; 52 int GetAddressByLocationName(MessageParcel &data, MessageParcel &replay) override; 53 bool IsLocationPrivacyConfirmed(const int type) override; 54 void SetLocationPrivacyConfirmStatus(const int type, bool isConfirmed) override; 55 56 int RegisterCachedLocationCallback(std::unique_ptr<CachedGnssLocationsRequest>& request, 57 sptr<ICachedLocationsCallback>& callback, std::string bundleName) override; 58 int UnregisterCachedLocationCallback(sptr<ICachedLocationsCallback>& callback) override; 59 60 int GetCachedGnssLocationsSize() override; 61 int FlushCachedGnssLocations() override; 62 void SendCommand(std::unique_ptr<LocationCommand>& commands) override; 63 64 void AddFence(std::unique_ptr<GeofenceRequest>& request) override; 65 void RemoveFence(std::unique_ptr<GeofenceRequest>& request) override; 66 private: 67 static inline BrokerDelegator<LocatorProxy> delegator_; 68 }; 69 } // namespace Location 70 } // namespace OHOS 71 #endif // LOCATOR_PROXY_H 72