diff --git a/services/implementation/BUILD.gn b/services/implementation/BUILD.gn index 9497bdb52fa45e4fc5f818d92811bf1546f37338..5d98bfdb97ee23260b7142691ac946500ec4dda6 100644 --- a/services/implementation/BUILD.gn +++ b/services/implementation/BUILD.gn @@ -75,29 +75,27 @@ if (defined(ohos_lite)) { ] sources = [ - "${services_path}/src/ability/lite/dm_ability_manager.cpp", - "${services_path}/src/adapter/standard/dm_adapter_manager.cpp", - "${services_path}/src/authentication/auth_message_processor.cpp", - "${services_path}/src/authentication/auth_request_state.cpp", - "${services_path}/src/authentication/auth_response_state.cpp", - "${services_path}/src/authentication/dm_auth_manager.cpp", - "${services_path}/src/authentication/showconfirm/lite/show_confirm.cpp", - "${services_path}/src/config/mini/dm_config_manager.cpp", - "${services_path}/src/config/mini/pin_auth.cpp", - "${services_path}/src/dependency/hichain/hichain_connector.cpp", - "${services_path}/src/dependency/mini/dm_mutex.cpp", - "${services_path}/src/dependency/mini/dm_thread.cpp", - "${services_path}/src/dependency/multipleuser/multiple_user_connector.cpp", - "${services_path}/src/dependency/softbus/softbus_connector.cpp", - "${services_path}/src/dependency/softbus/softbus_session.cpp", - "${services_path}/src/dependency/timer/mini/dm_timer.cpp", - "${services_path}/src/device_manager_service.cpp", - "${services_path}/src/deviceinfo/dm_device_info_manager.cpp", - "${services_path}/src/devicestate/dm_device_state_manager.cpp", - "${services_path}/src/discovery/dm_discovery_manager.cpp", - "${services_path}/src/dispatch/command_dispatch.cpp", - "${services_path}/src/dispatch/device_manager_service_listener_mini.cpp", - "${services_path}/src/dispatch/server_stub.cpp", + "${servicesimpl_path}/src/ability/lite/dm_ability_manager.cpp", + "${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp", + "${servicesimpl_path}/src/authentication/auth_message_processor.cpp", + "${servicesimpl_path}/src/authentication/auth_request_state.cpp", + "${servicesimpl_path}/src/authentication/auth_response_state.cpp", + "${servicesimpl_path}/src/authentication/dm_auth_manager.cpp", + "${servicesimpl_path}/src/authentication/showconfirm/lite/show_confirm.cpp", + "${servicesimpl_path}/src/config/mini/dm_config_manager.cpp", + "${servicesimpl_path}/src/config/mini/pin_auth.cpp", + "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", + "${servicesimpl_path}/src/dependency/mini/dm_mutex.cpp", + "${servicesimpl_path}/src/dependency/mini/dm_thread.cpp", + "${servicesimpl_path}/src/dependency/multipleuser/multiple_user_connector.cpp", + "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", + "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", + "${servicesimpl_path}/src/dependency/timer/mini/dm_timer.cpp", + "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", + "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", + "${servicesimpl_path}/src/dispatch/command_dispatch.cpp", + "${servicesimpl_path}/src/dispatch/device_manager_service_listener_mini.cpp", + "${servicesimpl_path}/src/dispatch/server_stub.cpp", ] defines = [ diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn index ebe2949acb882c958d118c9b10755e5af9a7abb6..bfab025278b226ccabf53a927db7de5e0d9129a0 100644 --- a/services/service/BUILD.gn +++ b/services/service/BUILD.gn @@ -75,29 +75,13 @@ if (defined(ohos_lite)) { ] sources = [ - "${services_path}/src/ability/lite/dm_ability_manager.cpp", - "${services_path}/src/adapter/standard/dm_adapter_manager.cpp", - "${services_path}/src/authentication/auth_message_processor.cpp", - "${services_path}/src/authentication/auth_request_state.cpp", - "${services_path}/src/authentication/auth_response_state.cpp", - "${services_path}/src/authentication/dm_auth_manager.cpp", - "${services_path}/src/authentication/showconfirm/lite/show_confirm.cpp", - "${services_path}/src/config/mini/dm_config_manager.cpp", - "${services_path}/src/config/mini/pin_auth.cpp", - "${services_path}/src/dependency/hichain/hichain_connector.cpp", - "${services_path}/src/dependency/mini/dm_mutex.cpp", - "${services_path}/src/dependency/mini/dm_thread.cpp", - "${services_path}/src/dependency/multipleuser/multiple_user_connector.cpp", - "${services_path}/src/dependency/softbus/softbus_listener.cpp", - "${services_path}/src/dependency/softbus/softbus_session.cpp", - "${services_path}/src/dependency/timer/mini/dm_timer.cpp", - "${services_path}/src/device_manager_service.cpp", - "${services_path}/src/deviceinfo/dm_device_info_manager.cpp", - "${services_path}/src/devicestate/dm_device_state_manager.cpp", - "${services_path}/src/discovery/dm_discovery_manager.cpp", - "${services_path}/src/dispatch/command_dispatch.cpp", - "${services_path}/src/dispatch/device_manager_service_listener_mini.cpp", - "${services_path}/src/dispatch/server_stub.cpp", + "src/device_manager_service.cpp", + "src/device_manager_service_listener.cpp", + "src/ipc/lite/ipc_cmd_parser.cpp", + "src/ipc/lite/ipc_server_listener.cpp", + "src/ipc/lite/ipc_server_main", + "src/ipc/lite/ipc_server_stub.cpp", + "src/softbus/softbus_listener.cpp", ] defines = [ @@ -170,9 +154,7 @@ if (defined(ohos_lite)) { "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include", ] - sources = [ - "src/ipc/lite/ipc_server_main.cpp", - ] + sources = [ "src/ipc/lite/ipc_server_main.cpp" ] ldflags = dm_ldflags defines = [ @@ -260,4 +242,4 @@ if (defined(ohos_lite)) { part_name = "device_manager" } -} \ No newline at end of file +} diff --git a/utils/include/dfx/dm_dfx_constants.h b/utils/include/dfx/dm_dfx_constants.h index 1605aefdce82d7d49a62dc64816795aa2c1ee672..32dad7ae9ce61d414935883b8b0888c887019a9b 100644 --- a/utils/include/dfx/dm_dfx_constants.h +++ b/utils/include/dfx/dm_dfx_constants.h @@ -15,6 +15,8 @@ #ifndef OHOS_DM_DFX_CONSTANTS_H #define OHOS_DM_DFX_CONSTANTS_H +#include "dm_device_info.h" + #include #include @@ -26,7 +28,7 @@ const int DM_HISYEVENT_STATISTIC = 2; const int DM_HISYEVENT_SECURITY = 3; const int DM_HISYEVENT_BEHAVIOR = 4; -// state +// HisysEvent state const std::string DM_INIT_DEVICE_MANAGER_SUCCESS = "DM_INIT_DEVICE_MANAGER_SUCCESS"; const std::string DM_INIT_DEVICE_MANAGER_FAILED = "DM_INIT_DEVICE_MANAGER_FAILED"; const std::string START_DEVICE_DISCOVERY_SUCCESS = "START_DEVICE_DISCOVERY_SUCCESS"; @@ -42,7 +44,7 @@ const std::string DM_CREATE_GROUP_FAILED = "DM_CREATE_GROUP_FAILED"; const std::string UNAUTHENTICATE_DEVICE_SUCCESS = "UNAUTHENTICATE_DEVICE_SUCCESS"; const std::string UNAUTHENTICATE_DEVICE_FAILED = "UNAUTHENTICATE_DEVICE_FAILED"; -// msg +// HisysEvent msg const std::string DM_INIT_DEVICE_MANAGER_SUCCESS_MSG = "init devicemanager success."; const std::string DM_INIT_DEVICE_MANAGER_FAILED_MSG = "init devicemanager failed."; const std::string START_DEVICE_DISCOVERY_SUCCESS_MSG = "device manager discovery success."; @@ -63,7 +65,6 @@ const std::string DM_HITRACE_START_DEVICE = "DM_HITRACE_START_DEVICE"; const std::string DM_HITRACE_GET_LOCAL_DEVICE_INFO = "DM_HITRACE_GET_LOCAL_DEVICE_INFO"; const std::string DM_HITRACE_AUTH_TO_CONSULT = "DM_HITRACE_AUTH_TO_CONSULT"; const std::string DM_HITRACE_AUTH_TO_OPPEN_SESSION = "DM_HITRACE_AUTH_TO_OPPEN_SESSION"; -const std::string DM_HITRACE_DEVICE_ONLINE = "DM_HITRACE_DEVICE_ONLINE"; const std::string DM_HITRACE_INIT = "DM_HITRACE_INIT"; // HiDumper Flag @@ -78,10 +79,29 @@ enum class HidumperFlag { const std::string ARGS_HELP_INFO = "-help"; const std::string HIDUMPER_GET_TRUSTED_LIST_INFO = "-getTrustlist"; +// HiDumper command const std::unordered_map MAP_ARGS = { { ARGS_HELP_INFO, HidumperFlag::HIDUMPER_GET_HELP }, { HIDUMPER_GET_TRUSTED_LIST_INFO, HidumperFlag::HIDUMPER_GET_TRUSTED_LIST }, }; + +// HiDumper device type +typedef struct DumperInfo { + DmDeviceType deviceTypeId; + std::string deviceTypeInfo; +} DumperInfo; + +static DumperInfo dumperDeviceType[] = { + {DEVICE_TYPE_UNKNOWN, "DEVICE_TYPE_UNKNOWN"}, + {DEVICE_TYPE_WIFI_CAMERA, "DEVICE_TYPE_WIFI_CAMERA"}, + {DEVICE_TYPE_AUDIO, "DEVICE_TYPE_AUDIO"}, + {DEVICE_TYPE_PC, "DEVICE_TYPE_PC"}, + {DEVICE_TYPE_PHONE, "DEVICE_TYPE_PHONE"}, + {DEVICE_TYPE_PAD, "DEVICE_TYPE_PAD"}, + {DEVICE_TYPE_WATCH, "DEVICE_TYPE_WATCH"}, + {DEVICE_TYPE_CAR, "DEVICE_TYPE_CAR"}, + {DEVICE_TYPE_TV, "DEVICE_TYPE_TV"}, +}; } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DM_DFX_CONSTANTS_H diff --git a/utils/include/dfx/standard/dm_hidumper.h b/utils/include/dfx/standard/dm_hidumper.h index cf866ef8b313ed90db6fa74a8654c5a1bcb889e9..51397d7e632c3cb6d38818f6c803ca7badefbf88 100644 --- a/utils/include/dfx/standard/dm_hidumper.h +++ b/utils/include/dfx/standard/dm_hidumper.h @@ -41,6 +41,7 @@ private: int32_t ShowAllLoadTrustedList(std::string &result); int32_t ShowHelp(std::string &result); int32_t ShowIllealInfomation(std::string &result); + std::string GetDeviceType(int32_t deviceTypeId); private: std::vector nodeInfos_; diff --git a/utils/src/dfx/standard/dm_hidumper.cpp b/utils/src/dfx/standard/dm_hidumper.cpp index 78b989e19c3718951c7cffe05bbacad03014125f..e5023748170e38383a2c5620d284783deec3b46d 100644 --- a/utils/src/dfx/standard/dm_hidumper.cpp +++ b/utils/src/dfx/standard/dm_hidumper.cpp @@ -81,7 +81,8 @@ int32_t HiDumpHelper::ShowAllLoadTrustedList(std::string &result) result.append("\n{\n deviceId : ").append(GetAnonyString(nodeInfos_[i].deviceId).c_str()); result.append("\n{\n deviceName : ").append(nodeInfos_[i].deviceName); result.append("\n{\n networkId : ").append(GetAnonyString(nodeInfos_[i].networkId).c_str()); - result.append("\n{\n deviceTypeId : ").append(std::to_string(nodeInfos_[i].deviceTypeId)); + std::string deviceType = GetDeviceType(nodeInfos_[i].deviceTypeId); + result.append("\n{\n deviceType : ").append(deviceType); } nodeInfos_.clear(); @@ -89,6 +90,18 @@ int32_t HiDumpHelper::ShowAllLoadTrustedList(std::string &result) return ret; } +std::string HiDumpHelper::GetDeviceType(int32_t deviceTypeId) +{ + std::string dmDeviceTypeIdString = ""; + for (int32_t i = 0; i < (sizeof(dumperDeviceType) / sizeof(dumperDeviceType[0])); i++) { + if (deviceTypeId == dumperDeviceType[i].deviceTypeId) { + dmDeviceTypeIdString = dumperDeviceType[i].deviceTypeInfo; + break; + } + } + return dmDeviceTypeIdString; +} + int32_t HiDumpHelper::ShowHelp(std::string &result) { LOGI("Show hidumper help"); @@ -96,8 +109,7 @@ int32_t HiDumpHelper::ShowHelp(std::string &result) result.append(" -help "); result.append(": show help\n"); result.append(" -getTrustlist "); - result.append(": show all get trusted list:\n\n"); - LOGI("result is %s", result.c_str()); + result.append(": show all trusted device list\n\n"); return DM_OK; } @@ -105,7 +117,7 @@ int32_t HiDumpHelper::ShowIllealInfomation(std::string &result) { LOGI("ShowIllealInfomation Dump"); result.clear(); - result.append("unrecognized option, -h for help."); + result.append("unrecognized option, -help for help."); return DM_OK; }