已合并
dms测试框架mock #18324
wulong158创建于 3月5日
dms测试框架mock #18324
已合并
共 6 个文件变更+891-0
| @@ -0,0 +1,125 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2025 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 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +namespace OHOS { | ||
| 23 | +namespace PowerMgr { | ||
| 24 | + | ||
| 25 | +enum class PowerErrors : int32_t { | ||
| 26 | + ERR_OK = 0, | ||
| 27 | + ERR_FAILURE = 1, | ||
| 28 | + ERR_PERMISSION_DENIED = 201, | ||
| 29 | + ERR_SYSTEM_API_DENIED = 202, | ||
| 30 | + ERR_PARAM_INVALID = 401, | ||
| 31 | + ERR_CONNECTION_FAIL = 4900101, | ||
| 32 | + ERR_FREQUENT_FUNCTION_CALL = 4900201, | ||
| 33 | + ERR_POWER_MODE_TRANSIT_FAILED = 4900301, | ||
| 34 | +}; | ||
| 35 | + | ||
| 36 | +enum class WakeupDeviceType : uint32_t { | ||
| 37 | + WAKEUP_DEVICE_UNKNOWN = 0, | ||
| 38 | + WAKEUP_DEVICE_POWER_BUTTON = 1, | ||
| 39 | + WAKEUP_DEVICE_APPLICATION = 2, | ||
| 40 | + WAKEUP_DEVICE_PLUGGED_IN = 3, | ||
| 41 | + WAKEUP_DEVICE_GESTURE = 4, | ||
| 42 | + WAKEUP_DEVICE_CAMERA_LAUNCH = 5, | ||
| 43 | + WAKEUP_DEVICE_WAKE_KEY = 6, | ||
| 44 | + WAKEUP_DEVICE_WAKE_MOTION = 7, | ||
| 45 | + WAKEUP_DEVICE_HDMI = 8, | ||
| 46 | + WAKEUP_DEVICE_LID = 9, | ||
| 47 | + WAKEUP_DEVICE_DOUBLE_CLICK = 10, | ||
| 48 | + WAKEUP_DEVICE_KEYBOARD = 11, | ||
| 49 | + WAKEUP_DEVICE_MOUSE = 12, | ||
| 50 | + WAKEUP_DEVICE_TOUCHPAD = 13, | ||
| 51 | + WAKEUP_DEVICE_PEN = 14, | ||
| 52 | + WAKEUP_DEVICE_TOUCH_SCREEN = 15, | ||
| 53 | + WAKEUP_DEVICE_SWITCH = 16, | ||
| 54 | + WAKEUP_DEVICE_SINGLE_CLICK = 17, | ||
| 55 | + WAKEUP_DEVICE_PRE_BRIGHT = 18, | ||
| 56 | + WAKEUP_DEVICE_PRE_BRIGHT_AUTH_SUCCESS = 19, | ||
| 57 | + WAKEUP_DEVICE_PRE_BRIGHT_AUTH_FAIL_SCREEN_ON = 20, | ||
| 58 | + WAKEUP_DEVICE_PRE_BRIGHT_AUTH_FAIL_SCREEN_OFF = 21, | ||
| 59 | + WAKEUP_DEVICE_AOD_SLIDING = 22, | ||
| 60 | + WAKEUP_DEVICE_INCOMING_CALL = 23, | ||
| 61 | + WAKEUP_DEVICE_SHELL = 24, | ||
| 62 | + WAKEUP_DEVICE_PICKUP = 25, | ||
| 63 | + WAKEUP_DEVICE_EXIT_SYSTEM_STR = 26, // STR: suspend to ram | ||
| 64 | + WAKEUP_DEVICE_SCREEN_CONNECT = 27, | ||
| 65 | + WAKEUP_DEVICE_TP_TOUCH = 28, | ||
| 66 | + WAKEUP_DEVICE_EX_SCREEN_INIT = 29, | ||
| 67 | + WAKEUP_DEVICE_ABNORMAL_SCREEN_CONNECT = 30, | ||
| 68 | + WAKEUP_DEVICE_PLUG_CHANGE = 31, | ||
| 69 | + WAKEUP_DEVICE_TENT_MODE_CHANGE = 32, | ||
| 70 | + WAKEUP_DEVICE_END_DREAM = 33, | ||
| 71 | + WAKEUP_DEVICE_BLUETOOTH_INCOMING_CALL = 34, | ||
| 72 | + WAKEUP_DEVICE_FROM_ULSR = 35, | ||
| 73 | + WAKEUP_DEVICE_MESSAGE_NOTIFICATION = 36, | ||
| 74 | + WAKEUP_DEVICE_MAX | ||
| 75 | +}; | ||
| 76 | + | ||
| 77 | +class PowerMgrClient final { | ||
| 78 | +public: | ||
| 79 | + static PowerMgrClient& GetInstance() | ||
| 80 | + { | ||
| 81 | + static PowerMgrClient instance_; | ||
| 82 | + return instance_; | ||
| 83 | + } | ||
| 84 | + virtual ~PowerMgrClient() = default; | ||
| 85 | + | ||
| 86 | + PowerErrors WakeupDevice(WakeupDeviceType reason = WakeupDeviceType::WAKEUP_DEVICE_APPLICATION, | ||
| 87 | + const std::string& detail = std::string("app call"), const std::string& apiVersion = "-1") | ||
| 88 | + { | ||
| 89 | + return PowerErrors::ERR_OK; | ||
| 90 | + } | ||
| 91 | + void WakeupDeviceAsync(WakeupDeviceType reason = WakeupDeviceType::WAKEUP_DEVICE_APPLICATION, | ||
| 92 | + const std::string& detail = std::string("app call")) | ||
| 93 | + { | ||
| 94 | + } | ||
| 95 | + bool RefreshActivity() | ||
| 96 | + { | ||
| 97 | + return true; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + bool IsScreenOn(bool needPrintLog = true) | ||
| 101 | + { | ||
| 102 | + return true; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + bool IsFoldScreenOn() | ||
| 106 | + { | ||
| 107 | + return true; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + PowerErrors SetForceTimingOut(bool enabled) | ||
| 111 | + { | ||
| 112 | + return PowerErrors::ERR_OK; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + PowerErrors LockScreenAfterTimingOut(bool enabledLockScreen, bool checkLock, bool sendScreenOffEvent = true) | ||
| 116 | + { | ||
| 117 | + return PowerErrors::ERR_OK; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | +private: | ||
| 121 | + PowerMgrClient() = default; | ||
| 122 | +}; | ||
| 123 | +} // namespace PowerMgr | ||
| 124 | +} // namespace OHOS | ||
| 125 | + | ||
| @@ -0,0 +1,74 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2025 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 | + | ||
| 17 | +namespace OHOS { | ||
| 18 | +namespace Rosen { | ||
| 19 | +namespace { | ||
| 20 | + constexpr uint32_t PHY_WIDTH = 1316; | ||
| 21 | + constexpr uint32_t PHY_HEIGHT = 2832; | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +ProductConfigMock ProductConfigMock::currentConfig_; | ||
| 25 | +std::mutex ProductConfigMock::configMutex_; | ||
| 26 | + | ||
| 27 | +ProductConfigMock& ProductConfigMock::GetCurrentConfig() | ||
| 28 | +{ | ||
| 29 | + std::unique_lock<std::mutex> lock(configMutex_); | ||
| 30 | + return currentConfig_; | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +const ProductConfigMock& ProductConfigMock::ResetAndGetDeviceDefaultConfig() | ||
| 34 | +{ | ||
| 35 | + std::unique_lock<std::mutex> lock(configMutex_); | ||
| 36 | + if (currentConfig_.deviceType_ == ProductConfigMock::currentDeviceType_) { | ||
| 37 | + return currentConfig_; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + if (ProductConfigMock::currentDeviceType_ == "PLR") { | ||
| 41 | + ProductConfigMock::ResetToPLR(); | ||
| 42 | + } | ||
| 43 | + return currentConfig_; | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +void ProductConfigMock::ResetToPLR() | ||
| 47 | +{ | ||
| 48 | + currentConfig_.deviceType_ = "PLR"; | ||
| 49 | + currentConfig_.innerScreenId_ = {0}; | ||
| 50 | + currentConfig_.screenActiveModeId_ = {{0, 3}}; | ||
| 51 | + currentConfig_.screenModeInfo_ = {{0, | ||
| 52 | + {{1316. 2832, 120, 0}, | ||
| 53 | + {1316, 2832, 90, 1}, | ||
| 54 | + {1316, 2832, 72, 2}, | ||
| 55 | + {1316, 2832, 60, 3}, | ||
| 56 | + {1316, 2832, 45, 4}, | ||
| 57 | + {1316, 2832, 40, 5}, | ||
| 58 | + {1316, 2832, 36, 6}, | ||
| 59 | + {1316, 2832, 30, 7}}}}; | ||
| 60 | + RSScreenCapability capability; | ||
| 61 | + capability.SetPhyWidth(PHY_WIDTH); | ||
| 62 | + capability.SetPhyHeight(PHY_HEIGHT); | ||
| 63 | + currentConfig_.screenCapability_[0] = capability; | ||
| 64 | + | ||
| 65 | + currentConfig_.screenHdrFormat_ = {{0, {ScreenHDRFormat::VIDEO_HDR_VIVID, ScreenHDRFormat::IMAGE_HDR_VIVID_DUAL}}}; | ||
| 66 | + currentConfig_.screenColorSpace_ = { | ||
| 67 | + {0, | ||
| 68 | + {GraphicCM_ColorSpaceType::GRAPHIC_CM_DISPLAY_BT2020_SRGB, | ||
| 69 | + GraphicCM_ColorSpaceType::GRAPHIC_CM_DISPLAY_BT2020_HLG, | ||
| 70 | + GraphicCM_ColorSpaceType::GRAPHIC_CM_DISPLAY_BT2020_PQ, | ||
| 71 | + GraphicCM_ColorSpaceType::GRAPHIC_CM_DISPLAY_P3_PQ}}}; | ||
| 72 | +} | ||
| 73 | +} // namespace Rosen | ||
| 74 | +} // namespace OHOS | ||
| @@ -0,0 +1,49 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2025 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 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +namespace OHOS { | ||
| 23 | +namespace Rosen { | ||
| 24 | +class ProductConfigMock { | ||
| 25 | +public: | ||
| 26 | + ProductConfigMock() = default; | ||
| 27 | + ~ProductConfigMock() = default; | ||
| 28 | + static ProductConfigMock& GetCurrentConfig(); | ||
| 29 | + static const ProductConfigMock& ResetAndGetDeviceDefaultConfig(); | ||
| 30 | + static void ResetToPLR(); | ||
| 31 | + | ||
| 32 | + std::string deviceType_; | ||
| 33 | + std::vector<ScreenId> innerScreenId_; | ||
| 34 | + std::map<ScreenId, int32_t> screenActiveModeId_; | ||
| 35 | + std::map<ScreenId, std::vector<RSScreenModeInfo>> screenModeInfo_; | ||
| 36 | + std::map<ScreenId, RSScreenCapability> screenCapability_; | ||
| 37 | + std::map<ScreenId, std::vector<ScreenHDRFormat>> screenHdrFormat_; | ||
| 38 | + std::map<ScreenId, std::vector<GraphicCM_ColorSpaceType>> screenColorSpace_; | ||
| 39 | + | ||
| 40 | +private: | ||
| 41 | + static ProductConfigMock currentConfig_; | ||
| 42 | + static std::mutex configMutex_; | ||
| 43 | + static std::string currentDeviceType_; | ||
| 44 | +}; | ||
| 45 | + | ||
| 46 | +} // namespace OHOS | ||
| 47 | +} // namespace OHOS | ||
| 48 | + | ||
| 49 | + | ||
| @@ -0,0 +1,56 @@ | |||
| 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 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | +extern "C" { | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + | ||
| 24 | +int32_t SubscribeSensor(int32_t sensorTypeId, const SensorUser* user) | ||
| 25 | +{ | ||
| 26 | + return 0; | ||
| 27 | +} | ||
| 28 | +int32_t UnsubscribeSensor(int32_t sensorTypeId, const SensorUser* user) | ||
| 29 | +{ | ||
| 30 | + return 0; | ||
| 31 | +} | ||
| 32 | +int32_t SetBatch(int32_t sensorTypeId, const SensorUser* user, int64_t samplingInterval, int64_t reportInterval) | ||
| 33 | +{ | ||
| 34 | + return 0; | ||
| 35 | +} | ||
| 36 | +int32_t ActivateSensor(int32_t sensorTypeId, const SensorUser* user) | ||
| 37 | +{ | ||
| 38 | + return 0; | ||
| 39 | +} | ||
| 40 | +int32_t DeactivateSensor(int32_t sensorTypeId, const SensorUser* user) | ||
| 41 | +{ | ||
| 42 | + return 0; | ||
| 43 | +} | ||
| 44 | +int32_t SetMode(int32_t sensorTypeId, const SensorUser* user, int32_t mode) | ||
| 45 | +{ | ||
| 46 | + return 0; | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +void SetDeviceStatus(uint32_t deviceStatus) {} | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + | ||
| @@ -0,0 +1,41 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2025 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 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +extern "C" { | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + | ||
| 27 | +int32_t SubscribeSensor(int32_t sensorTypeId, const SensorUser* user); | ||
| 28 | +int32_t UnsubscribeSensor(int32_t sensorTypeId, const SensorUser* user); | ||
| 29 | +int32_t SetBatch(int32_t sensorTypeId, const SensorUser* user, int64_t samplingInterval, int64_t reportInterval); | ||
| 30 | +int32_t ActivateSensor(int32_t sensorTypeId, const SensorUser* user); | ||
| 31 | +int32_t DeactivateSensor(int32_t sensorTypeId, const SensorUser* user); | ||
| 32 | +int32_t SetMode(int32_t sensorTypeId, const SensorUser* user, int32_t mode); | ||
| 33 | +void SetDeviceStatus(uint32_t deviceStatus); | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 41 | +/** @} */ | ||
| @@ -0,0 +1,546 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2025 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 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +extern "C" { | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + | ||
| 27 | +/** Maximum length of the sensor name */ | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +/** Size of sensor data */ | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + | ||
| 35 | +/** Maximum length of the sensor version */ | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | +/** | ||
| 41 | + * @brief Enumerates sensor types. | ||
| 42 | + * | ||
| 43 | + * @since 5 | ||
| 44 | + */ | ||
| 45 | +typedef enum SensorTypeId { | ||
| 46 | + SENSOR_TYPE_ID_NONE = 0, /**< None */ | ||
| 47 | + SENSOR_TYPE_ID_ACCELEROMETER = 1, /**< Acceleration sensor */ | ||
| 48 | + SENSOR_TYPE_ID_GYROSCOPE = 2, /**< Gyroscope sensor */ | ||
| 49 | + SENSOR_TYPE_ID_AMBIENT_LIGHT = 5, /**< Ambient light sensor */ | ||
| 50 | + SENSOR_TYPE_ID_MAGNETIC_FIELD = 6, /**< Magnetic field sensor */ | ||
| 51 | + SENSOR_TYPE_ID_CAPACITIVE = 7, /**< Capacitive sensor */ | ||
| 52 | + SENSOR_TYPE_ID_BAROMETER = 8, /**< Barometric pressure sensor */ | ||
| 53 | + SENSOR_TYPE_ID_TEMPERATURE = 9, /**< Temperature sensor */ | ||
| 54 | + SENSOR_TYPE_ID_HALL = 10, /**< Hall effect sensor */ | ||
| 55 | + SENSOR_TYPE_ID_GESTURE = 11, /**< Gesture sensor */ | ||
| 56 | + SENSOR_TYPE_ID_PROXIMITY = 12, /**< Proximity sensor */ | ||
| 57 | + SENSOR_TYPE_ID_HUMIDITY = 13, /**< Humidity sensor */ | ||
| 58 | + SENSOR_TYPE_ID_COLOR = 14, /**< Color sensor */ | ||
| 59 | + SENSOR_TYPE_ID_SAR = 15, /**< Sar sensor */ | ||
| 60 | + SENSOR_TYPE_ID_AMBIENT_LIGHT1 = 16, /**< Secondary ambient light sensor */ | ||
| 61 | + SENSOR_TYPE_ID_HALL_EXT = 17, /**< Extended hall effect sensor */ | ||
| 62 | + SENSOR_TYPE_ID_PROXIMITY1 = 18, /**< Secondary proximity sensor */ | ||
| 63 | + SENSOR_TYPE_ID_PHYSICAL_MAX = 0xFF, /**< Maximum type ID of a physical sensor */ | ||
| 64 | + SENSOR_TYPE_ID_ORIENTATION = 256, /**< Orientation sensor */ | ||
| 65 | + SENSOR_TYPE_ID_GRAVITY = 257, /**< Gravity sensor */ | ||
| 66 | + SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ | ||
| 67 | + SENSOR_TYPE_ID_ROTATION_VECTOR = 259, /**< Rotation vector sensor */ | ||
| 68 | + SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */ | ||
| 69 | + SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */ | ||
| 70 | + SENSOR_TYPE_ID_GAME_ROTATION_VECTOR = 262, /**< Game rotation vector sensor */ | ||
| 71 | + SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED = 263, /**< Uncalibrated gyroscope sensor */ | ||
| 72 | + SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */ | ||
| 73 | + SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */ | ||
| 74 | + SENSOR_TYPE_ID_PEDOMETER = 266, /**< Pedometer sensor */ | ||
| 75 | + SENSOR_TYPE_ID_POSTURE = 267, /**< Posture sensor */ | ||
| 76 | + SENSOR_TYPE_ID_HEADPOSTURE = 268, /**< Head posture sensor */ | ||
| 77 | + SENSOR_TYPE_ID_DROP_DETECTION = 269, /**< Drop detection sensor */ | ||
| 78 | + SENSOR_TYPE_ID_GEOMAGNETIC_ROTATION_VECTOR = 277, /**< Geomagnetic rotation vector sensor */ | ||
| 79 | + SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ | ||
| 80 | + SENSOR_TYPE_ID_DEVICE_ORIENTATION = 279, /**< Device orientation sensor */ | ||
| 81 | + SENSOR_TYPE_ID_WEAR_DETECTION = 280, /**< Wear detection sensor */ | ||
| 82 | + SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ | ||
| 83 | + SENSOR_TYPE_ID_RPC = 282, /**< Radio power control sensor */ | ||
| 84 | + SENSOR_TYPE_ID_FUSION_PRESSURE = 283, /**< Fusion pressure sensor */ | ||
| 85 | + SENSOR_TYPE_ID_MAX = 300, /**< Maximum number of sensor type IDs*/ | ||
| 86 | +} SensorTypeId; | ||
| 87 | + | ||
| 88 | +/** | ||
| 89 | + * @brief Defines sensor information. | ||
| 90 | + * | ||
| 91 | + * @since 5 | ||
| 92 | + */ | ||
| 93 | +typedef struct SensorInfo { | ||
| 94 | + char sensorName[NAME_MAX_LEN]; /**< Sensor name */ | ||
| 95 | + char vendorName[NAME_MAX_LEN]; /**< Sensor vendor */ | ||
| 96 | + char firmwareVersion[VERSION_MAX_LEN]; /**< Sensor firmware version */ | ||
| 97 | + char hardwareVersion[VERSION_MAX_LEN]; /**< Sensor hardware version */ | ||
| 98 | + int32_t sensorTypeId = -1; /**< Sensor type ID */ | ||
| 99 | + int32_t sensorId = -1; /**< Sensor ID */ | ||
| 100 | + float maxRange = 0.0; /**< Maximum measurement range of the sensor */ | ||
| 101 | + float precision = 0.0; /**< Sensor accuracy */ | ||
| 102 | + float power = 0.0; /**< Sensor power */ | ||
| 103 | + int64_t minSamplePeriod = -1; /**< Minimum sample period allowed, in ns */ | ||
| 104 | + int64_t maxSamplePeriod = -1; /**< Maximum sample period allowed, in ns */ | ||
| 105 | + int32_t deviceId = -1; /**< Device ID */ | ||
| 106 | + int32_t location = -1; /**< Is the device a local device or an external device */ | ||
| 107 | + int32_t sensorIndex = -1; /**< Sensor Index */ | ||
| 108 | + bool isMockSensor = false; /**< Is the device a mock device or a real device */ | ||
| 109 | +} SensorInfo; | ||
| 110 | + | ||
| 111 | +/** | ||
| 112 | + * @brief Enumerates the accuracy levels of data reported by a sensor. | ||
| 113 | + * | ||
| 114 | + * @since 11 | ||
| 115 | + */ | ||
| 116 | +typedef enum SensorAccuracy { | ||
| 117 | + /**< The sensor data is unreliable. | ||
| 118 | + * It is possible that the sensor does not contact with the device to measure.*/ | ||
| 119 | + ACCURACY_UNRELIABLE = 0, | ||
| 120 | + /**< The sensor data is at a low accuracy level. | ||
| 121 | + * You are required to calibrate the data based on the environment before using it. */ | ||
| 122 | + ACCURACY_LOW = 1, | ||
| 123 | + /**< The sensor data is at a medium accuracy level. | ||
| 124 | + * You are advised to calibrate the data based on the environment before using it. */ | ||
| 125 | + ACCURACY_MEDIUM = 2, | ||
| 126 | + /**< The sensor data is at a high accuracy level. | ||
| 127 | + * The data can be used directly. */ | ||
| 128 | + ACCURACY_HIGH = 3, | ||
| 129 | +} SensorAccuracy; | ||
| 130 | + | ||
| 131 | +/** | ||
| 132 | + * @brief Defines the data reported by the sensor. | ||
| 133 | + * | ||
| 134 | + * @since 5 | ||
| 135 | + */ | ||
| 136 | +typedef struct SensorEvent { | ||
| 137 | + int32_t sensorTypeId = -1; /**< Sensor type ID */ | ||
| 138 | + int32_t version = -1; /**< Sensor algorithm version */ | ||
| 139 | + int64_t timestamp = -1; /**< Time when sensor data was reported */ | ||
| 140 | + int32_t option = -1; /**< Sensor data options, including the measurement range and accuracy */ | ||
| 141 | + int32_t mode = -1; /**< Sensor data reporting mode (described in {@link SensorMode}) */ | ||
| 142 | + uint8_t *data = nullptr; /**< Sensor data */ | ||
| 143 | + uint32_t dataLen = 0; /**< Sensor data length */ | ||
| 144 | + int32_t deviceId = -1; /**< Device ID */ | ||
| 145 | + int32_t sensorId = -1; /**< Sensor ID */ | ||
| 146 | + int32_t location = -1; /**< Is the device a local device or an external device */ | ||
| 147 | +} SensorEvent; | ||
| 148 | + | ||
| 149 | +/** | ||
| 150 | + * @brief Defines the callback for data reporting by the sensor agent. | ||
| 151 | + * | ||
| 152 | + * @since 5 | ||
| 153 | + */ | ||
| 154 | +typedef void (*RecordSensorCallback)(SensorEvent *event); | ||
| 155 | + | ||
| 156 | +typedef struct SensorStatusEvent { | ||
| 157 | + int64_t timestamp = -1; /**< Time when sensor data was reported */ | ||
| 158 | + int32_t sensorType = -1; /**< Sensor type ID */ | ||
| 159 | + int32_t sensorId = -1; /**< Sensor ID */ | ||
| 160 | + bool isSensorOnline = false; /**< Whether the sensor is online */ | ||
| 161 | + int32_t deviceId = -1; /**< Device ID */ | ||
| 162 | + std::string deviceName = ""; /**< Device name */ | ||
| 163 | + int32_t location = -1; /**< Is the device a local device or an external device */ | ||
| 164 | +} SensorStatusEvent; | ||
| 165 | + | ||
| 166 | +/** | ||
| 167 | + * @brief Defines the callback for data reporting by the sensor plug in/out state. | ||
| 168 | + * | ||
| 169 | + * @since 18 | ||
| 170 | + */ | ||
| 171 | +typedef void (*SensorPlugCallback)(SensorStatusEvent *statusEvent); | ||
| 172 | + | ||
| 173 | +/** | ||
| 174 | + * @brief Defines a reserved field for the sensor data subscriber. | ||
| 175 | + * | ||
| 176 | + * @since 5 | ||
| 177 | + */ | ||
| 178 | +typedef struct UserData { | ||
| 179 | + char userData[SENSOR_USER_DATA_SIZE]; /**< Reserved for the sensor data subscriber */ | ||
| 180 | +} UserData; | ||
| 181 | + | ||
| 182 | +/** | ||
| 183 | + * @brief Defines information about the sensor data subscriber. | ||
| 184 | + * | ||
| 185 | + * @since 5 | ||
| 186 | + */ | ||
| 187 | +typedef struct SensorUser { | ||
| 188 | + char name[NAME_MAX_LEN]; /**< Name of the sensor data subscriber */ | ||
| 189 | + RecordSensorCallback callback; /**< Callback for reporting sensor data */ | ||
| 190 | + SensorPlugCallback plugCallback; /**< Callback for reporting sensor plug data */ | ||
| 191 | + UserData *userData = nullptr; /**< Reserved field for the sensor data subscriber */ | ||
| 192 | +} SensorUser; | ||
| 193 | + | ||
| 194 | +/** | ||
| 195 | + * @brief Enumerates data reporting modes of sensors. | ||
| 196 | + * | ||
| 197 | + * @since 5 | ||
| 198 | + */ | ||
| 199 | +typedef enum SensorMode { | ||
| 200 | + SENSOR_DEFAULT_MODE = 0, /**< Default data reporting mode */ | ||
| 201 | + SENSOR_REALTIME_MODE = 1, /**< Real-time data reporting mode to report a group of data each time */ | ||
| 202 | + SENSOR_ON_CHANGE = 2, /**< Real-time data reporting mode to report data upon status changes */ | ||
| 203 | + SENSOR_ONE_SHOT = 3, /**< Real-time data reporting mode to report data only once */ | ||
| 204 | + SENSOR_FIFO_MODE = 4, /**< FIFO-based data reporting mode to report data based on the <b>BatchCnt</b> setting */ | ||
| 205 | + SENSOR_MODE_MAX2, /**< Maximum sensor data reporting mode */ | ||
| 206 | +} SensorMode; | ||
| 207 | + | ||
| 208 | +/** | ||
| 209 | + * @brief Defines the struct of the data reported by the acceleration sensor. | ||
| 210 | + * This sensor measures the acceleration applied to the device on three physical axes (x, y, and z), in m/s2. | ||
| 211 | + * | ||
| 212 | + */ | ||
| 213 | +typedef struct AccelData { | ||
| 214 | + float x = 0.0; | ||
| 215 | + float y = 0.0; | ||
| 216 | + float z = 0.0; | ||
| 217 | +} AccelData; | ||
| 218 | + | ||
| 219 | +/** | ||
| 220 | + * @brief Defines the struct of the data reported by the linear acceleration sensor. | ||
| 221 | + * This sensor measures the linear acceleration applied to the device on three physical axes (x, y, and z), in m/s2. | ||
| 222 | + */ | ||
| 223 | +typedef struct LinearAccelData { | ||
| 224 | + float x = 0.0; | ||
| 225 | + float y = 0.0; | ||
| 226 | + float z = 0.0; | ||
| 227 | +} LinearAccelData; | ||
| 228 | + | ||
| 229 | +/** | ||
| 230 | + * @brief Defines the struct of the data reported by the gyroscope sensor. | ||
| 231 | + * This sensor measures the angular velocity of the device on three physical axes (x, y, and z), in rad/s. | ||
| 232 | + */ | ||
| 233 | +typedef struct GyroscopeData { | ||
| 234 | + float x = 0.0; | ||
| 235 | + float y = 0.0; | ||
| 236 | + float z = 0.0; | ||
| 237 | +} GyroscopeData; | ||
| 238 | + | ||
| 239 | +/** | ||
| 240 | + * @brief Defines the struct of the data reported by the gravity sensor. | ||
| 241 | + * This sensor measures the acceleration of gravity applied to the device on three physical axes (x, y, and z), in m/s2. | ||
| 242 | + */ | ||
| 243 | +typedef struct GravityData { | ||
| 244 | + float x = 0.0; | ||
| 245 | + float y = 0.0; | ||
| 246 | + float z = 0.0; | ||
| 247 | +} GravityData; | ||
| 248 | + | ||
| 249 | +/** | ||
| 250 | + * @brief Defines the struct of the data reported by the uncalibrated acceleration sensor. | ||
| 251 | + * This sensor measures the uncalibrated acceleration applied to the device on three physical axes (x, y, and z), | ||
| 252 | + * in m/s2. | ||
| 253 | + */ | ||
| 254 | +typedef struct AccelUncalibratedData { | ||
| 255 | + float x = 0.0; | ||
| 256 | + float y = 0.0; | ||
| 257 | + float z = 0.0; | ||
| 258 | + float biasX = 0.0; | ||
| 259 | + float biasY = 0.0; | ||
| 260 | + float biasZ = 0.0; | ||
| 261 | +} AccelUncalibratedData; | ||
| 262 | + | ||
| 263 | +/** | ||
| 264 | + * @brief Defines the struct of the data reported by the uncalibrated gyroscope sensor. | ||
| 265 | + * This sensor measures the uncalibrated angular velocity of the device on three physical axes (x, y, and z), in rad/s. | ||
| 266 | + */ | ||
| 267 | +typedef struct GyroUncalibratedData { | ||
| 268 | + float x = 0.0; | ||
| 269 | + float y = 0.0; | ||
| 270 | + float z = 0.0; | ||
| 271 | + float biasX = 0.0; | ||
| 272 | + float biasY = 0.0; | ||
| 273 | + float biasZ = 0.0; | ||
| 274 | +} GyroUncalibratedData; | ||
| 275 | + | ||
| 276 | +/** | ||
| 277 | + * @brief Defines the struct of the data reported by the significant motion sensor. | ||
| 278 | + * This sensor detects whether there is substantial motion in the device on the three physical axes (x, y, and z). | ||
| 279 | + * The value <b>1</b> means that there is substantial motion, and <b>0</b> means the opposite. | ||
| 280 | + */ | ||
| 281 | +typedef struct SignificantMotionData { | ||
| 282 | + float scalar = 0.0; | ||
| 283 | +} SignificantMotionData; | ||
| 284 | + | ||
| 285 | +/** | ||
| 286 | + * @brief Defines the struct of the data reported by the pedometer detection sensor. | ||
| 287 | + * This sensor detects whether a user is walking. | ||
| 288 | + * The value <b>1</b> means that the user is walking, and <b>0</b> means the opposite. | ||
| 289 | + */ | ||
| 290 | +typedef struct PedometerDetectData { | ||
| 291 | + float scalar = 0.0; | ||
| 292 | +} PedometerDetectData; | ||
| 293 | + | ||
| 294 | +/** | ||
| 295 | + * @brief Defines the struct of the data reported by the pedometer sensor. | ||
| 296 | + * This sensor counts the number of steps taken by a user. | ||
| 297 | + */ | ||
| 298 | +typedef struct PedometerData { | ||
| 299 | + float steps = 0.0; | ||
| 300 | +} PedometerData; | ||
| 301 | + | ||
| 302 | +/** | ||
| 303 | + * @brief Defines the struct of the data reported by the ambient temperature sensor. | ||
| 304 | + * This sensor measures the ambient temperature, in degrees Celsius (°C). | ||
| 305 | + */ | ||
| 306 | +typedef struct AmbientTemperatureData { | ||
| 307 | + float temperature = 0.0; | ||
| 308 | +} AmbientTemperatureData; | ||
| 309 | + | ||
| 310 | +/** | ||
| 311 | + * @brief Defines the struct of the data reported by the humidity sensor. | ||
| 312 | + * This sensor measures the relative humidity of the environment, | ||
| 313 | + * expressed as a percentage (%). | ||
| 314 | + */ | ||
| 315 | +typedef struct HumidityData { | ||
| 316 | + float humidity = 0.0; | ||
| 317 | +} HumidityData; | ||
| 318 | + | ||
| 319 | +/** | ||
| 320 | + * @brief Defines the struct of the data reported by the temperature sensor. | ||
| 321 | + * This sensor measures the relative temperature of the environment, in degrees Celsius (°C). | ||
| 322 | + */ | ||
| 323 | +typedef struct TemperatureData { | ||
| 324 | + float temperature = 0.0; | ||
| 325 | +} TemperatureData; | ||
| 326 | + | ||
| 327 | +/** | ||
| 328 | + * @brief Defines the struct of the data reported by the magnetic field sensor. | ||
| 329 | + * This sensor measures the ambient geomagnetic field in three physical axes (x, y, z), in μT. | ||
| 330 | + */ | ||
| 331 | +typedef struct MagneticFieldData { | ||
| 332 | + float x = 0.0; | ||
| 333 | + float y = 0.0; | ||
| 334 | + float z = 0.0; | ||
| 335 | +} MagneticFieldData; | ||
| 336 | + | ||
| 337 | +/** | ||
| 338 | + * @brief Defines the struct of the data reported by the uncalibrated magnetic field sensor. | ||
| 339 | + * This sensor measures the uncalibrated ambient geomagnetic field in three physical axes (x, y, z), in μT. | ||
| 340 | + */ | ||
| 341 | +typedef struct MagneticFieldUncalibratedData { | ||
| 342 | + float x = 0.0; | ||
| 343 | + float y = 0.0; | ||
| 344 | + float z = 0.0; | ||
| 345 | + float biasX = 0.0; | ||
| 346 | + float biasY = 0.0; | ||
| 347 | + float biasZ = 0.0; | ||
| 348 | +} MagneticFieldUncalibratedData; | ||
| 349 | + | ||
| 350 | +/** | ||
| 351 | + * @brief Defines the struct of the data reported by the barometer sensor. | ||
| 352 | + * This sensor measures the atmospheric pressure, in hPa or mb. | ||
| 353 | + */ | ||
| 354 | +typedef struct BarometerData { | ||
| 355 | + float pressure = 0.0; | ||
| 356 | +} BarometerData; | ||
| 357 | + | ||
| 358 | +/** | ||
| 359 | + * @brief Defines the struct of the data reported by the device orientation sensor. | ||
| 360 | + * This sensor measures the direction of rotation of the device, in rad. | ||
| 361 | + */ | ||
| 362 | +typedef struct DeviceOrientationData { | ||
| 363 | + float scalar = 0.0; | ||
| 364 | +} DeviceOrientationData; | ||
| 365 | + | ||
| 366 | +/** | ||
| 367 | + * @brief Defines the struct of the data reported by the orientation sensor. | ||
| 368 | + * This sensor measures the angle of rotation of the device around all three physical axes (z, x, y), in rad. | ||
| 369 | + */ | ||
| 370 | +typedef struct OrientationData { | ||
| 371 | + float alpha = 0.0; /**< The device rotates at an angle around the Z axis. */ | ||
| 372 | + float beta = 0.0; /**< The device rotates at an angle around the X axis. */ | ||
| 373 | + float gamma = 0.0; /**< The device rotates at an angle around the Y axis. */ | ||
| 374 | +} OrientationData; | ||
| 375 | + | ||
| 376 | +/** | ||
| 377 | + * @brief Defines the struct of the data reported by the rotation vector sensor. | ||
| 378 | + * This sensor measures the rotation vector of the device. | ||
| 379 | + * It is synthesized by the acceleration sensor and gyroscope sensor. | ||
| 380 | + */ | ||
| 381 | +typedef struct RotationVectorData { | ||
| 382 | + float x = 0.0; | ||
| 383 | + float y = 0.0; | ||
| 384 | + float z = 0.0; | ||
| 385 | + float w = 0.0; | ||
| 386 | +} RotationVectorData; | ||
| 387 | + | ||
| 388 | +/** | ||
| 389 | + * @brief Defines the struct of the data reported by the game rotation vector sensor. | ||
| 390 | + * This sensor measures the game rotation vector of the device. | ||
| 391 | + * It is synthesized by the acceleration sensor and gyroscope sensor. | ||
| 392 | + */ | ||
| 393 | +typedef struct GameRotationVectorData { | ||
| 394 | + float x = 0.0; | ||
| 395 | + float y = 0.0; | ||
| 396 | + float z = 0.0; | ||
| 397 | + float w = 0.0; | ||
| 398 | +} GameRotationVectorData; | ||
| 399 | + | ||
| 400 | +/** | ||
| 401 | + * @brief Defines the struct of the data reported by the geomagnetic rotation vector sensor. | ||
| 402 | + * This sensor measures the geomagnetic rotation vector of the device. | ||
| 403 | + * It is synthesized by the acceleration sensor and magnetic field sensor. | ||
| 404 | + */ | ||
| 405 | +typedef struct GeomagneticRotaVectorData { | ||
| 406 | + float x = 0.0; | ||
| 407 | + float y = 0.0; | ||
| 408 | + float z = 0.0; | ||
| 409 | + float w = 0.0; | ||
| 410 | +} GeomagneticRotaVectorData; | ||
| 411 | + | ||
| 412 | +/** | ||
| 413 | + * @brief Defines the struct of the data reported by the proximity light sensor. | ||
| 414 | + * This sensor measures the proximity or distance of visible objects relative to the device display, | ||
| 415 | + * where 0 indicates proximity and 1 indicates distance. | ||
| 416 | + */ | ||
| 417 | +typedef struct ProximityData { | ||
| 418 | + float distance = 0.0; | ||
| 419 | +} ProximityData; | ||
| 420 | + | ||
| 421 | +/** | ||
| 422 | + * @brief Defines the struct of the data reported by the ambient light sensor. | ||
| 423 | + * This sensor measures the intensity of light around the device, in lux. | ||
| 424 | + */ | ||
| 425 | +typedef struct AmbientLightData { | ||
| 426 | + float intensity = 0.0; | ||
| 427 | + float colorTemperature = 0.0; | ||
| 428 | + float infraredLuminance = 0.0; | ||
| 429 | +} AmbientLightData; | ||
| 430 | + | ||
| 431 | +/** | ||
| 432 | + * @brief Defines the struct of the data reported by the hall effect sensor. | ||
| 433 | + * This sensor measures whether there is magnetic attraction around the device. | ||
| 434 | + * The value <b>1</b> means that there is magnet attraction, and <b>0</b> means the opposite. | ||
| 435 | + */ | ||
| 436 | +typedef struct HallData { | ||
| 437 | + float status = 0.0; | ||
| 438 | +} HallData; | ||
| 439 | + | ||
| 440 | +/** | ||
| 441 | + * @brief Defines the struct of the data reported by the heart rate sensor. | ||
| 442 | + * This sensor measures a user's heart rate, in bpm. | ||
| 443 | + */ | ||
| 444 | +typedef struct HeartRateData { | ||
| 445 | + float heartRate = 0.0; | ||
| 446 | +} HeartRateData; | ||
| 447 | + | ||
| 448 | +/** | ||
| 449 | + * @brief Defines the struct of the data reported by the wear detection sensor. | ||
| 450 | + * This sensor detects whether a user is wearing a wearable device. | ||
| 451 | + * The value <b>1</b> means that the user is wearing a wearable device, and <b>0</b> means the opposite. | ||
| 452 | + */ | ||
| 453 | +typedef struct WearDetectionData { | ||
| 454 | + float value = 0.0; | ||
| 455 | +} WearDetectionData; | ||
| 456 | + | ||
| 457 | +/** | ||
| 458 | + * @brief Defines the struct of the data reported by the color sensor. | ||
| 459 | + * This sensor is used to measure the luminous intensity (in lux) and color temperature (in Kelvin). | ||
| 460 | + */ | ||
| 461 | +typedef struct ColorData { | ||
| 462 | + float lightIntensity = 0.0; | ||
| 463 | + float colorTemperature = 0.0; | ||
| 464 | +} ColorData; | ||
| 465 | + | ||
| 466 | +/** | ||
| 467 | + * @brief Defines the struct of the data reported by the SAR sensor. | ||
| 468 | + * This sensor measures the SAR, in W/kg. | ||
| 469 | + */ | ||
| 470 | +typedef struct SarData { | ||
| 471 | + float absorptionRatio = 0.0; | ||
| 472 | +} SarData; | ||
| 473 | + | ||
| 474 | +/** | ||
| 475 | + * @brief Defines the struct of the data reported by the RPC sensor. | ||
| 476 | + * This sensor measures the radio power control. | ||
| 477 | + */ | ||
| 478 | +typedef struct RPCData { | ||
| 479 | + float absorptionRatio = 0.0; | ||
| 480 | + float threshold = 0.0; | ||
| 481 | + float offset = 0.0; | ||
| 482 | +} RPCData; | ||
| 483 | + | ||
| 484 | +/** | ||
| 485 | + * @brief Defines the struct of the data reported by the posture sensor. | ||
| 486 | + * This sensor measures the angle between two screens, in degrees. The angle ranges from 0 to 180. | ||
| 487 | + */ | ||
| 488 | +typedef struct PostureData { | ||
| 489 | + float gxm = 0.0f; /**< The main screen acceleration on the x axis */ | ||
| 490 | + float gym = 0.0f; /**< The main screen acceleration on the y axis */ | ||
| 491 | + float gzm = 0.0f; /**< The main screen acceleration on the z axis */ | ||
| 492 | + float gxs = 0.0f; /**< The second screen acceleration on the x axis */ | ||
| 493 | + float gys = 0.0f; /**< The second screen acceleration on the y axis */ | ||
| 494 | + float gzs = 0.0f; /**< The second screen acceleration on the z axis */ | ||
| 495 | + float angle = 0.0f; /**< The angle between two screens. The angle ranges from 0 to 180 degrees. */ | ||
| 496 | + float screenAndPostureStatus = 0.0f; /**< The screen and posture status. */ | ||
| 497 | + float gxt = 0.0f; /**< The third screen acceleration on the x axis */ | ||
| 498 | + float gyt = 0.0f; /**< The third screen acceleration on the y axis */ | ||
| 499 | + float gzt = 0.0f; /**< The third screen acceleration on the z axis */ | ||
| 500 | + float abAngle = 0.0f; /**< The angle between second and third screen. The angle ranges from 0 to 180 degrees. */ | ||
| 501 | + float abFoldedState = 0.0f; /**< The state between second and third screen. */ | ||
| 502 | +} PostureData; | ||
| 503 | + | ||
| 504 | +/** | ||
| 505 | + * @brief Defines the struct of the data reported by the head posture sensor. | ||
| 506 | + * This sensor measures the head posture of user. | ||
| 507 | + */ | ||
| 508 | +typedef struct HeadPostureData { | ||
| 509 | + int32_t order = 0; | ||
| 510 | + float w = 0.0; | ||
| 511 | + float x = 0.0; | ||
| 512 | + float y = 0.0; | ||
| 513 | + float z = 0.0; | ||
| 514 | +} HeadPostureData; | ||
| 515 | + | ||
| 516 | +typedef struct DropDetectionData { | ||
| 517 | + float status = 0.0F; | ||
| 518 | +} DropDetectionData; | ||
| 519 | + | ||
| 520 | +typedef struct SensorActiveInfo { | ||
| 521 | + int32_t pid = -1; /**< PID */ | ||
| 522 | + int32_t sensorId = -1; /**< Sensor ID */ | ||
| 523 | + int64_t samplingPeriodNs = -1; /**< Sample period, in ns */ | ||
| 524 | + int64_t maxReportDelayNs = -1; /**< Maximum Report Delay, in ns */ | ||
| 525 | +} SensorActiveInfo; | ||
| 526 | + | ||
| 527 | +typedef struct FusionPressureData { | ||
| 528 | + float fusionPressure = 0.0f; | ||
| 529 | +} FusionPressureData; | ||
| 530 | + | ||
| 531 | +typedef struct SensorIdentifier { | ||
| 532 | + int32_t deviceId = -1; /**< device ID */ | ||
| 533 | + int32_t sensorType = -1; /**< sensor type ID */ | ||
| 534 | + int32_t sensorId = -1; /**< sensor ID, defined by the sensor driver developer */ | ||
| 535 | + int32_t location = -1; /**< Is the device a local device or an external device */ | ||
| 536 | +} SensorIdentifier; | ||
| 537 | + | ||
| 538 | +typedef void (*SensorActiveInfoCB)(SensorActiveInfo &sensorActiveInfo); | ||
| 539 | + | ||
| 540 | + | ||
| 541 | + | ||
| 542 | +} | ||
| 543 | + | ||
| 544 | + | ||
| 545 | + | ||
| 546 | +/**< @} */ | ||