From 80ef1a9e185c8598a2f76703e7688e3e2683709f Mon Sep 17 00:00:00 2001 From: hui1975 Date: Wed, 21 Sep 2022 17:23:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B1=BB=E5=92=8C=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=90=8D=E4=B8=BA=E5=A4=A7=E9=A9=BC=E5=B3=B0=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hui1975 Change-Id: Id99b802d1e538a021994475e4f65713d242c006c --- .../sensor/include/sensor_data_channel.h | 2 +- interfaces/native/include/sensor_algorithm.h | 18 ++++++------- interfaces/native/src/sensor_algorithm.cpp | 26 +++++++++---------- interfaces/plugin/src/sensor_js.cpp | 20 +++++++------- .../adapter/include/compatible_connection.h | 4 +-- .../adapter/include/hdi_connection.h | 16 ++++++------ .../adapter/src/compatible_connection.cpp | 4 +-- .../adapter/src/hdi_connection.cpp | 24 ++++++++--------- .../adapter/src/sensor_event_callback.cpp | 4 +-- .../include/i_sensor_hdi_connection.h | 2 +- .../interface/include/sensor_hdi_connection.h | 4 +-- .../interface/src/sensor_hdi_connection.cpp | 8 +++--- services/sensor/src/sensor_service.cpp | 2 +- utils/include/report_data_callback.h | 2 +- 14 files changed, 68 insertions(+), 68 deletions(-) diff --git a/frameworks/native/sensor/include/sensor_data_channel.h b/frameworks/native/sensor/include/sensor_data_channel.h index 20ef450e..8a9bb96d 100644 --- a/frameworks/native/sensor/include/sensor_data_channel.h +++ b/frameworks/native/sensor/include/sensor_data_channel.h @@ -40,7 +40,7 @@ public: void *privateData_ = nullptr; private: - static void threadProcessTask(SensorDataChannel *sensorChannel); + static void ThreadProcessTask(SensorDataChannel *sensorChannel); int32_t InnerSensorDataChannel(); std::mutex eventRunnerMutex_; static std::shared_ptr eventHandler_; diff --git a/interfaces/native/include/sensor_algorithm.h b/interfaces/native/include/sensor_algorithm.h index 10ebca55..83bee7e2 100644 --- a/interfaces/native/include/sensor_algorithm.h +++ b/interfaces/native/include/sensor_algorithm.h @@ -23,20 +23,20 @@ class SensorAlgorithm { public: SensorAlgorithm() = default; ~SensorAlgorithm() = default; - int32_t createQuaternion(std::vector rotationVector, std::vector &quaternion); - int32_t transformCoordinateSystem(std::vector inRotationMatrix, int32_t axisX, + int32_t CreateQuaternion(std::vector rotationVector, std::vector &quaternion); + int32_t TransformCoordinateSystem(std::vector inRotationMatrix, int32_t axisX, int32_t axisY, std::vector &outRotationMatrix); - int32_t getAltitude(float seaPressure, float currentPressure, float *altitude); - int32_t getGeomagneticDip(std::vector inclinationMatrix, float *geomagneticDip); - int32_t getAngleModify(std::vector currotationMatrix, std::vector prerotationMatrix, + int32_t GetAltitude(float seaPressure, float currentPressure, float *altitude); + int32_t GetGeomagneticDip(std::vector inclinationMatrix, float *geomagneticDip); + int32_t GetAngleModify(std::vector currotationMatrix, std::vector prerotationMatrix, std::vector &angleChange); - int32_t getDirection(std::vector rotationMatrix, std::vector &rotationAngle); - int32_t createRotationMatrix(std::vector rotationVector, std::vector &rotationMatrix); - int32_t createRotationAndInclination(std::vector gravity, std::vector geomagnetic, + int32_t GetDirection(std::vector rotationMatrix, std::vector &rotationAngle); + int32_t CreateRotationMatrix(std::vector rotationVector, std::vector &rotationMatrix); + 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 TransformCoordinateSystemImpl(std::vector inRotationMatrix, int32_t axisX, int32_t axisY, std::vector &outRotationMatrix); static constexpr int32_t QUATERNION_LENGTH = 4; static constexpr int32_t ROTATION_VECTOR_LENGTH = 3; diff --git a/interfaces/native/src/sensor_algorithm.cpp b/interfaces/native/src/sensor_algorithm.cpp index 30071cb8..80da8de9 100644 --- a/interfaces/native/src/sensor_algorithm.cpp +++ b/interfaces/native/src/sensor_algorithm.cpp @@ -24,7 +24,7 @@ using OHOS::HiviewDFX::HiLogLabel; static constexpr HiLogLabel LABEL = {LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAlgorithmAPI"}; -int32_t SensorAlgorithm::createQuaternion(std::vector rotationVector, std::vector &quaternion) +int32_t SensorAlgorithm::CreateQuaternion(std::vector rotationVector, std::vector &quaternion) { if (static_cast(rotationVector.size()) < ROTATION_VECTOR_LENGTH || static_cast(rotationVector.size()) > QUATERNION_LENGTH) { @@ -48,7 +48,7 @@ int32_t SensorAlgorithm::createQuaternion(std::vector rotationVector, std return OHOS::Sensors::SUCCESS; } -int32_t SensorAlgorithm::transformCoordinateSystemImpl(std::vector inRotationMatrix, int32_t axisX, +int32_t SensorAlgorithm::TransformCoordinateSystemImpl(std::vector inRotationMatrix, int32_t axisX, int32_t axisY, std::vector &outRotationMatrix) { if ((axisX & 0x7C) != 0 || (axisX & 0x3) == 0) { @@ -91,7 +91,7 @@ int32_t SensorAlgorithm::transformCoordinateSystemImpl(std::vector inRota return OHOS::Sensors::SUCCESS; } -int32_t SensorAlgorithm::transformCoordinateSystem(std::vector inRotationMatrix, int32_t axisX, int32_t axisY, +int32_t SensorAlgorithm::TransformCoordinateSystem(std::vector inRotationMatrix, int32_t axisX, int32_t axisY, std::vector &outRotationMatrix) { int32_t inRotationMatrixLength = static_cast(inRotationMatrix.size()); @@ -102,8 +102,8 @@ int32_t SensorAlgorithm::transformCoordinateSystem(std::vector inRotation } if (inRotationMatrix == outRotationMatrix) { std::vector tempRotationMatrix(inRotationMatrixLength); - if (transformCoordinateSystemImpl(inRotationMatrix, axisX, axisY, tempRotationMatrix) != OHOS::Sensors::SUCCESS) { - SEN_HILOGE("transformCoordinateSystemImpl failed"); + if (TransformCoordinateSystemImpl(inRotationMatrix, axisX, axisY, tempRotationMatrix) != OHOS::Sensors::SUCCESS) { + SEN_HILOGE("TransformCoordinateSystemImpl failed"); return OHOS::Sensors::ERROR; } for (int32_t i = 0; i < inRotationMatrixLength; i++) { @@ -111,10 +111,10 @@ int32_t SensorAlgorithm::transformCoordinateSystem(std::vector inRotation } return OHOS::Sensors::SUCCESS; } - return transformCoordinateSystemImpl(inRotationMatrix, axisX, axisY, outRotationMatrix); + return TransformCoordinateSystemImpl(inRotationMatrix, axisX, axisY, outRotationMatrix); } -int32_t SensorAlgorithm::getAltitude(float seaPressure, float currentPressure, float *altitude) +int32_t SensorAlgorithm::GetAltitude(float seaPressure, float currentPressure, float *altitude) { if (altitude == nullptr) { SEN_HILOGE("invalid parameter"); @@ -127,7 +127,7 @@ int32_t SensorAlgorithm::getAltitude(float seaPressure, float currentPressure, f return OHOS::Sensors::SUCCESS; } -int32_t SensorAlgorithm::getGeomagneticDip(std::vector inclinationMatrix, float *geomagneticDip) +int32_t SensorAlgorithm::GetGeomagneticDip(std::vector inclinationMatrix, float *geomagneticDip) { if (geomagneticDip == nullptr) { SEN_HILOGE("invalid parameter"); @@ -146,7 +146,7 @@ int32_t SensorAlgorithm::getGeomagneticDip(std::vector inclinationMatrix, return OHOS::Sensors::SUCCESS; } -int32_t SensorAlgorithm::getAngleModify(std::vector curRotationMatrix, std::vector preRotationMatrix, +int32_t SensorAlgorithm::GetAngleModify(std::vector curRotationMatrix, std::vector preRotationMatrix, std::vector &angleChange) { if (static_cast(angleChange.size()) < ROTATION_VECTOR_LENGTH) { @@ -189,7 +189,7 @@ int32_t SensorAlgorithm::getAngleModify(std::vector curRotationMatrix, st return OHOS::Sensors::SUCCESS; } -int32_t SensorAlgorithm::getDirection(std::vector rotationMatrix, std::vector &rotationAngle) +int32_t SensorAlgorithm::GetDirection(std::vector rotationMatrix, std::vector &rotationAngle) { if (static_cast(rotationAngle.size()) < ROTATION_VECTOR_LENGTH) { SEN_HILOGE("invalid parameter"); @@ -212,7 +212,7 @@ int32_t SensorAlgorithm::getDirection(std::vector rotationMatrix, std::ve return OHOS::Sensors::SUCCESS; } -int32_t SensorAlgorithm::createRotationMatrix(std::vector rotationVector, std::vector &rotationMatrix) +int32_t SensorAlgorithm::CreateRotationMatrix(std::vector rotationVector, std::vector &rotationMatrix) { int32_t rotationMatrixLength = static_cast(rotationMatrix.size()); if ((static_cast(rotationVector.size()) < ROTATION_VECTOR_LENGTH) @@ -222,7 +222,7 @@ int32_t SensorAlgorithm::createRotationMatrix(std::vector rotationVector, return OHOS::Sensors::ERROR; } std::vector quaternion(4); - int32_t ret = createQuaternion(rotationVector, quaternion); + int32_t ret = CreateQuaternion(rotationVector, quaternion); if (ret != OHOS::Sensors::SUCCESS) { SEN_HILOGE("create quaternion failed"); return OHOS::Sensors::ERROR; @@ -261,7 +261,7 @@ int32_t SensorAlgorithm::createRotationMatrix(std::vector rotationVector, return OHOS::Sensors::SUCCESS; } -int32_t SensorAlgorithm::createRotationAndInclination(std::vector gravity, std::vector geomagnetic, +int32_t SensorAlgorithm::CreateRotationAndInclination(std::vector gravity, std::vector geomagnetic, std::vector &rotationMatrix, std::vector &inclinationMatrix) { if (static_cast(gravity.size()) < ROTATION_VECTOR_LENGTH diff --git a/interfaces/plugin/src/sensor_js.cpp b/interfaces/plugin/src/sensor_js.cpp index 0e449211..a706638b 100644 --- a/interfaces/plugin/src/sensor_js.cpp +++ b/interfaces/plugin/src/sensor_js.cpp @@ -437,7 +437,7 @@ static napi_value TransformCoordinateSystem(napi_env env, napi_callback_info inf CHKPP(asyncCallbackInfo); std::vector outRotationVector(length); SensorAlgorithm sensorAlgorithm; - int32_t ret = sensorAlgorithm.transformCoordinateSystem(inRotationVector, axisX, axisY, outRotationVector); + int32_t ret = sensorAlgorithm.TransformCoordinateSystem(inRotationVector, axisX, axisY, outRotationVector); if (ret != OHOS::ERR_OK) { SEN_HILOGE("Transform coordinate system fail"); asyncCallbackInfo->type = FAIL; @@ -481,7 +481,7 @@ static napi_value GetAngleModify(napi_env env, napi_callback_info info) std::vector angleChange(ROTATION_VECTOR_LENGTH); SensorAlgorithm sensorAlgorithm; - int32_t ret = sensorAlgorithm.getAngleModify(curRotationVector, preRotationVector, angleChange); + int32_t ret = sensorAlgorithm.GetAngleModify(curRotationVector, preRotationVector, angleChange); if (ret != OHOS::ERR_OK) { SEN_HILOGE("Get angle modify fail"); asyncCallbackInfo->type = FAIL; @@ -523,7 +523,7 @@ static napi_value GetDirection(napi_env env, napi_callback_info info) CHKNCP(env, GetFloatArray(env, args[0], rotationMatrix), "Wrong argument type, get rotationMatrix fail"); std::vector rotationAngle(ROTATION_VECTOR_LENGTH); SensorAlgorithm sensorAlgorithm; - int32_t ret = sensorAlgorithm.getDirection(rotationMatrix, rotationAngle); + int32_t ret = sensorAlgorithm.GetDirection(rotationMatrix, rotationAngle); if (ret != OHOS::ERR_OK) { SEN_HILOGE("Get direction fail"); asyncCallbackInfo->type = FAIL; @@ -565,7 +565,7 @@ static napi_value CreateQuaternion(napi_env env, napi_callback_info info) "Wrong argument type, get rotationVector fail"); std::vector quaternion(QUATERNION_LENGTH); SensorAlgorithm sensorAlgorithm; - int32_t ret = sensorAlgorithm.createQuaternion(rotationVector, quaternion); + int32_t ret = sensorAlgorithm.CreateQuaternion(rotationVector, quaternion); if (ret != OHOS::ERR_OK) { SEN_HILOGE("Create quaternin fail"); asyncCallbackInfo->type = FAIL; @@ -609,7 +609,7 @@ static napi_value GetAltitude(napi_env env, napi_callback_info info) CHKNCP(env, GetCppFloat(env, args[1], currentPressure), "Wrong argument type, get currentPressure fail"); float altitude = 0; SensorAlgorithm sensorAlgorithm; - int32_t ret = sensorAlgorithm.getAltitude(seaPressure, currentPressure, &altitude); + int32_t ret = sensorAlgorithm.GetAltitude(seaPressure, currentPressure, &altitude); if (ret != OHOS::ERR_OK) { SEN_HILOGE("Get altitude fail"); asyncCallbackInfo->type = FAIL; @@ -648,7 +648,7 @@ static napi_value GetGeomagneticDip(napi_env env, napi_callback_info info) "Wrong argument type, get inclinationMatrix fail"); float geomagneticDip = 0; SensorAlgorithm sensorAlgorithm; - int32_t ret = sensorAlgorithm.getGeomagneticDip(inclinationMatrix, &geomagneticDip); + int32_t ret = sensorAlgorithm.GetGeomagneticDip(inclinationMatrix, &geomagneticDip); if (ret != OHOS::ERR_OK) { SEN_HILOGE("Get geomagnetic dip fail"); asyncCallbackInfo->type = FAIL; @@ -670,7 +670,7 @@ static napi_value GetGeomagneticDip(napi_env env, napi_callback_info info) return nullptr; } -static napi_value createRotationAndInclination(const napi_env &env, napi_value args[], size_t argc) +static napi_value CreateRotationAndInclination(const napi_env &env, napi_value args[], size_t argc) { CALL_LOG_ENTER; CHKNCP(env, ((argc == 2) || (argc == 3)), "The number of parameters is not valid"); @@ -684,7 +684,7 @@ static napi_value createRotationAndInclination(const napi_env &env, napi_value a new (std::nothrow) AsyncCallbackInfo(env, ROTATION_INCLINATION_MATRIX); CHKPP(asyncCallbackInfo); SensorAlgorithm sensorAlgorithm; - int32_t ret = sensorAlgorithm.createRotationAndInclination(gravity, geomagnetic, rotation, inclination); + int32_t ret = sensorAlgorithm.CreateRotationAndInclination(gravity, geomagnetic, rotation, inclination); if (ret != OHOS::ERR_OK) { SEN_HILOGE("Create rotation and inclination matrix fail"); asyncCallbackInfo->type = FAIL; @@ -724,7 +724,7 @@ static napi_value GetRotationMatrix(const napi_env &env, napi_value args[], size CHKPP(asyncCallbackInfo); std::vector rotationMatrix(THREE_DIMENSIONAL_MATRIX_LENGTH); SensorAlgorithm sensorAlgorithm; - int32_t ret = sensorAlgorithm.createRotationMatrix(rotationVector, rotationMatrix); + int32_t ret = sensorAlgorithm.CreateRotationMatrix(rotationVector, rotationMatrix); if (ret != OHOS::ERR_OK) { SEN_HILOGE("Create rotation matrix fail"); asyncCallbackInfo->type = FAIL; @@ -761,7 +761,7 @@ static napi_value CreateRotationMatrix(napi_env env, napi_callback_info info) if (argc == 1 || (argc == 2 && IsMatchType(env, args[1], napi_function))) { return GetRotationMatrix(env, args, argc); } else if (IsMatchArrayType(env, args[1])) { - return createRotationAndInclination(env, args, argc); + return CreateRotationAndInclination(env, args, argc); } return nullptr; } diff --git a/services/sensor/hdi_connection/adapter/include/compatible_connection.h b/services/sensor/hdi_connection/adapter/include/compatible_connection.h index 80e8d088..1dad247a 100644 --- a/services/sensor/hdi_connection/adapter/include/compatible_connection.h +++ b/services/sensor/hdi_connection/adapter/include/compatible_connection.h @@ -33,13 +33,13 @@ public: int32_t SetMode(int32_t sensorId, int32_t mode) override; int32_t SetOption(int32_t sensorId, int32_t option) override; int32_t RunCommand(int32_t sensorId, int32_t cmd, int32_t params) override; - int32_t RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) override; + int32_t RegisteDataReport(ReportDataCb cb, sptr reportDataCallback) override; int32_t DestroyHdiConnection() override; private: DISALLOW_COPY_AND_MOVE(CompatibleConnection); static int32_t SensorDataCallback(const SensorEvents *event); - static ZReportDataCb reportDataCb_; + static ReportDataCb reportDataCb_; static sptr reportDataCallback_; HdiServiceImpl &hdiServiceImpl_ = HdiServiceImpl::GetInstance(); }; diff --git a/services/sensor/hdi_connection/adapter/include/hdi_connection.h b/services/sensor/hdi_connection/adapter/include/hdi_connection.h index 4b692bd4..f93de5be 100644 --- a/services/sensor/hdi_connection/adapter/include/hdi_connection.h +++ b/services/sensor/hdi_connection/adapter/include/hdi_connection.h @@ -34,23 +34,23 @@ public: int32_t SetMode(int32_t sensorId, int32_t mode) override; int32_t SetOption(int32_t sensorId, int32_t option) override; int32_t RunCommand(int32_t sensorId, int32_t cmd, int32_t params) override; - int32_t RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) override; + int32_t RegisteDataReport(ReportDataCb cb, sptr reportDataCallback) override; int32_t DestroyHdiConnection() override; - ZReportDataCb getReportDataCb(); - sptr getReportDataCallback(); + ReportDataCb GetReportDataCb(); + sptr GetReportDataCallback(); void ProcessDeathObserver(const wptr &object); private: DISALLOW_COPY_AND_MOVE(HdiConnection); - static ZReportDataCb reportDataCb_; + static ReportDataCb reportDataCb_; static sptr reportDataCallback_; sptr hdiDeathObserver_; void RegisterHdiDeathRecipient(); void UnregisterHdiDeathRecipient(); - void reconnect(); - void updateSensorBasicInfo(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs); - void setSensorBasicInfoState(int32_t sensorId, bool state); - void deleteSensorBasicInfoState(int32_t sensorId); + void Reconnect(); + void UpdateSensorBasicInfo(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs); + void SetSensorBasicInfoState(int32_t sensorId, bool state); + void DeleteSensorBasicInfoState(int32_t sensorId); }; } // namespace Sensors } // namespace OHOS diff --git a/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp b/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp index cd7f25ff..73129f40 100644 --- a/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp +++ b/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp @@ -27,7 +27,7 @@ namespace { constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "CompatibleConnection" }; } -ZReportDataCb CompatibleConnection::reportDataCb_ = nullptr; +ReportDataCb CompatibleConnection::reportDataCb_ = nullptr; sptr CompatibleConnection::reportDataCallback_ = nullptr; std::mutex ISensorHdiConnection::dataMutex_; std::condition_variable ISensorHdiConnection::dataCondition_; @@ -156,7 +156,7 @@ int32_t CompatibleConnection::SensorDataCallback(const SensorEvents *event) return ERR_OK; } -int32_t CompatibleConnection::RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) +int32_t CompatibleConnection::RegisteDataReport(ReportDataCb cb, sptr reportDataCallback) { CHKPR(reportDataCallback, ERR_INVALID_VALUE); int32_t ret = hdiServiceImpl_.Register(SensorDataCallback); diff --git a/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp b/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp index d6e69521..1b84ecf0 100644 --- a/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp @@ -40,7 +40,7 @@ constexpr int32_t GET_HDI_SERVICE_COUNT = 30; constexpr uint32_t WAIT_MS = 200; } -ZReportDataCb HdiConnection::reportDataCb_ = nullptr; +ReportDataCb HdiConnection::reportDataCb_ = nullptr; sptr HdiConnection::reportDataCallback_ = nullptr; int32_t HdiConnection::ConnectHdi() @@ -106,7 +106,7 @@ int32_t HdiConnection::EnableSensor(int32_t sensorId) SEN_HILOGE("connect v1_0 hdi failed"); return ret; } - setSensorBasicInfoState(sensorId, true); + SetSensorBasicInfoState(sensorId, true); return ERR_OK; } @@ -120,7 +120,7 @@ int32_t HdiConnection::DisableSensor(int32_t sensorId) SEN_HILOGE("Disable is failed"); return ret; } - deleteSensorBasicInfoState(sensorId); + DeleteSensorBasicInfoState(sensorId); return ERR_OK; } @@ -134,7 +134,7 @@ int32_t HdiConnection::SetBatch(int32_t sensorId, int64_t samplingInterval, int6 SEN_HILOGE("SetBatch is failed"); return ret; } - updateSensorBasicInfo(sensorId, samplingInterval, reportInterval); + UpdateSensorBasicInfo(sensorId, samplingInterval, reportInterval); return ERR_OK; } @@ -166,7 +166,7 @@ int32_t HdiConnection::SetOption(int32_t sensorId, int32_t option) return ERR_OK; } -int32_t HdiConnection::RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) +int32_t HdiConnection::RegisteDataReport(ReportDataCb cb, sptr reportDataCallback) { CALL_LOG_ENTER; CHKPR(reportDataCallback, ERR_NO_INIT); @@ -204,7 +204,7 @@ int32_t HdiConnection::RunCommand(int32_t sensorId, int32_t cmd, int32_t params) return 0; } -ZReportDataCb HdiConnection::getReportDataCb() +ReportDataCb HdiConnection::GetReportDataCb() { if (reportDataCb_ == nullptr) { SEN_HILOGE("reportDataCb_ cannot be null"); @@ -212,7 +212,7 @@ ZReportDataCb HdiConnection::getReportDataCb() return reportDataCb_; } -sptr HdiConnection::getReportDataCallback() +sptr HdiConnection::GetReportDataCallback() { if (reportDataCallback_ == nullptr) { SEN_HILOGE("reportDataCallback_ cannot be null"); @@ -220,7 +220,7 @@ sptr HdiConnection::getReportDataCallback() return reportDataCallback_; } -void HdiConnection::updateSensorBasicInfo(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) +void HdiConnection::UpdateSensorBasicInfo(int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) { std::lock_guard sensorInfoLock(sensorBasicInfoMutex_); SensorBasicInfo sensorBasicInfo; @@ -229,7 +229,7 @@ void HdiConnection::updateSensorBasicInfo(int32_t sensorId, int64_t samplingPeri sensorBasicInfoMap_[sensorId] = sensorBasicInfo; } -void HdiConnection::setSensorBasicInfoState(int32_t sensorId, bool state) +void HdiConnection::SetSensorBasicInfoState(int32_t sensorId, bool state) { std::lock_guard sensorInfoLock(sensorBasicInfoMutex_); auto it = sensorBasicInfoMap_.find(sensorId); @@ -240,7 +240,7 @@ void HdiConnection::setSensorBasicInfoState(int32_t sensorId, bool state) sensorBasicInfoMap_[sensorId].SetSensorState(state); } -void HdiConnection::deleteSensorBasicInfoState(int32_t sensorId) +void HdiConnection::DeleteSensorBasicInfoState(int32_t sensorId) { std::lock_guard sensorInfoLock(sensorBasicInfoMutex_); auto it = sensorBasicInfoMap_.find(sensorId); @@ -273,10 +273,10 @@ void HdiConnection::ProcessDeathObserver(const wptr &object) CHKPV(hdiService); hdiService->RemoveDeathRecipient(hdiDeathObserver_); eventCallback_ = nullptr; - reconnect(); + Reconnect(); } -void HdiConnection::reconnect() +void HdiConnection::Reconnect() { CALL_LOG_ENTER; int32_t ret = ConnectHdi(); 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 e06939c2..a5a9fbf8 100644 --- a/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp +++ b/services/sensor/hdi_connection/adapter/src/sensor_event_callback.cpp @@ -28,8 +28,8 @@ std::unique_ptr HdiConnection_ = std::make_unique( } int32_t SensorEventCallback::OnDataEvent(const HdfSensorEvents& event) { - ZReportDataCb reportDataCb_ = HdiConnection_->getReportDataCb(); - sptr reportDataCallback_ = HdiConnection_->getReportDataCallback(); + ReportDataCb reportDataCb_ = HdiConnection_->GetReportDataCb(); + sptr reportDataCallback_ = HdiConnection_->GetReportDataCallback(); CHKPR(reportDataCb_, ERR_NO_INIT); CHKPR(reportDataCallback_, ERR_NO_INIT); int32_t dataSize = static_cast(event.data.size()); diff --git a/services/sensor/hdi_connection/interface/include/i_sensor_hdi_connection.h b/services/sensor/hdi_connection/interface/include/i_sensor_hdi_connection.h index 910a5a9b..c0890f9c 100644 --- a/services/sensor/hdi_connection/interface/include/i_sensor_hdi_connection.h +++ b/services/sensor/hdi_connection/interface/include/i_sensor_hdi_connection.h @@ -35,7 +35,7 @@ public: virtual int32_t SetMode(int32_t sensorId, int32_t mode) = 0; virtual int32_t SetOption(int32_t sensorId, int32_t option) = 0; virtual int32_t RunCommand(int32_t sensorId, int32_t cmd, int32_t params) = 0; - virtual int32_t RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) = 0; + virtual int32_t RegisteDataReport(ReportDataCb cb, sptr reportDataCallback) = 0; virtual int32_t DestroyHdiConnection() = 0; static std::mutex dataMutex_; static std::condition_variable dataCondition_; diff --git a/services/sensor/hdi_connection/interface/include/sensor_hdi_connection.h b/services/sensor/hdi_connection/interface/include/sensor_hdi_connection.h index 3378a31f..6c67144d 100644 --- a/services/sensor/hdi_connection/interface/include/sensor_hdi_connection.h +++ b/services/sensor/hdi_connection/interface/include/sensor_hdi_connection.h @@ -33,14 +33,14 @@ public: int32_t SetMode(int32_t sensorId, int32_t mode) override; int32_t SetOption(int32_t sensorId, int32_t option) override; int32_t RunCommand(int32_t sensorId, int32_t cmd, int32_t params) override; - int32_t RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) override; + int32_t RegisteDataReport(ReportDataCb cb, sptr reportDataCallback) override; int32_t DestroyHdiConnection() override; private: DISALLOW_COPY_AND_MOVE(SensorHdiConnection); std::unique_ptr iSensorHdiConnection_; std::vector sensorList_; - int32_t connectHdiService(); + int32_t ConnectHdiService(); }; } // namespace Sensors } // 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 3f25365b..7f1ca5e6 100644 --- a/services/sensor/hdi_connection/interface/src/sensor_hdi_connection.cpp +++ b/services/sensor/hdi_connection/interface/src/sensor_hdi_connection.cpp @@ -30,11 +30,11 @@ int32_t SensorHdiConnection::ConnectHdi() { iSensorHdiConnection_ = std::make_unique(); CHKPR(iSensorHdiConnection_, ERROR); - int32_t ret = connectHdiService(); + int32_t ret = ConnectHdiService(); if (ret != ERR_OK) { SEN_HILOGE("connect hdi service failed, try to connect compatible connection"); iSensorHdiConnection_ = std::make_unique(); - ret = connectHdiService(); + ret = ConnectHdiService(); } if (ret != ERR_OK) { SEN_HILOGE("connect hdi failed"); @@ -42,7 +42,7 @@ int32_t SensorHdiConnection::ConnectHdi() return ERR_OK; } -int32_t SensorHdiConnection::connectHdiService() +int32_t SensorHdiConnection::ConnectHdiService() { int32_t ret = iSensorHdiConnection_->ConnectHdi(); if (ret != 0) { @@ -135,7 +135,7 @@ int32_t SensorHdiConnection::RunCommand(int32_t sensorId, int32_t cmd, int32_t p return ret; } -int32_t SensorHdiConnection::RegisteDataReport(ZReportDataCb cb, sptr reportDataCallback) +int32_t SensorHdiConnection::RegisteDataReport(ReportDataCb cb, sptr reportDataCallback) { StartTrace(HITRACE_TAG_SENSORS, "RegisteDataReport"); int32_t ret = iSensorHdiConnection_->RegisteDataReport(cb, reportDataCallback); diff --git a/services/sensor/src/sensor_service.cpp b/services/sensor/src/sensor_service.cpp index 7018e889..d9990954 100644 --- a/services/sensor/src/sensor_service.cpp +++ b/services/sensor/src/sensor_service.cpp @@ -103,7 +103,7 @@ bool SensorService::InitDataCallback() { reportDataCallback_ = new (std::nothrow) ReportDataCallback(); CHKPF(reportDataCallback_); - ZReportDataCb cb = &ReportDataCallback::ReportEventCallback; + ReportDataCb cb = &ReportDataCallback::ReportEventCallback; auto ret = sensorHdiConnection_.RegisteDataReport(cb, reportDataCallback_); if (ret != ERR_OK) { SEN_HILOGE("RegisterDataReport failed"); diff --git a/utils/include/report_data_callback.h b/utils/include/report_data_callback.h index 34088dd7..4c6acd5d 100644 --- a/utils/include/report_data_callback.h +++ b/utils/include/report_data_callback.h @@ -40,7 +40,7 @@ public: CircularEventBuf eventsBuf_; }; -using ZReportDataCb = int32_t (ReportDataCallback::*)(SensorEvent *event, sptr cb); +using ReportDataCb = int32_t (ReportDataCallback::*)(SensorEvent *event, sptr cb); } // namespace Sensors } // namespace OHOS #endif // REPORT_DATA_CALLBACK_H -- Gitee