From 1c2e26cb0768866c6f5710c75a97d447fb0285f8 Mon Sep 17 00:00:00 2001 From: Yusuf Can INCE Date: Wed, 2 Dec 2020 12:47:08 +0300 Subject: [PATCH] type definition Licence Indentifier --- index.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 39 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..18a8e1d --- /dev/null +++ b/index.d.ts @@ -0,0 +1,38 @@ +// SPDX-Licence-Indentifier: MIT +// By: Yusuf Can INCE + +/// + +interface Device { + devId: number | null; + 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; +} + +declare class BluetoothHciSocket extends NodeJS.EventEmitter { + getDeviceList(): Device[]; + isDevUp(): boolean; + + start(): void; + stop(): void; + reset(): void; + + bindRaw(devId: number): number; + bindUser(devId: number): 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 = BluetoothHciSocket; diff --git a/package.json b/package.json index acfc39f..9e26b07 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.5.3-6", "description": "Bluetooth HCI socket binding for Node.js", "main": "index.js", + "types": "index.d.ts", "repository": { "type": "git", "url": "https://github.com/abandonware/node-bluetooth-hci-socket.git"