From 03a39914ce8b6dc494204f137dabcbcaeeb14a30 Mon Sep 17 00:00:00 2001 From: shenpeixing Date: Fri, 11 Apr 2025 18:17:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=BC=A0=E6=84=9F=E5=99=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenpeixing --- frameworks/native/include/sensor_agent_proxy.h | 1 + frameworks/native/src/sensor_agent_proxy.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/frameworks/native/include/sensor_agent_proxy.h b/frameworks/native/include/sensor_agent_proxy.h index 58e8bd1f..964dd255 100644 --- a/frameworks/native/include/sensor_agent_proxy.h +++ b/frameworks/native/include/sensor_agent_proxy.h @@ -55,6 +55,7 @@ private: void ClearSensorInfos() const; std::set GetSubscribeUserCallback(int32_t sensorId); bool IsSubscribeMapEmpty() const; + void PrintSersorInfo(SensorInfo *sensorInfos, int32_t sensorInfoCount) const; static std::recursive_mutex subscribeMutex_; static std::mutex chanelMutex_; OHOS::sptr dataChannel_ = nullptr; diff --git a/frameworks/native/src/sensor_agent_proxy.cpp b/frameworks/native/src/sensor_agent_proxy.cpp index 2d023b4d..73a467a3 100644 --- a/frameworks/native/src/sensor_agent_proxy.cpp +++ b/frameworks/native/src/sensor_agent_proxy.cpp @@ -430,9 +430,20 @@ int32_t SensorAgentProxy::GetAllSensors(SensorInfo **sensorInfo, int32_t *count) } *sensorInfo = sensorInfos_; *count = sensorInfoCount_; + PrintSersorInfo(sensorInfos_, sensorInfoCount_); return SUCCESS; } +void SensorAgentProxy::PrintSersorInfo(SensorInfo *sensorInfos, int32_t sensorInfoCount) const +{ + std::string combineSensorIds = ""; + for (int32_t i = 0; i < sensorInfoCount; ++i) { + combineSensorIds = combineSensorIds + std::to_string(sensorInfos[i].sensorTypeId) + " "; + } + SEN_HILOGI("PrintSersorInfo success, sensorIds:%{public}s, sensorInfoCount:%{public}d", combineSensorIds.c_str(), + sensorInfoCount); +} + int32_t SensorAgentProxy::SuspendSensors(int32_t pid) { CALL_LOG_ENTER; -- Gitee