• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup DeviceManager
18  * @{
19  *
20  * @brief Distributed device management module,
21  * which provides APIs to obtain information about trusted devices and local devices.
22  *
23  * @since 20
24  */
25 
26 /**
27  * @file oh_device_manager.h
28  *
29  * @brief Provides APIs to obtain information about trusted devices and local devices.
30  * File to include: <distributedhardware/device_manager/oh_device_manager_err_code.h>
31  *
32  * @kit DistributedServiceKit
33  * @library libdevicemanager_ndk.so
34  * @syscap SystemCapability.DistributedHardware.DeviceManager
35  *
36  * @since 20
37  */
38 
39 #ifndef OH_DEVICE_MANAGER_H
40 #define OH_DEVICE_MANAGER_H
41 
42 #include <stdint.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /**
49  * @brief Obtains the display name of the local device.
50  * The device display name involves user privacy.
51  * You need to provide a privacy statement to declare the purpose of the device display name.
52  *
53  * @permission ohos.permission.READ_LOCAL_DEVICE_NAME
54  * @param localDeviceName Pointer to the display name of the local device.
55  * After using this API, you need to manually release resources to free up space.
56  * If the application has the ohos.permission.READ_LOCAL_DEVICE_NAME permission, the device display name is returned.
57  * Otherwise, the default device name is returned.
58  * @param len Length of the display name of the local device.
59  * @return Error code. For details about the error code definitions, see {@link DeviceManager_ErrorCode}.
60  *      Returns {@link ERR_OK} is returned if the execution is successful.
61  *      Returns {@link DM_ERR_FAILED} is returned if the function fails to be executed.
62  *      Returns {@link DM_ERR_OBTAIN_SERVICE} is returned if the device management service fails to be obtained.
63  *      Returns {@link DM_ERR_OBTAIN_BUNDLE_NAME} is returned if the bundle name fails to be obtained.
64  * @since 20
65  */
66 int32_t OH_DeviceManager_GetLocalDeviceName(char **localDeviceName, unsigned int &len);
67 
68 #ifdef __cplusplus
69 };
70 #endif
71 
72 /** @} */
73 #endif