From b312d6ef7c912a4045aaf7d6195c2526c89b4486 Mon Sep 17 00:00:00 2001 From: summer8999 Date: Mon, 3 Apr 2023 16:24:47 +0800 Subject: [PATCH] docs modify Signed-off-by: summer8999 --- .../reference/apis/js-apis-device-manager.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/zh-cn/application-dev/reference/apis/js-apis-device-manager.md b/zh-cn/application-dev/reference/apis/js-apis-device-manager.md index 3c0701bd50..b40d4ae681 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-device-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-device-manager.md @@ -460,6 +460,76 @@ getLocalDeviceInfo(): Promise<DeviceInfo> }); ``` +### getDeviceInfo10+ + +getDeviceInfo(callback:AsyncCallback<DeviceInfo>): void + +获取指定本地设备信息。使用callback异步回调。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ---------------------------------------- | ---- | --------- | + | callback | AsyncCallback<[DeviceInfo](#deviceinfo)> | 是 | 获取指定设备信息。 | + +**错误码:** + +以下的错误码的详细介绍请参见[设备管理错误码](../errorcodes/errorcode-device-manager.md) + +| 错误码ID | 错误信息 | +| -------- | --------------------------------------------------------------- | +| 11600101 | Failed to execute the function. | + +**示例:** + + ```js + try { + dmInstance.getDeviceInfo(networkId, (err, data) => { + if (err) { + console.error("getDeviceInfo errCode:" + err.code + ",errMessage:" + err.message); + return; + } + console.log('get device info: ' + JSON.stringify(data)); + }); + } catch (err) { + console.error("getDeviceInfo errCode:" + err.code + ",errMessage:" + err.message); + } + ``` + +### getDeviceInfo10+ + +getDeviceInfo(): Promise<DeviceInfo> + +获取指定设备信息。使用Promise异步回调。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +**返回值:** + + | 类型 | 说明 | + | ---------------------------------------- | --------------------- | + | Promise<[DeviceInfo](#deviceinfo)> | Promise实例,用于获取异步返回结果。 | + +**错误码:** + +以下的错误码的详细介绍请参见[设备管理错误码](../errorcodes/errorcode-device-manager.md) + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------------------------- | +| 11600101| Failed to execute the function. | + +**示例:** + + ```js + dmInstance.getDeviceInfo(networkId).then((data) => { + console.log('get device info: ' + JSON.stringify(data)); + }).catch((err) => { + console.error("getDeviceInfo errCode:" + err.code + ",errMessage:" + err.message); + }); + ``` + ### startDeviceDiscovery8+ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void -- GitLab