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 I_SENSOR_SERVICE_H 17 #define I_SENSOR_SERVICE_H 18 19 #include <vector> 20 21 #include "errors.h" 22 #include "iremote_broker.h" 23 24 #include "i_sensor_client.h" 25 #include "sensor_basic_data_channel.h" 26 #include "sensor.h" 27 28 namespace OHOS { 29 namespace Sensors { 30 class ISensorService : public IRemoteBroker { 31 public: 32 ISensorService() = default; 33 virtual ~ISensorService() = default; 34 DECLARE_INTERFACE_DESCRIPTOR(u"ISensorService"); 35 virtual ErrCode EnableSensor(uint32_t sensorId, int64_t samplingPeriodNs, 36 int64_t maxReportDelayNs) = 0; 37 virtual ErrCode DisableSensor(uint32_t sensorId) = 0; 38 virtual std::vector<Sensor> GetSensorList() = 0; 39 virtual ErrCode TransferDataChannel(const sptr<SensorBasicDataChannel> &sensorBasicDataChannel, 40 const sptr<IRemoteObject> &sensorClient) = 0; 41 virtual ErrCode DestroySensorChannel(sptr<IRemoteObject> sensorClient) = 0; 42 enum { 43 ENABLE_SENSOR = 0, 44 DISABLE_SENSOR, 45 GET_SENSOR_STATE, 46 RUN_COMMAND, 47 GET_SENSOR_LIST, 48 TRANSFER_DATA_CHANNEL, 49 DESTROY_SENSOR_CHANNEL, 50 }; 51 }; 52 } // namespace Sensors 53 } // namespace OHOS 54 #endif // I_SENSOR_SERVICE_H 55