diff --git a/interfaces/native/include/sensor_agent_type.h b/interfaces/native/include/sensor_agent_type.h index 82cafee83f03593931466755413f060fba7a5cd9..46b3dd6dc4b7a633cea2a6ceacd9f08b851a1d4e 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 0c3d7c88069bffedadfd6a9589b72e0b647cc427..77ca622675edf058f948dd0edb12d154f471b4bc 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;