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 SENSOR_SERVICE_PROXY_H 17 #define SENSOR_SERVICE_PROXY_H 18 19 #include "errors.h" 20 #include "iremote_proxy.h" 21 #include "nocopyable.h" 22 23 #include "i_sensor_service.h" 24 #include "sensor_agent_type.h" 25 26 namespace OHOS { 27 namespace Sensors { 28 class SensorServiceProxy : public IRemoteProxy<ISensorService> { 29 public: 30 explicit SensorServiceProxy(const sptr<IRemoteObject> &impl); 31 virtual ~SensorServiceProxy() = default; 32 ErrCode EnableSensor(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) override; 33 ErrCode DisableSensor(int32_t sensorId) override; 34 int32_t GetSensorState(int32_t sensorId) override; 35 ErrCode RunCommand(int32_t sensorId, uint32_t cmdType, uint32_t params) override; 36 std::vector<Sensor> GetSensorList() override; 37 ErrCode TransferDataChannel(const sptr<SensorBasicDataChannel> &sensorBasicDataChannel, 38 const sptr<IRemoteObject> &sensorClient) override; 39 ErrCode DestroySensorChannel(sptr<IRemoteObject> sensorClient) override; 40 41 private: 42 DISALLOW_COPY_AND_MOVE(SensorServiceProxy); 43 static inline BrokerDelegator<SensorServiceProxy> delegator_; 44 }; 45 } // namespace Sensors 46 } // namespace OHOS 47 #endif // SENSOR_SERVICE_PROXY_H 48