1 /*
2  * Copyright (c) 2021-2023 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 "active_info.h"
25 #include "i_sensor_client.h"
26 #include "sensor_basic_data_channel.h"
27 #include "sensor.h"
28 #include "sensors_ipc_interface_code.h"
29 
30 namespace OHOS {
31 namespace Sensors {
32 class ISensorService : public IRemoteBroker {
33 public:
34     ISensorService() = default;
35     virtual ~ISensorService() = default;
36     DECLARE_INTERFACE_DESCRIPTOR(u"ISensorService");
37     virtual ErrCode EnableSensor(int32_t sensorId, int64_t samplingPeriodNs,
38                                  int64_t maxReportDelayNs) = 0;
39     virtual ErrCode DisableSensor(int32_t sensorId) = 0;
40     virtual std::vector<Sensor> GetSensorList() = 0;
41     virtual ErrCode TransferDataChannel(const sptr<SensorBasicDataChannel> &sensorBasicDataChannel,
42                                         const sptr<IRemoteObject> &sensorClient) = 0;
43     virtual ErrCode DestroySensorChannel(sptr<IRemoteObject> sensorClient) = 0;
44     virtual ErrCode SuspendSensors(int32_t pid) = 0;
45     virtual ErrCode ResumeSensors(int32_t pid) = 0;
46     virtual ErrCode GetActiveInfoList(int32_t pid, std::vector<ActiveInfo> &activeInfoList) = 0;
47     virtual ErrCode CreateSocketChannel(sptr<IRemoteObject> sensorClient, int32_t &clientFd) = 0;
48     virtual ErrCode DestroySocketChannel(sptr<IRemoteObject> sensorClient) = 0;
49     virtual ErrCode EnableActiveInfoCB() = 0;
50     virtual ErrCode DisableActiveInfoCB() = 0;
51     virtual ErrCode ResetSensors() = 0;
52 };
53 }  // namespace Sensors
54 }  // namespace OHOS
55 #endif // I_SENSOR_SERVICE_H
56