bluetooth 整改

Signed-off-by: lverpeng <lverpeng118@163.com>
This commit is contained in:
lverpeng 2023-07-31 11:35:58 +08:00
parent c63c6660a0
commit 68a9bc9168
3 changed files with 1958 additions and 381 deletions

2309
api/@ohos.bluetooth.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { AsyncCallback, Callback } from './@ohos.base';
import type { AsyncCallback, Callback } from './@ohos.base';
/**
* Provides methods to operate or manage Bluetooth.

View File

@ -14,6 +14,7 @@
*/
/**
* @typedef StartBLEScanOptions
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
@ -25,6 +26,7 @@ export interface StartBLEScanOptions {
}
/**
* @typedef StopBLEScanOptions
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
@ -35,11 +37,12 @@ export interface StopBLEScanOptions {
}
/**
* @typedef BluetoothDevice
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
export interface BluetoothDevice {
addrType: "public" | "random";
addrType: 'public' | 'random';
addr: string;
rssi: number;
txpower: string;
@ -47,6 +50,7 @@ export interface BluetoothDevice {
}
/**
* @typedef BLEFoundResponse
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
@ -55,6 +59,7 @@ export interface BLEFoundResponse {
}
/**
* @typedef SubscribeBLEFoundOptions
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
@ -65,30 +70,43 @@ export interface SubscribeBLEFoundOptions {
/**
* Provides methods to manage BLE scan.
* @since 6
*
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
export default class Bluetooth {
/**
* Start BLE scan
* @param options Options
*
* @param { StartBLEScanOptions } options - Options
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
static startBLEScan(options: StartBLEScanOptions): void;
/**
* Stop BLE scan
* @param options Options
*
* @param { StopBLEScanOptions } options - Options
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
static stopBLEScan(options: StopBLEScanOptions): void;
/**
* Subscribe BLE found
* @param options Options
*
* @param { SubscribeBLEFoundOptions } options - Options
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
static subscribeBLEFound(options: SubscribeBLEFoundOptions): void;
/**
* Stop the subscription of BLE found
*
* @syscap SystemCapability.Communication.Bluetooth.Lite
* @since 6
*/
static unsubscribeBLEFound(): void;
}