From 1ee1b46cb8ac72b4e264badbf9c4a16b4a42e902 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Sun, 27 Apr 2025 17:24:44 +0800 Subject: [PATCH] Adapter data for gamerotationvector/drop/posture Signed-off-by: wuzhihuitmac Change-Id: Ib5c64330b117d04ddd2f53652f46254c46507358 --- frameworks/js/napi/src/sensor_napi_utils.cpp | 4 ++++ interfaces/inner_api/sensor_agent_type.h | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frameworks/js/napi/src/sensor_napi_utils.cpp b/frameworks/js/napi/src/sensor_napi_utils.cpp index 66d14d78..930d7eba 100644 --- a/frameworks/js/napi/src/sensor_napi_utils.cpp +++ b/frameworks/js/napi/src/sensor_napi_utils.cpp @@ -177,6 +177,7 @@ std::map> g_sensorAttributeList = { { SENSOR_TYPE_ID_GRAVITY, { "x", "y", "z" } }, { SENSOR_TYPE_ID_LINEAR_ACCELERATION, { "x", "y", "z" } }, { SENSOR_TYPE_ID_ROTATION_VECTOR, { "x", "y", "z", "w" } }, + { SENSOR_TYPE_ID_GAME_ROTATION_VECTOR, { "x", "y", "z", "w" } }, { SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, { "temperature" } }, { SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, { "x", "y", "z", "biasX", "biasY", "biasZ" } }, { SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, { "x", "y", "z", "biasX", "biasY", "biasZ" } }, @@ -189,6 +190,9 @@ std::map> g_sensorAttributeList = { { SENSOR_TYPE_ID_COLOR, { "lightIntensity", "colorTemperature" } }, { SENSOR_TYPE_ID_SAR, { "absorptionRatio" } }, { SENSOR_TYPE_ID_FUSION_PRESSURE, { "fusionPressure" } }, + { SENSOR_TYPE_ID_DROP_DETECTION, { "x", "y", "z", "biasX", "biasY", "biasZ" } }, + { SENSOR_TYPE_ID_POSTURE, { "gxm", "gym", "gzm", "gxs", "gys", "gzs", "angle", "screenAndPostureStatus", "gxt", + "gyt", "gzt", "abAngle", "abFoldedState" } }, }; std::map g_convertfuncList = { diff --git a/interfaces/inner_api/sensor_agent_type.h b/interfaces/inner_api/sensor_agent_type.h index 5d57cb2e..57509831 100644 --- a/interfaces/inner_api/sensor_agent_type.h +++ b/interfaces/inner_api/sensor_agent_type.h @@ -510,7 +510,12 @@ typedef struct HeadPostureData { } HeadPostureData; typedef struct DropDetectionData { - float status = 0.0; + float x = 0.0; + float y = 0.0; + float z = 0.0; + float biasX = 0.0; + float biasY = 0.0; + float biasZ = 0.0; } DropDetectionData; typedef struct SensorActiveInfo { -- Gitee