From f8f6664b5e2b3b9c49ec5d3280b6adcb0b2255e5 Mon Sep 17 00:00:00 2001 From: toutes Date: Wed, 30 Mar 2022 20:13:57 -0700 Subject: [PATCH] test Signed-off-by: toutes Change-Id: I3f34cc210bb6cafb4ecf68fe37cfd3f3ae994c3a --- interfaces/native/include/sensor_agent_type.h | 2 +- .../hdi_connection/adapter/src/sensor_event_callback.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/interfaces/native/include/sensor_agent_type.h b/interfaces/native/include/sensor_agent_type.h index 82cafee8..46b3dd6d 100644 --- a/interfaces/native/include/sensor_agent_type.h +++ b/interfaces/native/include/sensor_agent_type.h @@ -366,7 +366,7 @@ typedef struct GeomagneticRotaVectorData { * the device display, where 0 indicates proximity and 1 indicates distance. */ typedef struct ProximityData { - int32_t scalar; + float scalar; } ProximityData; /** diff --git a/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp b/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp index 0c3d7c88..77ca6226 100644 --- a/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp +++ b/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp @@ -50,6 +50,12 @@ int32_t SensorEventCallback::OnDataEvent(const HdfSensorEvents& event) for (int32_t i = 0; i < static_cast(dataSize); i++) { sensorEvent.data[i] = event.data[i]; } + + if (sensorEvent.sensorTypeId == SENSOR_TYPE_ID_PROXIMITY) { + ProximityData* data = (ProximityData*)sensorEvent.data; + HiLog::Debug(LABEL, "%{public}s ProximityData = %{public}f",__func__ ,data->scalar); + } + (void)(reportDataCallback_->*(reportDataCb_))(&sensorEvent, reportDataCallback_); ISensorHdiConnection::dataCondition_.notify_one(); return ERR_OK; -- Gitee