From fcfa9de3306055e552d22ea517bfd3327c91d1ad Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Mon, 21 Mar 2022 15:37:58 +0800 Subject: [PATCH] Signed-off-by:hellohyh001 Signed-off-by: hellohyh001 --- frameworks/native/sensor/include/my_event_handler.h | 2 +- frameworks/native/sensor/src/my_event_handler.cpp | 2 +- frameworks/native/sensor/src/my_file_descriptor_listener.cpp | 2 +- frameworks/native/sensor/src/sensor_agent_proxy.cpp | 4 ++-- interfaces/native/include/geomagnetic_field.h | 2 +- interfaces/native/include/sensor_algorithm.h | 1 + interfaces/native/src/geomagnetic_field.cpp | 1 - interfaces/native/src/sensor_agent.cpp | 2 +- interfaces/native/src/sensor_algorithm.cpp | 2 +- interfaces/plugin/include/sensor_js.h | 2 +- interfaces/plugin/include/sensor_system_js.h | 2 +- interfaces/plugin/src/sensor_napi_utils.cpp | 2 +- .../hdi_connection/adapter/include/compatible_connection.h | 2 +- .../sensor/hdi_connection/adapter/include/hdi_connection.h | 3 ++- .../hdi_connection/adapter/src/compatible_connection.cpp | 2 +- .../hdi_connection/adapter/src/sensor_event_callback.cpp | 2 +- .../sensor/hdi_connection/hardware/include/hdi_service_impl.h | 2 +- .../sensor/hdi_connection/hardware/src/hdi_service_impl.cpp | 2 +- .../hdi_connection/interface/src/sensor_hdi_connection.cpp | 1 + services/sensor/include/fifo_cache_data.h | 2 +- services/sensor/include/sensor_service.h | 2 +- services/sensor/src/sensor_service.cpp | 2 +- 22 files changed, 23 insertions(+), 21 deletions(-) diff --git a/frameworks/native/sensor/include/my_event_handler.h b/frameworks/native/sensor/include/my_event_handler.h index 3b89c93b..8f30f92b 100755 --- a/frameworks/native/sensor/include/my_event_handler.h +++ b/frameworks/native/sensor/include/my_event_handler.h @@ -34,4 +34,4 @@ public: }; } // namespace Sensors } // namespace OHOS -#endif // MY_EVENT_HANDLER_H \ No newline at end of file +#endif // MY_EVENT_HANDLER_H diff --git a/frameworks/native/sensor/src/my_event_handler.cpp b/frameworks/native/sensor/src/my_event_handler.cpp index 802c1286..b6f067ff 100755 --- a/frameworks/native/sensor/src/my_event_handler.cpp +++ b/frameworks/native/sensor/src/my_event_handler.cpp @@ -32,4 +32,4 @@ MyEventHandler::MyEventHandler(const std::shared_ptr &runner):Event */ void MyEventHandler::ProcessEvent(const InnerEvent::Pointer &event){} } // namespace Sensors -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/frameworks/native/sensor/src/my_file_descriptor_listener.cpp b/frameworks/native/sensor/src/my_file_descriptor_listener.cpp index a562164c..a61e7271 100644 --- a/frameworks/native/sensor/src/my_file_descriptor_listener.cpp +++ b/frameworks/native/sensor/src/my_file_descriptor_listener.cpp @@ -113,4 +113,4 @@ void MyFileDescriptorListener::OnException(int32_t fileDescriptor) } } } // namespace Sensors -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/frameworks/native/sensor/src/sensor_agent_proxy.cpp b/frameworks/native/sensor/src/sensor_agent_proxy.cpp index a5522d8d..80b4b478 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()) {} @@ -358,4 +358,4 @@ int32_t SensorAgentProxy::GetAllSensors(SensorInfo **sensorInfo, int32_t *count) return OHOS::Sensors::SUCCESS; } } // namespace Sensors -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/interfaces/native/include/geomagnetic_field.h b/interfaces/native/include/geomagnetic_field.h index 2031e505..4e370481 100755 --- a/interfaces/native/include/geomagnetic_field.h +++ b/interfaces/native/include/geomagnetic_field.h @@ -86,4 +86,4 @@ private: double ToDegrees(double angrad); static double ToRadians(double angdeg); }; -#endif // GEOMAGNETIC_FIELD_H \ No newline at end of file +#endif // GEOMAGNETIC_FIELD_H 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/native/src/geomagnetic_field.cpp b/interfaces/native/src/geomagnetic_field.cpp index 1b7c0f2d..2cb30749 100644 --- a/interfaces/native/src/geomagnetic_field.cpp +++ b/interfaces/native/src/geomagnetic_field.cpp @@ -309,4 +309,3 @@ float GeomagneticField::ObtainTotalIntensity() float totalIntensity = static_cast(sqrt(sumOfSquares)); return totalIntensity; } - diff --git a/interfaces/native/src/sensor_agent.cpp b/interfaces/native/src/sensor_agent.cpp index e7e8b14f..ff40ebba 100755 --- a/interfaces/native/src/sensor_agent.cpp +++ b/interfaces/native/src/sensor_agent.cpp @@ -117,4 +117,4 @@ int32_t SetOption(int32_t sensorId, const SensorUser *user, int32_t option) return OHOS::Sensors::ERROR; } return proxy->SetOption(sensorId, user, option); -} \ No newline at end of file +} diff --git a/interfaces/native/src/sensor_algorithm.cpp b/interfaces/native/src/sensor_algorithm.cpp index 6742b4d4..932dfac6 100644 --- a/interfaces/native/src/sensor_algorithm.cpp +++ b/interfaces/native/src/sensor_algorithm.cpp @@ -351,4 +351,4 @@ int32_t SensorAlgorithm::createRotationAndInclination(std::vector gravity inclinationMatrix[15] = 1.0f; } return OHOS::Sensors::SUCCESS; -} \ No newline at end of file +} diff --git a/interfaces/plugin/include/sensor_js.h b/interfaces/plugin/include/sensor_js.h index 00d01db9..4ae20f05 100755 --- a/interfaces/plugin/include/sensor_js.h +++ b/interfaces/plugin/include/sensor_js.h @@ -21,4 +21,4 @@ static int32_t UnsubscribeSensor(int32_t sensorTypeId); static void DataCallbackImpl(SensorEvent *event); static int32_t SubscribeSensor(int32_t sensorTypeId, int64_t interval, RecordSensorCallback callback); -#endif // SENSOR_JS_H \ No newline at end of file +#endif // SENSOR_JS_H diff --git a/interfaces/plugin/include/sensor_system_js.h b/interfaces/plugin/include/sensor_system_js.h index 3b8dd9bd..dfff58da 100644 --- a/interfaces/plugin/include/sensor_system_js.h +++ b/interfaces/plugin/include/sensor_system_js.h @@ -45,4 +45,4 @@ napi_value UnsubscribeMagnetic(napi_env env, napi_callback_info info); napi_value SubscribeHall(napi_env env, napi_callback_info info); napi_value UnsubscribeHall(napi_env env, napi_callback_info info); -#endif // SENSOR_SYSTEM_JS_H \ No newline at end of file +#endif // SENSOR_SYSTEM_JS_H diff --git a/interfaces/plugin/src/sensor_napi_utils.cpp b/interfaces/plugin/src/sensor_napi_utils.cpp index 40fb2846..ff5b905b 100644 --- a/interfaces/plugin/src/sensor_napi_utils.cpp +++ b/interfaces/plugin/src/sensor_napi_utils.cpp @@ -494,4 +494,4 @@ void EmitPromiseWork(AsyncCallbackInfo *asyncCallbackInfo) }, (void*)asyncCallbackInfo, &asyncCallbackInfo->asyncWork); napi_queue_async_work(asyncCallbackInfo->env, asyncCallbackInfo->asyncWork); -} \ No newline at end of file +} diff --git a/services/sensor/hdi_connection/adapter/include/compatible_connection.h b/services/sensor/hdi_connection/adapter/include/compatible_connection.h index 958fb80d..c175b1f4 100644 --- a/services/sensor/hdi_connection/adapter/include/compatible_connection.h +++ b/services/sensor/hdi_connection/adapter/include/compatible_connection.h @@ -56,4 +56,4 @@ private: }; } // namespace Sensors } // namespace OHOS -#endif // COMPATIBLE_CONNECTION_H \ No newline at end of file +#endif // COMPATIBLE_CONNECTION_H diff --git a/services/sensor/hdi_connection/adapter/include/hdi_connection.h b/services/sensor/hdi_connection/adapter/include/hdi_connection.h index b5f26cb5..f2a2c3f9 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_; @@ -67,4 +68,4 @@ private: }; } // namespace Sensors } // namespace OHOS -#endif // HDI_CONNECTION_H \ No newline at end of file +#endif // HDI_CONNECTION_H diff --git a/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp b/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp index 13b0d0db..6f838648 100644 --- a/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp +++ b/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp @@ -179,4 +179,4 @@ int32_t CompatibleConnection::DestroyHdiConnection() return ERR_OK; } } // namespace Sensors -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp b/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp index 0c3d7c88..815f85ec 100644 --- a/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp +++ b/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp @@ -55,4 +55,4 @@ int32_t SensorEventCallback::OnDataEvent(const HdfSensorEvents& event) return ERR_OK; } } // namespace Sensors -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/sensor/hdi_connection/hardware/include/hdi_service_impl.h b/services/sensor/hdi_connection/hardware/include/hdi_service_impl.h index 9c9d041e..d0c3d108 100644 --- a/services/sensor/hdi_connection/hardware/include/hdi_service_impl.h +++ b/services/sensor/hdi_connection/hardware/include/hdi_service_impl.h @@ -61,4 +61,4 @@ private: }; } // namespace Sensors } // namespace OHOS -#endif // HDI_SERVICE_IMPL_H \ No newline at end of file +#endif // HDI_SERVICE_IMPL_H diff --git a/services/sensor/hdi_connection/hardware/src/hdi_service_impl.cpp b/services/sensor/hdi_connection/hardware/src/hdi_service_impl.cpp index a4c0f50f..d9cc86a6 100644 --- a/services/sensor/hdi_connection/hardware/src/hdi_service_impl.cpp +++ b/services/sensor/hdi_connection/hardware/src/hdi_service_impl.cpp @@ -157,4 +157,4 @@ int32_t HdiServiceImpl::Unregister() return ERR_OK; } } // namespace Sensors -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/sensor/hdi_connection/interface/src/sensor_hdi_connection.cpp b/services/sensor/hdi_connection/interface/src/sensor_hdi_connection.cpp index 78e63162..c3952706 100644 --- a/services/sensor/hdi_connection/interface/src/sensor_hdi_connection.cpp +++ b/services/sensor/hdi_connection/interface/src/sensor_hdi_connection.cpp @@ -145,3 +145,4 @@ int32_t SensorHdiConnection::DestroyHdiConnection() } } // namespace Sensors } // namespace OHOS + diff --git a/services/sensor/include/fifo_cache_data.h b/services/sensor/include/fifo_cache_data.h index 22d25798..fcfdfcd5 100755 --- a/services/sensor/include/fifo_cache_data.h +++ b/services/sensor/include/fifo_cache_data.h @@ -46,4 +46,4 @@ private: }; } // namespace Sensors } // namespace OHOS -#endif // FIFO_CACHE_DATA_H \ No newline at end of file +#endif // FIFO_CACHE_DATA_H 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_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