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_INTERFACE_H 17 #define SENSOR_SERVICE_INTERFACE_H 18 19 #include "iproxy_server.h" 20 #include "ipc_skeleton.h" 21 #include "sensor_if.h" 22 #include "sensor_service.h" 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif 29 30 #define TASK_CONFIG_STACK_SIZE 0x800 31 #define TASK_CONFIG_QUEUE_SIZE 20 32 33 const char *SENSOR_GetName(Service *service); 34 BOOL Initialize(Service *service, Identity identity); 35 BOOL MessageHandle(Service *service, Request *msg); 36 TaskConfig GetTaskConfig(Service *service); 37 int32_t GetAllSensorsImpl(SensorInfo **sensorInfo, int32_t *count); 38 int32_t ActivateSensorImpl(int32_t sensorId, const SensorUser *user); 39 int32_t DeactivateSensorImpl(int32_t sensorId, const SensorUser *user); 40 int32_t SetBatchImpl(int32_t sensorId, const SensorUser *user, int64_t samplingInterval, int64_t reportInterval); 41 int32_t SubscribeSensorImpl(int32_t sensorId, const SensorUser *user); 42 int32_t UnsubscribeSensorImpl(int32_t sensorId, const SensorUser *user); 43 int32_t SetModeImpl(int32_t sensorId, const SensorUser *user, int32_t mode); 44 int32_t SetOptionImpl(int32_t sensorId, const SensorUser *user, int32_t option); 45 46 typedef int32 (*InvokeFunc)(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 47 int32_t GetAllSensorsInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 48 int32_t ActivateSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 49 int32_t DeactivateSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 50 int32_t SetBatchInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 51 int32_t SubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 52 int32_t UnsubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 53 int32_t SetModeInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 54 int32_t SetOptionInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply); 55 void SetSvcIdentity(IpcIo *req, const IpcIo *reply); 56 #ifdef __cplusplus 57 #if __cplusplus 58 } 59 #endif 60 #endif 61 #endif