forked from noble/node-bluetooth-hci-socket
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.d.ts
More file actions
64 lines (53 loc) · 1.83 KB
/
index.d.ts
File metadata and controls
64 lines (53 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/// <reference types="node" />
declare module '@stoprocent/bluetooth-hci-socket' {
import { EventEmitter } from 'events';
export interface Device {
/** Device ID */
devId: number | null;
/** Device is up */
devUp: boolean | null;
/** USB-IF vendor ID. */
idVendor: number | null;
/** USB-IF product ID. */
idProduct: number | null;
/** Integer USB device number */
busNumber: number | null;
/** Integer USB device address */
deviceAddress: number | null;
/** Device path (UART) */
path: string | null;
}
export interface BindParams {
usb: {
vid: number;
pid: number;
bus?: number;
address?: number;
} | undefined;
uart: {
port: string;
baudRate: number;
retryConnection?: number;
flowControl?: boolean;
} | undefined;
}
export class BluetoothHciSocket extends EventEmitter {
getDeviceList(): Promise<Device[]>;
isDevUp(): boolean;
start(): void;
stop(): void;
reset(): void;
bindRaw(devId: number, params?: BindParams): number;
bindUser(devId: number, params?: BindParams): number;
bindControl(): number;
setFilter(filter: Buffer): void;
write(data: Buffer): void;
on(event: "data", cb: (data: Buffer) => void): this;
on(event: "error", cb: (error: NodeJS.ErrnoException) => void): this;
}
export type DriverType = 'default' | 'uart' | 'usb' | 'native';
export function loadDriver(driverType: DriverType): typeof BluetoothHciSocket;
// Define a default export
const BluetoothHciSocketDefault: typeof BluetoothHciSocket;
export default BluetoothHciSocketDefault;
}