UNPKG

hybrid_plus

Version:

Hybrid Flutter Javascript SDK

95 lines (94 loc) 3.23 kB
import { ExecOptions } from "../types/core.ts"; import { BluetoothAdapterState, BluetoothAdapterStateListener, ConnectOptions, DisconnectOptions, ScanResultListener, StartScanOptions } from "../types/bluetooth.ts"; /** * 打开系统蓝牙 * @module bluetooth */ export declare function turnOn(options: ExecOptions<any, any>): Promise<unknown>; /** * 当前系统是否支持蓝牙功能 * @module bluetooth * @return {boolean} true 表示支持,false 表示不支持 */ export declare function isSupported(options: ExecOptions<boolean, any>): Promise<unknown>; /** * 当前是否正在扫描 * @module bluetooth * @return {boolean} true 表示扫描中,false 表示不在扫描 */ export declare function isScanningNow(options: ExecOptions<boolean, any>): Promise<unknown>; /** * 当前蓝牙状态 * @module bluetooth * @return {BluetoothAdapterState} state 蓝牙状态 */ export declare function adapterStateNow(options: ExecOptions<BluetoothAdapterState, any>): Promise<unknown>; /** * 当前设备蓝牙名称 * @module bluetooth * @return {string} name 蓝牙名称 */ export declare function adapterName(options: ExecOptions<string, any>): Promise<unknown>; /** * 添加蓝牙扫描结果监听 * @param {ScanResultListener} listener 扫描结果监听器 * @module bluetooth */ export declare function bindScanResultListener(listener: ScanResultListener): void; /** * 移除蓝牙扫描结果监听 * @module bluetooth */ export declare function unbindScanResultListener(): void; /** * 开始扫描蓝牙设备 * @module bluetooth */ export declare function startScan(options: StartScanOptions): Promise<unknown>; /** * 停止扫描 * @module bluetooth */ export declare function stopScan(): void; /** * 检索绑定设备列表(仅限 Android) * @module bluetooth * @return {string[]} 蓝牙设备Id列表 */ export declare function getBondedDevices(options: ExecOptions<string[], any>): Promise<unknown>; /** * 检索当前连接到系统的设备列表 * @description 该列表包括任何应用连接到的设备,您仍必须调用 device.connect() 才能将它们连接到您的应用 * @module bluetooth * @return {string[]} 蓝牙设备Id列表 */ export declare function getSystemDevices(options: ExecOptions<string[], any>): Promise<unknown>; /** * 检索当前连接到应用的设备列表 * @module bluetooth * @return {string[]} 蓝牙设备Id列表 */ export declare function getConnectedDevices(options: ExecOptions<string[], any>): Promise<unknown>; /** * 连接指定蓝牙设备 * @param {ConnectOptions} options * @module bluetooth */ export declare function connect(options: ConnectOptions): Promise<unknown>; /** * 断开指定蓝牙设备连接 * @param {DisconnectOptions} options * @module bluetooth */ export declare function disconnect(options: DisconnectOptions): Promise<unknown>; /** * 添加蓝牙状态监听 * @param {BluetoothAdapterStateListener} listener 蓝牙状态监听器 * @module bluetooth */ export declare function bindAdapterStateListener(listener: BluetoothAdapterStateListener): void; /** * 移除蓝牙状态监听 * @module bluetooth */ export declare function unbindAdapterStateListener(): void;