• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# oh_device_manager.h
2
3## Overview
4
5Provides APIs to obtain information about trusted devices and local devices.
6
7**File to include**: <distributedhardware/device_manager/oh_device_manager.h>
8
9**Library**: libdevicemanager_ndk.so
10
11**System capability**: SystemCapability.DistributedHardware.DeviceManager
12
13**Since**: 20
14
15**Related module**: [DeviceManager](capi-devicemanager.md)
16
17## Summary
18
19### Function
20
21| Name| Description|
22| -- | -- |
23| [int32_t OH_DeviceManager_GetLocalDeviceName(char **localDeviceName, unsigned int &len)](#oh_devicemanager_getlocaldevicename) | Obtains the display name of the local device.<br>The device display name involves user privacy. You need to provide a privacy statement to declare the purpose of the device display name.|
24
25## Function Description
26
27### OH_DeviceManager_GetLocalDeviceName()
28
29```
30int32_t OH_DeviceManager_GetLocalDeviceName(char **localDeviceName, unsigned int &len)
31```
32
33**Description**
34
35Obtains the display name of the local device.<br>The device display name involves user privacy. You need to provide a privacy statement to declare the purpose of the device display name.
36
37**Required permissions**: ohos.permission.READ_LOCAL_DEVICE_NAME
38
39**Since**: 20
40
41
42**Parameters**
43
44| Parameter| Description|
45| -- | -- |
46| char **localDeviceName | Pointer to the display name of the local device. After using this API, you need to manually release resources to free up space. If the application has the **ohos.permission.READ_LOCAL_DEVICE_NAME** permission, the device display name is returned. Otherwise, the default device name is returned.|
47| unsigned int &len | Length of the display name of the local device.|
48
49**Return value**
50
51| Type| Description                                                                                                                                                                                                                                                                                                                                                                          |
52| -- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
53| int32_t | Error code. For details about the error code definitions, see [DeviceManager_ErrorCode](capi-oh-device-manager-err-code-h.md#devicemanager_errorcode).<br>         [ERR_OK](capi-oh-device-manager-err-code-h.md#devicemanager_errorcode) is returned if the execution is successful.<br>         [DM_ERR_FAILED](capi-oh-device-manager-err-code-h.md#devicemanager_errorcode) is returned if the function fails to be executed.<br>         [DM_ERR_OBTAIN_SERVICE](capi-oh-device-manager-err-code-h.md#devicemanager_errorcode) is returned if the device management service fails to be obtained.<br>         [DM_ERR_OBTAIN_BUNDLE_NAME](capi-oh-device-manager-err-code-h.md#devicemanager_errorcode) is returned if the bundle name fails to be obtained.|
54