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 GNSS_ABILITY_PROXY_H 17 #define GNSS_ABILITY_PROXY_H 18 #ifdef FEATURE_GNSS_SUPPORT 19 20 #include <vector> 21 22 #include "iremote_object.h" 23 #include "iremote_proxy.h" 24 25 #include "constant_definition.h" 26 #include "gnss_ability_skeleton.h" 27 28 namespace OHOS { 29 namespace Location { 30 class GnssAbilityProxy : public IRemoteProxy<IGnssAbility> { 31 public: 32 explicit GnssAbilityProxy(const sptr<IRemoteObject> &impl); 33 ~GnssAbilityProxy() = default; 34 LocationErrCode SendLocationRequest(WorkRecord &workrecord) override; 35 LocationErrCode SetEnable(bool state) override; 36 LocationErrCode RefrashRequirements() override; 37 LocationErrCode RegisterGnssStatusCallback(const sptr<IRemoteObject>& callback, pid_t uid) override; 38 LocationErrCode UnregisterGnssStatusCallback(const sptr<IRemoteObject>& callback) override; 39 LocationErrCode RegisterNmeaMessageCallback(const sptr<IRemoteObject>& callback, pid_t uid) override; 40 LocationErrCode UnregisterNmeaMessageCallback(const sptr<IRemoteObject>& callback) override; 41 LocationErrCode RegisterCachedCallback(const std::unique_ptr<CachedGnssLocationsRequest>& request, 42 const sptr<IRemoteObject>& callback) override; 43 LocationErrCode UnregisterCachedCallback(const sptr<IRemoteObject>& callback) override; 44 LocationErrCode GetCachedGnssLocationsSize(int &size) override; 45 LocationErrCode FlushCachedGnssLocations() override; 46 LocationErrCode SendCommand(std::unique_ptr<LocationCommand>& commands) override; 47 LocationErrCode AddFence(std::unique_ptr<GeofenceRequest>& request) override; 48 LocationErrCode RemoveFence(std::unique_ptr<GeofenceRequest>& request) override; 49 LocationErrCode EnableMock() override; 50 LocationErrCode DisableMock() override; 51 LocationErrCode SetMocked(const int timeInterval, const std::vector<std::shared_ptr<Location>> &location) override; 52 private: 53 static inline BrokerDelegator<GnssAbilityProxy> delegator_; 54 }; 55 } // namespace Location 56 } // namespace OHOS 57 #endif // FEATURE_GNSS_SUPPORT 58 #endif // GNSS_ABILITY_PROXY_H 59