forked from nathankellenicki/node-poweredup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.ts
26 lines (23 loc) · 1.06 KB
/
interfaces.ts
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
import { EventEmitter } from "events";
import * as Consts from "./consts";
export interface IBLEAbstraction extends EventEmitter {
uuid: string;
name: string;
connecting: boolean;
connected: boolean;
connect: () => Promise<void>;
disconnect: () => Promise<void>;
discoverCharacteristicsForService: (uuid: string) => Promise<void>;
subscribeToCharacteristic: (uuid: string, callback: (data: Buffer) => void) => void;
addToCharacteristicMailbox: (uuid: string, data: Buffer) => void;
readFromCharacteristic: (uuid: string, callback: (err: string | null, data: Buffer | null) => void) => void;
writeToCharacteristic: (uuid: string, data: Buffer) => Promise<void>;
}
export interface IDeviceInterface extends EventEmitter {
type: Consts.HubType;
getPortNameForPortId: (portId: number) => string | undefined;
send: (message: Buffer, uuid: string) => Promise<void>;
subscribe: (portId: number, deviceType: number, mode: number) => void;
isPortVirtual: (portId: number) => boolean;
sleep: (delay: number) => Promise<any>;
}