From 5e03de1364ee89f151f4c3cedc1509b224587d00 Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Tue, 21 Nov 2023 14:11:10 +0000 Subject: [PATCH 1/2] add fifo cnt Signed-off-by: lixiangpeng5 Change-Id: Ie0089694c62102878e4cb05261d3b36dc4cb74b9 --- services/hdi_connection/adapter/src/hdi_connection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/hdi_connection/adapter/src/hdi_connection.cpp b/services/hdi_connection/adapter/src/hdi_connection.cpp index f6cd5ed9..c9d554aa 100644 --- a/services/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/hdi_connection/adapter/src/hdi_connection.cpp @@ -96,6 +96,7 @@ int32_t HdiConnection::GetSensorList(std::vector &sensorList) sensor.SetPower(sensorInfos[i].power); sensor.SetMinSamplePeriodNs(sensorInfos[i].minDelay); sensor.SetMaxSamplePeriodNs(sensorInfos[i].maxDelay); + sensor.SetFifoMaxEventCount(sensorInfos[i].fifoMaxEventCount); sensorList.push_back(sensor); } return ERR_OK; -- Gitee From e1eb9da090113a5ad5c244ca02cac04bb9a4ea88 Mon Sep 17 00:00:00 2001 From: lixiangpeng5 Date: Tue, 28 Nov 2023 11:34:26 +0000 Subject: [PATCH 2/2] enable head posture fifo cnt Signed-off-by: lixiangpeng5 Change-Id: Ic24c7c160e0fe871e2911a77f907bb5809bdaa76 --- services/hdi_connection/adapter/src/hdi_connection.cpp | 9 +++++++-- services/src/sensor_data_processer.cpp | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/hdi_connection/adapter/src/hdi_connection.cpp b/services/hdi_connection/adapter/src/hdi_connection.cpp index c9d554aa..01ec4d96 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,7 +99,9 @@ int32_t HdiConnection::GetSensorList(std::vector &sensorList) sensor.SetPower(sensorInfos[i].power); sensor.SetMinSamplePeriodNs(sensorInfos[i].minDelay); sensor.SetMaxSamplePeriodNs(sensorInfos[i].maxDelay); - sensor.SetFifoMaxEventCount(sensorInfos[i].fifoMaxEventCount); + 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 34486f01..c73702c8 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; } -- Gitee