mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-23 15:20:17 +00:00
!10863 蓝牙模块新增@atomicservice标签
Merge pull request !10863 from liuqian_herb/master
This commit is contained in:
commit
652b35a79f
52
api/@ohos.bluetooth.access.d.ts
vendored
52
api/@ohos.bluetooth.access.d.ts
vendored
@ -47,6 +47,18 @@ declare namespace access {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Enables Bluetooth on a device.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function enableBluetooth(): void;
|
||||
|
||||
/**
|
||||
@ -60,6 +72,18 @@ declare namespace access {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Disables Bluetooth on a device.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function disableBluetooth(): void;
|
||||
|
||||
/**
|
||||
@ -151,6 +175,20 @@ declare namespace access {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Subscribe the event reported when the Bluetooth state changes.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for.
|
||||
* @param { Callback<BluetoothState> } callback - Callback used to listen for the Bluetooth state event.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 401 - Invalid parameter.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function on(type: 'stateChange', callback: Callback<BluetoothState>): void;
|
||||
|
||||
/**
|
||||
@ -166,6 +204,20 @@ declare namespace access {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Unsubscribe the event reported when the Bluetooth state changes.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for.
|
||||
* @param { Callback<BluetoothState> } callback - Callback used to listen for the Bluetooth state event.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 401 - Invalid parameter.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function off(type: 'stateChange', callback?: Callback<BluetoothState>): void;
|
||||
|
||||
/**
|
||||
|
933
api/@ohos.bluetooth.ble.d.ts
vendored
933
api/@ohos.bluetooth.ble.d.ts
vendored
File diff suppressed because it is too large
Load Diff
173
api/@ohos.bluetooth.connection.d.ts
vendored
173
api/@ohos.bluetooth.connection.d.ts
vendored
@ -28,10 +28,19 @@ import type constant from './@ohos.bluetooth.constant';
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Provides methods to operate or manage Bluetooth.
|
||||
*
|
||||
* @namespace connection
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
declare namespace connection {
|
||||
/**
|
||||
* Indicate the profile connection state.
|
||||
*
|
||||
* @typedef { constant.ProfileConnectionState } ProfileConnectionState
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
@ -40,6 +49,7 @@ declare namespace connection {
|
||||
/**
|
||||
* Indicate the profile id.
|
||||
*
|
||||
* @typedef { constant.ProfileId } ProfileId
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
@ -48,6 +58,7 @@ declare namespace connection {
|
||||
/**
|
||||
* Indicate the profile uuid.
|
||||
*
|
||||
* @typedef { constant.ProfileUuids } ProfileUuids
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
@ -57,6 +68,7 @@ declare namespace connection {
|
||||
/**
|
||||
* Indicate the major class of a bluetooth device.
|
||||
*
|
||||
* @typedef { constant.MajorClass } MajorClass
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
@ -65,6 +77,7 @@ declare namespace connection {
|
||||
/**
|
||||
* Indicate the major minor class of a bluetooth device.
|
||||
*
|
||||
* @typedef { constant.MajorMinorClass } MajorMinorClass
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
@ -106,6 +119,22 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Starts pairing with a remote Bluetooth device.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
|
||||
* @param { AsyncCallback<void> } callback - the callback of pairDevice.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 401 - Invalid parameter.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900003 - Bluetooth switch is off.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function pairDevice(deviceId: string, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
@ -123,6 +152,22 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Starts pairing with a remote Bluetooth device.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
|
||||
* @returns { Promise<void> } Returns the promise object.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 401 - Invalid parameter.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900003 - Bluetooth switch is off.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function pairDevice(deviceId: string): Promise<void>;
|
||||
|
||||
/**
|
||||
@ -260,6 +305,22 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Obtains the name of a peer Bluetooth device.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
|
||||
* @returns { string } Returns the device name in character string format.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 401 - Invalid parameter.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900003 - Bluetooth switch is off.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function getRemoteDeviceName(deviceId: string): string;
|
||||
|
||||
/**
|
||||
@ -306,6 +367,20 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Obtains the list of Bluetooth devices that have been paired with the current device.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900003 - Bluetooth switch is off.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function getPairedDevices(): Array<string>;
|
||||
|
||||
/**
|
||||
@ -323,6 +398,22 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 11
|
||||
*/
|
||||
/**
|
||||
* Obtains the pair state of a specified device.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
|
||||
* @returns { BondState } Returns the pair state.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 401 - Invalid parameter.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900003 - Bluetooth switch is off.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function getPairState(deviceId: string): BondState;
|
||||
|
||||
/**
|
||||
@ -438,6 +529,19 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Starts scanning Bluetooth devices.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900003 - Bluetooth switch is off.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function startBluetoothDiscovery(): void;
|
||||
|
||||
/**
|
||||
@ -452,6 +556,19 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Stops Bluetooth device scanning.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900001 - Service stopped.
|
||||
* @throws { BusinessError } 2900003 - Bluetooth switch is off.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function stopBluetoothDiscovery(): void;
|
||||
|
||||
/**
|
||||
@ -700,6 +817,20 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Subscribe the event reported when a remote Bluetooth device is discovered.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
|
||||
* @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 401 - Invalid parameter.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function on(type: 'bluetoothDeviceFind', callback: Callback<Array<string>>): void;
|
||||
|
||||
/**
|
||||
@ -714,6 +845,19 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Unsubscribe the event reported when a remote Bluetooth device is discovered.
|
||||
*
|
||||
* @permission ohos.permission.ACCESS_BLUETOOTH
|
||||
* @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
|
||||
* @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 801 - Capability not supported.
|
||||
* @throws { BusinessError } 2900099 - Operation failed.
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
function off(type: 'bluetoothDeviceFind', callback?: Callback<Array<string>>): void;
|
||||
|
||||
/**
|
||||
@ -984,6 +1128,14 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* The enum of bond state.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
enum BondState {
|
||||
/**
|
||||
* Indicate the bond state is invalid
|
||||
@ -991,6 +1143,13 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Indicate the bond state is invalid
|
||||
*
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
BOND_STATE_INVALID = 0,
|
||||
/**
|
||||
* Indicate the bond state is bonding
|
||||
@ -998,6 +1157,13 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Indicate the bond state is bonding
|
||||
*
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
BOND_STATE_BONDING = 1,
|
||||
/**
|
||||
* Indicate the bond state is bonded
|
||||
@ -1005,6 +1171,13 @@ declare namespace connection {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* Indicate the bond state is bonded
|
||||
*
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
BOND_STATE_BONDED = 2
|
||||
}
|
||||
|
||||
|
44
api/@ohos.bluetooth.constant.d.ts
vendored
44
api/@ohos.bluetooth.constant.d.ts
vendored
@ -25,6 +25,14 @@
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* The definition of constant.
|
||||
*
|
||||
* @namespace constant
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
declare namespace constant {
|
||||
/**
|
||||
* The enum of profile id.
|
||||
@ -165,6 +173,14 @@ declare namespace constant {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* The enum of profile connection state.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export enum ProfileConnectionState {
|
||||
/**
|
||||
* the current profile is disconnected
|
||||
@ -172,6 +188,13 @@ declare namespace constant {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* the current profile is disconnected
|
||||
*
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
STATE_DISCONNECTED = 0,
|
||||
/**
|
||||
* the current profile is being connected
|
||||
@ -179,6 +202,13 @@ declare namespace constant {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* the current profile is being connected
|
||||
*
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
STATE_CONNECTING = 1,
|
||||
/**
|
||||
* the current profile is connected
|
||||
@ -186,6 +216,13 @@ declare namespace constant {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* the current profile is connected
|
||||
*
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
STATE_CONNECTED = 2,
|
||||
/**
|
||||
* the current profile is being disconnected
|
||||
@ -193,6 +230,13 @@ declare namespace constant {
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 10
|
||||
*/
|
||||
/**
|
||||
* the current profile is being disconnected
|
||||
*
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
STATE_DISCONNECTING = 3
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user