From 3bfdc0afa55f9793b928dc783ddda508d2b47cf3 Mon Sep 17 00:00:00 2001 From: maan4 Date: Thu, 28 Aug 2025 22:10:35 +0800 Subject: [PATCH] =?UTF-8?q?sensors=20=E6=97=A5=E5=BF=97=E8=B6=85=E9=87=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: maan4 --- frameworks/native/src/sensor_agent_proxy.cpp | 2 +- utils/common/src/print_sensor_data.cpp | 38 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/frameworks/native/src/sensor_agent_proxy.cpp b/frameworks/native/src/sensor_agent_proxy.cpp index d86e4e87..a3e5a65e 100644 --- a/frameworks/native/src/sensor_agent_proxy.cpp +++ b/frameworks/native/src/sensor_agent_proxy.cpp @@ -451,7 +451,7 @@ int32_t SensorAgentProxy::ConvertSensorInfos() const sensorInfo->power = sensorList[i].GetPower(); sensorInfo->minSamplePeriod = sensorList[i].GetMinSamplePeriodNs(); sensorInfo->maxSamplePeriod = sensorList[i].GetMaxSamplePeriodNs(); - SEN_HILOGI("deviceId %{public}d: sensorTypeId %{public}d, sensorIndex %{public}d", + SEN_HILOGD("deviceId %{public}d: sensorTypeId %{public}d, sensorIndex %{public}d", sensorInfo->deviceId, sensorInfo->sensorTypeId, sensorInfo->sensorIndex); } sensorInfoCount_ = static_cast(count); diff --git a/utils/common/src/print_sensor_data.cpp b/utils/common/src/print_sensor_data.cpp index c9306c34..1280e289 100644 --- a/utils/common/src/print_sensor_data.cpp +++ b/utils/common/src/print_sensor_data.cpp @@ -39,7 +39,7 @@ enum { DEFAULT_DIMENSION = 16 }; constexpr int64_t LOG_INTERVAL = 60000000000L; -constexpr int32_t FIRST_PRINT_TIMES = 20; +constexpr int32_t FIRST_PRINT_TIMES = 10; constexpr float LOG_FORMAT_DIVIDER = 1e9f; const std::vector g_triggerSensorType = { @@ -102,11 +102,11 @@ void PrintSensorData::ControlSensorHdiPrint(const SensorData &sensorData) void PrintSensorData::PrintHdiData(const SensorData &sensorData) { std::string str; - str += "deviceId:" + std::to_string(sensorData.deviceId) + ", "; - str += "sensorType:" + std::to_string(sensorData.sensorTypeId) + ", "; - str += "sensorId:" + std::to_string(sensorData.sensorId) + ", "; - str += "location:" + std::to_string(sensorData.location) + ", "; - str += "timestamp:" + std::to_string(sensorData.timestamp / LOG_FORMAT_DIVIDER) + ", "; + str += std::to_string(sensorData.deviceId) + " "; + str += std::to_string(sensorData.sensorTypeId) + " "; + str += std::to_string(sensorData.sensorId) + " "; + str += std::to_string(sensorData.location) + " "; + str += " ts:" + std::to_string(sensorData.timestamp / LOG_FORMAT_DIVIDER) + ", "; int32_t dataDim = GetDataDimension(sensorData.sensorTypeId); auto data = reinterpret_cast(sensorData.data); for (int32_t i = 0; i < dataDim; ++i) { @@ -118,7 +118,7 @@ void PrintSensorData::PrintHdiData(const SensorData &sensorData) ++data; } str.append("\n"); - SEN_HILOGI("SensorData:%{public}s", str.c_str()); + SEN_HILOGI("%{public}s", str.c_str()); } void PrintSensorData::ProcessHdiDFX(const SensorData &sensorData) @@ -213,11 +213,11 @@ void PrintSensorData::ControlSensorClientPrint(const RecordSensorCallback callba void PrintSensorData::PrintClientData(const SensorEvent &event) { std::string str; - str += "deviceId:" + std::to_string(event.deviceId) + ", "; - str += "sensorType:" + std::to_string(event.sensorTypeId) + ", "; - str += "sensorId:" + std::to_string(event.sensorId) + ", "; - str += "location:" + std::to_string(event.location) + ", "; - str += "timestamp:" + std::to_string(event.timestamp / LOG_FORMAT_DIVIDER) + ", "; + str += std::to_string(event.deviceId) + " "; + str += std::to_string(event.sensorTypeId) + " "; + str += std::to_string(event.sensorId) + " "; + str += std::to_string(event.location) + " "; + str += " ts:" + std::to_string(event.timestamp / LOG_FORMAT_DIVIDER) + ", "; int32_t dataDim = GetDataDimension(event.sensorTypeId); auto data = reinterpret_cast(event.data); for (int32_t i = 0; i < dataDim; ++i) { @@ -229,7 +229,7 @@ void PrintSensorData::PrintClientData(const SensorEvent &event) ++data; } str.append("\n"); - SEN_HILOGI("SensorData:%{public}s", str.c_str()); + SEN_HILOGI("%{public}s", str.c_str()); } void PrintSensorData::ProcessClientDFX(const SensorEvent &event) @@ -307,11 +307,11 @@ void PrintSensorData::ResetHdiTimes(int32_t sensorType) void PrintSensorData::PrintSensorDataLog(const std::string &name, const SensorData &data) { std::string str; - str += "deviceId:" + std::to_string(data.deviceId) + ", "; - str += "sensorType:" + std::to_string(data.sensorTypeId) + ", "; - str += "sensorId:" + std::to_string(data.sensorId) + ", "; - str += "location:" + std::to_string(data.location) + ", "; - str += "timestamp:" + std::to_string(data.timestamp / LOG_FORMAT_DIVIDER) + ", "; + str += std::to_string(data.deviceId) + ", "; + str += std::to_string(data.sensorTypeId) + ", "; + str += std::to_string(data.sensorId) + ", "; + str += std::to_string(data.location) + ", "; + str += " ts:" + std::to_string(data.timestamp / LOG_FORMAT_DIVIDER) + ", "; int32_t dataDim = GetDataDimension(data.sensorTypeId); auto tempData = reinterpret_cast(data.data); for (int32_t i = 0; i < dataDim; ++i) { @@ -332,7 +332,7 @@ void PrintSensorData::PrintSensorInfo(SensorInfo *sensorInfos, int32_t sensorInf for (int32_t i = 0; i < sensorInfoCount; ++i) { combineSensorIds = combineSensorIds + std::to_string(sensorInfos[i].sensorTypeId) + " "; } - SEN_HILOGI("PrintSensorInfo success, sensorIds:%{public}s, sensorInfoCount:%{public}d", combineSensorIds.c_str(), + SEN_HILOGD("PrintSensorInfo success, sensorIds:%{public}s, sensorInfoCount:%{public}d", combineSensorIds.c_str(), sensorInfoCount); } } // namespace Sensors -- Gitee