mirror of
https://github.com/openharmony/device_manager.git
synced 2026-07-19 18:13:32 -04:00
@@ -101,7 +101,7 @@ public:
|
||||
~SoftbusListener();
|
||||
int32_t GetTrustedDeviceList(std::vector<DmDeviceInfo> &deviceInfoList);
|
||||
int32_t GetLocalDeviceInfo(DmDeviceInfo &deviceInfo);
|
||||
bool DumperIsDeviceOnline(const std::string &deviceId);
|
||||
bool IsDeviceOnline(const std::string &deviceId);
|
||||
|
||||
private:
|
||||
int32_t Init();
|
||||
|
||||
@@ -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<std::string>& args, std::string &result)
|
||||
{
|
||||
LOGI("Hidumper GetTrustedDeviceList");
|
||||
LOGI("HiDump GetTrustedDeviceList");
|
||||
std::vector<HidumperFlag> 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<std::string>& 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
|
||||
|
||||
@@ -175,7 +175,7 @@ int32_t SoftbusListener::GetTrustedDeviceList(std::vector<DmDeviceInfo> &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;
|
||||
|
||||
@@ -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<std::string, HidumperFlag> 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
|
||||
|
||||
@@ -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<std::string>& args, std::string &result);
|
||||
|
||||
@@ -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<std::string>& args, std::string &result);
|
||||
int32_t GetArgsType(const std::vector<std::string>& args, std::vector<HidumperFlag> &Flag);
|
||||
|
||||
@@ -17,21 +17,20 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
IMPLEMENT_SINGLE_INSTANCE(HidumpHelper);
|
||||
int32_t HidumpHelper::HiDump(const std::vector<std::string>& args, std::string &result)
|
||||
IMPLEMENT_SINGLE_INSTANCE(HiDumpHelper);
|
||||
int32_t HiDumpHelper::HiDump(const std::vector<std::string>& args, std::string &result)
|
||||
{
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t HidumpHelper::GetArgsType(const std::vector<std::string>& args, std::vector<HidumperFlag> &Flag)
|
||||
int32_t HiDumpHelper::GetArgsType(const std::vector<std::string>& args, std::vector<HidumperFlag> &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
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#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<std::string>& args, std::string &result)
|
||||
IMPLEMENT_SINGLE_INSTANCE(HiDumpHelper);
|
||||
int32_t HiDumpHelper::HiDump(const std::vector<std::string>& 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<std::string>& 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<std::string>& args, std::vector<HidumperFlag> &Flag)
|
||||
int32_t HiDumpHelper::GetArgsType(const std::vector<std::string>& args, std::vector<HidumperFlag> &Flag)
|
||||
{
|
||||
LOGI("HidumpHelper::GetArgsType");
|
||||
LOGI("HiDumpHelper::GetArgsType");
|
||||
int32_t ret = ERR_DM_FAILED;
|
||||
if (args.empty()) {
|
||||
Flag.push_back(HidumperFlag::HIDUMPER_GET_HELP);
|
||||
|
||||
Reference in New Issue
Block a user