!37 文档修改,接口使用示例修改,hidumper 支持。

Merge pull request !37 from Zen知仁/xzr
This commit is contained in:
openharmony_ci 2022-02-24 08:27:42 +00:00 committed by Gitee
commit facf021b5e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 35 additions and 2 deletions

View File

@ -112,6 +112,7 @@ OpenHarmony系统安全架构如下图所示
ret = GetDeviceSecurityLevelValue(info, &level);
if (ret != SUCCESS) {
// 提取信息失败, 此场景建议开发者根据实际情况进行重试
FreeDeviceSecurityInfo(info);
return;
}
@ -139,6 +140,7 @@ OpenHarmony系统安全架构如下图所示
int32_t ret = GetDeviceSecurityLevelValue(info, &level);
if (ret != SUCCESS) {
// 获取信息失败。此场景建议开发者根据实际情况进行重试
FreeDeviceSecurityInfo(info);
return;
}

View File

@ -38,7 +38,6 @@ extern "C" {
typedef struct DslmDeviceInfo {
ListNode linkNode;
StateMachine machine;
Mutex mutex;
DeviceIdentify identity;
uint32_t version;
uint32_t onlineStatus;

View File

@ -19,15 +19,47 @@
#include "securec.h"
#include "dslm_device_list.h"
#include "dslm_messenger_wrapper.h"
static void PrintBanner(int fd)
{
dprintf(fd, " ___ ___ _ __ __ ___ _ _ __ __ ___ ___ ___ \n");
dprintf(fd, " | \\/ __| | | \\/ | | \\| | | | \\/ | _ \\ __| _ \\\n");
dprintf(fd, " | |) \\__ \\ |__| |\\/| | | |) | |_| | |\\/| | _/ _|| /\n");
dprintf(fd, " | |) \\__ \\ |__| |\\/| | | |) | |_| | |\\/| | _/ __| /\n");
dprintf(fd, " |___/|___/____|_| |_| |___/ \\___/|_| |_|_| |___|_|_\\\n");
}
static void PrintHeader(int fd)
{
const DeviceIdentify *device = GetSelfDevice(NULL);
char *deviceName[DEVICE_ID_MAX_LEN + 1] = {0};
errno_t ret = memcpy_s(deviceName, DEVICE_ID_MAX_LEN + 1, device->identity, DEVICE_ID_MAX_LEN);
if (ret != EOK) {
return;
}
dprintf(fd, "selfUdid: %s\n", deviceName);
}
static void DeviceDumper(const DslmDeviceInfo *info, int32_t fd)
{
if (info == NULL) {
return;
}
char *deviceName[DEVICE_ID_MAX_LEN + 1] = {0};
errno_t ret = memcpy_s(deviceName, DEVICE_ID_MAX_LEN + 1, info->identity.identity, DEVICE_ID_MAX_LEN);
if (ret == EOK) {
dprintf(fd, "deviceId: %s\n", deviceName);
dprintf(fd, "credLevel: %d\n", info->credInfo.credLevel);
dprintf(fd, "manufacture: %s\n", info->credInfo.manufacture);
dprintf(fd, "brand: %s\n", info->credInfo.brand);
dprintf(fd, "\n");
}
}
void DslmDumper(int fd)
{
PrintBanner(fd);
PrintHeader(fd);
ForEachDeviceDump(DeviceDumper, fd);
}