/* * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LOCATOR_IMPL_H #define LOCATOR_IMPL_H #include #include "iremote_object.h" #include "constant_definition.h" #include "country_code.h" #include "geo_address.h" #include "geo_coding_mock_info.h" #include "i_cached_locations_callback.h" #include "locator.h" #include "locator_proxy.h" namespace OHOS { namespace Location { class LocatorImpl : public Locator { public: explicit LocatorImpl(); ~LocatorImpl() override; bool Init(); bool IsLocationEnabled() override; void ShowNotification() override; void RequestPermission() override; void RequestEnableLocation() override; void EnableAbility(bool enable) override; void StartLocating(std::unique_ptr& requestConfig, sptr& callback) override; void StopLocating(sptr& callback) override; std::unique_ptr GetCachedLocation() override; bool RegisterSwitchCallback(const sptr& callback, pid_t uid) override; bool UnregisterSwitchCallback(const sptr& callback) override; bool RegisterGnssStatusCallback(const sptr& callback, pid_t uid) override; bool UnregisterGnssStatusCallback(const sptr& callback) override; bool RegisterNmeaMessageCallback(const sptr& callback, pid_t uid) override; bool UnregisterNmeaMessageCallback(const sptr& callback) override; bool RegisterCountryCodeCallback(const sptr& callback, pid_t uid) override; bool UnregisterCountryCodeCallback(const sptr& callback) override; void RegisterCachedLocationCallback(std::unique_ptr& request, sptr& callback) override; void UnregisterCachedLocationCallback(sptr& callback) override; bool IsGeoServiceAvailable() override; void GetAddressByCoordinate(MessageParcel &data, std::list>& replyList) override; void GetAddressByLocationName(MessageParcel &data, std::list>& replyList) override; bool IsLocationPrivacyConfirmed(const int type) override; int SetLocationPrivacyConfirmStatus(const int type, bool isConfirmed) override; int GetCachedGnssLocationsSize() override; int FlushCachedGnssLocations() override; bool SendCommand(std::unique_ptr& commands) override; bool AddFence(std::unique_ptr& request) override; bool RemoveFence(std::unique_ptr& request) override; std::shared_ptr GetIsoCountryCode() override; bool EnableLocationMock() override; bool DisableLocationMock() override; bool SetMockedLocations( const int timeInterval, const std::vector> &location) override; bool EnableReverseGeocodingMock() override; bool DisableReverseGeocodingMock() override; bool SetReverseGeocodingMockInfo(std::vector>& mockInfo) override; bool ProxyUidForFreeze(int32_t uid, bool isProxy) override; bool ResetAllProxy() override; LocationErrCode IsLocationEnabledV9(bool &isEnabled) override; LocationErrCode EnableAbilityV9(bool enable) override; LocationErrCode StartLocatingV9(std::unique_ptr& requestConfig, sptr& callback) override; LocationErrCode StopLocatingV9(sptr& callback) override; LocationErrCode GetCachedLocationV9(std::unique_ptr &loc) override; LocationErrCode RegisterSwitchCallbackV9(const sptr& callback) override; LocationErrCode UnregisterSwitchCallbackV9(const sptr& callback) override; LocationErrCode RegisterGnssStatusCallbackV9(const sptr& callback) override; LocationErrCode UnregisterGnssStatusCallbackV9(const sptr& callback) override; LocationErrCode RegisterNmeaMessageCallbackV9(const sptr& callback) override; LocationErrCode UnregisterNmeaMessageCallbackV9(const sptr& callback) override; LocationErrCode RegisterCountryCodeCallbackV9(const sptr& callback) override; LocationErrCode UnregisterCountryCodeCallbackV9(const sptr& callback) override; LocationErrCode RegisterCachedLocationCallbackV9(std::unique_ptr& request, sptr& callback) override; LocationErrCode UnregisterCachedLocationCallbackV9(sptr& callback) override; LocationErrCode IsGeoServiceAvailableV9(bool &isAvailable) override; LocationErrCode GetAddressByCoordinateV9(MessageParcel &data, std::list>& replyList) override; LocationErrCode GetAddressByLocationNameV9(MessageParcel &data, std::list>& replyList) override; LocationErrCode IsLocationPrivacyConfirmedV9(const int type, bool &isConfirmed) override; LocationErrCode SetLocationPrivacyConfirmStatusV9(const int type, bool isConfirmed) override; LocationErrCode GetCachedGnssLocationsSizeV9(int &size) override; LocationErrCode FlushCachedGnssLocationsV9() override; LocationErrCode SendCommandV9(std::unique_ptr& commands) override; LocationErrCode AddFenceV9(std::unique_ptr& request) override; LocationErrCode RemoveFenceV9(std::unique_ptr& request) override; LocationErrCode GetIsoCountryCodeV9(std::shared_ptr& countryCode) override; LocationErrCode EnableLocationMockV9() override; LocationErrCode DisableLocationMockV9() override; LocationErrCode SetMockedLocationsV9( const int timeInterval, const std::vector> &location) override; LocationErrCode EnableReverseGeocodingMockV9() override; LocationErrCode DisableReverseGeocodingMockV9() override; LocationErrCode SetReverseGeocodingMockInfoV9(std::vector>& mockInfo) override; LocationErrCode ProxyUidForFreezeV9(int32_t uid, bool isProxy) override; LocationErrCode ResetAllProxyV9() override; private: std::unique_ptr client_; }; } // namespace Location } // namespace OHOS #endif // LOCATOR_IMPL_H