mirror of
https://gitee.com/openharmony/security_device_security_level
synced 2024-11-28 01:11:20 +00:00
commit
facf021b5e
@ -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;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ extern "C" {
|
||||
typedef struct DslmDeviceInfo {
|
||||
ListNode linkNode;
|
||||
StateMachine machine;
|
||||
Mutex mutex;
|
||||
DeviceIdentify identity;
|
||||
uint32_t version;
|
||||
uint32_t onlineStatus;
|
||||
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user