From 1ed673e4be1fffe5c6ce8640f5ee91e0a330bd90 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Wed, 9 Mar 2022 10:34:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=88=E5=B9=B6sensor=5Fservice.cpp?= =?UTF-8?q?=E7=9A=8489=E5=92=8C90=E8=A1=8C=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite --- services/sensor/src/sensor_service.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/sensor/src/sensor_service.cpp b/services/sensor/src/sensor_service.cpp index 97724d87..943ec590 100644 --- a/services/sensor/src/sensor_service.cpp +++ b/services/sensor/src/sensor_service.cpp @@ -86,8 +86,7 @@ void SensorService::OnStart() HiLog::Error(LABEL, "%{public}s Init sensor policy error", __func__); } - bool isPublished = SystemAbility::Publish(this); - if (!isPublished) { + if (!SystemAbility::Publish(this)) { HiLog::Error(LABEL, "%{public}s publish SensorService error", __func__); return; } -- Gitee From d2abb8ffa1004401022b49c3de143bba6dc585c9 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Wed, 9 Mar 2022 10:58:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=A0=E9=99=A4sensor=5Fseiver=E7=9A=848?= =?UTF-8?q?5=E5=92=8C87=E4=BB=A5=E5=8F=8A142=E5=92=8C145?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/sensor/src/sensor_service.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/services/sensor/src/sensor_service.cpp b/services/sensor/src/sensor_service.cpp index 943ec590..9740ffa0 100644 --- a/services/sensor/src/sensor_service.cpp +++ b/services/sensor/src/sensor_service.cpp @@ -82,9 +82,6 @@ void SensorService::OnStart() HiLog::Error(LABEL, "%{public}s failed, sensorDataProcesser_ cannot be null", __func__); return; } - if (!InitSensorPolicy()) { - HiLog::Error(LABEL, "%{public}s Init sensor policy error", __func__); - } if (!SystemAbility::Publish(this)) { HiLog::Error(LABEL, "%{public}s publish SensorService error", __func__); @@ -138,11 +135,6 @@ bool SensorService::InitSensorList() return true; } -bool SensorService::InitSensorPolicy() -{ - return true; -} - void SensorService::OnStop() { HiLog::Debug(LABEL, "%{public}s begin", __func__); -- Gitee From 8f5ee90f3cd76e011cfb6bdb3260de8168a99a86 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Wed, 9 Mar 2022 16:54:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?hdi=5Fconnection.cpp=E7=9A=8439=E8=A1=8C?= =?UTF-8?q?=E6=94=B9300ms=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86end=E6=97=A5?= =?UTF-8?q?=E5=BF=97=EF=BC=8C82=E8=A1=8C=E7=9A=84int32=5Ft=E6=94=B9?= =?UTF-8?q?=E4=B8=BAsize=5Ft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite --- .../hdi_connection/adapter/src/hdi_connection.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp b/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp index 4315873b..8a20a16a 100644 --- a/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp @@ -36,7 +36,7 @@ sptr eventCallback_ = nullptr; std::map sensorBasicInfoMap_; std::mutex sensorBasicInfoMutex_; constexpr int32_t GET_HDI_SERVICE_COUNT = 10; -constexpr uint32_t WAIT_MS = 100; +constexpr uint32_t WAIT_MS = 300; } ZReportDataCb HdiConnection::reportDataCb_ = nullptr; @@ -64,6 +64,7 @@ int32_t HdiConnection::ConnectHdi() } HiLog::Error(LABEL, "%{public}s connect v1_0 hdi failed", __func__); return ERR_NO_INIT; + HiLog::Debug(LABEL, "%{public}s end", __func__); } int32_t HdiConnection::GetSensorList(std::vector& sensorList) @@ -79,7 +80,7 @@ int32_t HdiConnection::GetSensorList(std::vector& sensorList) HiLog::Error(LABEL, "%{public}s get sensor list failed", __func__); return ret; } - for (int32_t i = 0; i < static_cast(sensorInfos.size()); i++) { + for (size_t i = 0; i < sensorInfos.size(); i++) { const std::string sensorName(sensorInfos[i].sensorName); const std::string vendorName(sensorInfos[i].vendorName); const std::string firmwareVersion(sensorInfos[i].firmwareVersion); @@ -99,6 +100,7 @@ int32_t HdiConnection::GetSensorList(std::vector& sensorList) sensorList.push_back(sensor); } return ERR_OK; + HiLog::Debug(LABEL, "%{public}s end", __func__); } int32_t HdiConnection::EnableSensor(int32_t sensorId) @@ -159,6 +161,7 @@ int32_t HdiConnection::SetMode(int32_t sensorId, int32_t mode) return ret; } return ERR_OK; + HiLog::Debug(LABEL, "%{public}s end", __func__); } int32_t HdiConnection::SetOption(int32_t sensorId, int32_t option) @@ -174,6 +177,7 @@ int32_t HdiConnection::SetOption(int32_t sensorId, int32_t option) return ret; } return ERR_OK; + HiLog::Debug(LABEL, "%{public}s end", __func__); } int32_t HdiConnection::RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) @@ -191,6 +195,7 @@ int32_t HdiConnection::RegisteDataReport(ZReportDataCb cb, sptr HdiConnection::getReportDataCallback() @@ -231,6 +238,7 @@ sptr HdiConnection::getReportDataCallback() HiLog::Error(LABEL, "%{public}s reportDataCallback_ cannot be null", __func__); } return reportDataCallback_; + HiLog::Debug(LABEL, "%{public}s end", __func__); } void HdiConnection::updateSensorBasicInfo(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) @@ -285,6 +293,7 @@ void HdiConnection::UnregisterHdiDeathRecipient() return; } sensorInterface_->AsObject()->RemoveDeathRecipient(hdiDeathObserver_); + HiLog::Debug(LABEL, "%{public}s end", __func__); } void HdiConnection::ProcessDeathObserver(const wptr &object) @@ -298,6 +307,7 @@ void HdiConnection::ProcessDeathObserver(const wptr &object) hdiService->RemoveDeathRecipient(hdiDeathObserver_); eventCallback_ = nullptr; reconnect(); + HiLog::Debug(LABEL, "%{public}s end", __func__); } void HdiConnection::reconnect() @@ -334,6 +344,7 @@ void HdiConnection::reconnect() HiLog::Error(LABEL, "%{public}s enable sensor fail, sensorTypeId: %{public}d", __func__, sensorTypeId); } } + HiLog::Debug(LABEL, "%{public}s end", __func__); } } // namespace Sensors } // namespace OHOS -- Gitee