From 7690862d63a64e74be0efb03510a87f52d036ec0 Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Mon, 21 Mar 2022 19:44:32 +0800 Subject: [PATCH 1/2] Signed-off-by:hellohyh001 Signed-off-by: hellohyh001 --- frameworks/native/sensor/src/sensor_agent_proxy.cpp | 2 +- interfaces/native/include/sensor_algorithm.h | 1 + interfaces/plugin/src/sensor_js.cpp | 2 +- services/sensor/hdi_connection/adapter/include/hdi_connection.h | 1 + services/sensor/include/sensor_service.h | 2 +- services/sensor/src/sensor_dump.cpp | 2 +- services/sensor/src/sensor_service.cpp | 2 +- 7 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frameworks/native/sensor/src/sensor_agent_proxy.cpp b/frameworks/native/sensor/src/sensor_agent_proxy.cpp index a5522d8d..126e24ef 100644 --- a/frameworks/native/sensor/src/sensor_agent_proxy.cpp +++ b/frameworks/native/sensor/src/sensor_agent_proxy.cpp @@ -75,7 +75,7 @@ std::mutex SensorAgentProxy::chanelMutex_; std::map SensorAgentProxy::g_subscribeMap; std::map SensorAgentProxy::g_unsubscribeMap; -SensorAgentProxy::SensorAgentProxy() +SensorAgentProxy::SensorAgentProxy() : dataChannel_(new (std::nothrow) SensorDataChannel()) {} diff --git a/interfaces/native/include/sensor_algorithm.h b/interfaces/native/include/sensor_algorithm.h index 4dd157f0..e8d96685 100644 --- a/interfaces/native/include/sensor_algorithm.h +++ b/interfaces/native/include/sensor_algorithm.h @@ -42,6 +42,7 @@ public: int32_t createRotationAndInclination(std::vector gravity, std::vector geomagnetic, std::vector &rotationMatrix, std::vector &inclinationMatrix); + private: int32_t transformCoordinateSystemImpl(std::vector inRotationMatrix, int32_t axisX, int32_t axisY, std::vector &outRotationMatrix); diff --git a/interfaces/plugin/src/sensor_js.cpp b/interfaces/plugin/src/sensor_js.cpp index 74072a2c..b15abe0e 100644 --- a/interfaces/plugin/src/sensor_js.cpp +++ b/interfaces/plugin/src/sensor_js.cpp @@ -227,7 +227,7 @@ static napi_value On(napi_env env, napi_callback_info info) return nullptr; } interval = GetCppInt64(value, env); - HiLog::Debug(LABEL, "%{public}s interval is %{public}lld", __func__, interval); + HiLog::Debug(LABEL, "%{public}s interval is %{public}" PRId64, __func__, interval); } int32_t ret = SubscribeSensor(sensorTypeId, interval, DataCallbackImpl); if (ret != OHOS::ERR_OK) { diff --git a/services/sensor/hdi_connection/adapter/include/hdi_connection.h b/services/sensor/hdi_connection/adapter/include/hdi_connection.h index b5f26cb5..95cd5516 100644 --- a/services/sensor/hdi_connection/adapter/include/hdi_connection.h +++ b/services/sensor/hdi_connection/adapter/include/hdi_connection.h @@ -53,6 +53,7 @@ public: sptr getReportDataCallback(); void ProcessDeathObserver(const wptr &object); + private: DISALLOW_COPY_AND_MOVE(HdiConnection); static ZReportDataCb reportDataCb_; diff --git a/services/sensor/include/sensor_service.h b/services/sensor/include/sensor_service.h index 95b0f40a..94687ae3 100644 --- a/services/sensor/include/sensor_service.h +++ b/services/sensor/include/sensor_service.h @@ -20,7 +20,6 @@ #include #include - #include "nocopyable.h" #include "system_ability.h" @@ -40,6 +39,7 @@ enum class SensorServiceState { class SensorService : public SystemAbility, public SensorServiceStub { DECLARE_SYSTEM_ABILITY(SensorService) + public: explicit SensorService(int32_t systemAbilityId, bool runOnCreate = false); diff --git a/services/sensor/src/sensor_dump.cpp b/services/sensor/src/sensor_dump.cpp index 6ef5503a..c412a3e7 100644 --- a/services/sensor/src/sensor_dump.cpp +++ b/services/sensor/src/sensor_dump.cpp @@ -144,7 +144,7 @@ bool SensorDump::DumpSensorList(int32_t fd, const std::vector &sensors, auto sensorId = sensor.GetSensorId(); dprintf(fd, "sensorId:%8u | sensorType:%s | sensorName:%s | vendorName:%s | maxRange:%f" - "| fifoMaxEventCount:%d | minSamplePeriodNs:%lld | maxSamplePeriodNs:%lld\n", + "| fifoMaxEventCount:%d | minSamplePeriodNs:%" PRId64 " | maxSamplePeriodNs:%" PRId64 "\n", sensorId, sensorMap_[sensorId].c_str(), sensor.GetSensorName().c_str(), sensor.GetVendorName().c_str(), sensor.GetMaxRange(), sensor.GetFifoMaxEventCount(), (long long) { sensor.GetMinSamplePeriodNs() }, (long long) { sensor.GetMaxSamplePeriodNs() }); diff --git a/services/sensor/src/sensor_service.cpp b/services/sensor/src/sensor_service.cpp index 0072026f..5a753265 100644 --- a/services/sensor/src/sensor_service.cpp +++ b/services/sensor/src/sensor_service.cpp @@ -236,7 +236,7 @@ ErrCode SensorService::SaveSubscriber(uint32_t sensorId, int64_t samplingPeriodN ErrCode SensorService::EnableSensor(uint32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) { - HiLog::Debug(LABEL, "%{public}s begin, sensorId : %{public}u, samplingPeriodNs : %{public}" + HiLog::Debug(LABEL, "%{public}s begin, sensorId : %{public}u, samplingPeriodNs : %{public}" PRId64, __func__, sensorId, samplingPeriodNs); if ((sensorId == INVALID_SENSOR_ID) || ((samplingPeriodNs != 0L) && ((maxReportDelayNs / samplingPeriodNs) > MAX_EVENT_COUNT))) { -- Gitee From da51747bff589bc6166cadf5606dfa074e1702ef Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Mon, 21 Mar 2022 19:53:59 +0800 Subject: [PATCH 2/2] Signed-off-by:hellohyh001 Signed-off-by: hellohyh001 --- services/sensor/src/sensor_dump.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/sensor/src/sensor_dump.cpp b/services/sensor/src/sensor_dump.cpp index c412a3e7..fe4f22d0 100644 --- a/services/sensor/src/sensor_dump.cpp +++ b/services/sensor/src/sensor_dump.cpp @@ -146,8 +146,8 @@ bool SensorDump::DumpSensorList(int32_t fd, const std::vector &sensors, "sensorId:%8u | sensorType:%s | sensorName:%s | vendorName:%s | maxRange:%f" "| fifoMaxEventCount:%d | minSamplePeriodNs:%" PRId64 " | maxSamplePeriodNs:%" PRId64 "\n", sensorId, sensorMap_[sensorId].c_str(), sensor.GetSensorName().c_str(), sensor.GetVendorName().c_str(), - sensor.GetMaxRange(), sensor.GetFifoMaxEventCount(), (long long) { sensor.GetMinSamplePeriodNs() }, - (long long) { sensor.GetMaxSamplePeriodNs() }); + sensor.GetMaxRange(), sensor.GetFifoMaxEventCount(), sensor.GetMinSamplePeriodNs(), + sensor.GetMaxSamplePeriodNs()); } return true; } -- Gitee