提交 96b65ee4 编写于 作者: G gloria

update docs against 11879

Signed-off-by: Ngloria <80926032@qq.com>
上级 e6d3d8f7
# Device Management # @ohos.distributedHardware.deviceManager (Device Management)
The **DeviceManager** module provides APIs for distributed device management. The **DeviceManager** module provides APIs for distributed device management.
...@@ -34,10 +34,10 @@ Creates a **DeviceManager** instance. ...@@ -34,10 +34,10 @@ Creates a **DeviceManager** instance.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ---------- | ---------------------------------------- | ---- | ------------------------------------ | | ---------- | ---------------------------------------------------- | ---- | ----------------------------------------------------------- |
| bundleName | string | Yes | Bundle name of an application. | | bundleName | string | Yes | Bundle name of the application. |
| callback | AsyncCallback&lt;[DeviceManager](#devicemanager)&gt; | Yes | Callback used to return the **DeviceManager** instance created.| | callback | AsyncCallback&lt;[DeviceManager](#devicemanager)&gt; | Yes | Callback used to return the **DeviceManager** instance created.|
**Error codes** **Error codes**
...@@ -85,7 +85,7 @@ Enumerates the device types. ...@@ -85,7 +85,7 @@ Enumerates the device types.
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
| Name | Default Value | Description | | Name | Value | Description |
| ------------ | ---- | ---- | | ------------ | ---- | ---- |
| SPEAKER | 0x0A | Smart speaker.| | SPEAKER | 0x0A | Smart speaker.|
| PHONE | 0x0E | Phone. | | PHONE | 0x0E | Phone. |
...@@ -102,7 +102,7 @@ Enumerates the device states. ...@@ -102,7 +102,7 @@ Enumerates the device states.
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
| Name | Default Value | Description | | Name | Value | Description |
| ------- | ---- | --------------- | | ------- | ---- | --------------- |
| ONLINE | 0 | The device is physically online. | | ONLINE | 0 | The device is physically online. |
| READY | 1 | The information between devices has been synchronized in the Distributed Data Service (DDS) module, and the device is ready for running distributed services.| | READY | 1 | The information between devices has been synchronized in the Distributed Data Service (DDS) module, and the device is ready for running distributed services.|
...@@ -132,7 +132,7 @@ Enumerates the device discovery modes. ...@@ -132,7 +132,7 @@ Enumerates the device discovery modes.
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
| Name | Default Value | Description | | Name | Value | Description |
| --------------------- | ---- | ----- | | --------------------- | ---- | ----- |
| DISCOVER_MODE_PASSIVE | 0x55 | Passive discovery.| | DISCOVER_MODE_PASSIVE | 0x55 | Passive discovery.|
| DISCOVER_MODE_ACTIVE | 0xAA | Active discovery.| | DISCOVER_MODE_ACTIVE | 0xAA | Active discovery.|
...@@ -144,7 +144,7 @@ Enumerates the media used for device discovery. ...@@ -144,7 +144,7 @@ Enumerates the media used for device discovery.
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
| Name | Default Value | Description | | Name | Value | Description |
| ---- | ---- | --------- | | ---- | ---- | --------- |
| AUTO | 0 | Automatic. | | AUTO | 0 | Automatic. |
| BLE | 1 | Bluetooth. | | BLE | 1 | Bluetooth. |
...@@ -157,7 +157,7 @@ Enumerates the device discovery frequencies. ...@@ -157,7 +157,7 @@ Enumerates the device discovery frequencies.
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
| Name | Default Value | Description | | Name | Value | Description |
| ---------- | ---- | ----- | | ---------- | ---- | ----- |
| LOW | 0 | Low frequency. | | LOW | 0 | Low frequency. |
| MID | 1 | Medium frequency. | | MID | 1 | Medium frequency. |
...@@ -171,7 +171,7 @@ Enumerates the discovery capabilities. ...@@ -171,7 +171,7 @@ Enumerates the discovery capabilities.
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
| Name | Default Value | Description | | Name | Value | Description |
| ------------------------- | ---- | -------------- | | ------------------------- | ---- | -------------- |
| SUBSCRIBE_CAPABILITY_DDMP | 0 | DDMP capability. This will be deprecated later.| | SUBSCRIBE_CAPABILITY_DDMP | 0 | DDMP capability. This will be deprecated later.|
| SUBSCRIBE_CAPABILITY_OSD | 1 | OSD capability. | | SUBSCRIBE_CAPABILITY_OSD | 1 | OSD capability. |
...@@ -186,7 +186,7 @@ Defines the authentication parameters. ...@@ -186,7 +186,7 @@ Defines the authentication parameters.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | -------------------- | ---- | ---------- | | --------- | -------------------- | ---- | ---------- |
| authType | number | Yes | Authentication type. | | authType | number | Yes | Authentication type. |
| extraInfo | {[key:string] : any} | No | Extended field.| | extraInfo | {[key:string]&nbsp;:&nbsp;any} | No | Extended field.|
## AuthInfo ## AuthInfo
...@@ -198,9 +198,9 @@ Defines authentication information. ...@@ -198,9 +198,9 @@ Defines authentication information.
| --------- | -------------------- | ---- | ---------- | | --------- | -------------------- | ---- | ---------- |
| authType | number | Yes | Authentication type. | | authType | number | Yes | Authentication type. |
| token | number | Yes | Authentication token. | | token | number | Yes | Authentication token. |
| extraInfo | {[key:string] : any} | No | Extended field.| | extraInfo | {[key:string]&nbsp;:&nbsp;any} | No | Extended field.|
## PublishInfo9+</sup> ## PublishInfo<sup>9+</sup>
Defines published device information. Defines published device information.
...@@ -249,6 +249,8 @@ getTrustedDeviceListSync(): Array&lt;DeviceInfo&gt; ...@@ -249,6 +249,8 @@ getTrustedDeviceListSync(): Array&lt;DeviceInfo&gt;
Obtains all trusted devices synchronously. Obtains all trusted devices synchronously.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value** **Return value**
...@@ -281,6 +283,8 @@ getTrustedDeviceList(callback:AsyncCallback&lt;Array&lt;DeviceInfo&gt;&gt;): voi ...@@ -281,6 +283,8 @@ getTrustedDeviceList(callback:AsyncCallback&lt;Array&lt;DeviceInfo&gt;&gt;): voi
Obtains all trusted devices. This API uses an asynchronous callback to return the result. Obtains all trusted devices. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -319,6 +323,8 @@ getTrustedDeviceList(): Promise&lt;Array&lt;DeviceInfo&gt;&gt; ...@@ -319,6 +323,8 @@ getTrustedDeviceList(): Promise&lt;Array&lt;DeviceInfo&gt;&gt;
Obtains all trusted devices. This API uses a promise to return the result. Obtains all trusted devices. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value** **Return value**
...@@ -351,6 +357,8 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo) ...@@ -351,6 +357,8 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo)
Obtains local device information synchronously. Obtains local device information synchronously.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value** **Return value**
...@@ -383,6 +391,8 @@ getLocalDeviceInfo(callback:AsyncCallback&lt;DeviceInfo&gt;): void ...@@ -383,6 +391,8 @@ getLocalDeviceInfo(callback:AsyncCallback&lt;DeviceInfo&gt;): void
Obtains local device information. This API uses an asynchronous callback to return the result. Obtains local device information. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -421,6 +431,8 @@ getLocalDeviceInfo(): Promise&lt;DeviceInfo&gt; ...@@ -421,6 +431,8 @@ getLocalDeviceInfo(): Promise&lt;DeviceInfo&gt;
Obtains local device information. This API uses a promise to return the result. Obtains local device information. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value** **Return value**
...@@ -447,12 +459,14 @@ For details about the error codes, see [Device Management Error Codes](../errorc ...@@ -447,12 +459,14 @@ For details about the error codes, see [Device Management Error Codes](../errorc
}); });
``` ```
### startDeviceDiscovery8+</sup> ### startDeviceDiscovery<sup>8+</sup>
startDeviceDiscovery(subscribeInfo: SubscribeInfo): void startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
Starts to discover peripheral devices. Starts to discover peripheral devices.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -491,12 +505,14 @@ For details about the error codes, see [Device Management Error Codes](../errorc ...@@ -491,12 +505,14 @@ For details about the error codes, see [Device Management Error Codes](../errorc
} }
``` ```
### startDeviceDiscovery9+</sup> ### startDeviceDiscovery<sup>9+</sup>
startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void
Starts to discover peripheral devices and filters discovered devices. Starts to discover peripheral devices and filters discovered devices.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -551,6 +567,8 @@ stopDeviceDiscovery(subscribeId: number): void ...@@ -551,6 +567,8 @@ stopDeviceDiscovery(subscribeId: number): void
Stops device discovery. Stops device discovery.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -578,12 +596,14 @@ For details about the error codes, see [Device Management Error Codes](../errorc ...@@ -578,12 +596,14 @@ For details about the error codes, see [Device Management Error Codes](../errorc
} }
``` ```
### publishDeviceDiscovery9+</sup> ### publishDeviceDiscovery<sup>9+</sup>
publishDeviceDiscovery(publishInfo: PublishInfo): void publishDeviceDiscovery(publishInfo: PublishInfo): void
Publishes device information for discovery purposes. Publishes device information for discovery purposes.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -618,13 +638,15 @@ For details about the error codes, see [Device Management Error Codes](../errorc ...@@ -618,13 +638,15 @@ For details about the error codes, see [Device Management Error Codes](../errorc
console.error("publishDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message); console.error("publishDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message);
} }
``` ```
### unPublishDeviceDiscovery9+</sup> ### unPublishDeviceDiscovery<sup>9+</sup>
unPublishDeviceDiscovery(publishId: number): void unPublishDeviceDiscovery(publishId: number): void
Stops publishing device information. Stops publishing device information.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -654,10 +676,12 @@ For details about the error codes, see [Device Management Error Codes](../errorc ...@@ -654,10 +676,12 @@ For details about the error codes, see [Device Management Error Codes](../errorc
### authenticateDevice ### authenticateDevice
authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback&lt;{deviceId: string, pinToken ?: number}&gt;): void
Authenticates a device. Authenticates a device.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -666,7 +690,7 @@ Authenticates a device. ...@@ -666,7 +690,7 @@ Authenticates a device.
| ---------- | ---------------------------------------- | ---- | ------- | | ---------- | ---------------------------------------- | ---- | ------- |
| deviceInfo | [DeviceInfo](#deviceinfo) | Yes | Device information. | | deviceInfo | [DeviceInfo](#deviceinfo) | Yes | Device information. |
| authParam | [AuthParam](#authparam) | Yes | Authentication parameter. | | authParam | [AuthParam](#authparam) | Yes | Authentication parameter. |
| callback | AsyncCallback<{ deviceId: string, pinToken ?: number }> | Yes | Callback used to return the authentication result.| | callback | AsyncCallback&lt;{deviceId:&nbsp;string,&nbsp;pinToken&nbsp;?:&nbsp;number}&gt; | Yes | Callback used to return the authentication result.|
**Error codes** **Error codes**
...@@ -710,6 +734,8 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void ...@@ -710,6 +734,8 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void
Deauthenticates a device. Deauthenticates a device.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -738,10 +764,12 @@ For details about the error codes, see [Device Management Error Codes](../errorc ...@@ -738,10 +764,12 @@ For details about the error codes, see [Device Management Error Codes](../errorc
### verifyAuthInfo ### verifyAuthInfo
verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): void verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback&lt;{deviceId: string, level: number}&gt;): void
Verifies authentication information. Verifies authentication information.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -749,7 +777,7 @@ Verifies authentication information. ...@@ -749,7 +777,7 @@ Verifies authentication information.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------- | | -------- | ---------------------------------------- | ---- | ------- |
| authInfo | [AuthInfo](#authinfo) | Yes | Authentication information. | | authInfo | [AuthInfo](#authinfo) | Yes | Authentication information. |
| callback | AsyncCallback<{ deviceId: string, level: number }> | Yes | Callback used to return the verification result.| | callback | AsyncCallback&lt;{deviceId:&nbsp;string,&nbsp;level:&nbsp;number}&gt; | Yes | Callback used to return the verification result.|
**Error codes** **Error codes**
...@@ -780,11 +808,13 @@ For details about the error codes, see [Device Management Error Codes](../errorc ...@@ -780,11 +808,13 @@ For details about the error codes, see [Device Management Error Codes](../errorc
} }
``` ```
### setUserOperation9+</sup> ### setUserOperation<sup>9+</sup>
setUserOperation(operateAction: number, params: string): void; setUserOperation(operateAction: number, params: string): void;
Sets a user operation action. Sets a user operation.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
...@@ -792,7 +822,7 @@ Sets a user operation action. ...@@ -792,7 +822,7 @@ Sets a user operation action.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------------- | --------------- | ---- | ------------------- | | ------------- | --------------- | ---- | ------------------- |
| operateAction | number | Yes | User operation action. | | operateAction | number | Yes | User operation. |
| params | string | Yes | Input parameters of the user.| | params | string | Yes | Input parameters of the user.|
**Example** **Example**
...@@ -804,8 +834,8 @@ Sets a user operation action. ...@@ -804,8 +834,8 @@ Sets a user operation action.
operateAction = 1 - Revoke the permission. operateAction = 1 - Revoke the permission.
operateAction = 2 - The user operation in the permission request dialog box times out. operateAction = 2 - The user operation in the permission request dialog box times out.
operateAction = 3 - Cancel the display of the PIN box. operateAction = 3 - Cancel the display of the PIN box.
operateAction = 4 - Cancel the display of the PIN text box. operateAction = 4 - Cancel the display of the PIN input box.
operateAction = 5 - Confirm in the pin text box. operateAction = 5 - Confirm the input in the PIN input box.
*/ */
let operation = 0; let operation = 0;
this.dmInstance.setUserOperation(operation, "extra") this.dmInstance.setUserOperation(operation, "extra")
...@@ -814,12 +844,14 @@ Sets a user operation action. ...@@ -814,12 +844,14 @@ Sets a user operation action.
} }
``` ```
### on('uiStateChange')9+</sup> ### on('uiStateChange')<sup>9+</sup>
on(type: 'uiStateChange', callback: Callback<{ param: string}>): void; on(type: 'uiStateChange', callback: Callback&lt;{ param: string}&gt;): void;
Subscribes to UI status changes. Subscribes to UI status changes.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -827,7 +859,7 @@ Subscribes to UI status changes. ...@@ -827,7 +859,7 @@ Subscribes to UI status changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | ------------------------------ | | -------- | ------------------------------------ | ---- | ------------------------------ |
| type | string | Yes | Event type. The value **'uiStateChange'** indicates a UI status change event.| | type | string | Yes | Event type. The value **'uiStateChange'** indicates a UI status change event.|
| callback | Callback&lt;{&nbsp;param: string}&gt; | Yes | Callback used to return the UI status. | | callback | Callback&lt;{&nbsp;param:&nbsp;string}&gt; | Yes | Callback used to return the UI status. |
**Example** **Example**
...@@ -847,12 +879,14 @@ Subscribes to UI status changes. ...@@ -847,12 +879,14 @@ Subscribes to UI status changes.
} }
``` ```
### off('uiStateChange')9+</sup> ### off('uiStateChange')<sup>9+</sup>
off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void; off(type: 'uiStateChange', callback?: Callback&lt;{ param: string}&gt;): void;
Unsubscribes from UI status changes. Unsubscribes from UI status changes.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -860,7 +894,7 @@ Unsubscribes from UI status changes. ...@@ -860,7 +894,7 @@ Unsubscribes from UI status changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | ------------------------------ | | -------- | ------------------------------------- | ---- | ------------------------------ |
| type | string | Yes | Event type. The value **'uiStateChange'** indicates a UI status change event.| | type | string | Yes | Event type. The value **'uiStateChange'** indicates a UI status change event.|
| callback | Callback&lt;{&nbsp;param: string}&gt; | Yes | Callback used to return the UI status.| | callback | Callback&lt;{&nbsp;param:&nbsp;string}&gt; | No | Callback used to return the UI status.|
**Example** **Example**
...@@ -878,6 +912,8 @@ on(type: 'deviceStateChange', callback: Callback&lt;{ action: DeviceStateChange ...@@ -878,6 +912,8 @@ on(type: 'deviceStateChange', callback: Callback&lt;{ action: DeviceStateChange
Subscribes to changes in the device state. Subscribes to changes in the device state.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -905,6 +941,8 @@ off(type: 'deviceStateChange', callback?: Callback&lt;{ action: DeviceStateChang ...@@ -905,6 +941,8 @@ off(type: 'deviceStateChange', callback?: Callback&lt;{ action: DeviceStateChang
Unsubscribes from changes in the device state. Unsubscribes from changes in the device state.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -912,7 +950,7 @@ Unsubscribes from changes in the device state. ...@@ -912,7 +950,7 @@ Unsubscribes from changes in the device state.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------------------------- | | -------- | ---------------------------------------- | ---- | --------------------------- |
| type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event. | | type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event. |
| callback | Callback&lt;{&nbsp;action:&nbsp;[DeviceStateChangeAction](#devicestatechangeaction),&nbsp;device:&nbsp;[DeviceInfo](#deviceinfo)&nbsp;&nbsp;}&gt; | Yes | Callback used to return the device information and state.| | callback | Callback&lt;{ action: [DeviceStateChangeAction](#devicestatechangeaction), device: [DeviceInfo](#deviceinfo) }&gt; | No | Callback used to return the device information and state.|
**Example** **Example**
...@@ -932,6 +970,8 @@ on(type: 'deviceFound', callback: Callback&lt;{ subscribeId: number, device: Dev ...@@ -932,6 +970,8 @@ on(type: 'deviceFound', callback: Callback&lt;{ subscribeId: number, device: Dev
Subscribes to device discovery events. Subscribes to device discovery events.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -939,7 +979,7 @@ Subscribes to device discovery events. ...@@ -939,7 +979,7 @@ Subscribes to device discovery events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | -------------------------- | | -------- | ---------------------------------------- | ---- | -------------------------- |
| type | string | Yes | Event type. The value **'deviceFound'** indicates an event reported when a device is discovered.| | type | string | Yes | Event type. The value **'deviceFound'** indicates an event reported when a device is discovered.|
| callback | Callback&lt;{&nbsp;subscribeId: number, device: DeviceInfo&nbsp;}&gt; | Yes | Callback used for device discovery. | | callback | Callback&lt;{&nbsp;subscribeId:&nbsp;number,&nbsp;device:&nbsp;[DeviceInfo](#deviceinfo)&nbsp;}&gt; | Yes | Callback used for device discovery. |
**Example** **Example**
...@@ -959,6 +999,8 @@ off(type: 'deviceFound', callback?: Callback&lt;{ subscribeId: number, device: D ...@@ -959,6 +999,8 @@ off(type: 'deviceFound', callback?: Callback&lt;{ subscribeId: number, device: D
Unsubscribes from device discovery events. Unsubscribes from device discovery events.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -966,7 +1008,7 @@ Unsubscribes from device discovery events. ...@@ -966,7 +1008,7 @@ Unsubscribes from device discovery events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------------------------- | | -------- | ---------------------------------------- | ---- | --------------------------- |
| type | string | Yes | Event type. The value **'deviceFound'** indicates an event reported when a device is discovered. | | type | string | Yes | Event type. The value **'deviceFound'** indicates an event reported when a device is discovered. |
| callback | Callback&lt;{&nbsp;subscribeId: number, device: [DeviceInfo](#deviceinfo)&nbsp;}&gt; | Yes | Callback used to return the device information and state.| | callback | Callback&lt;{&nbsp;subscribeId:&nbsp;number,&nbsp;device:&nbsp;[DeviceInfo](#deviceinfo)&nbsp;}&gt; | No | Callback used to return the device information and state.|
**Example** **Example**
...@@ -986,6 +1028,8 @@ on(type: 'discoverFail', callback: Callback&lt;{ subscribeId: number, reason: nu ...@@ -986,6 +1028,8 @@ on(type: 'discoverFail', callback: Callback&lt;{ subscribeId: number, reason: nu
Subscribes to device discovery failures. Subscribes to device discovery failures.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -993,7 +1037,7 @@ Subscribes to device discovery failures. ...@@ -993,7 +1037,7 @@ Subscribes to device discovery failures.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------ | | -------- | ---------------------------------------- | ---- | ------------------------------ |
| type | string | Yes | Event type. The event **'discoverFail'** indicates an event reported when device discovery fails.| | type | string | Yes | Event type. The event **'discoverFail'** indicates an event reported when device discovery fails.|
| callback | Callback&lt;{&nbsp;subscribeId: number, reason: number&nbsp;}&gt; | Yes | Callback used for the device discovery failure. | | callback | Callback&lt;{&nbsp;subscribeId:&nbsp;number,&nbsp;reason:&nbsp;number&nbsp;}&gt; | Yes | Callback used for the device discovery failure. |
**Example** **Example**
...@@ -1013,6 +1057,8 @@ off(type: 'discoverFail', callback?: Callback&lt;{ subscribeId: number, reason: ...@@ -1013,6 +1057,8 @@ off(type: 'discoverFail', callback?: Callback&lt;{ subscribeId: number, reason:
Unsubscribes from device discovery failures. Unsubscribes from device discovery failures.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1020,7 +1066,7 @@ Unsubscribes from device discovery failures. ...@@ -1020,7 +1066,7 @@ Unsubscribes from device discovery failures.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------- | | -------- | ---------------------------------------- | ---- | ----------------- |
| type | string | Yes | Event type. The event **'discoverFail'** indicates an event reported when device discovery fails. | | type | string | Yes | Event type. The event **'discoverFail'** indicates an event reported when device discovery fails. |
| callback | Callback&lt;{&nbsp;subscribeId: number, reason: number&nbsp;}&gt; | Yes | Callback used for the device discovery failure.| | callback | Callback&lt;{&nbsp;subscribeId:&nbsp;number,&nbsp;reason:&nbsp;number&nbsp;}&gt; | No | Callback used for the device discovery failure.|
**Example** **Example**
...@@ -1034,12 +1080,14 @@ Unsubscribes from device discovery failures. ...@@ -1034,12 +1080,14 @@ Unsubscribes from device discovery failures.
} }
``` ```
### on('publishSuccess')9+</sup> ### on('publishSuccess')<sup>9+</sup>
on(type: 'publishSuccess', callback: Callback&lt;{ publishId: number }&gt;): void on(type: 'publishSuccess', callback: Callback&lt;{ publishId: number }&gt;): void
Subscribes to device information publication success events. Subscribes to device information publication success events.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1047,7 +1095,7 @@ Subscribes to device information publication success events. ...@@ -1047,7 +1095,7 @@ Subscribes to device information publication success events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | ---- | -------------------------- | | -------- | ---------------------------------------- | ---- | -------------------------- |
| type | string | Yes | Event type. The value **'publishSuccess'** indicates an event reported when device information is published.| | type | string | Yes | Event type. The value **'publishSuccess'** indicates an event reported when device information is published.|
| callback | Callback&lt;{ publishId: number }&gt; | Yes | Callback used to return the publish ID. | | callback | Callback&lt;{&nbsp;publishId:&nbsp;number&nbsp;}&gt; | Yes | Callback used to return the publish ID. |
**Example** **Example**
...@@ -1062,12 +1110,14 @@ Subscribes to device information publication success events. ...@@ -1062,12 +1110,14 @@ Subscribes to device information publication success events.
} }
``` ```
### off('publishSuccess')9+</sup> ### off('publishSuccess')<sup>9+</sup>
off(type: 'publishSuccess', callback?: Callback&lt;{ publishId: number }&gt;): void off(type: 'publishSuccess', callback?: Callback&lt;{ publishId: number }&gt;): void
Unsubscribes from device information publication success events. Unsubscribes from device information publication success events.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1075,7 +1125,7 @@ Unsubscribes from device information publication success events. ...@@ -1075,7 +1125,7 @@ Unsubscribes from device information publication success events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | ---- | --------------------------- | | -------- | ---------------------------------------- | ---- | --------------------------- |
| type | string | Yes | Event type. The value **'publishSuccess'** indicates an event reported when device information is published. | | type | string | Yes | Event type. The value **'publishSuccess'** indicates an event reported when device information is published. |
| callback | Callback&lt;{ publishId: number }&gt; | Yes | Callback used to return the publish ID.| | callback | Callback&lt;{&nbsp;publishId:&nbsp;number&nbsp;}&gt; | No | Callback used to return the publish ID.|
**Example** **Example**
...@@ -1089,12 +1139,14 @@ Unsubscribes from device information publication success events. ...@@ -1089,12 +1139,14 @@ Unsubscribes from device information publication success events.
} }
``` ```
### on('publishFail')9+</sup> ### on('publishFail')<sup>9+</sup>
on(type: 'publishFail', callback: Callback&lt;{ publishId: number, reason: number }&gt;): void on(type: 'publishFail', callback: Callback&lt;{ publishId: number, reason: number }&gt;): void
Subscribes to device information publication failures. Subscribes to device information publication failures.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1102,7 +1154,7 @@ Subscribes to device information publication failures. ...@@ -1102,7 +1154,7 @@ Subscribes to device information publication failures.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | ------------------------------ | | -------- | ----------------------------------------------------- | ---- | ------------------------------ |
| type | string | Yes | Event type. The event **'publishFail'** indicates an event reported when publishing device information fails.| | type | string | Yes | Event type. The event **'publishFail'** indicates an event reported when publishing device information fails.|
| callback | Callback&lt;{ publishId: number, reason: number }&gt; | Yes | Callback used for the publication failure. | | callback | Callback&lt;{&nbsp;publishId:&nbsp;number,&nbsp;reason:&nbsp;number&nbsp;}&gt; | Yes | Callback used for the publication failure. |
**Example** **Example**
...@@ -1116,12 +1168,14 @@ Subscribes to device information publication failures. ...@@ -1116,12 +1168,14 @@ Subscribes to device information publication failures.
} }
``` ```
### off('publishFail')9+</sup> ### off('publishFail')<sup>9+</sup>
off(type: 'publishFail', callback?: Callback&lt;{ publishId: number, reason: number }&gt;): void off(type: 'publishFail', callback?: Callback&lt;{ publishId: number, reason: number }&gt;): void
Unsubscribes from device information publication failures. Unsubscribes from device information publication failures.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1129,7 +1183,7 @@ Unsubscribes from device information publication failures. ...@@ -1129,7 +1183,7 @@ Unsubscribes from device information publication failures.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | ----------------- | | -------- | ----------------------------------------------------- | ---- | ----------------- |
| type | string | Yes | Event type. The event **'publishFail'** indicates an event reported when publishing device information fails. | | type | string | Yes | Event type. The event **'publishFail'** indicates an event reported when publishing device information fails. |
| callback | Callback&lt;{ publishId: number, reason: number }&gt; | Yes | Callback used for the device discovery failure.| | callback | Callback&lt;{&nbsp;publishId:&nbsp;number,&nbsp;reason:&nbsp;number&nbsp;}&gt; | No | Callback used for the device discovery failure.|
**Example** **Example**
...@@ -1149,6 +1203,8 @@ on(type: 'serviceDie', callback: () =&gt; void): void ...@@ -1149,6 +1203,8 @@ on(type: 'serviceDie', callback: () =&gt; void): void
Subscribes to dead events of the **DeviceManager** service. Subscribes to dead events of the **DeviceManager** service.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1176,6 +1232,8 @@ off(type: 'serviceDie', callback?: () =&gt; void): void ...@@ -1176,6 +1232,8 @@ off(type: 'serviceDie', callback?: () =&gt; void): void
Unsubscribes from dead events of the **DeviceManager** service. Unsubscribes from dead events of the **DeviceManager** service.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
......
...@@ -26,7 +26,7 @@ The service is not started or fails to start. ...@@ -26,7 +26,7 @@ The service is not started or fails to start.
**Solution** **Solution**
Check whether the service is started normally and obtain the service again. Make sure the service is started and obtain the service again.
## 11600103 Authentication Unavailable ## 11600103 Authentication Unavailable
...@@ -38,7 +38,7 @@ Authentication invalid. ...@@ -38,7 +38,7 @@ Authentication invalid.
The last authentication service is still in progress. The last authentication service is still in progress.
**Procedure** **Solution**
Wait until the last authentication service is complete and call the authentication API again. Wait until the last authentication service is complete and call the authentication API again.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册