1 /* 2 * Copyright (C) 2021 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 SERVICES_INCLUDE_TIME_SERVICE_PROXY_H 17 #define SERVICES_INCLUDE_TIME_SERVICE_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "time_service_interface.h" 21 22 namespace OHOS { 23 namespace MiscServices { 24 class TimeServiceProxy : public IRemoteProxy<ITimeService> { 25 public: 26 explicit TimeServiceProxy(const sptr<IRemoteObject> &object); 27 ~TimeServiceProxy() = default; 28 DISALLOW_COPY_AND_MOVE(TimeServiceProxy); 29 30 int32_t SetTime(int64_t time, APIVersion apiVersion = APIVersion::API_VERSION_7) override; 31 int32_t SetTimeZone(const std::string &timeZoneId, APIVersion apiVersion = APIVersion::API_VERSION_7) override; 32 int32_t GetTimeZone(std::string &timeZoneId) override; 33 int32_t GetWallTimeMs(int64_t ×) override; 34 int32_t GetWallTimeNs(int64_t ×) override; 35 int32_t GetBootTimeMs(int64_t ×) override; 36 int32_t GetBootTimeNs(int64_t ×) override; 37 int32_t GetMonotonicTimeMs(int64_t ×) override; 38 int32_t GetMonotonicTimeNs(int64_t ×) override; 39 int32_t GetThreadTimeMs(int64_t ×) override; 40 int32_t GetThreadTimeNs(int64_t ×) override; 41 int32_t CreateTimer(const std::shared_ptr<ITimerInfo> &timerOptions, sptr<IRemoteObject> &timerCallback, 42 uint64_t &timerId) override; 43 int32_t StartTimer(uint64_t timerId, uint64_t triggerTime) override; 44 int32_t StopTimer(uint64_t timerId) override; 45 int32_t DestroyTimer(uint64_t timerId) override; 46 bool ProxyTimer(int32_t uid, bool isProxy, bool needRetrigger) override; 47 bool ResetAllProxy() override; 48 private: 49 static inline BrokerDelegator<TimeServiceProxy> delegator_; 50 }; 51 } // namespace MiscServices 52 } // namespace OHOS 53 #endif // SERVICES_INCLUDE_TIME_SERVICE_PROXY_H