webbluetooth
Version:
Node.js implementation of the Web Bluetooth Specification
38 lines (37 loc) • 1.99 kB
TypeScript
import { EventEmitter } from 'events';
import { Adapter as BluetoothAdapter } from './adapter';
import { BluetoothRemoteGATTCharacteristicImpl } from '../characteristic';
import { BluetoothRemoteGATTServiceImpl } from '../service';
import { BluetoothRemoteGATTDescriptorImpl } from '../descriptor';
/**
* @hidden
*/
export declare class SimplebleAdapter extends EventEmitter implements BluetoothAdapter {
private adapter;
private peripherals;
private handles;
private validDevice;
private buildBluetoothDevice;
private get state();
getEnabled(): Promise<boolean>;
getAdapters(): Array<{
index: number;
address: string;
active: boolean;
}>;
useAdapter(index: number): void;
startScan(serviceUUIDs: Array<string>, foundFn: (device: Partial<BluetoothDevice>) => void): Promise<void>;
stopScan(_errorFn?: (errorMsg: string) => void): void;
connect(handle: string, disconnectFn?: () => void): Promise<void>;
disconnect(handle: string): Promise<void>;
discoverServices(handle: string, serviceUUIDs?: Array<string>): Promise<Array<Partial<BluetoothRemoteGATTServiceImpl>>>;
discoverIncludedServices(_handle: string, _serviceUUIDs?: Array<string>): Promise<Array<Partial<BluetoothRemoteGATTServiceImpl>>>;
discoverCharacteristics(handle: string, characteristicUUIDs?: Array<string>): Promise<Array<Partial<BluetoothRemoteGATTCharacteristicImpl>>>;
discoverDescriptors(handle: string, descriptorUUIDs?: Array<string>): Promise<Array<Partial<BluetoothRemoteGATTDescriptorImpl>>>;
readCharacteristic(handle: string): Promise<DataView>;
writeCharacteristic(handle: string, value: DataView, withoutResponse?: boolean): Promise<void>;
enableNotify(handle: string, notifyFn: (value: DataView) => void): Promise<void>;
disableNotify(handle: string): Promise<void>;
readDescriptor(handle: string): Promise<DataView>;
writeDescriptor(handle: string, value: DataView): Promise<void>;
}