From c72aa068df6fa0e2f621587500f218a5d53877db Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Wed, 29 Jun 2022 19:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86=E6=84=8F?= =?UTF-8?q?=E8=A7=81=20Signed-off-by:=20wangyb0625=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../include/softbus/softbus_listener.h | 2 +- .../service/src/device_manager_service.cpp | 16 +++++----- .../service/src/softbus/softbus_listener.cpp | 2 +- utils/include/dfx/dm_dfx_constants.h | 2 -- utils/include/dfx/lite/dm_hidumper.h | 4 +-- utils/include/dfx/standard/dm_hidumper.h | 4 +-- utils/src/dfx/lite/dm_hidumper.cpp | 9 +++--- utils/src/dfx/standard/dm_hidumper.cpp | 30 +++++++++---------- 8 files changed, 32 insertions(+), 37 deletions(-) diff --git a/services/service/include/softbus/softbus_listener.h b/services/service/include/softbus/softbus_listener.h index 5ac58532..ce039152 100644 --- a/services/service/include/softbus/softbus_listener.h +++ b/services/service/include/softbus/softbus_listener.h @@ -101,7 +101,7 @@ public: ~SoftbusListener(); int32_t GetTrustedDeviceList(std::vector &deviceInfoList); int32_t GetLocalDeviceInfo(DmDeviceInfo &deviceInfo); - bool DumperIsDeviceOnline(const std::string &deviceId); + bool IsDeviceOnline(const std::string &deviceId); private: int32_t Init(); diff --git a/services/service/src/device_manager_service.cpp b/services/service/src/device_manager_service.cpp index 5e9dcf53..7c1de2c6 100644 --- a/services/service/src/device_manager_service.cpp +++ b/services/service/src/device_manager_service.cpp @@ -87,8 +87,6 @@ int32_t DeviceManagerService::GetLocalDeviceInfo(DmDeviceInfo &info) return ret; } - - int32_t DeviceManagerService::GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &udid) { @@ -274,9 +272,9 @@ bool DeviceManagerService::IsDMServiceImplReady() int32_t DeviceManagerService::DmHiDumper(const std::vector& args, std::string &result) { - LOGI("Hidumper GetTrustedDeviceList"); + LOGI("HiDump GetTrustedDeviceList"); std::vector dumpflag; - HidumpHelper::GetInstance().GetArgsType(args, dumpflag); + HiDumpHelper::GetInstance().GetArgsType(args, dumpflag); for (unsigned int i = 0; i < dumpflag.size(); i++) { if (dumpflag[i] == HidumperFlag::HIDUMPER_GET_TRUSTED_LIST) { @@ -284,19 +282,19 @@ int32_t DeviceManagerService::DmHiDumper(const std::vector& args, s int32_t ret = softbusListener_->GetTrustedDeviceList(deviceList); if (ret != DM_OK) { - result.append("Hidumper GetTrustedDeviceList failed"); - LOGE("Hidumper GetTrustedDeviceList failed"); + result.append("HiDumpHelper GetTrustedDeviceList failed"); + LOGE("HiDumpHelper GetTrustedDeviceList failed"); return ERR_DM_FAILED; } bool deviceState = false; for (unsigned int j = 0; j < deviceList.size(); j++) { - deviceState = softbusListener_->DumperIsDeviceOnline(deviceList[j].deviceId); - HidumpHelper::GetInstance().SetNodeInfo(deviceList[j], deviceState); + deviceState = softbusListener_->IsDeviceOnline(deviceList[j].deviceId); + HiDumpHelper::GetInstance().SetNodeInfo(deviceList[j], deviceState); LOGI("DeviceManagerService::DmHiDumper SetNodeInfo."); } } } - HidumpHelper::GetInstance().HiDump(args, result); + HiDumpHelper::GetInstance().HiDump(args, result); return DM_OK; } } // namespace DistributedHardware diff --git a/services/service/src/softbus/softbus_listener.cpp b/services/service/src/softbus/softbus_listener.cpp index 8ea1eb2d..ea141118 100644 --- a/services/service/src/softbus/softbus_listener.cpp +++ b/services/service/src/softbus/softbus_listener.cpp @@ -175,7 +175,7 @@ int32_t SoftbusListener::GetTrustedDeviceList(std::vector &deviceI return DM_OK; } -bool SoftbusListener::DumperIsDeviceOnline(const std::string &deviceId) +bool SoftbusListener::IsDeviceOnline(const std::string &deviceId) { NodeBasicInfo *info = nullptr; int32_t infoNum = 0; diff --git a/utils/include/dfx/dm_dfx_constants.h b/utils/include/dfx/dm_dfx_constants.h index e3aa466d..1605aefd 100644 --- a/utils/include/dfx/dm_dfx_constants.h +++ b/utils/include/dfx/dm_dfx_constants.h @@ -77,12 +77,10 @@ enum class HidumperFlag { // HiDumper info const std::string ARGS_HELP_INFO = "-help"; const std::string HIDUMPER_GET_TRUSTED_LIST_INFO = "-getTrustlist"; -const std::string HIDUMPER_GET_DEVICE_STATE_INFO = "-getDeviceState"; const std::unordered_map MAP_ARGS = { { ARGS_HELP_INFO, HidumperFlag::HIDUMPER_GET_HELP }, { HIDUMPER_GET_TRUSTED_LIST_INFO, HidumperFlag::HIDUMPER_GET_TRUSTED_LIST }, - { HIDUMPER_GET_DEVICE_STATE_INFO, HidumperFlag::HIDUMPER_GET_DEVICE_STATE }, }; } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/include/dfx/lite/dm_hidumper.h b/utils/include/dfx/lite/dm_hidumper.h index 241ca324..298d6154 100644 --- a/utils/include/dfx/lite/dm_hidumper.h +++ b/utils/include/dfx/lite/dm_hidumper.h @@ -29,8 +29,8 @@ namespace OHOS { namespace DistributedHardware { -class HidumpHelper { - DECLARE_SINGLE_INSTANCE(HidumpHelper); +class HiDumpHelper { + DECLARE_SINGLE_INSTANCE(HiDumpHelper); public: int32_t HiDump(const std::vector& args, std::string &result); diff --git a/utils/include/dfx/standard/dm_hidumper.h b/utils/include/dfx/standard/dm_hidumper.h index 6e39f034..dc1bf5b4 100644 --- a/utils/include/dfx/standard/dm_hidumper.h +++ b/utils/include/dfx/standard/dm_hidumper.h @@ -29,8 +29,8 @@ namespace OHOS { namespace DistributedHardware { -class HidumpHelper { -DECLARE_SINGLE_INSTANCE(HidumpHelper); +class HiDumpHelper { +DECLARE_SINGLE_INSTANCE(HiDumpHelper); public: int32_t HiDump(const std::vector& args, std::string &result); int32_t GetArgsType(const std::vector& args, std::vector &Flag); diff --git a/utils/src/dfx/lite/dm_hidumper.cpp b/utils/src/dfx/lite/dm_hidumper.cpp index 3cabdae9..ca6ab992 100644 --- a/utils/src/dfx/lite/dm_hidumper.cpp +++ b/utils/src/dfx/lite/dm_hidumper.cpp @@ -17,21 +17,20 @@ namespace OHOS { namespace DistributedHardware { -IMPLEMENT_SINGLE_INSTANCE(HidumpHelper); -int32_t HidumpHelper::HiDump(const std::vector& args, std::string &result) +IMPLEMENT_SINGLE_INSTANCE(HiDumpHelper); +int32_t HiDumpHelper::HiDump(const std::vector& args, std::string &result) { return DM_OK; } -int32_t HidumpHelper::GetArgsType(const std::vector& args, std::vector &Flag) +int32_t HiDumpHelper::GetArgsType(const std::vector& args, std::vector &Flag) { return DM_OK; } -void HidumpHelper::SetNodeInfo(const DmDeviceInfo& deviceInfo, const bool deviceStates) +void HiDumpHelper::SetNodeInfo(const DmDeviceInfo& deviceInfo, const bool deviceStates) { return; } - } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/src/dfx/standard/dm_hidumper.cpp b/utils/src/dfx/standard/dm_hidumper.cpp index 4434021f..fc72bef1 100644 --- a/utils/src/dfx/standard/dm_hidumper.cpp +++ b/utils/src/dfx/standard/dm_hidumper.cpp @@ -15,17 +15,17 @@ #include -#include "dm_hidumper.h" #include "dm_anonymous.h" #include "dm_dfx_constants.h" #include "dm_device_info.h" +#include "dm_hidumper.h" namespace OHOS { namespace DistributedHardware { -IMPLEMENT_SINGLE_INSTANCE(HidumpHelper); -int32_t HidumpHelper::HiDump(const std::vector& args, std::string &result) +IMPLEMENT_SINGLE_INSTANCE(HiDumpHelper); +int32_t HiDumpHelper::HiDump(const std::vector& args, std::string &result) { - LOGI("HidumpHelper hidumper start."); + LOGI("HiDumpHelper start."); result.clear(); int32_t errCode = ERR_DM_FAILED; @@ -41,9 +41,9 @@ int32_t HidumpHelper::HiDump(const std::vector& args, std::string & return errCode; } -void HidumpHelper::SetNodeInfo(const DmDeviceInfo& deviceInfo, const bool deviceStates) +void HiDumpHelper::SetNodeInfo(const DmDeviceInfo& deviceInfo, const bool deviceStates) { - LOGI("HidumpHelper::SetNodeInfo"); + LOGI("HiDumpHelper::SetNodeInfo"); nodeInfos_.push_back(deviceInfo); std::string deviceState = "offline"; if (deviceStates) { @@ -52,7 +52,7 @@ void HidumpHelper::SetNodeInfo(const DmDeviceInfo& deviceInfo, const bool device deviceState_.push_back(deviceState); } -int32_t HidumpHelper::ProcessDump(const HidumperFlag &flag, std::string &result) +int32_t HiDumpHelper::ProcessDump(const HidumperFlag &flag, std::string &result) { LOGI("Process Dump."); int32_t ret = ERR_DM_FAILED; @@ -73,7 +73,7 @@ int32_t HidumpHelper::ProcessDump(const HidumperFlag &flag, std::string &result) return ret; } -int32_t HidumpHelper::ShowAllLoadTrustedList(std::string &result) +int32_t HiDumpHelper::ShowAllLoadTrustedList(std::string &result) { LOGI("Dump Show All Load Trust List"); int32_t ret = DM_OK; @@ -90,13 +90,13 @@ int32_t HidumpHelper::ShowAllLoadTrustedList(std::string &result) } nodeInfos_.clear(); - LOGI("HidumpHelper ShowAllLoadTrustedList %s", result.c_str()); + LOGI("HiDumpHelper ShowAllLoadTrustedList %s", result.c_str()); return ret; } -int32_t HidumpHelper::ShowHelp(std::string &result) +int32_t HiDumpHelper::ShowHelp(std::string &result) { - LOGI("Show hidumper help."); + LOGI("Show hidumper help"); result.append("DistributedHardwareDeviceManager hidumper options:\n"); result.append(" -help "); result.append(": Show help\n"); @@ -106,17 +106,17 @@ int32_t HidumpHelper::ShowHelp(std::string &result) return DM_OK; } -int32_t HidumpHelper::ShowIllealInfomation(std::string &result) +int32_t HiDumpHelper::ShowIllealInfomation(std::string &result) { - LOGI("ShowIllealInfomation Dump."); + LOGI("ShowIllealInfomation Dump"); result.clear(); result.append("Unrecognized option, -h for help."); return DM_OK; } -int32_t HidumpHelper::GetArgsType(const std::vector& args, std::vector &Flag) +int32_t HiDumpHelper::GetArgsType(const std::vector& args, std::vector &Flag) { - LOGI("HidumpHelper::GetArgsType"); + LOGI("HiDumpHelper::GetArgsType"); int32_t ret = ERR_DM_FAILED; if (args.empty()) { Flag.push_back(HidumperFlag::HIDUMPER_GET_HELP);