diff --git a/services/hdi_connection/adapter/src/sensor_event_callback.cpp b/services/hdi_connection/adapter/src/sensor_event_callback.cpp index 85b8a466f5c155968da8a6f4a5185d35d8d943bc..19c830f8c0206f3d5f00877d8be807e7711e785a 100644 --- a/services/hdi_connection/adapter/src/sensor_event_callback.cpp +++ b/services/hdi_connection/adapter/src/sensor_event_callback.cpp @@ -14,6 +14,8 @@ */ #include "sensor_event_callback.h" +#include + #include "hdi_connection.h" #include "sensor_agent_type.h" #include "sensor_errors.h" @@ -35,6 +37,13 @@ enum { SEVEN_DIMENSION = 7, DEFAULT_DIMENSION = 16 }; +const std::set g_sensorTypeTrigger = { + SENSOR_TYPE_ID_PROXIMITY, + SENSOR_TYPE_ID_DROP_DETECTION, + SENSOR_TYPE_ID_HALL, + SENSOR_TYPE_ID_HALL_EXT, + SENSOR_TYPE_ID_PROXIMITY1 +}; } // namespace int32_t SensorEventCallback::OnDataEvent(const HdfSensorEvents &event) @@ -56,8 +65,7 @@ int32_t SensorEventCallback::OnDataEvent(const HdfSensorEvents &event) .mode = event.mode, .dataLen = event.dataLen }; - if (sensorData.sensorTypeId == SENSOR_TYPE_ID_PROXIMITY || - sensorData.sensorTypeId == SENSOR_TYPE_ID_DROP_DETECTION) { + if (g_sensorTypeTrigger.find(sensorData.sensorTypeId) != g_sensorTypeTrigger.end()) { sensorData.mode = SENSOR_ON_CHANGE; } CHKPR(sensorData.data, ERR_NO_INIT);