1 /* 2 * Copyright (c) 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 NATIVE_SENSOR_IMPL 17 #define NATIVE_SENSOR_IMPL 18 19 #include "oh_sensor.h" 20 #include "sensor_agent_type.h" 21 22 struct Sensor_Info { 23 char sensorName[NAME_MAX_LEN]; /**< Sensor name */ 24 char vendorName[NAME_MAX_LEN]; /**< Sensor vendor */ 25 char firmwareVersion[VERSION_MAX_LEN]; /**< Sensor firmware version */ 26 char hardwareVersion[VERSION_MAX_LEN]; /**< Sensor hardware version */ 27 int32_t sensorTypeId = -1; /**< Sensor type ID */ 28 int32_t sensorId = -1; /**< Sensor ID */ 29 float maxRange = 0.0; /**< Maximum measurement range of the sensor */ 30 float precision = 0.0; /**< Sensor accuracy */ 31 float power = 0.0; /**< Sensor power */ 32 int64_t minSamplePeriod = -1; /**< Minimum sample period allowed, in ns */ 33 int64_t maxSamplePeriod = -1; /**< Maximum sample period allowed, in ns */ 34 }; 35 36 struct Sensor_SubscriptionAttribute { 37 int64_t samplingInterval = -1; 38 int64_t reportInterval = -1; 39 }; 40 41 struct Sensor_SubscriptionId { 42 int32_t sensorType = -1; 43 }; 44 45 struct Sensor_Subscriber { 46 char name[NAME_MAX_LEN]; 47 Sensor_EventCallback callback; 48 UserData *userData = nullptr; 49 }; 50 51 struct Sensor_Event { 52 int32_t sensorTypeId = -1; 53 int32_t version = -1; 54 int64_t timestamp = -1; 55 int32_t option = -1; 56 int32_t mode = -1; 57 uint8_t *data = nullptr; 58 uint32_t dataLen = 0; 59 }; 60 #endif // NATIVE_SENSOR_IMPL 61 62