diff --git a/services/hdi_connection/adapter/src/hdi_connection.cpp b/services/hdi_connection/adapter/src/hdi_connection.cpp index f6cd5ed9613f3f0acb1db0c78bbc2d332798a434..01ec4d9630aea216de29225a333ca975ac86f49a 100644 --- a/services/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/hdi_connection/adapter/src/hdi_connection.cpp @@ -20,9 +20,11 @@ #include "hisysevent.h" #include "iproxy_broker.h" +#include "v1_1/isensor_interface.h" + +#include "sensor_agent_type.h" #include "sensor_errors.h" #include "sensor_event_callback.h" -#include "v1_1/isensor_interface.h" namespace OHOS { namespace Sensors { @@ -38,6 +40,7 @@ std::map g_sensorBasicInfoMap; std::mutex g_sensorBasicInfoMutex; constexpr int32_t GET_HDI_SERVICE_COUNT = 5; constexpr uint32_t WAIT_MS = 200; +constexpr int32_t HEADPOSTURE_FIFO_COUNT = 5; } // namespace ReportDataCb HdiConnection::reportDataCb_ = nullptr; @@ -96,6 +99,9 @@ int32_t HdiConnection::GetSensorList(std::vector &sensorList) sensor.SetPower(sensorInfos[i].power); sensor.SetMinSamplePeriodNs(sensorInfos[i].minDelay); sensor.SetMaxSamplePeriodNs(sensorInfos[i].maxDelay); + if (sensorInfos[i].sensorId == SENSOR_TYPE_ID_HEADPOSTURE) { + sensor.SetFifoMaxEventCount(HEADPOSTURE_FIFO_COUNT); + } sensorList.push_back(sensor); } return ERR_OK; diff --git a/services/src/sensor_data_processer.cpp b/services/src/sensor_data_processer.cpp index 34486f01db146cfb5ecc6e81dee5848ba0e88722..c73702c8a768a39e875fef52117b51486e9f7f76 100644 --- a/services/src/sensor_data_processer.cpp +++ b/services/src/sensor_data_processer.cpp @@ -168,7 +168,7 @@ void SensorDataProcesser::ReportData(sptr &channel, Sens return; } auto fifoCount = clientInfo_.ComputeBestFifoCount(sensorId, channel); - if (fifoCount <= 0) { + if (fifoCount <= 1) { SendNoneFifoCacheData(cacheBuf, channel, data, periodCount); return; }