diff --git a/lib/bindings/dbus/Adapter.js b/lib/bindings/dbus/Adapter.js index 26bbb865..0efbe301 100644 --- a/lib/bindings/dbus/Adapter.js +++ b/lib/bindings/dbus/Adapter.js @@ -1,20 +1,8 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusAdapter = void 0; -const models_1 = require("../../models"); -const misc_1 = require("./misc"); -const Peripheral_1 = require("./Peripheral"); +import { Adapter } from '../../models'; +import { buildTypedValue, I_BLUEZ_ADAPTER, I_BLUEZ_DEVICE, I_OBJECT_MANAGER, I_PROPERTIES } from './misc'; +import { DbusPeripheral } from './Peripheral'; const UPDATE_INTERVAL = 5; // in seconds -class DbusAdapter extends models_1.Adapter { +export class DbusAdapter extends Adapter { constructor(modblue, path, name, address) { super(modblue, path.replace(`/org/bluez/`, '')); this.initialized = false; @@ -22,128 +10,115 @@ class DbusAdapter extends models_1.Adapter { this.requestScanStop = false; this.peripherals = new Map(); this.onDeviceFound = (path, data) => { - var _a, _b, _c, _d; const id = path.replace(`${this.path}/`, ''); let peripheral = this.peripherals.get(id); if (!peripheral) { - const address = ((_a = data.Address) === null || _a === void 0 ? void 0 : _a.value).toLowerCase(); - const addressType = (_b = data.AddressType) === null || _b === void 0 ? void 0 : _b.value; - const advertisement = (_c = data.ManufacturerData) === null || _c === void 0 ? void 0 : _c.value; - const rssi = (_d = data.RSSI) === null || _d === void 0 ? void 0 : _d.value; - peripheral = new Peripheral_1.DbusPeripheral(this, path, id, addressType, address, advertisement, rssi); + const address = data.Address?.value.toLowerCase(); + const addressType = data.AddressType?.value; + const advertisement = data.ManufacturerData?.value; + const rssi = data.RSSI?.value; + peripheral = new DbusPeripheral(this, path, id, addressType, address, advertisement, rssi); this.peripherals.set(id, peripheral); } this.emit('discover', peripheral); }; - this.updatePeripherals = () => __awaiter(this, void 0, void 0, function* () { - const objs = yield this.objManagerIface.GetManagedObjects(); + this.updatePeripherals = async () => { + const objs = await this.objManagerIface.GetManagedObjects(); const keys = Object.keys(objs); for (const devicePath of keys) { if (!devicePath.startsWith(this.path)) { continue; } - const deviceObj = objs[devicePath][misc_1.I_BLUEZ_DEVICE]; + const deviceObj = objs[devicePath][I_BLUEZ_DEVICE]; if (!deviceObj) { continue; } this.onDeviceFound(devicePath, deviceObj); } - }); + }; this.path = path; this._name = name; this._address = address.toLowerCase(); } - init() { - return __awaiter(this, void 0, void 0, function* () { - if (this.initialized) { + async init() { + if (this.initialized) { + return; + } + this.initialized = true; + const objManager = await this.modblue.dbus.getProxyObject(`org.bluez`, '/'); + this.objManagerIface = objManager.getInterface(I_OBJECT_MANAGER); + this.objManagerIface.on('InterfacesAdded', (path, data) => { + if (!path.startsWith(`${this.path}/`)) { return; } - this.initialized = true; - const objManager = yield this.modblue.dbus.getProxyObject(`org.bluez`, '/'); - this.objManagerIface = objManager.getInterface(misc_1.I_OBJECT_MANAGER); - this.objManagerIface.on('InterfacesAdded', (path, data) => { - if (!path.startsWith(`${this.path}/`)) { - return; - } - const deviceObj = data[misc_1.I_BLUEZ_DEVICE]; - if (!deviceObj) { - return; - } - if (this.scanning) { - this.onDeviceFound(path, deviceObj); - } - }); - const obj = yield this.modblue.dbus.getProxyObject(`org.bluez`, this.path); - this.adapterIface = obj.getInterface(misc_1.I_BLUEZ_ADAPTER); - this.propsIface = obj.getInterface(misc_1.I_PROPERTIES); - const onPropertiesChanged = (iface, changedProps) => { - if (iface !== misc_1.I_BLUEZ_ADAPTER) { - return; + const deviceObj = data[I_BLUEZ_DEVICE]; + if (!deviceObj) { + return; + } + if (this.scanning) { + this.onDeviceFound(path, deviceObj); + } + }); + const obj = await this.modblue.dbus.getProxyObject(`org.bluez`, this.path); + this.adapterIface = obj.getInterface(I_BLUEZ_ADAPTER); + this.propsIface = obj.getInterface(I_PROPERTIES); + const onPropertiesChanged = (iface, changedProps) => { + if (iface !== I_BLUEZ_ADAPTER) { + return; + } + if ('Discovering' in changedProps) { + if (this.scanning && !changedProps.Discovering.value) { + this.onScanStop(); } - if ('Discovering' in changedProps) { - if (this.scanning && !changedProps.Discovering.value) { - this.onScanStop(); - } - else if (!this.scanning && changedProps.Discovering.value) { - this.onScanStart(); - } + else if (!this.scanning && changedProps.Discovering.value) { + this.onScanStart(); } - }; - this.propsIface.on('PropertiesChanged', onPropertiesChanged); - }); + } + }; + this.propsIface.on('PropertiesChanged', onPropertiesChanged); } - prop(iface, name) { - return __awaiter(this, void 0, void 0, function* () { - const rawProp = yield this.propsIface.Get(iface, name); - return rawProp.value; - }); + async prop(iface, name) { + const rawProp = await this.propsIface.Get(iface, name); + return rawProp.value; } - getScannedPeripherals() { - return __awaiter(this, void 0, void 0, function* () { - return [...this.peripherals.values()]; - }); + async getScannedPeripherals() { + return [...this.peripherals.values()]; } - isScanning() { - return __awaiter(this, void 0, void 0, function* () { - return this.scanning; - }); + async isScanning() { + return this.scanning; } - startScanning() { - return __awaiter(this, void 0, void 0, function* () { - yield this.init(); - if (this.scanning) { - return; - } - this.peripherals.clear(); - const scanning = yield this.prop(misc_1.I_BLUEZ_ADAPTER, 'Discovering'); - if (!scanning) { - yield this.adapterIface.SetDiscoveryFilter({ - Transport: misc_1.buildTypedValue('string', 'le'), - DuplicateData: misc_1.buildTypedValue('boolean', false) - }); - yield this.adapterIface.StartDiscovery(); - } - const objs = yield this.objManagerIface.GetManagedObjects(); - const keys = Object.keys(objs); - for (const key of keys) { - this.objManagerIface.emit('InterfacesAdded', key, objs[key]); - } - this.updateTimer = setInterval(this.updatePeripherals, UPDATE_INTERVAL * 1000); - }); + async startScanning() { + await this.init(); + if (this.scanning) { + return; + } + this.peripherals.clear(); + const scanning = await this.prop(I_BLUEZ_ADAPTER, 'Discovering'); + if (!scanning) { + await this.adapterIface.SetDiscoveryFilter({ + Transport: buildTypedValue('string', 'le'), + DuplicateData: buildTypedValue('boolean', false) + }); + await this.adapterIface.StartDiscovery(); + } + const objs = await this.objManagerIface.GetManagedObjects(); + const keys = Object.keys(objs); + for (const key of keys) { + this.objManagerIface.emit('InterfacesAdded', key, objs[key]); + } + this.updateTimer = setInterval(this.updatePeripherals, UPDATE_INTERVAL * 1000); } onScanStart() { this.scanning = true; } - stopScanning() { - return __awaiter(this, void 0, void 0, function* () { - if (!this.scanning) { - return; - } - clearInterval(this.updateTimer); - this.updateTimer = null; - this.requestScanStop = true; - yield this.adapterIface.StopDiscovery(); - }); + async stopScanning() { + if (!this.scanning) { + return; + } + clearInterval(this.updateTimer); + this.updateTimer = null; + this.requestScanStop = true; + await this.adapterIface.StopDiscovery(); } onScanStop() { this.scanning = false; @@ -156,24 +131,17 @@ class DbusAdapter extends models_1.Adapter { // NO-OP }); } - isAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - return false; - }); + async isAdvertising() { + return false; } - startAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('Method not implemented.'); - }); + async startAdvertising() { + throw new Error('Method not implemented.'); } - stopAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('Method not implemented.'); - }); + async stopAdvertising() { + throw new Error('Method not implemented.'); } setupGatt() { throw new Error('Method not implemented.'); } } -exports.DbusAdapter = DbusAdapter; //# sourceMappingURL=Adapter.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/Adapter.js.map b/lib/bindings/dbus/Adapter.js.map index 5f82cf99..206ed4c7 100644 --- a/lib/bindings/dbus/Adapter.js.map +++ b/lib/bindings/dbus/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../../src/bindings/dbus/Adapter.ts"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E,CAAC;IACzC,CAAC;IAEO,UAAU;QACjB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,IAAI,IAAI,CAAC,eAAe,EAAE;YACzB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;YAC7B,OAAO;SACP;QAED,8FAA8F;QAC9F,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;YAC/B,QAAQ;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IAoCM,KAAK,CAAC,aAAa;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACM,KAAK,CAAC,eAAe;QAC3B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/dbus/MODblue.js b/lib/bindings/dbus/MODblue.js index bce50dec..ecaace79 100644 --- a/lib/bindings/dbus/MODblue.js +++ b/lib/bindings/dbus/MODblue.js @@ -1,55 +1,38 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusMODblue = void 0; -const dbus_next_1 = require("dbus-next"); -const models_1 = require("../../models"); -const Adapter_1 = require("./Adapter"); -const misc_1 = require("./misc"); +import { systemBus } from 'dbus-next'; +import { MODblue } from '../../models'; +import { DbusAdapter } from './Adapter'; +import { I_BLUEZ_ADAPTER, I_OBJECT_MANAGER } from './misc'; /** * Use the DBUS Bluez bindings to access BLE functions. */ -class DbusMODblue extends models_1.MODblue { +export class DbusMODblue extends MODblue { constructor() { super(); this.adapters = new Map(); - this.dbus = dbus_next_1.systemBus(); + this.dbus = systemBus(); } - dispose() { - return __awaiter(this, void 0, void 0, function* () { - this.adapters = new Map(); - }); + async dispose() { + this.adapters = new Map(); } - getAdapters() { - return __awaiter(this, void 0, void 0, function* () { - if (!this.objManagerIface) { - const objManager = yield this.dbus.getProxyObject('org.bluez', '/'); - this.objManagerIface = objManager.getInterface(misc_1.I_OBJECT_MANAGER); + async getAdapters() { + if (!this.objManagerIface) { + const objManager = await this.dbus.getProxyObject('org.bluez', '/'); + this.objManagerIface = objManager.getInterface(I_OBJECT_MANAGER); + } + const objs = await this.objManagerIface.GetManagedObjects(); + const keys = Object.keys(objs); + for (const adapterPath of keys) { + const adapterObj = objs[adapterPath][I_BLUEZ_ADAPTER]; + if (!adapterObj) { + continue; } - const objs = yield this.objManagerIface.GetManagedObjects(); - const keys = Object.keys(objs); - for (const adapterPath of keys) { - const adapterObj = objs[adapterPath][misc_1.I_BLUEZ_ADAPTER]; - if (!adapterObj) { - continue; - } - let adapter = this.adapters.get(adapterPath); - if (!adapter) { - adapter = new Adapter_1.DbusAdapter(this, adapterPath, adapterObj.Name.value, adapterObj.Address.value); - this.adapters.set(adapterPath, adapter); - } + let adapter = this.adapters.get(adapterPath); + if (!adapter) { + adapter = new DbusAdapter(this, adapterPath, adapterObj.Name.value, adapterObj.Address.value); + this.adapters.set(adapterPath, adapter); } - return [...this.adapters.values()]; - }); + } + return [...this.adapters.values()]; } } -exports.DbusMODblue = DbusMODblue; //# sourceMappingURL=MODblue.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/MODblue.js.map b/lib/bindings/dbus/MODblue.js.map index c560a2e7..d4182550 100644 --- a/lib/bindings/dbus/MOD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IAAI,EAAE;YAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,eAAe,CAAC,CAAC;YACtD,IAAI,CAAC,UAAU,EAAE;gBAChB,SAAS;aACT;YAED,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAC7C,IAAI,CAAC,OAAO,EAAE;gBACb,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAC9F,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;aACxC;SACD;QAED,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACpC,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/dbus/Peripheral.js b/lib/bindings/dbus/Peripheral.js index 238a3160..b8677a40 100644 --- a/lib/bindings/dbus/Peripheral.js +++ b/lib/bindings/dbus/Peripheral.js @@ -1,20 +1,8 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusPeripheral = void 0; -const models_1 = require("../../models"); -const gatt_1 = require("./gatt"); -const misc_1 = require("./misc"); +import { Peripheral } from '../../models'; +import { DbusGattRemote } from './gatt'; +import { I_BLUEZ_DEVICE, I_PROPERTIES } from './misc'; const CONNECT_TIMEOUT = 10; // in seconds -class DbusPeripheral extends models_1.Peripheral { +export class DbusPeripheral extends Peripheral { constructor(adapter, path, id, addressType, address, advertisement, rssi) { super(adapter, id, addressType, address, advertisement, rssi); this._init = false; @@ -24,106 +12,96 @@ class DbusPeripheral extends models_1.Peripheral { this.disconnecting = []; this.path = path; } - init() { - return __awaiter(this, void 0, void 0, function* () { - if (this._init) { - return; - } - const obj = yield this.adapter.modblue.dbus.getProxyObject('org.bluez', this.path); - this.propsIface = obj.getInterface(misc_1.I_PROPERTIES); - this.deviceIface = obj.getInterface(misc_1.I_BLUEZ_DEVICE); - this._init = true; - }); + async init() { + if (this._init) { + return; + } + const obj = await this.adapter.modblue.dbus.getProxyObject('org.bluez', this.path); + this.propsIface = obj.getInterface(I_PROPERTIES); + this.deviceIface = obj.getInterface(I_BLUEZ_DEVICE); + this._init = true; } - prop(iface, name) { - return __awaiter(this, void 0, void 0, function* () { - yield this.init(); - const rawProp = yield this.propsIface.Get(iface, name); - return rawProp.value; - }); + async prop(iface, name) { + await this.init(); + const rawProp = await this.propsIface.Get(iface, name); + return rawProp.value; } - isConnected() { - return __awaiter(this, void 0, void 0, function* () { - return this.prop(misc_1.I_BLUEZ_DEVICE, 'Connected'); - }); + async isConnected() { + return this.prop(I_BLUEZ_DEVICE, 'Connected'); } - connect() { - return __awaiter(this, void 0, void 0, function* () { - if (yield this.isConnected()) { - return; - } - if (this.isDisconnecting) { - throw new Error(`Device is currently disconnecting, cannot connect`); - } - if (this.isConnecting) { - return new Promise((resolve, reject) => this.connecting.push([resolve, reject])); - } - this.connecting = []; - this.isConnecting = true; - yield this.init(); - return new Promise((resolve, reject) => { - this.connecting.push([resolve, reject]); - const done = () => this.doneConnecting(); - const onPropertiesChanged = (iface, changedProps) => { - if (iface !== misc_1.I_BLUEZ_DEVICE) { - return; - } - if ('Connected' in changedProps && changedProps.Connected.value) { - this.propsIface.off('PropertiesChanged', onPropertiesChanged); - done(); - } - }; - this.propsIface.on('PropertiesChanged', onPropertiesChanged); - const timeout = () => __awaiter(this, void 0, void 0, function* () { - this.doneConnecting(new Error('Connecting timed out')); + async connect() { + if (await this.isConnected()) { + return; + } + if (this.isDisconnecting) { + throw new Error(`Device is currently disconnecting, cannot connect`); + } + if (this.isConnecting) { + return new Promise((resolve, reject) => this.connecting.push([resolve, reject])); + } + this.connecting = []; + this.isConnecting = true; + await this.init(); + return new Promise((resolve, reject) => { + this.connecting.push([resolve, reject]); + const done = () => this.doneConnecting(); + const onPropertiesChanged = (iface, changedProps) => { + if (iface !== I_BLUEZ_DEVICE) { + return; + } + if ('Connected' in changedProps && changedProps.Connected.value) { this.propsIface.off('PropertiesChanged', onPropertiesChanged); - try { - // Disconnect can be used to cancel pending connects - yield this.deviceIface.Disconnect(); - } - catch (_a) { - // NO-OP - } - }); - this.connectTimeout = setTimeout(timeout, CONNECT_TIMEOUT * 1000); - this.deviceIface.Connect().catch((err) => this.doneConnecting(err)); - }); + done(); + } + }; + this.propsIface.on('PropertiesChanged', onPropertiesChanged); + const timeout = async () => { + this.doneConnecting(new Error('Connecting timed out')); + this.propsIface.off('PropertiesChanged', onPropertiesChanged); + try { + // Disconnect can be used to cancel pending connects + await this.deviceIface.Disconnect(); + } + catch { + // NO-OP + } + }; + this.connectTimeout = setTimeout(timeout, CONNECT_TIMEOUT * 1000); + this.deviceIface.Connect().catch((err) => this.doneConnecting(err)); }); } - disconnect() { - return __awaiter(this, void 0, void 0, function* () { - if (!(yield this.isConnected())) { - return; - } - if (this.isConnecting) { - throw new Error(`Device is currently connecting, cannot disconnect`); - } - if (this.isDisconnecting) { - return new Promise((resolve, reject) => this.disconnecting.push([resolve, reject])); - } - this.disconnecting = []; - this.isDisconnecting = true; - yield this.init(); - return new Promise((resolve, reject) => { - this.disconnecting.push([resolve, reject]); - const done = () => this.doneDisconnecting(); - const onPropertiesChanged = (iface, changedProps) => { - if (iface !== misc_1.I_BLUEZ_DEVICE) { - return; - } - if ('Connected' in changedProps && !changedProps.Connected.value) { - this.propsIface.off('PropertiesChanged', onPropertiesChanged); - done(); - } - }; - this.propsIface.on('PropertiesChanged', onPropertiesChanged); - const timeout = () => { - this.doneDisconnecting(new Error('Disconnecting timed out')); + async disconnect() { + if (!(await this.isConnected())) { + return; + } + if (this.isConnecting) { + throw new Error(`Device is currently connecting, cannot disconnect`); + } + if (this.isDisconnecting) { + return new Promise((resolve, reject) => this.disconnecting.push([resolve, reject])); + } + this.disconnecting = []; + this.isDisconnecting = true; + await this.init(); + return new Promise((resolve, reject) => { + this.disconnecting.push([resolve, reject]); + const done = () => this.doneDisconnecting(); + const onPropertiesChanged = (iface, changedProps) => { + if (iface !== I_BLUEZ_DEVICE) { + return; + } + if ('Connected' in changedProps && !changedProps.Connected.value) { this.propsIface.off('PropertiesChanged', onPropertiesChanged); - }; - this.disconnectTimeout = setTimeout(timeout, CONNECT_TIMEOUT * 1000); - this.deviceIface.Disconnect().catch((err) => this.doneDisconnecting(err)); - }); + done(); + } + }; + this.propsIface.on('PropertiesChanged', onPropertiesChanged); + const timeout = () => { + this.doneDisconnecting(new Error('Disconnecting timed out')); + this.propsIface.off('PropertiesChanged', onPropertiesChanged); + }; + this.disconnectTimeout = setTimeout(timeout, CONNECT_TIMEOUT * 1000); + this.deviceIface.Disconnect().catch((err) => this.doneDisconnecting(err)); }); } doneConnecting(error) { @@ -154,18 +132,15 @@ class DbusPeripheral extends models_1.Peripheral { } this.disconnecting = []; } - setupGatt(requestMtu) { - return __awaiter(this, void 0, void 0, function* () { - if (this.gatt) { - return this.gatt; - } - if (requestMtu) { - throw new Error(`MTU requests are not accepted for dbus`); - } - this.gatt = new gatt_1.DbusGattRemote(this); + async setupGatt(requestMtu) { + if (this.gatt) { return this.gatt; - }); + } + if (requestMtu) { + throw new Error(`MTU requests are not accepted for dbus`); + } + this.gatt = new DbusGattRemote(this); + return this.gatt; } } -exports.DbusPeripheral = DbusPeripheral; //# sourceMappingURL=Peripheral.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/Peripheral.js.map b/lib/bindings/dbus/Peripheral.js.map index f0ba67e4..d1843b90 100644 --- a/lib/bindings/dbus/Peripheral.js.map +++ b/lib/bindings/dbus/Peripheral.js.map @@ -1 +1 @@ -{"version":3,"file":"Peripheral.js","sourceRoot":"","sources":["../../../src/bindings/dbus/Peripheral.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAAmE;AAGnE,iCAAwC;AACxC,iCAAkE;AAElE,MAAM,eAAe,GAAG,EAAE,CAAC,CAAC,aAAa;AAEzC,MAAa,cAAe,SAAQ,mBAAU;IAiB7C,YACC,OAAoB,EACpB,IAAY,EACZ,EAAU,EACV,WAAwB,EACxB,OAAe,EACf,aAAsC,EACtC,IAAY;QAEZ,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;QApBvD,UAAK,GAAG,KAAK,CAAC;QAId,iBAAY,GAAG,KAAK,CAAC;QACrB,eAAU,GAA4C,EAAE,CAAC;QAEzD,oBAAe,GAAG,KAAK,CAAC;QACxB,kBAAa,GAA4C,EAAE,CAAC;QAcnE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAEa,IAAI;;YACjB,IAAI,IAAI,CAAC,KAAK,EAAE;gBACf,OAAO;aACP;YAED,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACnF,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,YAAY,CAAC,mBAAY,CAAC,CAAC;YACjD,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,YAAY,CAAC,qBAAc,CAAC,CAAC;YAEpD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACnB,CAAC;KAAA;IAEa,IAAI,CAAI,KAAa,EAAE,IAAY;;YAChD,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,MAA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A;CACD;AAnMD,wCAmMC"} \ No newline at end of file +{"version":3,"file":"Peripheral.js","sourceRoot":"","sources":["../../../src/bindings/dbus/Peripheral.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,UAAU,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAc,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAElE,MAAM,eAAe,GAAG,EAAE,CAAC,CAAC,aAAa;AAEzC,MAAM,OAAO,cAAe,SAAQ,UAAU;IAiB7C,YACC,OAAoB,EACpB,IAAY,EACZ,EAAU,EACV,WAAwB,EACxB,OAAe,EACf,aAAsC,EACtC,IAAY;QAEZ,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;QApBvD,UAAK,GAAG,KAAK,CAAC;QAId,iBAAY,GAAG,KAAK,CAAC;QACrB,eAAU,GAA4C,EAAE,CAAC;QAEzD,oBAAe,GAAG,KAAK,CAAC;QACxB,kBAAa,GAA4C,EAAE,CAAC;QAcnE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,IAAI;QACjB,IAAI,IAAI,CAAC,KAAK,EAAE;YACf,OAAO;SACP;QAED,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACnF,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;QAEpD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,IAAI,CAAI,KAAa,EAAE,IAAY;QAChD,MAAM,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,CAAC;IAClB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/index.js b/lib/bindings/dbus/gatt/index.js index 17673270..75e59c88 100644 --- a/lib/bindings/dbus/gatt/index.js +++ b/lib/bindings/dbus/gatt/index.js @@ -1,8 +1,2 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusGattServiceRemote = exports.DbusGattRemote = exports.DbusGattCharacteristicRemote = void 0; -var remote_1 = require("./remote"); -Object.defineProperty(exports, "DbusGattCharacteristicRemote", { enumerable: true, get: function () { return remote_1.DbusGattCharacteristicRemote; } }); -Object.defineProperty(exports, "DbusGattRemote", { enumerable: true, get: function () { return remote_1.DbusGattRemote; } }); -Object.defineProperty(exports, "DbusGattServiceRemote", { enumerable: true, get: function () { return remote_1.DbusGattServiceRemote; } }); +export { DbusGattCharacteristicRemote, DbusGattRemote, DbusGattServiceRemote } from './remote'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/index.js.map b/lib/bindings/dbus/gatt/index.js.map index ea0ce35a..0aefdfa5 100644 --- a/lib/bindings/dbus/gatt/index.js.map +++ b/lib/bindings/dbus/gatt/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bindings/dbus/gatt/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+F;AAAtF,sHAAA,4BAA4B,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,+GAAA,qBAAqB,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bindings/dbus/gatt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC"} \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/remote/Characteristic.js b/lib/bindings/dbus/gatt/remote/Characteristic.js index 68722b18..add72e57 100644 --- a/lib/bindings/dbus/gatt/remote/Characteristic.js +++ b/lib/bindings/dbus/gatt/remote/Characteristic.js @@ -1,12 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusGattCharacteristicRemote = void 0; -const models_1 = require("../../../../models"); -class DbusGattCharacteristicRemote extends models_1.GattCharacteristicRemote { +import { GattCharacteristicRemote } from '../../../../models'; +export class DbusGattCharacteristicRemote extends GattCharacteristicRemote { constructor(service, path, uuid, properties, secure) { super(service, uuid, properties, secure); this.path = path; } } -exports.DbusGattCharacteristicRemote = DbusGattCharacteristicRemote; //# sourceMappingURL=Characteristic.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/remote/Characteristic.js.map b/lib/bindings/dbus/gatt/remote/Characteristic.js.map index 450006ae..a83bbeb1 100644 --- a/lib/bindings/dbus/gatt/remote/Characteristic.js.map +++ b/lib/bindings/dbus/gatt/remote/Characteristic.js.map @@ -1 +1 @@ -{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../../../src/bindings/dbus/gatt/remote/Characteristic.ts"],"names":[],"mappings":";;;AAAA,+CAA0F;AAI1F,MAAa,4BAA6B,SAAQ,iCAAwB;IAGzE,YACC,OAA8B,EAC9B,IAAY,EACZ,IAAY,EACZ,UAAwC,EACxC,MAAoC;QAEpC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAEzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD;AAdD,oEAcC"} \ No newline at end of file +{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../../../src/bindings/dbus/gatt/remote/Characteristic.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAI1F,MAAM,OAAO,4BAA6B,SAAQ,wBAAwB;IAGzE,YACC,OAA8B,EAC9B,IAAY,EACZ,IAAY,EACZ,UAAwC,EACxC,MAAoC;QAEpC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAEzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/remote/Gatt.js b/lib/bindings/dbus/gatt/remote/Gatt.js index b902f2ca..07a3863c 100644 --- a/lib/bindings/dbus/gatt/remote/Gatt.js +++ b/lib/bindings/dbus/gatt/remote/Gatt.js @@ -1,167 +1,136 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusGattRemote = void 0; -const models_1 = require("../../../../models"); -const misc_1 = require("../../misc"); -const Characteristic_1 = require("./Characteristic"); -const Service_1 = require("./Service"); +import { GattRemote } from '../../../../models'; +import { buildTypedValue, I_BLUEZ_CHARACTERISTIC, I_BLUEZ_DEVICE, I_BLUEZ_SERVICE, I_OBJECT_MANAGER, I_PROPERTIES } from '../../misc'; +import { DbusGattCharacteristicRemote } from './Characteristic'; +import { DbusGattServiceRemote } from './Service'; // tslint:disable: promise-must-complete const DISCOVER_TIMEOUT = 10; // in seconds -class DbusGattRemote extends models_1.GattRemote { +export class DbusGattRemote extends GattRemote { constructor(peripheral) { super(peripheral); this.services = new Map(); } - doDiscoverServices() { - return __awaiter(this, void 0, void 0, function* () { - const path = this.peripheral.path; - const dbus = this.peripheral.adapter.modblue.dbus; - const obj = yield dbus.getProxyObject('org.bluez', path); - const propsIface = obj.getInterface(misc_1.I_PROPERTIES); - const servicesResolved = (yield propsIface.Get(misc_1.I_BLUEZ_DEVICE, 'ServicesResolved')).value; - if (!servicesResolved) { - const timeoutError = new Error('Discovering timed out'); - yield new Promise((res, rej) => { - let timeout; - const onPropertiesChanged = (iface, changedProps) => { - if (iface !== misc_1.I_BLUEZ_DEVICE) { - return; - } - if ('ServicesResolved' in changedProps && changedProps.ServicesResolved.value) { - propsIface.off('PropertiesChanged', onPropertiesChanged); - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - res(); - } - }; - propsIface.on('PropertiesChanged', onPropertiesChanged); - timeout = setTimeout(() => { + async doDiscoverServices() { + const path = this.peripheral.path; + const dbus = this.peripheral.adapter.modblue.dbus; + const obj = await dbus.getProxyObject('org.bluez', path); + const propsIface = obj.getInterface(I_PROPERTIES); + const servicesResolved = (await propsIface.Get(I_BLUEZ_DEVICE, 'ServicesResolved')).value; + if (!servicesResolved) { + const timeoutError = new Error('Discovering timed out'); + await new Promise((res, rej) => { + let timeout; + const onPropertiesChanged = (iface, changedProps) => { + if (iface !== I_BLUEZ_DEVICE) { + return; + } + if ('ServicesResolved' in changedProps && changedProps.ServicesResolved.value) { propsIface.off('PropertiesChanged', onPropertiesChanged); - rej(timeoutError); - }, DISCOVER_TIMEOUT * 1000); - }); + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + res(); + } + }; + propsIface.on('PropertiesChanged', onPropertiesChanged); + timeout = setTimeout(() => { + propsIface.off('PropertiesChanged', onPropertiesChanged); + rej(timeoutError); + }, DISCOVER_TIMEOUT * 1000); + }); + } + const objManager = await dbus.getProxyObject(`org.bluez`, '/'); + const objManagerIface = objManager.getInterface(I_OBJECT_MANAGER); + const objs = await objManagerIface.GetManagedObjects(); + const keys = Object.keys(objs); + for (const srvPath of keys) { + if (!srvPath.startsWith(path)) { + continue; } - const objManager = yield dbus.getProxyObject(`org.bluez`, '/'); - const objManagerIface = objManager.getInterface(misc_1.I_OBJECT_MANAGER); - const objs = yield objManagerIface.GetManagedObjects(); - const keys = Object.keys(objs); - for (const srvPath of keys) { - if (!srvPath.startsWith(path)) { - continue; - } - const srvObj = objs[srvPath][misc_1.I_BLUEZ_SERVICE]; - if (!srvObj) { - continue; - } - let service = this.services.get(srvPath); - if (!service) { - const uuid = srvObj.UUID.value.replace(/-/g, ''); - service = new Service_1.DbusGattServiceRemote(this, srvPath, uuid); - this.services.set(uuid, service); - } + const srvObj = objs[srvPath][I_BLUEZ_SERVICE]; + if (!srvObj) { + continue; } - return [...this.services.values()]; - }); - } - discoverCharacteristics(serviceUUID) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); + let service = this.services.get(srvPath); if (!service) { - throw new Error(`Service ${serviceUUID} not found`); - } - const objManager = yield this.peripheral.adapter.modblue.dbus.getProxyObject(`org.bluez`, '/'); - const objManagerIface = objManager.getInterface(misc_1.I_OBJECT_MANAGER); - const objs = yield objManagerIface.GetManagedObjects(); - const keys = Object.keys(objs); - const characteristics = []; - for (const charPath of keys) { - if (!charPath.startsWith(service.path)) { - continue; - } - const charObj = objs[charPath][misc_1.I_BLUEZ_CHARACTERISTIC]; - if (!charObj) { - continue; - } - const uuid = charObj.UUID.value.replace(/-/g, ''); - const properties = charObj.Flags.value.filter((p) => !p.startsWith('secure-')); - const secure = properties.filter((p) => p.startsWith('encrypt')).map((p) => p.replace('encrypt-', '')); - const characteristic = new Characteristic_1.DbusGattCharacteristicRemote(service, charPath, uuid, properties, secure); - characteristics.push(characteristic); + const uuid = srvObj.UUID.value.replace(/-/g, ''); + service = new DbusGattServiceRemote(this, srvPath, uuid); + this.services.set(uuid, service); } - return characteristics; - }); + } + return [...this.services.values()]; } - read(serviceUUID, characteristicUUID) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new Error(`Service ${serviceUUID} not found`); + async discoverCharacteristics(serviceUUID) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new Error(`Service ${serviceUUID} not found`); + } + const objManager = await this.peripheral.adapter.modblue.dbus.getProxyObject(`org.bluez`, '/'); + const objManagerIface = objManager.getInterface(I_OBJECT_MANAGER); + const objs = await objManagerIface.GetManagedObjects(); + const keys = Object.keys(objs); + const characteristics = []; + for (const charPath of keys) { + if (!charPath.startsWith(service.path)) { + continue; } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new Error(`Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + const charObj = objs[charPath][I_BLUEZ_CHARACTERISTIC]; + if (!charObj) { + continue; } - const obj = yield this.peripheral.adapter.modblue.dbus.getProxyObject('org.bluez', characteristic.path); - const iface = obj.getInterface(misc_1.I_BLUEZ_CHARACTERISTIC); - return iface.ReadValue({ - offset: misc_1.buildTypedValue('uint16', 0) - }); - }); + const uuid = charObj.UUID.value.replace(/-/g, ''); + const properties = charObj.Flags.value.filter((p) => !p.startsWith('secure-')); + const secure = properties.filter((p) => p.startsWith('encrypt')).map((p) => p.replace('encrypt-', '')); + const characteristic = new DbusGattCharacteristicRemote(service, charPath, uuid, properties, secure); + characteristics.push(characteristic); + } + return characteristics; } - write(serviceUUID, characteristicUUID, data, withoutResponse) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new Error(`Service ${serviceUUID} not found`); - } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new Error(`Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); - } - const obj = yield this.peripheral.adapter.modblue.dbus.getProxyObject('org.bluez', characteristic.path); - const iface = obj.getInterface(misc_1.I_BLUEZ_CHARACTERISTIC); - yield iface.WriteValue([...data], { - offset: misc_1.buildTypedValue('uint16', 0), - type: misc_1.buildTypedValue('string', withoutResponse ? 'command' : 'request') - }); + async read(serviceUUID, characteristicUUID) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new Error(`Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new Error(`Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const obj = await this.peripheral.adapter.modblue.dbus.getProxyObject('org.bluez', characteristic.path); + const iface = obj.getInterface(I_BLUEZ_CHARACTERISTIC); + return iface.ReadValue({ + offset: buildTypedValue('uint16', 0) }); } - broadcast() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('Method not implemented.'); + async write(serviceUUID, characteristicUUID, data, withoutResponse) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new Error(`Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new Error(`Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const obj = await this.peripheral.adapter.modblue.dbus.getProxyObject('org.bluez', characteristic.path); + const iface = obj.getInterface(I_BLUEZ_CHARACTERISTIC); + await iface.WriteValue([...data], { + offset: buildTypedValue('uint16', 0), + type: buildTypedValue('string', withoutResponse ? 'command' : 'request') }); } - notify() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('Method not implemented.'); - }); + async broadcast() { + throw new Error('Method not implemented.'); } - discoverDescriptors() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('Method not implemented.'); - }); + async notify() { + throw new Error('Method not implemented.'); } - readValue() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('Method not implemented.'); - }); + async discoverDescriptors() { + throw new Error('Method not implemented.'); } - writeValue() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error('Method not implemented.'); - }); + async readValue() { + throw new Error('Method not implemented.'); + } + async writeValue() { + throw new Error('Method not implemented.'); } } -exports.DbusGattRemote = DbusGattRemote; //# sourceMappingURL=Gatt.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/remote/Gatt.js.map b/lib/bindings/dbus/gatt/remote/Gatt.js.map index 1310ee82..e1d2765b 100644 --- a/lib/bindings/dbus/gatt/remote/Gatt.js.map +++ b/lib/bindings/dbus/gatt/remote/Gatt.js.map @@ -1 +1 @@ -{"version":3,"file":"Gatt.js","sourceRoot":"","sources":["../../../../../src/bindings/dbus/gatt/remote/Gatt.ts"],"names":[],"mappings":";;;;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C,CAAC,CAAC,SAAS,CAAC;SACxE,CAAC,CAAC;IACJ,CAAC;IACM,KAAK,CAAC,SAAS;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACM,KAAK,CAAC,MAAM;QAClB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACM,KAAK,CAAC,mBAAmB;QAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,SAAS;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACM,KAAK,CAAC,UAAU;QACtB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/remote/Service.js b/lib/bindings/dbus/gatt/remote/Service.js index 9665a6b2..718d3251 100644 --- a/lib/bindings/dbus/gatt/remote/Service.js +++ b/lib/bindings/dbus/gatt/remote/Service.js @@ -1,13 +1,9 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusGattServiceRemote = void 0; -const models_1 = require("../../../../models"); -class DbusGattServiceRemote extends models_1.GattServiceRemote { +import { GattServiceRemote } from '../../../../models'; +export class DbusGattServiceRemote extends GattServiceRemote { constructor(gatt, path, uuid) { super(gatt, uuid); this.characteristics = new Map(); this.path = path; } } -exports.DbusGattServiceRemote = DbusGattServiceRemote; //# sourceMappingURL=Service.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/remote/Service.js.map b/lib/bindings/dbus/gatt/remote/Service.js.map index edac27b9..4ee21066 100644 --- a/lib/bindings/dbus/gatt/remote/Service.js.map +++ b/lib/bindings/dbus/gatt/remote/Service.js.map @@ -1 +1 @@ -{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../../src/bindings/dbus/gatt/remote/Service.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAKvD,MAAa,qBAAsB,SAAQ,0BAAiB;IAK3D,YAAmB,IAAoB,EAAE,IAAY,EAAE,IAAY;QAClE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAHZ,oBAAe,GAA8C,IAAI,GAAG,EAAE,CAAC;QAK7E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD;AAVD,sDAUC"} \ No newline at end of file +{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../../src/bindings/dbus/gatt/remote/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAKvD,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAK3D,YAAmB,IAAoB,EAAE,IAAY,EAAE,IAAY;QAClE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAHZ,oBAAe,GAA8C,IAAI,GAAG,EAAE,CAAC;QAK7E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/remote/index.js b/lib/bindings/dbus/gatt/remote/index.js index 03a1e942..85ee7461 100644 --- a/lib/bindings/dbus/gatt/remote/index.js +++ b/lib/bindings/dbus/gatt/remote/index.js @@ -1,10 +1,4 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusGattServiceRemote = exports.DbusGattRemote = exports.DbusGattCharacteristicRemote = void 0; -var Characteristic_1 = require("./Characteristic"); -Object.defineProperty(exports, "DbusGattCharacteristicRemote", { enumerable: true, get: function () { return Characteristic_1.DbusGattCharacteristicRemote; } }); -var Gatt_1 = require("./Gatt"); -Object.defineProperty(exports, "DbusGattRemote", { enumerable: true, get: function () { return Gatt_1.DbusGattRemote; } }); -var Service_1 = require("./Service"); -Object.defineProperty(exports, "DbusGattServiceRemote", { enumerable: true, get: function () { return Service_1.DbusGattServiceRemote; } }); +export { DbusGattCharacteristicRemote } from './Characteristic'; +export { DbusGattRemote } from './Gatt'; +export { DbusGattServiceRemote } from './Service'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/gatt/remote/index.js.map b/lib/bindings/dbus/gatt/remote/index.js.map index 38857483..af9a22c2 100644 --- a/lib/bindings/dbus/gatt/remote/index.js.map +++ b/lib/bindings/dbus/gatt/remote/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/bindings/dbus/gatt/remote/index.ts"],"names":[],"mappings":";;;AAAA,mDAAgE;AAAvD,8HAAA,4BAA4B,OAAA;AACrC,+BAAwC;AAA/B,sGAAA,cAAc,OAAA;AACvB,qCAAkD;AAAzC,gHAAA,qBAAqB,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/bindings/dbus/gatt/remote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/lib/bindings/dbus/index.js b/lib/bindings/dbus/index.js index c9afbe3a..afed289e 100644 --- a/lib/bindings/dbus/index.js +++ b/lib/bindings/dbus/index.js @@ -1,14 +1,5 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DbusGattServiceRemote = exports.DbusGattRemote = exports.DbusGattCharacteristicRemote = exports.DbusPeripheral = exports.DbusMODblue = exports.DbusAdapter = void 0; -var Adapter_1 = require("./Adapter"); -Object.defineProperty(exports, "DbusAdapter", { enumerable: true, get: function () { return Adapter_1.DbusAdapter; } }); -var MODblue_1 = require("./MODblue"); -Object.defineProperty(exports, "DbusMODblue", { enumerable: true, get: function () { return MODblue_1.DbusMODblue; } }); -var Peripheral_1 = require("./Peripheral"); -Object.defineProperty(exports, "DbusPeripheral", { enumerable: true, get: function () { return Peripheral_1.DbusPeripheral; } }); -var gatt_1 = require("./gatt"); -Object.defineProperty(exports, "DbusGattCharacteristicRemote", { enumerable: true, get: function () { return gatt_1.DbusGattCharacteristicRemote; } }); -Object.defineProperty(exports, "DbusGattRemote", { enumerable: true, get: function () { return gatt_1.DbusGattRemote; } }); -Object.defineProperty(exports, "DbusGattServiceRemote", { enumerable: true, get: function () { return gatt_1.DbusGattServiceRemote; } }); +export { DbusAdapter } from './Adapter'; +export { DbusMODblue } from './MODblue'; +export { DbusPeripheral } from './Peripheral'; +export { DbusGattCharacteristicRemote, DbusGattRemote, DbusGattServiceRemote } from './gatt'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/index.js.map b/lib/bindings/dbus/index.js.map index 96d135d6..c8128d60 100644 --- a/lib/bindings/dbus/index.js.map +++ b/lib/bindings/dbus/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bindings/dbus/index.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,+BAA6F;AAApF,oHAAA,4BAA4B,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,6GAAA,qBAAqB,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bindings/dbus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib/bindings/dbus/misc/DbusObject.js b/lib/bindings/dbus/misc/DbusObject.js index f3524816..f14fa7a9 100644 --- a/lib/bindings/dbus/misc/DbusObject.js +++ b/lib/bindings/dbus/misc/DbusObject.js @@ -1,3 +1,2 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //# sourceMappingURL=DbusObject.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/misc/Interfaces.js b/lib/bindings/dbus/misc/Interfaces.js index 910caec1..90f06e7a 100644 --- a/lib/bindings/dbus/misc/Interfaces.js +++ b/lib/bindings/dbus/misc/Interfaces.js @@ -1,10 +1,7 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.I_OBJECT_MANAGER = exports.I_PROPERTIES = exports.I_BLUEZ_CHARACTERISTIC = exports.I_BLUEZ_SERVICE = exports.I_BLUEZ_DEVICE = exports.I_BLUEZ_ADAPTER = void 0; -exports.I_BLUEZ_ADAPTER = 'org.bluez.Adapter1'; -exports.I_BLUEZ_DEVICE = 'org.bluez.Device1'; -exports.I_BLUEZ_SERVICE = 'org.bluez.GattService1'; -exports.I_BLUEZ_CHARACTERISTIC = 'org.bluez.GattCharacteristic1'; -exports.I_PROPERTIES = 'org.freedesktop.DBus.Properties'; -exports.I_OBJECT_MANAGER = 'org.freedesktop.DBus.ObjectManager'; +export const I_BLUEZ_ADAPTER = 'org.bluez.Adapter1'; +export const I_BLUEZ_DEVICE = 'org.bluez.Device1'; +export const I_BLUEZ_SERVICE = 'org.bluez.GattService1'; +export const I_BLUEZ_CHARACTERISTIC = 'org.bluez.GattCharacteristic1'; +export const I_PROPERTIES = 'org.freedesktop.DBus.Properties'; +export const I_OBJECT_MANAGER = 'org.freedesktop.DBus.ObjectManager'; //# sourceMappingURL=Interfaces.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/misc/Interfaces.js.map b/lib/bindings/dbus/misc/Interfaces.js.map index 48130bd3..c8e56b0f 100644 --- a/lib/bindings/dbus/misc/Interfaces.js.map +++ b/lib/bindings/dbus/misc/Interfaces.js.map @@ -1 +1 @@ -{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../../src/bindings/dbus/misc/Interfaces.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,oBAAoB,CAAC;AACvC,QAAA,cAAc,GAAG,mBAAmB,CAAC;AACrC,QAAA,eAAe,GAAG,wBAAwB,CAAC;AAC3C,QAAA,sBAAsB,GAAG,+BAA+B,CAAC;AAEzD,QAAA,YAAY,GAAG,iCAAiC,CAAC;AACjD,QAAA,gBAAgB,GAAG,oCAAoC,CAAC"} \ No newline at end of file +{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../../src/bindings/dbus/misc/Interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACxD,MAAM,CAAC,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;AAEtE,MAAM,CAAC,MAAM,YAAY,GAAG,iCAAiC,CAAC;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,oCAAoC,CAAC"} \ No newline at end of file diff --git a/lib/bindings/dbus/misc/TypeValue.js b/lib/bindings/dbus/misc/TypeValue.js index 5ed57a4c..5557c668 100644 --- a/lib/bindings/dbus/misc/TypeValue.js +++ b/lib/bindings/dbus/misc/TypeValue.js @@ -1,7 +1,4 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.buildTypedValue = void 0; -const dbus_next_1 = require("dbus-next"); +import { Variant } from 'dbus-next'; // https://dbus.freedesktop.org/doc/dbus-specification.html const MAPPINGS = { string: 's', @@ -12,12 +9,11 @@ const MAPPINGS = { array: 'a', variant: 'v' }; -function buildTypedValue(types, value) { +export function buildTypedValue(types, value) { const dbusTypes = Array.isArray(types) ? types.map((type) => MAPPINGS[type]) : [MAPPINGS[types]]; if (dbusTypes.some((type) => !type)) { throw new Error(`Unknown type ${types} for value ${value}`); } - return new dbus_next_1.Variant(dbusTypes.join(''), value); + return new Variant(dbusTypes.join(''), value); } -exports.buildTypedValue = buildTypedValue; //# sourceMappingURL=TypeValue.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/misc/TypeValue.js.map b/lib/bindings/dbus/misc/TypeValue.js.map index a3f9228f..547977d1 100644 --- a/lib/bindings/dbus/misc/TypeValue.js.map +++ b/lib/bindings/dbus/misc/TypeValue.js.map @@ -1 +1 @@ -{"version":3,"file":"TypeValue.js","sourceRoot":"","sources":["../../../../src/bindings/dbus/misc/TypeValue.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,2DAA2D;AAC3D,MAAM,QAAQ,GAAG;IAChB,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;CACZ,CAAC;AAEF,SAAgB,eAAe,CAAC,KAAwD,EAAE,KAAc;IACvG,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACjG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE;QACpC,MAAM,IAAI,KAAK,CAAC,gBAAgB,KAAK,cAAc,KAAK,EAAE,CAAC,CAAC;KAC5D;IAED,OAAO,IAAI,mBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAPD,0CAOC"} \ No newline at end of file +{"version":3,"file":"TypeValue.js","sourceRoot":"","sources":["../../../../src/bindings/dbus/misc/TypeValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,2DAA2D;AAC3D,MAAM,QAAQ,GAAG;IAChB,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;CACZ,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,KAAwD,EAAE,KAAc;IACvG,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACjG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE;QACpC,MAAM,IAAI,KAAK,CAAC,gBAAgB,KAAK,cAAc,KAAK,EAAE,CAAC,CAAC;KAC5D;IAED,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC"} \ No newline at end of file diff --git a/lib/bindings/dbus/misc/index.js b/lib/bindings/dbus/misc/index.js index bcbf17af..85458dd5 100644 --- a/lib/bindings/dbus/misc/index.js +++ b/lib/bindings/dbus/misc/index.js @@ -1,16 +1,4 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./Interfaces"), exports); -__exportStar(require("./TypeValue"), exports); -__exportStar(require("./DbusObject"), exports); +export * from './Interfaces'; +export * from './TypeValue'; +export * from './DbusObject'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/dbus/misc/index.js.map b/lib/bindings/dbus/misc/index.js.map index 84475fa3..93949e71 100644 --- a/lib/bindings/dbus/misc/index.js.map +++ b/lib/bindings/dbus/misc/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bindings/dbus/misc/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6B;AAC7B,8CAA4B;AAC5B,+CAA6B"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bindings/dbus/misc/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"} \ No newline at end of file diff --git a/lib/bindings/hci/Adapter.js b/lib/bindings/hci/Adapter.js index d432213b..2a7417f7 100644 --- a/lib/bindings/hci/Adapter.js +++ b/lib/bindings/hci/Adapter.js @@ -1,22 +1,10 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciAdapter = void 0; -const models_1 = require("../../models"); -const gatt_1 = require("./gatt"); -const misc_1 = require("./misc"); -const Peripheral_1 = require("./Peripheral"); +import { Adapter } from '../../models'; +import { HciGattLocal } from './gatt'; +import { Gap, Hci } from './misc'; +import { HciPeripheral } from './Peripheral'; const SCAN_ENABLE_TIMEOUT = 1000; const ADVERTISING_ENABLE_TIMEOUT = 1000; -class HciAdapter extends models_1.Adapter { +export class HciAdapter extends Adapter { constructor() { super(...arguments); this.initialized = false; @@ -47,7 +35,7 @@ class HciAdapter extends models_1.Adapter { const adv = advertisement; let peripheral = this.peripherals.get(uuid); if (!peripheral) { - peripheral = new Peripheral_1.HciPeripheral(this, uuid, addressType, address, adv, rssi); + peripheral = new HciPeripheral(this, uuid, addressType, address, adv, rssi); this.peripherals.set(uuid, peripheral); } else { @@ -97,7 +85,7 @@ class HciAdapter extends models_1.Adapter { } address = address.toLowerCase(); const uuid = address; - const peripheral = new Peripheral_1.HciPeripheral(this, uuid, addressType, address, null, 0); + const peripheral = new HciPeripheral(this, uuid, addressType, address, null, 0); peripheral.onConnect(true, this.hci, handle); this.connectedDevices.set(handle, peripheral); this.emit('connect', peripheral); @@ -123,27 +111,24 @@ class HciAdapter extends models_1.Adapter { } }; } - init() { - var _a; - return __awaiter(this, void 0, void 0, function* () { - if (this.initialized) { - return; - } - this.hci = new misc_1.Hci(Number(this.id)); - yield this.hci.init(); - // Don't listen for events until init is done - this.hci.on('error', this.onHciError); - this.hci.on('stateChange', this.onHciStateChange); - this.hci.on('leScanEnable', this.onLeScanEnable); - this.hci.on('leAdvertiseEnable', this.onLeAdvertiseEnable); - this.hci.on('leConnComplete', this.onLeConnComplete); - this.hci.on('disconnectComplete', this.onDisconnectComplete); - this.gap = new misc_1.Gap(this.hci); - this.gap.on('discover', this.onDiscover); - this._address = (_a = this.hci.address) === null || _a === void 0 ? void 0 : _a.toLowerCase(); - this._addressType = this.hci.addressType; - this.initialized = true; - }); + async init() { + if (this.initialized) { + return; + } + this.hci = new Hci(Number(this.id)); + await this.hci.init(); + // Don't listen for events until init is done + this.hci.on('error', this.onHciError); + this.hci.on('stateChange', this.onHciStateChange); + this.hci.on('leScanEnable', this.onLeScanEnable); + this.hci.on('leAdvertiseEnable', this.onLeAdvertiseEnable); + this.hci.on('leConnComplete', this.onLeConnComplete); + this.hci.on('disconnectComplete', this.onDisconnectComplete); + this.gap = new Gap(this.hci); + this.gap.on('discover', this.onDiscover); + this._address = this.hci.address?.toLowerCase(); + this._addressType = this.hci.addressType; + this.initialized = true; } dispose() { for (const device of this.connectedDevices.values()) { @@ -163,141 +148,120 @@ class HciAdapter extends models_1.Adapter { this._addressType = null; this.initialized = false; } - isScanning() { - return __awaiter(this, void 0, void 0, function* () { - return this.scanning; - }); + async isScanning() { + return this.scanning; } - startScanning() { - return __awaiter(this, void 0, void 0, function* () { - yield this.init(); - if (this.scanning) { - return; - } - this.peripherals.clear(); - yield this.gap.startScanning(true); - this.scanning = true; - }); + async startScanning() { + await this.init(); + if (this.scanning) { + return; + } + this.peripherals.clear(); + await this.gap.startScanning(true); + this.scanning = true; } - stopScanning() { - return __awaiter(this, void 0, void 0, function* () { - if (this.scanEnableTimer) { - clearTimeout(this.scanEnableTimer); - this.scanEnableTimer = null; - } - if (!this.scanning) { - return; - } - this.scanning = false; - yield this.gap.stopScanning(); - }); + async stopScanning() { + if (this.scanEnableTimer) { + clearTimeout(this.scanEnableTimer); + this.scanEnableTimer = null; + } + if (!this.scanning) { + return; + } + this.scanning = false; + await this.gap.stopScanning(); } - getScannedPeripherals() { - return __awaiter(this, void 0, void 0, function* () { - return [...this.peripherals.values()]; - }); + async getScannedPeripherals() { + return [...this.peripherals.values()]; } - connect(peripheral, minInterval, maxInterval, latency, supervisionTimeout) { - return __awaiter(this, void 0, void 0, function* () { - // For BLE <= 4.2: - // - Disable advertising while we're connected. - // - Don't connect if we have a connection in master mode - let advertisingWasDisabled = false; - if (this.hci.hciVersion < 8) { - if ([...this.connectedDevices.values()].some((d) => d.isMaster)) { - throw new Error(`Connecting in master & slave role concurrently is only supported in BLE 5+`); + async connect(peripheral, minInterval, maxInterval, latency, supervisionTimeout) { + // For BLE <= 4.2: + // - Disable advertising while we're connected. + // - Don't connect if we have a connection in master mode + let advertisingWasDisabled = false; + if (this.hci.hciVersion < 8) { + if ([...this.connectedDevices.values()].some((d) => d.isMaster)) { + throw new Error(`Connecting in master & slave role concurrently is only supported in BLE 5+`); + } + if (this.advertising) { + try { + await this.stopAdvertising(); + this.wasAdvertising = true; + advertisingWasDisabled = true; } - if (this.advertising) { - try { - yield this.stopAdvertising(); - this.wasAdvertising = true; - advertisingWasDisabled = true; - } - catch (err) { - this.emit('error', new Error(`Could not disable advertising before connecting: ${err}`)); - } + catch (err) { + this.emit('error', new Error(`Could not disable advertising before connecting: ${err}`)); } } - try { - const handle = yield this.hci.createLeConn(peripheral.address, peripheral.addressType, minInterval, maxInterval, latency, supervisionTimeout); - this.uuidToHandle.set(peripheral.uuid, handle); - this.handleToUUID.set(handle, peripheral.uuid); - peripheral.onConnect(false, this.hci, handle); - this.connectedDevices.set(handle, peripheral); - } - catch (err) { - // Dispose anything in case we got a partial setup/connection done - peripheral.onDisconnect(); - // Re-enable advertising since we didn't establish a connection - if (advertisingWasDisabled) { - yield this.startAdvertising(this.deviceName, this.advertisedServiceUUIDs); - this.wasAdvertising = false; - } - // Rethrow - throw err; + } + try { + const handle = await this.hci.createLeConn(peripheral.address, peripheral.addressType, minInterval, maxInterval, latency, supervisionTimeout); + this.uuidToHandle.set(peripheral.uuid, handle); + this.handleToUUID.set(handle, peripheral.uuid); + peripheral.onConnect(false, this.hci, handle); + this.connectedDevices.set(handle, peripheral); + } + catch (err) { + // Dispose anything in case we got a partial setup/connection done + peripheral.onDisconnect(); + // Re-enable advertising since we didn't establish a connection + if (advertisingWasDisabled) { + await this.startAdvertising(this.deviceName, this.advertisedServiceUUIDs); + this.wasAdvertising = false; } - }); + // Rethrow + throw err; + } } - disconnect(peripheral) { - return __awaiter(this, void 0, void 0, function* () { - const handle = this.uuidToHandle.get(peripheral.uuid); - try { - yield this.hci.disconnect(handle); - } - catch (_a) { - // NO-OP - } - finally { - peripheral.onDisconnect(); - } - }); + async disconnect(peripheral) { + const handle = this.uuidToHandle.get(peripheral.uuid); + try { + await this.hci.disconnect(handle); + } + catch { + // NO-OP + } + finally { + peripheral.onDisconnect(); + } } - isAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - return this.advertising; - }); + async isAdvertising() { + return this.advertising; } - startAdvertising(deviceName, serviceUUIDs = []) { - return __awaiter(this, void 0, void 0, function* () { - yield this.init(); - if (this.advertising) { - return; - } - this.deviceName = deviceName; - this.advertisedServiceUUIDs = serviceUUIDs; - if (this.gatt) { - this.gatt.setData(this.deviceName, this.gatt.serviceInputs); - } - yield this.gap.startAdvertising(this.deviceName, serviceUUIDs); - this.advertising = true; - }); + async startAdvertising(deviceName, serviceUUIDs = []) { + await this.init(); + if (this.advertising) { + return; + } + this.deviceName = deviceName; + this.advertisedServiceUUIDs = serviceUUIDs; + if (this.gatt) { + this.gatt.setData(this.deviceName, this.gatt.serviceInputs); + } + await this.gap.startAdvertising(this.deviceName, serviceUUIDs); + this.advertising = true; } - stopAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - if (this.advertisingEnableTimer) { - clearTimeout(this.advertisingEnableTimer); - this.advertisingEnableTimer = null; - } - if (!this.advertising) { - return; - } - try { - yield this.gap.stopAdvertising(); - } - catch (_a) { - // NO-OP: Errors here probably mean we already stopped advertising - } - this.advertising = false; - }); + async stopAdvertising() { + if (this.advertisingEnableTimer) { + clearTimeout(this.advertisingEnableTimer); + this.advertisingEnableTimer = null; + } + if (!this.advertising) { + return; + } + try { + await this.gap.stopAdvertising(); + } + catch { + // NO-OP: Errors here probably mean we already stopped advertising + } + this.advertising = false; } - setupGatt(maxMtu) { - return __awaiter(this, void 0, void 0, function* () { - yield this.init(); - this.gatt = new gatt_1.HciGattLocal(this, this.hci, maxMtu); - this.gatt.setData(this.deviceName, []); - return this.gatt; - }); + async setupGatt(maxMtu) { + await this.init(); + this.gatt = new HciGattLocal(this, this.hci, maxMtu); + this.gatt.setData(this.deviceName, []); + return this.gatt; } } -exports.HciAdapter = HciAdapter; //# sourceMappingURL=Adapter.js.map \ No newline at end of file diff --git a/lib/bindings/hci/Adapter.js.map b/lib/bindings/hci/Adapter.js.map index ea13cb57..585da297 100644 --- a/lib/bindings/hci/Adapter.js.map +++ b/lib/bindings/hci/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../../src/bindings/hci/Adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA2E;AAE3E,iCAAsC;AACtC,iCAAiD;AACjD,6CAA6C;AAE7C,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAExC,MAAa,UAAW,SAAQ,gBAAO;IAAvC;;QACS,gBAAW,GAAG,KAAK,CAAC;QAEpB,aAAQ,GAAG,KAAK,CAAC;QAGjB,gBAAW,GAAG,KAAK,CAAC;QAEpB,mBAAc,GAAG,KAAK,CAAC;QAKvB,eAAU,GAAW,IAAI,CAAC,EAAE,CAAC;QAC7B,2BAAsB,GAAa,EAAE,CAAC;QACtC,gBAAW,GAA+B,IAAI,GAAG,EAAE,CAAC;QACpD,qBAAgB,GAA+B,IAAI,GAAG,EAAE,CAAC;QACzD,iBAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;QAC9C,iBAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;QA4B9C,qBAAgB,GAAG,CAAC,QAAgB,EAAE,EAAE;YAC/C,oDAAoD;YACpD,IAAI,QAAQ,KAAK,YAAY,EAAE;gBAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;aACf;QACF,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,KAAY,EAAE,EAAE;YACrC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC1B,IAAI,IAAI,CAAC,WAAW,EAAE;gBACrB,IAAI,CAAC,GAAG,CAAC,KAAK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,KAAK,CAAC,eAAe;QAC3B,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAChC,YAAY,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAC1C,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;SACnC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACtB,OAAO;SACP;QAED,IAAI;YACH,MAAM,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;SACjC;QAAC,MAAM;YACP,kEAAkE;SAClE;QAED,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,MAAe;QACrC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAElB,IAAI,CAAC,IAAI,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;CAqFD"} \ No newline at end of file diff --git a/lib/bindings/hci/MODblue.js b/lib/bindings/hci/MODblue.js index e0a38cec..7b57cc66 100644 --- a/lib/bindings/hci/MODblue.js +++ b/lib/bindings/hci/MODblue.js @@ -1,47 +1,30 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciMODblue = void 0; -const models_1 = require("../../models"); -const Adapter_1 = require("./Adapter"); -const misc_1 = require("./misc"); +import { MODblue } from '../../models'; +import { HciAdapter } from './Adapter'; +import { Hci } from './misc'; /** * Use the HCI socket bindings to access BLE functions. */ -class HciMODblue extends models_1.MODblue { +export class HciMODblue extends MODblue { constructor() { super(...arguments); this.adapters = new Map(); } - dispose() { - return __awaiter(this, void 0, void 0, function* () { - for (const adapter of this.adapters.values()) { - adapter.dispose(); - } - this.adapters = new Map(); - }); + async dispose() { + for (const adapter of this.adapters.values()) { + adapter.dispose(); + } + this.adapters = new Map(); } - getAdapters() { - return __awaiter(this, void 0, void 0, function* () { - const adapters = misc_1.Hci.getDeviceList(); - for (const rawAdapter of adapters) { - let adapter = this.adapters.get(rawAdapter.devId); - if (!adapter) { - adapter = new Adapter_1.HciAdapter(this, `hci${rawAdapter.devId}`); - this.adapters.set(rawAdapter.devId, adapter); - } + async getAdapters() { + const adapters = Hci.getDeviceList(); + for (const rawAdapter of adapters) { + let adapter = this.adapters.get(rawAdapter.devId); + if (!adapter) { + adapter = new HciAdapter(this, `hci${rawAdapter.devId}`); + this.adapters.set(rawAdapter.devId, adapter); } - return [...this.adapters.values()]; - }); + } + return [...this.adapters.values()]; } } -exports.HciMODblue = HciMODblue; //# sourceMappingURL=MODblue.js.map \ No newline at end of file diff --git a/lib/bindings/hci/MODblue.js.map b/lib/bindings/hci/MODblue.js.map index 51c390df..2ac3c189 100644 --- a/lib/bindings/hci/MODblue.js.map +++ b/lib/bindings/hci/MODblue.js.map @@ -1 +1 @@ -{"version":3,"file":"MODblue.js","sourceRoot":"","sources":["../../../src/bindings/hci/MODblue.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAgD;AAEhD,uCAAuC;AACvC,iCAA6B;AAE7B;;GAEG;AACH,MAAa,UAAW,SAAQ,gBAAO;IAAvC;;QACS,aAAQ,GAA4B,IAAI,GAAG,EAAE,CAAC;IAoBvD,CAAC;IAlBa,OAAO;;YACnB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QA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AC3B,CAAC;IAEM,KAAK,CAAC,WAAW;QACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC;QACrC,KAAK,MAAM,UAAU,IAAI,QAAQ,EAAE;YAClC,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAClD,IAAI,CAAC,OAAO,EAAE;gBACb,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;gBACzD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;aAC7C;SACD;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACpC,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/Peripheral.js b/lib/bindings/hci/Peripheral.js index 99e1db15..27dc5c38 100644 --- a/lib/bindings/hci/Peripheral.js +++ b/lib/bindings/hci/Peripheral.js @@ -1,50 +1,34 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciPeripheral = void 0; -const models_1 = require("../../models"); -const gatt_1 = require("./gatt"); -const misc_1 = require("./misc"); +import { Peripheral } from '../../models'; +import { HciGattRemote } from './gatt'; +import { Signaling } from './misc'; // 512 bytes is max char size + 1 byte att opcode + 2 bytes handle + 2 bytes offset for long writes const DEFAULT_MTU = 517; -class HciPeripheral extends models_1.Peripheral { +export class HciPeripheral extends Peripheral { get isMaster() { return this._isMaster; } - connect(minInterval, maxInterval, latency, supervisionTimeout) { - return __awaiter(this, void 0, void 0, function* () { - if (this._state === 'connected') { - return; - } - this._state = 'connecting'; - yield this.adapter.connect(this, minInterval, maxInterval, latency, supervisionTimeout); - }); + async connect(minInterval, maxInterval, latency, supervisionTimeout) { + if (this._state === 'connected') { + return; + } + this._state = 'connecting'; + await this.adapter.connect(this, minInterval, maxInterval, latency, supervisionTimeout); } onConnect(isMaster, hci, handle) { this.hci = hci; this.handle = handle; this._isMaster = isMaster; - this.signaling = new misc_1.Signaling(this.hci, this.handle); - this.gatt = new gatt_1.HciGattRemote(this, hci, handle); + this.signaling = new Signaling(this.hci, this.handle); + this.gatt = new HciGattRemote(this, hci, handle); this.mtuExchanged = false; this._state = 'connected'; } - disconnect() { - return __awaiter(this, void 0, void 0, function* () { - if (this._state === 'disconnected') { - return; - } - this._state = 'disconnecting'; - yield this.adapter.disconnect(this); - }); + async disconnect() { + if (this._state === 'disconnected') { + return; + } + this._state = 'disconnecting'; + await this.adapter.disconnect(this); } onDisconnect(reason) { if (this.gatt) { @@ -60,18 +44,15 @@ class HciPeripheral extends models_1.Peripheral { this.mtuExchanged = false; this._state = 'disconnected'; } - setupGatt(requestMtu = DEFAULT_MTU) { - return __awaiter(this, void 0, void 0, function* () { - if (this.state !== 'connected' || !this.handle) { - throw new Error(`Peripheral is not connected`); - } - if (!this.mtuExchanged) { - yield this.gatt.exchangeMtu(requestMtu); - this.mtuExchanged = true; - } - return this.gatt; - }); + async setupGatt(requestMtu = DEFAULT_MTU) { + if (this.state !== 'connected' || !this.handle) { + throw new Error(`Peripheral is not connected`); + } + if (!this.mtuExchanged) { + await this.gatt.exchangeMtu(requestMtu); + this.mtuExchanged = true; + } + return this.gatt; } } -exports.HciPeripheral = HciPeripheral; //# sourceMappingURL=Peripheral.js.map \ No newline at end of file diff --git a/lib/bindings/hci/Peripheral.js.map b/lib/bindings/hci/Peripheral.js.map index db474cf2..0366876a 100644 --- a/lib/bindings/hci/Peripheral.js.map +++ b/lib/bindings/hci/Peripheral.js.map @@ -1 +1 @@ -{"version":3,"file":"Peripheral.js","sourceRoot":"","sources":["../../../src/bindings/hci/Peripheral.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAsD;AAGtD,iCAAuC;AACvC,iCAAwC;AAExC,mGAAmG;AACnG,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAa,aAAc,SAAQ,mBAAU;IAU5C,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAEY,OAAO,CACnB,WAAoB,EACpB,WAAoB,EACpB,OAAgB,EAChB,kBAA2B;;YAE3B,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,EAAE;gBAChC,OAAO;aACP;YAED,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC;YAC3B,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACzF,CAAC;KAAA;IACM,SAAS,CAAC,QAAiB,EAAE,GAAQ,EAAE,MAAc;QAC3D,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,IAAI,oBAAa,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QAEjD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC3B,CAAC;IAEY,UAAU;;YACtB,IAAI,IAAI,CAAC,MAAM,KAAK,cAAc,EAAE;gBACnC,OAAO;aACP;YAED,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;YAC9B,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;KAAA;IACM,YAAY,CAAC,MAAe;QAClC,IAAI,IAAI,CAAC,IAAI,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SACjB;QAED,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACtB;QAED,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC;IAC9B,CAAC;IAEY,SAAS,CAAC,aAAqB,WAAW;;YACtD,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC/C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;aAC/C;YAED,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;gBACvB,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;gBACxC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;aACzB;YAED,OAAO,IAAI,CAAC,IAAI,CAAC;QAClB,CAAC;KAAA;CACD;AA9ED,sCA8EC"} \ No newline at end of file +{"version":3,"file":"Peripheral.js","sourceRoot":"","sources":["../../../src/bindings/hci/Peripheral.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC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,IAAI,CAAC,IAAI,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SACjB;QAED,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACtB;QAED,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,aAAqB,WAAW;QACtD,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAC/C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAC/C;QAED,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACvB,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YACxC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SACzB;QAED,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/Constants.js b/lib/bindings/hci/gatt/Constants.js index 0320b3e3..3f146000 100644 --- a/lib/bindings/hci/gatt/Constants.js +++ b/lib/bindings/hci/gatt/Constants.js @@ -1,58 +1,54 @@ -"use strict"; // tslint:disable: no-bitwise -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GATT_CLIENT_CHARAC_CFG_UUID = exports.GATT_CHARAC_UUID = exports.GATT_INCLUDE_UUID = exports.GATT_PRIM_SVC_UUID = exports.ATT_ECODE_INSUFF_RESOURCES = exports.ATT_ECODE_UNSUPP_GRP_TYPE = exports.ATT_ECODE_INSUFF_ENC = exports.ATT_ECODE_UNLIKELY = exports.ATT_ECODE_INVAL_ATTR_VALUE_LEN = exports.ATT_ECODE_INSUFF_ENCR_KEY_SIZE = exports.ATT_ECODE_ATTR_NOT_LONG = exports.ATT_ECODE_ATTR_NOT_FOUND = exports.ATT_ECODE_PREP_QUEUE_FULL = exports.ATT_ECODE_AUTHORIZATION = exports.ATT_ECODE_INVALID_OFFSET = exports.ATT_ECODE_REQ_NOT_SUPP = exports.ATT_ECODE_AUTHENTICATION = exports.ATT_ECODE_INVALID_PDU = exports.ATT_ECODE_WRITE_NOT_PERM = exports.ATT_ECODE_READ_NOT_PERM = exports.ATT_ECODE_INVALID_HANDLE = exports.ATT_ECODE_SUCCESS = exports.ATT_OP_SIGNED_WRITE_CMD = exports.ATT_OP_WRITE_CMD = exports.ATT_OP_HANDLE_CNF = exports.ATT_OP_HANDLE_IND = exports.ATT_OP_HANDLE_NOTIFY = exports.ATT_OP_EXECUTE_WRITE_RESP = exports.ATT_OP_EXECUTE_WRITE_REQ = exports.ATT_OP_PREPARE_WRITE_RESP = exports.ATT_OP_PREPARE_WRITE_REQ = exports.ATT_OP_WRITE_RESP = exports.ATT_OP_WRITE_REQ = exports.ATT_OP_READ_BY_GROUP_RESP = exports.ATT_OP_READ_BY_GROUP_REQ = exports.ATT_OP_READ_MULTI_RESP = exports.ATT_OP_READ_MULTI_REQ = exports.ATT_OP_READ_BLOB_RESP = exports.ATT_OP_READ_BLOB_REQ = exports.ATT_OP_READ_RESP = exports.ATT_OP_READ_REQ = exports.ATT_OP_READ_BY_TYPE_RESP = exports.ATT_OP_READ_BY_TYPE_REQ = exports.ATT_OP_FIND_BY_TYPE_RESP = exports.ATT_OP_FIND_BY_TYPE_REQ = exports.ATT_OP_FIND_INFO_RESP = exports.ATT_OP_FIND_INFO_REQ = exports.ATT_OP_MTU_RESP = exports.ATT_OP_MTU_REQ = exports.ATT_OP_ERROR = void 0; -exports.ATT_CID = exports.GATT_SERVER_CHARAC_CFG_UUID = void 0; -exports.ATT_OP_ERROR = 0x01; -exports.ATT_OP_MTU_REQ = 0x02; -exports.ATT_OP_MTU_RESP = 0x03; -exports.ATT_OP_FIND_INFO_REQ = 0x04; -exports.ATT_OP_FIND_INFO_RESP = 0x05; -exports.ATT_OP_FIND_BY_TYPE_REQ = 0x06; -exports.ATT_OP_FIND_BY_TYPE_RESP = 0x07; -exports.ATT_OP_READ_BY_TYPE_REQ = 0x08; -exports.ATT_OP_READ_BY_TYPE_RESP = 0x09; -exports.ATT_OP_READ_REQ = 0x0a; -exports.ATT_OP_READ_RESP = 0x0b; -exports.ATT_OP_READ_BLOB_REQ = 0x0c; -exports.ATT_OP_READ_BLOB_RESP = 0x0d; -exports.ATT_OP_READ_MULTI_REQ = 0x0e; -exports.ATT_OP_READ_MULTI_RESP = 0x0f; -exports.ATT_OP_READ_BY_GROUP_REQ = 0x10; -exports.ATT_OP_READ_BY_GROUP_RESP = 0x11; -exports.ATT_OP_WRITE_REQ = 0x12; -exports.ATT_OP_WRITE_RESP = 0x13; -exports.ATT_OP_PREPARE_WRITE_REQ = 0x16; -exports.ATT_OP_PREPARE_WRITE_RESP = 0x17; -exports.ATT_OP_EXECUTE_WRITE_REQ = 0x18; -exports.ATT_OP_EXECUTE_WRITE_RESP = 0x19; -exports.ATT_OP_HANDLE_NOTIFY = 0x1b; -exports.ATT_OP_HANDLE_IND = 0x1d; -exports.ATT_OP_HANDLE_CNF = 0x1e; -exports.ATT_OP_WRITE_CMD = 0x52; -exports.ATT_OP_SIGNED_WRITE_CMD = 0xd2; -exports.ATT_ECODE_SUCCESS = 0x00; -exports.ATT_ECODE_INVALID_HANDLE = 0x01; -exports.ATT_ECODE_READ_NOT_PERM = 0x02; -exports.ATT_ECODE_WRITE_NOT_PERM = 0x03; -exports.ATT_ECODE_INVALID_PDU = 0x04; -exports.ATT_ECODE_AUTHENTICATION = 0x05; -exports.ATT_ECODE_REQ_NOT_SUPP = 0x06; -exports.ATT_ECODE_INVALID_OFFSET = 0x07; -exports.ATT_ECODE_AUTHORIZATION = 0x08; -exports.ATT_ECODE_PREP_QUEUE_FULL = 0x09; -exports.ATT_ECODE_ATTR_NOT_FOUND = 0x0a; -exports.ATT_ECODE_ATTR_NOT_LONG = 0x0b; -exports.ATT_ECODE_INSUFF_ENCR_KEY_SIZE = 0x0c; -exports.ATT_ECODE_INVAL_ATTR_VALUE_LEN = 0x0d; -exports.ATT_ECODE_UNLIKELY = 0x0e; -exports.ATT_ECODE_INSUFF_ENC = 0x0f; -exports.ATT_ECODE_UNSUPP_GRP_TYPE = 0x10; -exports.ATT_ECODE_INSUFF_RESOURCES = 0x11; -exports.GATT_PRIM_SVC_UUID = 0x2800; -exports.GATT_INCLUDE_UUID = 0x2802; -exports.GATT_CHARAC_UUID = 0x2803; -exports.GATT_CLIENT_CHARAC_CFG_UUID = 0x2902; -exports.GATT_SERVER_CHARAC_CFG_UUID = 0x2903; -exports.ATT_CID = 0x0004; +export const ATT_OP_ERROR = 0x01; +export const ATT_OP_MTU_REQ = 0x02; +export const ATT_OP_MTU_RESP = 0x03; +export const ATT_OP_FIND_INFO_REQ = 0x04; +export const ATT_OP_FIND_INFO_RESP = 0x05; +export const ATT_OP_FIND_BY_TYPE_REQ = 0x06; +export const ATT_OP_FIND_BY_TYPE_RESP = 0x07; +export const ATT_OP_READ_BY_TYPE_REQ = 0x08; +export const ATT_OP_READ_BY_TYPE_RESP = 0x09; +export const ATT_OP_READ_REQ = 0x0a; +export const ATT_OP_READ_RESP = 0x0b; +export const ATT_OP_READ_BLOB_REQ = 0x0c; +export const ATT_OP_READ_BLOB_RESP = 0x0d; +export const ATT_OP_READ_MULTI_REQ = 0x0e; +export const ATT_OP_READ_MULTI_RESP = 0x0f; +export const ATT_OP_READ_BY_GROUP_REQ = 0x10; +export const ATT_OP_READ_BY_GROUP_RESP = 0x11; +export const ATT_OP_WRITE_REQ = 0x12; +export const ATT_OP_WRITE_RESP = 0x13; +export const ATT_OP_PREPARE_WRITE_REQ = 0x16; +export const ATT_OP_PREPARE_WRITE_RESP = 0x17; +export const ATT_OP_EXECUTE_WRITE_REQ = 0x18; +export const ATT_OP_EXECUTE_WRITE_RESP = 0x19; +export const ATT_OP_HANDLE_NOTIFY = 0x1b; +export const ATT_OP_HANDLE_IND = 0x1d; +export const ATT_OP_HANDLE_CNF = 0x1e; +export const ATT_OP_WRITE_CMD = 0x52; +export const ATT_OP_SIGNED_WRITE_CMD = 0xd2; +export const ATT_ECODE_SUCCESS = 0x00; +export const ATT_ECODE_INVALID_HANDLE = 0x01; +export const ATT_ECODE_READ_NOT_PERM = 0x02; +export const ATT_ECODE_WRITE_NOT_PERM = 0x03; +export const ATT_ECODE_INVALID_PDU = 0x04; +export const ATT_ECODE_AUTHENTICATION = 0x05; +export const ATT_ECODE_REQ_NOT_SUPP = 0x06; +export const ATT_ECODE_INVALID_OFFSET = 0x07; +export const ATT_ECODE_AUTHORIZATION = 0x08; +export const ATT_ECODE_PREP_QUEUE_FULL = 0x09; +export const ATT_ECODE_ATTR_NOT_FOUND = 0x0a; +export const ATT_ECODE_ATTR_NOT_LONG = 0x0b; +export const ATT_ECODE_INSUFF_ENCR_KEY_SIZE = 0x0c; +export const ATT_ECODE_INVAL_ATTR_VALUE_LEN = 0x0d; +export const ATT_ECODE_UNLIKELY = 0x0e; +export const ATT_ECODE_INSUFF_ENC = 0x0f; +export const ATT_ECODE_UNSUPP_GRP_TYPE = 0x10; +export const ATT_ECODE_INSUFF_RESOURCES = 0x11; +export const GATT_PRIM_SVC_UUID = 0x2800; +export const GATT_INCLUDE_UUID = 0x2802; +export const GATT_CHARAC_UUID = 0x2803; +export const GATT_CLIENT_CHARAC_CFG_UUID = 0x2902; +export const GATT_SERVER_CHARAC_CFG_UUID = 0x2903; +export const ATT_CID = 0x0004; //# sourceMappingURL=Constants.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/Constants.js.map b/lib/bindings/hci/gatt/Constants.js.map index 3bcfa370..b987ad9b 100644 --- a/lib/bindings/hci/gatt/Constants.js.map +++ b/lib/bindings/hci/gatt/Constants.js.map @@ -1 +1 @@ -{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../../src/bindings/hci/gatt/Constants.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;;AAEhB,QAAA,YAAY,GAAG,IAAI,CAAC;AACpB,QAAA,cAAc,GAAG,IAAI,CAAC;AACtB,QAAA,eAAe,GAAG,IAAI,CAAC;AACvB,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAC5B,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAC7B,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAC/B,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAC/B,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,eAAe,GAAG,IAAI,CAAC;AACvB,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAC5B,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAC7B,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAC7B,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAC9B,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,yBAAyB,GAAG,IAAI,CAAC;AACjC,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,iBAAiB,GAAG,IAAI,CAAC;AACzB,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,yBAAyB,GAAG,IAAI,CAAC;AACjC,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,yBAAyB,GAAG,IAAI,CAAC;AACjC,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAC5B,QAAA,iBAAiB,GAAG,IAAI,CAAC;AACzB,QAAA,iBAAiB,GAAG,IAAI,CAAC;AACzB,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAE/B,QAAA,iBAAiB,GAAG,IAAI,CAAC;AACzB,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAC/B,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAC7B,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAC9B,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAC/B,QAAA,yBAAyB,GAAG,IAAI,CAAC;AACjC,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAC/B,QAAA,8BAA8B,GAAG,IAAI,CAAC;AACtC,QAAA,8BAA8B,GAAG,IAAI,CAAC;AACtC,QAAA,kBAAkB,GAAG,IAAI,CAAC;AAC1B,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAC5B,QAAA,yBAAyB,GAAG,IAAI,CAAC;AACjC,QAAA,0BAA0B,GAAG,IAAI,CAAC;AAElC,QAAA,kBAAkB,GAAG,MAAM,CAAC;AAC5B,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAC3B,QAAA,gBAAgB,GAAG,MAAM,CAAC;AAE1B,QAAA,2BAA2B,GAAG,MAAM,CAAC;AACrC,QAAA,2BAA2B,GAAG,MAAM,CAAC;AAErC,QAAA,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file +{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../../src/bindings/hci/gatt/Constants.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AACpC,MAAM,CAAC,MAAM,oBAAoB,GA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,CAAC"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/index.js b/lib/bindings/hci/gatt/index.js index 4f6831f3..8a4e02b4 100644 --- a/lib/bindings/hci/gatt/index.js +++ b/lib/bindings/hci/gatt/index.js @@ -1,22 +1,4 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattServiceRemote = exports.HciGattRemote = exports.HciGattDescriptorRemote = exports.HciGattCharacteristicRemote = exports.HciGattLocal = void 0; -__exportStar(require("./Constants"), exports); -var local_1 = require("./local"); -Object.defineProperty(exports, "HciGattLocal", { enumerable: true, get: function () { return local_1.HciGattLocal; } }); -var remote_1 = require("./remote"); -Object.defineProperty(exports, "HciGattCharacteristicRemote", { enumerable: true, get: function () { return remote_1.HciGattCharacteristicRemote; } }); -Object.defineProperty(exports, "HciGattDescriptorRemote", { enumerable: true, get: function () { return remote_1.HciGattDescriptorRemote; } }); -Object.defineProperty(exports, "HciGattRemote", { enumerable: true, get: function () { return remote_1.HciGattRemote; } }); -Object.defineProperty(exports, "HciGattServiceRemote", { enumerable: true, get: function () { return remote_1.HciGattServiceRemote; } }); +export * from './Constants'; +export { HciGattLocal } from './local'; +export { HciGattCharacteristicRemote, HciGattDescriptorRemote, HciGattRemote, HciGattServiceRemote } from './remote'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/index.js.map b/lib/bindings/hci/gatt/index.js.map index fbb4cf80..8e36b405 100644 --- a/lib/bindings/hci/gatt/index.js.map +++ b/lib/bindings/hci/gatt/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bindings/hci/gatt/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8CAA4B;AAE5B,iCAAuC;AAA9B,qGAAA,YAAY,OAAA;AACrB,mCAAqH;AAA5G,qHAAA,2BAA2B,OAAA;AAAE,iHAAA,uBAAuB,OAAA;AAAE,uGAAA,aAAa,OAAA;AAAE,8GAAA,oBAAoB,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bindings/hci/gatt/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/local/Gatt.js b/lib/bindings/hci/gatt/local/Gatt.js index c7f33fa4..2c8bce5b 100644 --- a/lib/bindings/hci/gatt/local/Gatt.js +++ b/lib/bindings/hci/gatt/local/Gatt.js @@ -1,46 +1,15 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattLocal = void 0; -const models_1 = require("../../../../models"); -const CONST = __importStar(require("../Constants")); +import { GattCharacteristicLocal, GattLocal } from '../../../../models'; +import * as CONST from '../Constants'; // 512 bytes is max char size + 1 byte att opcode + 2 bytes handle + 2 bytes offset for long writes const DEFAULT_MAX_MTU = 517; -class HciGattLocal extends models_1.GattLocal { +export class HciGattLocal extends GattLocal { constructor(adapter, hci, maxMtu = DEFAULT_MAX_MTU) { super(adapter, maxMtu); this.onHciDisconnect = (status, handleId) => { // Reset MTU after a device disconnects this.negotiatedMtus.delete(handleId); }; - this.onAclStreamData = (handle, cid, data) => __awaiter(this, void 0, void 0, function* () { + this.onAclStreamData = async (handle, cid, data) => { if (cid !== CONST.ATT_CID) { return; } @@ -49,36 +18,36 @@ class HciGattLocal extends models_1.GattLocal { try { switch (requestType) { case CONST.ATT_OP_MTU_REQ: - response = yield this.handleMtuRequest(handle, cid, data); + response = await this.handleMtuRequest(handle, cid, data); break; case CONST.ATT_OP_FIND_INFO_REQ: - response = yield this.handleFindInfoRequest(handle, cid, data); + response = await this.handleFindInfoRequest(handle, cid, data); break; case CONST.ATT_OP_FIND_BY_TYPE_REQ: - response = yield this.handleFindByTypeRequest(handle, cid, data); + response = await this.handleFindByTypeRequest(handle, cid, data); break; case CONST.ATT_OP_READ_BY_TYPE_REQ: - response = yield this.handleReadByTypeRequest(handle, cid, data); + response = await this.handleReadByTypeRequest(handle, cid, data); break; case CONST.ATT_OP_READ_REQ: case CONST.ATT_OP_READ_BLOB_REQ: - response = yield this.handleReadOrReadBlobRequest(handle, cid, data); + response = await this.handleReadOrReadBlobRequest(handle, cid, data); break; case CONST.ATT_OP_READ_BY_GROUP_REQ: - response = yield this.handleReadByGroupRequest(handle, cid, data); + response = await this.handleReadByGroupRequest(handle, cid, data); break; case CONST.ATT_OP_WRITE_REQ: case CONST.ATT_OP_WRITE_CMD: - response = yield this.handleWriteRequestOrCommand(handle, cid, data); + response = await this.handleWriteRequestOrCommand(handle, cid, data); break; case CONST.ATT_OP_PREPARE_WRITE_REQ: - response = yield this.handlePrepareWriteRequest(handle, cid, data); + response = await this.handlePrepareWriteRequest(handle, cid, data); break; case CONST.ATT_OP_EXECUTE_WRITE_REQ: - response = yield this.handleExecuteWriteRequest(handle, cid, data); + response = await this.handleExecuteWriteRequest(handle, cid, data); break; case CONST.ATT_OP_HANDLE_CNF: - response = yield this.handleConfirmation(handle, cid, data); + response = await this.handleConfirmation(handle, cid, data); break; default: case CONST.ATT_OP_READ_MULTI_REQ: @@ -95,7 +64,7 @@ class HciGattLocal extends models_1.GattLocal { if (response) { this.hci.writeAclDataPkt(handle, cid, response); } - }); + }; this.hci = hci; this.hci.on('aclDataPkt', this.onAclStreamData); this.hci.on('disconnectComplete', this.onHciDisconnect); @@ -112,571 +81,550 @@ class HciGattLocal extends models_1.GattLocal { getMtu(handle) { return this.negotiatedMtus.get(handle) || 23; } - handleMtuRequest(_handle, _cid, request) { - return __awaiter(this, void 0, void 0, function* () { - let mtu = request.readUInt16LE(1); - mtu = Math.max(23, Math.min(mtu, this.maxMtu)); - this.negotiatedMtus.set(_handle, mtu); - const response = Buffer.alloc(3); - response.writeUInt8(CONST.ATT_OP_MTU_RESP, 0); - response.writeUInt16LE(mtu, 1); - return response; - }); + async handleMtuRequest(_handle, _cid, request) { + let mtu = request.readUInt16LE(1); + mtu = Math.max(23, Math.min(mtu, this.maxMtu)); + this.negotiatedMtus.set(_handle, mtu); + const response = Buffer.alloc(3); + response.writeUInt8(CONST.ATT_OP_MTU_RESP, 0); + response.writeUInt16LE(mtu, 1); + return response; } - handleFindInfoRequest(_handle, _cid, request) { - return __awaiter(this, void 0, void 0, function* () { - let response = null; - const startHandle = Math.max(request.readUInt16LE(1), 1); - const endHandle = Math.min(request.readUInt16LE(3), this.handles.length - 1); - const infos = []; - for (let i = startHandle; i <= endHandle; i++) { - const handle = this.handles[i]; - let uuid = null; - if (handle.type === 'service') { - uuid = '2800'; - } - else if (handle.type === 'characteristic') { - uuid = '2803'; - } - else if (handle.type === 'characteristicValue') { - uuid = this.handles[i - 1].object.uuid; + async handleFindInfoRequest(_handle, _cid, request) { + let response = null; + const startHandle = Math.max(request.readUInt16LE(1), 1); + const endHandle = Math.min(request.readUInt16LE(3), this.handles.length - 1); + const infos = []; + for (let i = startHandle; i <= endHandle; i++) { + const handle = this.handles[i]; + let uuid = null; + if (handle.type === 'service') { + uuid = '2800'; + } + else if (handle.type === 'characteristic') { + uuid = '2803'; + } + else if (handle.type === 'characteristicValue') { + uuid = this.handles[i - 1].object.uuid; + } + else if (handle.type === 'descriptor') { + uuid = handle.object.uuid; + } + if (uuid) { + infos.push({ + handle: i, + uuid: uuid + }); + } + } + if (infos.length) { + const uuidSize = infos[0].uuid.length / 2; + let numInfo = 1; + for (let i = 1; i < infos.length; i++) { + if (infos[0].uuid.length !== infos[i].uuid.length) { + break; } - else if (handle.type === 'descriptor') { - uuid = handle.object.uuid; + numInfo++; + } + const lengthPerInfo = uuidSize === 2 ? 4 : 18; + const maxInfo = Math.floor((this.getMtu(_handle) - 2) / lengthPerInfo); + numInfo = Math.min(numInfo, maxInfo); + response = Buffer.alloc(2 + numInfo * lengthPerInfo); + response[0] = CONST.ATT_OP_FIND_INFO_RESP; + response[1] = uuidSize === 2 ? 0x01 : 0x2; + for (let i = 0; i < numInfo; i++) { + const info = infos[i]; + response.writeUInt16LE(info.handle, 2 + i * lengthPerInfo); + const uuid = Buffer.from(info.uuid + .match(/.{1,2}/g) + .reverse() + .join(''), 'hex'); + for (let j = 0; j < uuid.length; j++) { + response[2 + i * lengthPerInfo + 2 + j] = uuid[j]; } - if (uuid) { - infos.push({ - handle: i, - uuid: uuid - }); + } + } + else { + response = this.errorResponse(CONST.ATT_OP_FIND_INFO_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); + } + return response; + } + async handleFindByTypeRequest(_handle, _cid, request) { + let response = null; + const startHandle = Math.max(request.readUInt16LE(1), 1); + const endHandle = Math.min(request.readUInt16LE(3), this.handles.length - 1); + const uuid = request + .slice(5, 7) + .toString('hex') + .match(/.{1,2}/g) + .reverse() + .join(''); + const value = request + .slice(7) + .toString('hex') + .match(/.{1,2}/g) + .reverse() + .join(''); + const handles = []; + for (let i = startHandle; i <= endHandle; i++) { + const handle = this.handles[i]; + if ('2800' === uuid && handle.type === 'service' && handle.object.uuid === value) { + handles.push({ + start: handle.start, + end: handle.end + }); + } + } + if (handles.length) { + const lengthPerHandle = 4; + const maxHandles = Math.floor((this.getMtu(_handle) - 1) / lengthPerHandle); + const numHandles = Math.min(handles.length, maxHandles); + response = Buffer.alloc(1 + numHandles * lengthPerHandle); + response[0] = CONST.ATT_OP_FIND_BY_TYPE_RESP; + for (let i = 0; i < numHandles; i++) { + const handle = handles[i]; + response.writeUInt16LE(handle.start, 1 + i * lengthPerHandle); + response.writeUInt16LE(handle.end, 1 + i * lengthPerHandle + 2); + } + } + else { + response = this.errorResponse(CONST.ATT_OP_FIND_BY_TYPE_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); + } + return response; + } + async handleReadByGroupRequest(_handle, _cid, request) { + let response = null; + const startHandle = Math.max(request.readUInt16LE(1), 1); + const endHandle = Math.min(request.readUInt16LE(3), this.handles.length - 1); + const uuid = request + .slice(5) + .toString('hex') + .match(/.{1,2}/g) + .reverse() + .join(''); + if (uuid === '2800' || uuid === '2802') { + const services = []; + const type = uuid === '2800' ? 'service' : 'includedService'; + for (let i = startHandle; i <= endHandle; i++) { + const handle = this.handles[i]; + if (handle.type === type) { + services.push(handle); } } - if (infos.length) { - const uuidSize = infos[0].uuid.length / 2; - let numInfo = 1; - for (let i = 1; i < infos.length; i++) { - if (infos[0].uuid.length !== infos[i].uuid.length) { + if (services.length) { + const uuidSize = services[0].object.uuid.length / 2; + let numServices = 1; + for (let i = 1; i < services.length; i++) { + if (services[0].object.uuid.length !== services[i].object.uuid.length) { break; } - numInfo++; + numServices++; } - const lengthPerInfo = uuidSize === 2 ? 4 : 18; - const maxInfo = Math.floor((this.getMtu(_handle) - 2) / lengthPerInfo); - numInfo = Math.min(numInfo, maxInfo); - response = Buffer.alloc(2 + numInfo * lengthPerInfo); - response[0] = CONST.ATT_OP_FIND_INFO_RESP; - response[1] = uuidSize === 2 ? 0x01 : 0x2; - for (let i = 0; i < numInfo; i++) { - const info = infos[i]; - response.writeUInt16LE(info.handle, 2 + i * lengthPerInfo); - const uuid = Buffer.from(info.uuid + const lengthPerService = uuidSize === 2 ? 6 : 20; + const maxServices = Math.floor((this.getMtu(_handle) - 2) / lengthPerService); + numServices = Math.min(numServices, maxServices); + response = Buffer.alloc(2 + numServices * lengthPerService); + response[0] = CONST.ATT_OP_READ_BY_GROUP_RESP; + response[1] = lengthPerService; + for (let i = 0; i < numServices; i++) { + const service = services[i]; + response.writeUInt16LE(service.start, 2 + i * lengthPerService); + response.writeUInt16LE(service.end, 2 + i * lengthPerService + 2); + const serviceUuid = Buffer.from(service.object.uuid .match(/.{1,2}/g) .reverse() .join(''), 'hex'); - for (let j = 0; j < uuid.length; j++) { - response[2 + i * lengthPerInfo + 2 + j] = uuid[j]; + for (let j = 0; j < serviceUuid.length; j++) { + response[2 + i * lengthPerService + 4 + j] = serviceUuid[j]; } } } else { - response = this.errorResponse(CONST.ATT_OP_FIND_INFO_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); + response = this.errorResponse(CONST.ATT_OP_READ_BY_GROUP_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); } - return response; - }); + } + else { + response = this.errorResponse(CONST.ATT_OP_READ_BY_GROUP_REQ, startHandle, CONST.ATT_ECODE_UNSUPP_GRP_TYPE); + } + return response; } - handleFindByTypeRequest(_handle, _cid, request) { - return __awaiter(this, void 0, void 0, function* () { - let response = null; - const startHandle = Math.max(request.readUInt16LE(1), 1); - const endHandle = Math.min(request.readUInt16LE(3), this.handles.length - 1); - const uuid = request - .slice(5, 7) - .toString('hex') - .match(/.{1,2}/g) - .reverse() - .join(''); - const value = request - .slice(7) - .toString('hex') - .match(/.{1,2}/g) - .reverse() - .join(''); - const handles = []; + async handleReadByTypeRequest(_handle, _cid, request) { + let response = null; + const startHandle = Math.max(request.readUInt16LE(1), 1); + const endHandle = Math.min(request.readUInt16LE(3), this.handles.length - 1); + const uuid = request + .slice(5) + .toString('hex') + .match(/.{1,2}/g) + .reverse() + .join(''); + if (uuid === '2803') { + const characteristics = []; for (let i = startHandle; i <= endHandle; i++) { const handle = this.handles[i]; - if ('2800' === uuid && handle.type === 'service' && handle.object.uuid === value) { - handles.push({ - start: handle.start, - end: handle.end - }); + if (handle.type === 'characteristic') { + characteristics.push(handle); } } - if (handles.length) { - const lengthPerHandle = 4; - const maxHandles = Math.floor((this.getMtu(_handle) - 1) / lengthPerHandle); - const numHandles = Math.min(handles.length, maxHandles); - response = Buffer.alloc(1 + numHandles * lengthPerHandle); - response[0] = CONST.ATT_OP_FIND_BY_TYPE_RESP; - for (let i = 0; i < numHandles; i++) { - const handle = handles[i]; - response.writeUInt16LE(handle.start, 1 + i * lengthPerHandle); - response.writeUInt16LE(handle.end, 1 + i * lengthPerHandle + 2); + if (characteristics.length) { + const uuidSize = characteristics[0].object.uuid.length / 2; + let numCharacteristics = 1; + for (let i = 1; i < characteristics.length; i++) { + if (characteristics[0].object.uuid.length !== characteristics[i].object.uuid.length) { + break; + } + numCharacteristics++; + } + const lengthPerCharacteristic = uuidSize === 2 ? 7 : 21; + const maxCharacteristics = Math.floor((this.getMtu(_handle) - 2) / lengthPerCharacteristic); + numCharacteristics = Math.min(numCharacteristics, maxCharacteristics); + response = Buffer.alloc(2 + numCharacteristics * lengthPerCharacteristic); + response[0] = CONST.ATT_OP_READ_BY_TYPE_RESP; + response[1] = lengthPerCharacteristic; + for (let i = 0; i < numCharacteristics; i++) { + const characteristic = characteristics[i]; + response.writeUInt16LE(characteristic.start, 2 + i * lengthPerCharacteristic); + response.writeUInt8(characteristic.object.propertyFlag, 2 + i * lengthPerCharacteristic + 2); + response.writeUInt16LE(characteristic.value, 2 + i * lengthPerCharacteristic + 3); + const characteristicUuid = Buffer.from(characteristic.object.uuid + .match(/.{1,2}/g) + .reverse() + .join(''), 'hex'); + for (let j = 0; j < characteristicUuid.length; j++) { + response[2 + i * lengthPerCharacteristic + 5 + j] = characteristicUuid[j]; + } } } else { - response = this.errorResponse(CONST.ATT_OP_FIND_BY_TYPE_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); + response = this.errorResponse(CONST.ATT_OP_READ_BY_TYPE_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); } - return response; - }); - } - handleReadByGroupRequest(_handle, _cid, request) { - return __awaiter(this, void 0, void 0, function* () { - let response = null; - const startHandle = Math.max(request.readUInt16LE(1), 1); - const endHandle = Math.min(request.readUInt16LE(3), this.handles.length - 1); - const uuid = request - .slice(5) - .toString('hex') - .match(/.{1,2}/g) - .reverse() - .join(''); - if (uuid === '2800' || uuid === '2802') { - const services = []; - const type = uuid === '2800' ? 'service' : 'includedService'; - for (let i = startHandle; i <= endHandle; i++) { - const handle = this.handles[i]; - if (handle.type === type) { - services.push(handle); - } - } - if (services.length) { - const uuidSize = services[0].object.uuid.length / 2; - let numServices = 1; - for (let i = 1; i < services.length; i++) { - if (services[0].object.uuid.length !== services[i].object.uuid.length) { - break; - } - numServices++; - } - const lengthPerService = uuidSize === 2 ? 6 : 20; - const maxServices = Math.floor((this.getMtu(_handle) - 2) / lengthPerService); - numServices = Math.min(numServices, maxServices); - response = Buffer.alloc(2 + numServices * lengthPerService); - response[0] = CONST.ATT_OP_READ_BY_GROUP_RESP; - response[1] = lengthPerService; - for (let i = 0; i < numServices; i++) { - const service = services[i]; - response.writeUInt16LE(service.start, 2 + i * lengthPerService); - response.writeUInt16LE(service.end, 2 + i * lengthPerService + 2); - const serviceUuid = Buffer.from(service.object.uuid - .match(/.{1,2}/g) - .reverse() - .join(''), 'hex'); - for (let j = 0; j < serviceUuid.length; j++) { - response[2 + i * lengthPerService + 4 + j] = serviceUuid[j]; - } - } + } + else { + let handleId = startHandle; + let handleObject = null; + let secure = false; + for (; handleId <= endHandle; handleId++) { + const handle = this.handles[handleId]; + if (handle.type === 'characteristic' && handle.object.uuid === uuid) { + handleObject = handle.object; + handleId = handle.value; + secure = handle.object.secure.includes('read'); + break; } - else { - response = this.errorResponse(CONST.ATT_OP_READ_BY_GROUP_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); + else if (handle.type === 'descriptor' && handle.object.uuid === uuid) { + handleObject = handle.object; + secure = false; // handle.object.secure.includes('read'); + break; } } - else { - response = this.errorResponse(CONST.ATT_OP_READ_BY_GROUP_REQ, startHandle, CONST.ATT_ECODE_UNSUPP_GRP_TYPE); + if (secure /*&& !this._aclStream.encrypted*/) { + response = this.errorResponse(CONST.ATT_OP_READ_BY_TYPE_REQ, startHandle, CONST.ATT_ECODE_AUTHENTICATION); } - return response; - }); - } - handleReadByTypeRequest(_handle, _cid, request) { - return __awaiter(this, void 0, void 0, function* () { - let response = null; - const startHandle = Math.max(request.readUInt16LE(1), 1); - const endHandle = Math.min(request.readUInt16LE(3), this.handles.length - 1); - const uuid = request - .slice(5) - .toString('hex') - .match(/.{1,2}/g) - .reverse() - .join(''); - if (uuid === '2803') { - const characteristics = []; - for (let i = startHandle; i <= endHandle; i++) { - const handle = this.handles[i]; - if (handle.type === 'characteristic') { - characteristics.push(handle); - } + else if (handleObject) { + let responseStatus = 0; + let responseBuffer = null; + if (handleObject instanceof GattCharacteristicLocal) { + [responseStatus, responseBuffer] = await handleObject.readRequest(0); } - if (characteristics.length) { - const uuidSize = characteristics[0].object.uuid.length / 2; - let numCharacteristics = 1; - for (let i = 1; i < characteristics.length; i++) { - if (characteristics[0].object.uuid.length !== characteristics[i].object.uuid.length) { - break; - } - numCharacteristics++; - } - const lengthPerCharacteristic = uuidSize === 2 ? 7 : 21; - const maxCharacteristics = Math.floor((this.getMtu(_handle) - 2) / lengthPerCharacteristic); - numCharacteristics = Math.min(numCharacteristics, maxCharacteristics); - response = Buffer.alloc(2 + numCharacteristics * lengthPerCharacteristic); + else { + responseStatus = CONST.ATT_OP_READ_BY_TYPE_RESP; + responseBuffer = handleObject.value; + } + if (responseStatus === CONST.ATT_ECODE_SUCCESS) { + const dataLength = Math.min(responseBuffer.length, this.getMtu(_handle) - 4); + response = Buffer.alloc(4 + dataLength); response[0] = CONST.ATT_OP_READ_BY_TYPE_RESP; - response[1] = lengthPerCharacteristic; - for (let i = 0; i < numCharacteristics; i++) { - const characteristic = characteristics[i]; - response.writeUInt16LE(characteristic.start, 2 + i * lengthPerCharacteristic); - response.writeUInt8(characteristic.object.propertyFlag, 2 + i * lengthPerCharacteristic + 2); - response.writeUInt16LE(characteristic.value, 2 + i * lengthPerCharacteristic + 3); - const characteristicUuid = Buffer.from(characteristic.object.uuid - .match(/.{1,2}/g) - .reverse() - .join(''), 'hex'); - for (let j = 0; j < characteristicUuid.length; j++) { - response[2 + i * lengthPerCharacteristic + 5 + j] = characteristicUuid[j]; - } + response[1] = dataLength + 2; + response.writeUInt16LE(handleId, 2); + for (let i = 0; i < dataLength; i++) { + response[4 + i] = responseBuffer[i]; } } else { - response = this.errorResponse(CONST.ATT_OP_READ_BY_TYPE_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); + response = this.errorResponse(CONST.ATT_OP_READ_BY_TYPE_REQ, handleId, responseStatus); } } else { - let handleId = startHandle; - let handleObject = null; - let secure = false; - for (; handleId <= endHandle; handleId++) { - const handle = this.handles[handleId]; - if (handle.type === 'characteristic' && handle.object.uuid === uuid) { - handleObject = handle.object; - handleId = handle.value; - secure = handle.object.secure.includes('read'); - break; - } - else if (handle.type === 'descriptor' && handle.object.uuid === uuid) { - handleObject = handle.object; - secure = false; // handle.object.secure.includes('read'); - break; - } - } - if (secure /*&& !this._aclStream.encrypted*/) { - response = this.errorResponse(CONST.ATT_OP_READ_BY_TYPE_REQ, startHandle, CONST.ATT_ECODE_AUTHENTICATION); + response = this.errorResponse(CONST.ATT_OP_READ_BY_TYPE_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); + } + } + return response; + } + async handleReadOrReadBlobRequest(_handle, _cid, request) { + let response = null; + const requestType = request[0]; + const valueHandle = request.readUInt16LE(1); + const offset = requestType === CONST.ATT_OP_READ_BLOB_REQ ? request.readUInt16LE(3) : 0; + const handle = this.handles[valueHandle]; + if (handle) { + let result = null; + let data = null; + if (handle.type === 'service') { + result = CONST.ATT_ECODE_SUCCESS; + data = Buffer.from(handle.object.uuid + .match(/.{1,2}/g) + .reverse() + .join(''), 'hex'); + } + else if (handle.type === 'characteristic') { + const uuid = Buffer.from(handle.object.uuid + .match(/.{1,2}/g) + .reverse() + .join(''), 'hex'); + result = CONST.ATT_ECODE_SUCCESS; + data = Buffer.alloc(3 + uuid.length); + data.writeUInt8(handle.object.propertyFlag, 0); + data.writeUInt16LE(handle.value, 1); + for (let i = 0; i < uuid.length; i++) { + data[i + 3] = uuid[i]; } - else if (handleObject) { - let responseStatus = 0; - let responseBuffer = null; - if (handleObject instanceof models_1.GattCharacteristicLocal) { - [responseStatus, responseBuffer] = yield handleObject.readRequest(0); - } - else { - responseStatus = CONST.ATT_OP_READ_BY_TYPE_RESP; - responseBuffer = handleObject.value; - } - if (responseStatus === CONST.ATT_ECODE_SUCCESS) { - const dataLength = Math.min(responseBuffer.length, this.getMtu(_handle) - 4); - response = Buffer.alloc(4 + dataLength); - response[0] = CONST.ATT_OP_READ_BY_TYPE_RESP; - response[1] = dataLength + 2; - response.writeUInt16LE(handleId, 2); - for (let i = 0; i < dataLength; i++) { - response[4 + i] = responseBuffer[i]; - } + } + else if (handle.type === 'characteristicValue') { + if (handle.object.properties.includes('read')) { + if (handle.object.secure.includes('read') /*&& !this._aclStream.encrypted*/) { + result = CONST.ATT_ECODE_AUTHENTICATION; } else { - response = this.errorResponse(CONST.ATT_OP_READ_BY_TYPE_REQ, handleId, responseStatus); + [result, data] = await handle.object.readRequest(offset); } } else { - response = this.errorResponse(CONST.ATT_OP_READ_BY_TYPE_REQ, startHandle, CONST.ATT_ECODE_ATTR_NOT_FOUND); + result = CONST.ATT_ECODE_READ_NOT_PERM; // non-readable } } - return response; - }); - } - handleReadOrReadBlobRequest(_handle, _cid, request) { - return __awaiter(this, void 0, void 0, function* () { - let response = null; - const requestType = request[0]; - const valueHandle = request.readUInt16LE(1); - const offset = requestType === CONST.ATT_OP_READ_BLOB_REQ ? request.readUInt16LE(3) : 0; - const handle = this.handles[valueHandle]; - if (handle) { - let result = null; - let data = null; - if (handle.type === 'service') { - result = CONST.ATT_ECODE_SUCCESS; - data = Buffer.from(handle.object.uuid - .match(/.{1,2}/g) - .reverse() - .join(''), 'hex'); - } - else if (handle.type === 'characteristic') { - const uuid = Buffer.from(handle.object.uuid - .match(/.{1,2}/g) - .reverse() - .join(''), 'hex'); - result = CONST.ATT_ECODE_SUCCESS; - data = Buffer.alloc(3 + uuid.length); - data.writeUInt8(handle.object.propertyFlag, 0); - data.writeUInt16LE(handle.value, 1); - for (let i = 0; i < uuid.length; i++) { - data[i + 3] = uuid[i]; - } - } - else if (handle.type === 'characteristicValue') { - if (handle.object.properties.includes('read')) { - if (handle.object.secure.includes('read') /*&& !this._aclStream.encrypted*/) { - result = CONST.ATT_ECODE_AUTHENTICATION; - } - else { - [result, data] = yield handle.object.readRequest(offset); - } - } - else { - result = CONST.ATT_ECODE_READ_NOT_PERM; // non-readable + else if (handle.type === 'descriptor') { + // TODO: Descriptors are always read-only and not secure + result = CONST.ATT_ECODE_SUCCESS; + data = handle.object.value.slice(offset); + } + if (result !== null) { + if (result === CONST.ATT_ECODE_SUCCESS) { + const dataLength = Math.min(data.length, this.getMtu(_handle) - 1); + response = Buffer.alloc(1 + dataLength); + response[0] = + requestType === CONST.ATT_OP_READ_BLOB_REQ ? CONST.ATT_OP_READ_BLOB_RESP : CONST.ATT_OP_READ_RESP; + for (let i = 0; i < dataLength; i++) { + response[1 + i] = data[i]; } } - else if (handle.type === 'descriptor') { - // TODO: Descriptors are always read-only and not secure - result = CONST.ATT_ECODE_SUCCESS; - data = handle.object.value.slice(offset); - } - if (result !== null) { - if (result === CONST.ATT_ECODE_SUCCESS) { - const dataLength = Math.min(data.length, this.getMtu(_handle) - 1); - response = Buffer.alloc(1 + dataLength); - response[0] = - requestType === CONST.ATT_OP_READ_BLOB_REQ ? CONST.ATT_OP_READ_BLOB_RESP : CONST.ATT_OP_READ_RESP; - for (let i = 0; i < dataLength; i++) { - response[1 + i] = data[i]; - } - } - else { - response = this.errorResponse(requestType, valueHandle, result); - } + else { + response = this.errorResponse(requestType, valueHandle, result); } } - else { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_INVALID_HANDLE); - } - return response; - }); + } + else { + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_INVALID_HANDLE); + } + return response; } - handleWriteRequestOrCommand(_handle, _cid, request) { - return __awaiter(this, void 0, void 0, function* () { - let response = null; - const requestType = request[0]; - const withoutResponse = requestType === CONST.ATT_OP_WRITE_CMD; - const valueHandle = request.readUInt16LE(1); - const requestData = request.slice(3); - const offset = 0; - const handle = this.handles[valueHandle]; - if (handle && handle.type !== 'service') { - if (handle.type === 'descriptor' || + async handleWriteRequestOrCommand(_handle, _cid, request) { + let response = null; + const requestType = request[0]; + const withoutResponse = requestType === CONST.ATT_OP_WRITE_CMD; + const valueHandle = request.readUInt16LE(1); + const requestData = request.slice(3); + const offset = 0; + const handle = this.handles[valueHandle]; + if (handle && handle.type !== 'service') { + if (handle.type === 'descriptor' || + (withoutResponse + ? handle.object.properties.includes('write-without-response') + : handle.object.properties.includes('write'))) { + if (handle.type !== 'descriptor' && (withoutResponse - ? handle.object.properties.includes('write-without-response') - : handle.object.properties.includes('write'))) { - if (handle.type !== 'descriptor' && - (withoutResponse - ? handle.object.secure.includes('write-without-response') - : handle.object.secure.includes('write')) /*&& !this._aclStream.encrypted*/) { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_AUTHENTICATION); + ? handle.object.secure.includes('write-without-response') + : handle.object.secure.includes('write')) /*&& !this._aclStream.encrypted*/) { + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_AUTHENTICATION); + } + else if (handle.type === 'descriptor' || handle.object.uuid === '2902') { + let result = null; + let data = null; + console.log('write req 1', requestData); + if (requestData.length !== 2) { + result = CONST.ATT_ECODE_INVAL_ATTR_VALUE_LEN; } - else if (handle.type === 'descriptor' || handle.object.uuid === '2902') { - let result = null; - let data = null; - console.log('write req 1', requestData); - if (requestData.length !== 2) { - result = CONST.ATT_ECODE_INVAL_ATTR_VALUE_LEN; - } - else { - const value = requestData.readUInt16LE(0); - if (handle.type === 'descriptor') { - handle.object.value = requestData; - } - // tslint:disable-next-line: no-bitwise - if (value & 0x0003) { - // console.log('subscribe'); - const useNotify = true; // handle.object.properties.indexOf('notify') !== -1; - // const useIndicate = handle.object.properties.indexOf('indicate') !== -1; - if (useNotify) { - data = Buffer.alloc(3); - data.writeUInt8(CONST.ATT_OP_HANDLE_NOTIFY, 0); - data.writeUInt16LE(valueHandle, 1); - } /*else if (useIndicate) { - const indicateMessage = Buffer.alloc(3 + dataLength); - - indicateMessage.writeUInt8(CONST.ATT_OP_HANDLE_IND, 0); - indicateMessage.writeUInt16LE(charHandle, 1); - - for (let i = 0; i < dataLength; i++) { - indicateMessage[3 + i] = data[i]; - } - - this._lastIndicatedAttribute = attribute; - - this.send(indicateMessage); - }*/ - } - else { - // console.log('unsubscribe'); - data = Buffer.alloc(0); - } - result = CONST.ATT_ECODE_SUCCESS; + else { + const value = requestData.readUInt16LE(0); + if (handle.type === 'descriptor') { + handle.object.value = requestData; } - if (result !== null) { - if (result === CONST.ATT_ECODE_SUCCESS) { - const dataLength = Math.min(data.length, this.getMtu(_handle) - 1); - response = Buffer.alloc(1 + dataLength); - response[0] = CONST.ATT_OP_WRITE_RESP; + // tslint:disable-next-line: no-bitwise + if (value & 0x0003) { + // console.log('subscribe'); + const useNotify = true; // handle.object.properties.indexOf('notify') !== -1; + // const useIndicate = handle.object.properties.indexOf('indicate') !== -1; + if (useNotify) { + data = Buffer.alloc(3); + data.writeUInt8(CONST.ATT_OP_HANDLE_NOTIFY, 0); + data.writeUInt16LE(valueHandle, 1); + } /*else if (useIndicate) { + const indicateMessage = Buffer.alloc(3 + dataLength); + + indicateMessage.writeUInt8(CONST.ATT_OP_HANDLE_IND, 0); + indicateMessage.writeUInt16LE(charHandle, 1); + for (let i = 0; i < dataLength; i++) { - response[1 + i] = data[i]; + indicateMessage[3 + i] = data[i]; } - } - else { - response = this.errorResponse(requestType, valueHandle, result); - } + + this._lastIndicatedAttribute = attribute; + + this.send(indicateMessage); + }*/ } + else { + // console.log('unsubscribe'); + data = Buffer.alloc(0); + } + result = CONST.ATT_ECODE_SUCCESS; } - else { - const result = yield handle.object.writeRequest(offset, requestData, withoutResponse); - response = - result === CONST.ATT_ECODE_SUCCESS - ? Buffer.from([CONST.ATT_OP_WRITE_RESP]) - : this.errorResponse(requestType, valueHandle, result); + if (result !== null) { + if (result === CONST.ATT_ECODE_SUCCESS) { + const dataLength = Math.min(data.length, this.getMtu(_handle) - 1); + response = Buffer.alloc(1 + dataLength); + response[0] = CONST.ATT_OP_WRITE_RESP; + for (let i = 0; i < dataLength; i++) { + response[1 + i] = data[i]; + } + } + else { + response = this.errorResponse(requestType, valueHandle, result); + } } } else { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_WRITE_NOT_PERM); + const result = await handle.object.writeRequest(offset, requestData, withoutResponse); + response = + result === CONST.ATT_ECODE_SUCCESS + ? Buffer.from([CONST.ATT_OP_WRITE_RESP]) + : this.errorResponse(requestType, valueHandle, result); } } else { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_INVALID_HANDLE); + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_WRITE_NOT_PERM); } - return response; - }); + } + else { + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_INVALID_HANDLE); + } + return response; } - handlePrepareWriteRequest(handle, cid, request) { - return __awaiter(this, void 0, void 0, function* () { - throw new Error(`Method not implemented`); - /*let response: Buffer = null; - - const requestType = request[0]; - const valueHandle = request.readUInt16LE(1); - const offset = request.readUInt16LE(3); - const data = request.slice(5); - - let handle = this.handles[valueHandle]; - - if (handle) { - if (handle.type === 'characteristicValue') { - handle = this.handles[valueHandle - 1]; - - var handleProperties = handle.properties; - var handleSecure = handle.secure; - - if (handleProperties && handleProperties & 0x08) { - if (handleSecure & 0x08 && !this._aclStream.encrypted) { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_AUTHENTICATION); - } else if (this._preparedWriteRequest) { - if (this._preparedWriteRequest.handle !== handle) { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_UNLIKELY); - } else if (offset === this._preparedWriteRequest.offset + this._preparedWriteRequest.data.length) { - this._preparedWriteRequest.data = Buffer.concat([this._preparedWriteRequest.data, data]); - - response = Buffer.alloc(request.length); - request.copy(response); - response[0] = CONST.ATT_OP_PREPARE_WRITE_RESP; - } else { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_INVALID_OFFSET); - } - } else { - this._preparedWriteRequest = { - handle: handle, - valueHandle: valueHandle, - offset: offset, - data: data - }; - - response = new Buffer(request.length); + async handlePrepareWriteRequest(handle, cid, request) { + throw new Error(`Method not implemented`); + /*let response: Buffer = null; + + const requestType = request[0]; + const valueHandle = request.readUInt16LE(1); + const offset = request.readUInt16LE(3); + const data = request.slice(5); + + let handle = this.handles[valueHandle]; + + if (handle) { + if (handle.type === 'characteristicValue') { + handle = this.handles[valueHandle - 1]; + + var handleProperties = handle.properties; + var handleSecure = handle.secure; + + if (handleProperties && handleProperties & 0x08) { + if (handleSecure & 0x08 && !this._aclStream.encrypted) { + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_AUTHENTICATION); + } else if (this._preparedWriteRequest) { + if (this._preparedWriteRequest.handle !== handle) { + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_UNLIKELY); + } else if (offset === this._preparedWriteRequest.offset + this._preparedWriteRequest.data.length) { + this._preparedWriteRequest.data = Buffer.concat([this._preparedWriteRequest.data, data]); + + response = Buffer.alloc(request.length); request.copy(response); response[0] = CONST.ATT_OP_PREPARE_WRITE_RESP; + } else { + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_INVALID_OFFSET); } } else { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_WRITE_NOT_PERM); + this._preparedWriteRequest = { + handle: handle, + valueHandle: valueHandle, + offset: offset, + data: data + }; + + response = new Buffer(request.length); + request.copy(response); + response[0] = CONST.ATT_OP_PREPARE_WRITE_RESP; } } else { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_ATTR_NOT_LONG); + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_WRITE_NOT_PERM); } } else { - response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_INVALID_HANDLE); + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_ATTR_NOT_LONG); } - - return response;*/ - }); + } else { + response = this.errorResponse(requestType, valueHandle, CONST.ATT_ECODE_INVALID_HANDLE); + } + + return response;*/ } - handleExecuteWriteRequest(handle, cid, request) { - return __awaiter(this, void 0, void 0, function* () { - throw new Error(`Method not implemented`); - /* - let response: Buffer = null; - - const requestType = request[0]; - const flag = request[1]; - - if (this._preparedWriteRequest) { - const valueHandle = this._preparedWriteRequest.valueHandle; - - if (flag === 0x00) { - response = Buffer.from([CONST.ATT_OP_EXECUTE_WRITE_RESP]); - } else if (flag === 0x01) { - const newValueHandle = this._preparedWriteRequest.valueHandle; - const callback = () => { - return (result) => { - var callbackResponse = null; - - if (CONST.ATT_ECODE_SUCCESS === result) { - callbackResponse = Buffer.from([CONST.ATT_OP_EXECUTE_WRITE_RESP]); - } else { - callbackResponse = this.errorResponse(requestType, newValueHandle, result); - } - - this.send(callbackResponse); - }; + async handleExecuteWriteRequest(handle, cid, request) { + throw new Error(`Method not implemented`); + /* + let response: Buffer = null; + + const requestType = request[0]; + const flag = request[1]; + + if (this._preparedWriteRequest) { + const valueHandle = this._preparedWriteRequest.valueHandle; + + if (flag === 0x00) { + response = Buffer.from([CONST.ATT_OP_EXECUTE_WRITE_RESP]); + } else if (flag === 0x01) { + const newValueHandle = this._preparedWriteRequest.valueHandle; + const callback = () => { + return (result) => { + var callbackResponse = null; + + if (CONST.ATT_ECODE_SUCCESS === result) { + callbackResponse = Buffer.from([CONST.ATT_OP_EXECUTE_WRITE_RESP]); + } else { + callbackResponse = this.errorResponse(requestType, newValueHandle, result); + } + + this.send(callbackResponse); }; - - this._preparedWriteRequest.handle.attribute.emit( - 'writeRequest', - this._preparedWriteRequest.data, - this._preparedWriteRequest.offset, - false, - callback - ); - } else { - response = this.errorResponse(requestType, 0x0000, CONST.ATT_ECODE_UNLIKELY); - } - - this._preparedWriteRequest = null; + }; + + this._preparedWriteRequest.handle.attribute.emit( + 'writeRequest', + this._preparedWriteRequest.data, + this._preparedWriteRequest.offset, + false, + callback + ); } else { response = this.errorResponse(requestType, 0x0000, CONST.ATT_ECODE_UNLIKELY); } - - return response;*/ - }); + + this._preparedWriteRequest = null; + } else { + response = this.errorResponse(requestType, 0x0000, CONST.ATT_ECODE_UNLIKELY); + } + + return response;*/ } - handleConfirmation(handle, cid, request) { - return __awaiter(this, void 0, void 0, function* () { - throw new Error(`Method not implemented`); - /* - if (this._lastIndicatedAttribute) { - if (this._lastIndicatedAttribute.emit) { - this._lastIndicatedAttribute.emit('indicate'); - } - - this._lastIndicatedAttribute = null; + async handleConfirmation(handle, cid, request) { + throw new Error(`Method not implemented`); + /* + if (this._lastIndicatedAttribute) { + if (this._lastIndicatedAttribute.emit) { + this._lastIndicatedAttribute.emit('indicate'); } - - return undefined;*/ - }); + + this._lastIndicatedAttribute = null; + } + + return undefined;*/ } } -exports.HciGattLocal = HciGattLocal; //# sourceMappingURL=Gatt.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/local/Gatt.js.map b/lib/bindings/hci/gatt/local/Gatt.js.map index c6ba5350..e9d16311 100644 --- a/lib/bindings/hci/gatt/local/Gatt.js.map +++ b/lib/bindings/hci/gatt/local/Gatt.js.map @@ -1 +1 @@ -{"version":3,"file":"Gatt.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/local/Gatt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA6F;AAG7F,oDAAsC;AAEtC,mGAAmG;AACnG,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAa,YAAa,SAAQ,kBAAS;IAK1C,YAAmB,OAAmB,EAAE,GAAQ,EAAE,SAAiB,eAAe;QACjF,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAShB,oBAAe,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE;YAC9D,uCAAuC;YACvC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC,CAAC;QAEM,oBAAe,GAAG,CAAO,MAAc,EAAE,GAAW,EAAE,IAAY,EAAE,EAAE;YAC7E,IAAI,GAAG,KAAK,KAAK,CAAC,OAAO,EAAE;gBAC1B,OAAO;aACP;YAED,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,QAAQ,GAAW,IAAI,CAAC;YAE5B,IAAI;gBACH,QAAQ,WAAW,EAAE;oBACpB,KAAK,KAAK,CAAC,cAAc;wBACxB,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAA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C;QAE1C;;;;;;;;;2BASmB;IACpB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/local/index.js b/lib/bindings/hci/gatt/local/index.js index 73202821..7a780fda 100644 --- a/lib/bindings/hci/gatt/local/index.js +++ b/lib/bindings/hci/gatt/local/index.js @@ -1,6 +1,2 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattLocal = void 0; -var Gatt_1 = require("./Gatt"); -Object.defineProperty(exports, "HciGattLocal", { enumerable: true, get: function () { return Gatt_1.HciGattLocal; } }); +export { HciGattLocal } from './Gatt'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/local/index.js.map b/lib/bindings/hci/gatt/local/index.js.map index 58ed22ff..daf35170 100644 --- a/lib/bindings/hci/gatt/local/index.js.map +++ b/lib/bindings/hci/gatt/local/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/local/index.ts"],"names":[],"mappings":";;;AAAA,+BAAsC;AAA7B,oGAAA,YAAY,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/Characteristic.js b/lib/bindings/hci/gatt/remote/Characteristic.js index 906e2ff9..113352e5 100644 --- a/lib/bindings/hci/gatt/remote/Characteristic.js +++ b/lib/bindings/hci/gatt/remote/Characteristic.js @@ -1,8 +1,5 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattCharacteristicRemote = void 0; -const models_1 = require("../../../../models"); -class HciGattCharacteristicRemote extends models_1.GattCharacteristicRemote { +import { GattCharacteristicRemote } from '../../../../models'; +export class HciGattCharacteristicRemote extends GattCharacteristicRemote { constructor(service, uuid, propertiesFlag, secureFlag, startHandle, valueHandle) { super(service, uuid, propertiesFlag, secureFlag); this.descriptors = new Map(); @@ -10,5 +7,4 @@ class HciGattCharacteristicRemote extends models_1.GattCharacteristicRemote { this.valueHandle = valueHandle; } } -exports.HciGattCharacteristicRemote = HciGattCharacteristicRemote; //# sourceMappingURL=Characteristic.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/Characteristic.js.map b/lib/bindings/hci/gatt/remote/Characteristic.js.map index 6b2be44c..9be353f6 100644 --- a/lib/bindings/hci/gatt/remote/Characteristic.js.map +++ b/lib/bindings/hci/gatt/remote/Characteristic.js.map @@ -1 +1 @@ -{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/Characteristic.ts"],"names":[],"mappings":";;;AAAA,+CAA8D;AAK9D,MAAa,2BAA4B,SAAQ,iCAAwB;IASxE,YACC,OAA6B,EAC7B,IAAY,EACZ,cAAsB,EACtB,UAAkB,EAClB,WAAmB,EACnB,WAAmB;QAEnB,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAV3C,gBAAW,GAAyC,IAAI,GAAG,EAAE,CAAC;QAYpE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;CACD;AAtBD,kEAsBC"} \ No newline at end of file +{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/Characteristic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAK9D,MAAM,OAAO,2BAA4B,SAAQ,wBAAwB;IASxE,YACC,OAA6B,EAC7B,IAAY,EACZ,cAAsB,EACtB,UAAkB,EAClB,WAAmB,EACnB,WAAmB;QAEnB,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAV3C,gBAAW,GAAyC,IAAI,GAAG,EAAE,CAAC;QAYpE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/Descriptor.js b/lib/bindings/hci/gatt/remote/Descriptor.js index 8eac8e7e..b22b3387 100644 --- a/lib/bindings/hci/gatt/remote/Descriptor.js +++ b/lib/bindings/hci/gatt/remote/Descriptor.js @@ -1,12 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattDescriptorRemote = void 0; -const models_1 = require("../../../../models"); -class HciGattDescriptorRemote extends models_1.GattDescriptorRemote { +import { GattDescriptorRemote } from '../../../../models'; +export class HciGattDescriptorRemote extends GattDescriptorRemote { constructor(characteristic, uuid, handle) { super(characteristic, uuid); this.handle = handle; } } -exports.HciGattDescriptorRemote = HciGattDescriptorRemote; //# sourceMappingURL=Descriptor.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/Descriptor.js.map b/lib/bindings/hci/gatt/remote/Descriptor.js.map index 9f8999c6..f26acbf0 100644 --- a/lib/bindings/hci/gatt/remote/Descriptor.js.map +++ b/lib/bindings/hci/gatt/remote/Descriptor.js.map @@ -1 +1 @@ -{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/Descriptor.ts"],"names":[],"mappings":";;;AAAA,+CAA0D;AAI1D,MAAa,uBAAwB,SAAQ,6BAAoB;IAKhE,YAAmB,cAA2C,EAAE,IAAY,EAAE,MAAc;QAC3F,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAE5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD;AAVD,0DAUC"} \ No newline at end of file +{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/Descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAI1D,MAAM,OAAO,uBAAwB,SAAQ,oBAAoB;IAKhE,YAAmB,cAA2C,EAAE,IAAY,EAAE,MAAc;QAC3F,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAE5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/Gatt.js b/lib/bindings/hci/gatt/remote/Gatt.js index af4f344b..ecb83c19 100644 --- a/lib/bindings/hci/gatt/remote/Gatt.js +++ b/lib/bindings/hci/gatt/remote/Gatt.js @@ -1,42 +1,11 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattRemote = void 0; -const async_mutex_1 = require("async-mutex"); -const models_1 = require("../../../../models"); -const CONST = __importStar(require("../Constants")); -const Characteristic_1 = require("./Characteristic"); -const Descriptor_1 = require("./Descriptor"); -const Service_1 = require("./Service"); +import { Mutex, withTimeout } from 'async-mutex'; +import { GattError, GattRemote } from '../../../../models'; +import * as CONST from '../Constants'; +import { HciGattCharacteristicRemote } from './Characteristic'; +import { HciGattDescriptorRemote } from './Descriptor'; +import { HciGattServiceRemote } from './Service'; const GATT_CMD_TIMEOUT = 20000; // in milliseconds -class HciGattRemote extends models_1.GattRemote { +export class HciGattRemote extends GattRemote { constructor(peripheral, hci, handle, cmdTimeout = GATT_CMD_TIMEOUT) { super(peripheral); this.currentCmd = null; @@ -90,22 +59,19 @@ class HciGattRemote extends models_1.GattRemote { this.hci = hci; this.hci.on('aclDataPkt', this.onAclStreamData); this.cmdTimeout = cmdTimeout; - this.mutex = async_mutex_1.withTimeout(new async_mutex_1.Mutex(), this.cmdTimeout, new models_1.GattError(peripheral, 'GATT command mutex timeout')); + this.mutex = withTimeout(new Mutex(), this.cmdTimeout, new GattError(peripheral, 'GATT command mutex timeout')); this.currentCmd = null; this.mtuWasExchanged = false; } - acquireMutex() { - var _a; - return __awaiter(this, void 0, void 0, function* () { - try { - const release = yield this.mutex.acquire(); - this.mutexStack = new Error(); - return release; - } - catch (_b) { - throw new models_1.GattError(this.peripheral, `Could not acquire GATT command mutex`, (_a = this.mutexStack) === null || _a === void 0 ? void 0 : _a.stack); - } - }); + async acquireMutex() { + try { + const release = await this.mutex.acquire(); + this.mutexStack = new Error(); + return release; + } + catch { + throw new GattError(this.peripheral, `Could not acquire GATT command mutex`, this.mutexStack?.stack); + } } dispose(reason) { this.disposeReason = reason; @@ -132,58 +98,56 @@ class HciGattRemote extends models_1.GattRemote { buf.writeUInt8(status, 4); return buf; } - queueCommand(buffer, resolveOnWrite) { - return __awaiter(this, void 0, void 0, function* () { - // If we don't have an hci anymore exit now - if (!this.hci) { - throw new models_1.GattError(this.peripheral, `GATT already disposed`, this.disposeReason); - } - const release = yield this.acquireMutex(); - // The hci might have been disposed while we were waiting for the mutex - if (!this.hci) { + async queueCommand(buffer, resolveOnWrite) { + // If we don't have an hci anymore exit now + if (!this.hci) { + throw new GattError(this.peripheral, `GATT already disposed`, this.disposeReason); + } + const release = await this.acquireMutex(); + // The hci might have been disposed while we were waiting for the mutex + if (!this.hci) { + release(); + throw new GattError(this.peripheral, `GATT already disposed`, this.disposeReason); + } + // Create the error outside the promise to preserve the stack trace + const gattError = new GattError(this.peripheral, 'GATT Error'); // Actual error will be appended + const timeoutError = new GattError(this.peripheral, 'GATT command timed out'); + return new Promise((resolve, reject) => { + let isDone = false; + const onTimeout = () => { + if (isDone) { + return; + } + isDone = true; + this.currentCmd = null; release(); - throw new models_1.GattError(this.peripheral, `GATT already disposed`, this.disposeReason); - } - // Create the error outside the promise to preserve the stack trace - const gattError = new models_1.GattError(this.peripheral, 'GATT Error'); // Actual error will be appended - const timeoutError = new models_1.GattError(this.peripheral, 'GATT command timed out'); - return new Promise((resolve, reject) => { - let isDone = false; - const onTimeout = () => { - if (isDone) { - return; - } - isDone = true; - this.currentCmd = null; - release(); - reject(timeoutError); - }; - const onDone = (data, error) => { - if (isDone) { - return; - } - isDone = true; - this.currentCmd = null; - release(); - if (data === null) { - gattError.details = error; - gattError.stack = new Error().stack + '\n' + gattError.stack; - reject(gattError); - } - else { - resolve(data); - } - }; - this.currentCmd = { - buffer: buffer, - onResponse: onDone - }; - this.hci.writeAclDataPkt(this.handle, CONST.ATT_CID, buffer); - setTimeout(onTimeout, this.cmdTimeout); - if (resolveOnWrite) { - onDone(); + reject(timeoutError); + }; + const onDone = (data, error) => { + if (isDone) { + return; + } + isDone = true; + this.currentCmd = null; + release(); + if (data === null) { + gattError.details = error; + gattError.stack = new Error().stack + '\n' + gattError.stack; + reject(gattError); + } + else { + resolve(data); } - }); + }; + this.currentCmd = { + buffer: buffer, + onResponse: onDone + }; + this.hci.writeAclDataPkt(this.handle, CONST.ATT_CID, buffer); + setTimeout(onTimeout, this.cmdTimeout); + if (resolveOnWrite) { + onDone(); + } }); } mtuRequest(mtu) { @@ -263,374 +227,351 @@ class HciGattRemote extends models_1.GattRemote { buf.writeUInt8(CONST.ATT_OP_HANDLE_CNF, 0); return this.queueCommand(buf, true); } - exchangeMtu(mtu) { - return __awaiter(this, void 0, void 0, function* () { - if (this.mtuWasExchanged) { - return this.mtu; - } - const data = yield this.mtuRequest(mtu); - const opcode = data[0]; - if (opcode === CONST.ATT_OP_MTU_RESP) { - const newMtu = data.readUInt16LE(1); - this._mtu = Math.min(mtu, newMtu); - this.mtuWasExchanged = true; - } - else { - throw new models_1.GattError(this.peripheral, 'Exchanging mtu failed'); - } + async exchangeMtu(mtu) { + if (this.mtuWasExchanged) { return this.mtu; - }); + } + const data = await this.mtuRequest(mtu); + const opcode = data[0]; + if (opcode === CONST.ATT_OP_MTU_RESP) { + const newMtu = data.readUInt16LE(1); + this._mtu = Math.min(mtu, newMtu); + this.mtuWasExchanged = true; + } + else { + throw new GattError(this.peripheral, 'Exchanging mtu failed'); + } + return this.mtu; } - doDiscoverServices() { - return __awaiter(this, void 0, void 0, function* () { - const newServices = []; - let startHandle = 0x0001; - const run = true; - while (run) { - const data = yield this.readByGroupRequest(startHandle, 0xffff, CONST.GATT_PRIM_SVC_UUID); - const opcode = data[0]; - if (opcode === CONST.ATT_OP_READ_BY_GROUP_RESP) { - const type = data[1]; - const num = (data.length - 2) / type; - for (let i = 0; i < num; i++) { - const offset = 2 + i * type; - const srvStartHandle = data.readUInt16LE(offset); - const srvEndHandle = data.readUInt16LE(offset + 2); - const uuid = type === 6 - ? data.readUInt16LE(offset + 4).toString(16) - : data - .slice(offset + 4) - .slice(0, 16) - .toString('hex') - .match(/.{1,2}/g) - .reverse() - .join(''); - const newService = new Service_1.HciGattServiceRemote(this, uuid, srvStartHandle, srvEndHandle); - newServices.push(newService); - } - } - if (opcode !== CONST.ATT_OP_READ_BY_GROUP_RESP || newServices[newServices.length - 1].endHandle === 0xffff) { - break; - } - else { - startHandle = newServices[newServices.length - 1].endHandle + 1; + async doDiscoverServices() { + const newServices = []; + let startHandle = 0x0001; + const run = true; + while (run) { + const data = await this.readByGroupRequest(startHandle, 0xffff, CONST.GATT_PRIM_SVC_UUID); + const opcode = data[0]; + if (opcode === CONST.ATT_OP_READ_BY_GROUP_RESP) { + const type = data[1]; + const num = (data.length - 2) / type; + for (let i = 0; i < num; i++) { + const offset = 2 + i * type; + const srvStartHandle = data.readUInt16LE(offset); + const srvEndHandle = data.readUInt16LE(offset + 2); + const uuid = type === 6 + ? data.readUInt16LE(offset + 4).toString(16) + : data + .slice(offset + 4) + .slice(0, 16) + .toString('hex') + .match(/.{1,2}/g) + .reverse() + .join(''); + const newService = new HciGattServiceRemote(this, uuid, srvStartHandle, srvEndHandle); + newServices.push(newService); } } - return newServices; - }); - } - discoverCharacteristics(serviceUUID) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); + if (opcode !== CONST.ATT_OP_READ_BY_GROUP_RESP || newServices[newServices.length - 1].endHandle === 0xffff) { + break; } - const newChars = []; - let startHandle = service.startHandle; - const run = true; - while (run) { - const data = yield this.readByTypeRequest(startHandle, service.endHandle, CONST.GATT_CHARAC_UUID); - const opcode = data[0]; - if (opcode === CONST.ATT_OP_READ_BY_TYPE_RESP) { - const type = data[1]; - const num = (data.length - 2) / type; - for (let i = 0; i < num; i++) { - const offset = 2 + i * type; - const charStartHandle = data.readUInt16LE(offset); - const secureFlag = data.readUInt8(offset + 1); - const propertiesFlag = data.readUInt8(offset + 2); - const charValueHandle = data.readUInt16LE(offset + 3); - const uuid = type === 7 - ? data.readUInt16LE(offset + 5).toString(16) - : data - .slice(offset + 5) - .slice(0, 16) - .toString('hex') - .match(/.{1,2}/g) - .reverse() - .join(''); - const newChar = new Characteristic_1.HciGattCharacteristicRemote(service, uuid, propertiesFlag, secureFlag, charStartHandle, charValueHandle); - newChars.push(newChar); - } - } - if (opcode !== CONST.ATT_OP_READ_BY_TYPE_RESP || - newChars[newChars.length - 1].valueHandle === service.endHandle) { - break; - } - else { - startHandle = newChars[newChars.length - 1].valueHandle + 1; - } - } - // Add end handle to all characteristics - for (let i = 0; i < newChars.length; i++) { - const characteristic = newChars[i]; - if (i !== 0) { - newChars[i - 1].endHandle = newChars[i].startHandle - 1; - } - if (i === newChars.length - 1) { - characteristic.endHandle = service.endHandle; - } + else { + startHandle = newServices[newServices.length - 1].endHandle + 1; } - return newChars; - }); + } + return newServices; } - read(serviceUUID, characteristicUUID) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); - } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new models_1.GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); - } - let readData = Buffer.alloc(0); - let data = yield this.readRequest(characteristic.valueHandle); - let opcode = data[0]; - const run = true; - while (run) { - if (opcode !== CONST.ATT_OP_READ_RESP && opcode !== CONST.ATT_OP_READ_BLOB_RESP) { - return readData; - } - readData = Buffer.concat([readData, data.slice(1)], readData.length + data.length - 1); - if (data.length !== this.mtu) { - return readData; + async discoverCharacteristics(serviceUUID) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const newChars = []; + let startHandle = service.startHandle; + const run = true; + while (run) { + const data = await this.readByTypeRequest(startHandle, service.endHandle, CONST.GATT_CHARAC_UUID); + const opcode = data[0]; + if (opcode === CONST.ATT_OP_READ_BY_TYPE_RESP) { + const type = data[1]; + const num = (data.length - 2) / type; + for (let i = 0; i < num; i++) { + const offset = 2 + i * type; + const charStartHandle = data.readUInt16LE(offset); + const secureFlag = data.readUInt8(offset + 1); + const propertiesFlag = data.readUInt8(offset + 2); + const charValueHandle = data.readUInt16LE(offset + 3); + const uuid = type === 7 + ? data.readUInt16LE(offset + 5).toString(16) + : data + .slice(offset + 5) + .slice(0, 16) + .toString('hex') + .match(/.{1,2}/g) + .reverse() + .join(''); + const newChar = new HciGattCharacteristicRemote(service, uuid, propertiesFlag, secureFlag, charStartHandle, charValueHandle); + newChars.push(newChar); } - data = yield this.readBlobRequest(characteristic.valueHandle, readData.length); - opcode = data[0]; } - }); - } - write(serviceUUID, characteristicUUID, data, withoutResponse) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); + if (opcode !== CONST.ATT_OP_READ_BY_TYPE_RESP || + newChars[newChars.length - 1].valueHandle === service.endHandle) { + break; } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new models_1.GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + else { + startHandle = newChars[newChars.length - 1].valueHandle + 1; } - if (withoutResponse) { - yield this.writeRequest(characteristic.valueHandle, data, true); + } + // Add end handle to all characteristics + for (let i = 0; i < newChars.length; i++) { + const characteristic = newChars[i]; + if (i !== 0) { + newChars[i - 1].endHandle = newChars[i].startHandle - 1; } - else if (data.length + 3 > this.mtu) { - return this.longWrite(serviceUUID, characteristicUUID, data, withoutResponse); + if (i === newChars.length - 1) { + characteristic.endHandle = service.endHandle; } - else { - const respData = yield this.writeRequest(characteristic.valueHandle, data, false); - const opcode = respData[0]; - if (opcode !== CONST.ATT_OP_WRITE_RESP) { - throw new models_1.GattError(this.peripheral, `Write error, opcode ${opcode}`); - } + } + return newChars; + } + async read(serviceUUID, characteristicUUID) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + let readData = Buffer.alloc(0); + let data = await this.readRequest(characteristic.valueHandle); + let opcode = data[0]; + const run = true; + while (run) { + if (opcode !== CONST.ATT_OP_READ_RESP && opcode !== CONST.ATT_OP_READ_BLOB_RESP) { + return readData; + } + readData = Buffer.concat([readData, data.slice(1)], readData.length + data.length - 1); + if (data.length !== this.mtu) { + return readData; + } + data = await this.readBlobRequest(characteristic.valueHandle, readData.length); + opcode = data[0]; + } + } + async write(serviceUUID, characteristicUUID, data, withoutResponse) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + if (withoutResponse) { + await this.writeRequest(characteristic.valueHandle, data, true); + } + else if (data.length + 3 > this.mtu) { + return this.longWrite(serviceUUID, characteristicUUID, data, withoutResponse); + } + else { + const respData = await this.writeRequest(characteristic.valueHandle, data, false); + const opcode = respData[0]; + if (opcode !== CONST.ATT_OP_WRITE_RESP) { + throw new GattError(this.peripheral, `Write error, opcode ${opcode}`); } - }); + } } /* Perform a "long write" as described Bluetooth Spec section 4.9.4 "Write Long Characteristic Values" */ - longWrite(serviceUUID, characteristicUUID, data, withoutResponse) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); - } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new models_1.GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + async longWrite(serviceUUID, characteristicUUID, data, withoutResponse) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const limit = this.mtu - 5; + /* split into prepare-write chunks and queue them */ + let offset = 0; + while (offset < data.length) { + const end = offset + limit; + const chunk = data.slice(offset, end); + const chunkRespData = await this.prepareWriteRequest(characteristic.valueHandle, offset, chunk); + const chunkOpcode = chunkRespData[0]; + if (chunkOpcode !== CONST.ATT_OP_PREPARE_WRITE_RESP) { + throw new GattError(this.peripheral, `Long write chunk failed, invalid opcode ${chunkOpcode}`); } - const limit = this.mtu - 5; - /* split into prepare-write chunks and queue them */ - let offset = 0; - while (offset < data.length) { - const end = offset + limit; - const chunk = data.slice(offset, end); - const chunkRespData = yield this.prepareWriteRequest(characteristic.valueHandle, offset, chunk); - const chunkOpcode = chunkRespData[0]; - if (chunkOpcode !== CONST.ATT_OP_PREPARE_WRITE_RESP) { - throw new models_1.GattError(this.peripheral, `Long write chunk failed, invalid opcode ${chunkOpcode}`); - } - else { - const expectedLength = chunk.length + 5; - if (chunkRespData.length !== expectedLength) { - /* the response should contain the data packet echoed back to the caller */ - throw new models_1.GattError(this.peripheral, `Long write chunk failed, received invalid response length`); - } + else { + const expectedLength = chunk.length + 5; + if (chunkRespData.length !== expectedLength) { + /* the response should contain the data packet echoed back to the caller */ + throw new GattError(this.peripheral, `Long write chunk failed, received invalid response length`); } - offset = end; } - /* queue the execute command with a callback to emit the write signal when done */ - const respData = yield this.executeWriteRequest(characteristic.valueHandle); - const opcode = respData[0]; - if (opcode !== CONST.ATT_OP_EXECUTE_WRITE_RESP && !withoutResponse) { - throw new models_1.GattError(this.peripheral, `Long write failed, invalid opcode ${opcode}`); - } - }); + offset = end; + } + /* queue the execute command with a callback to emit the write signal when done */ + const respData = await this.executeWriteRequest(characteristic.valueHandle); + const opcode = respData[0]; + if (opcode !== CONST.ATT_OP_EXECUTE_WRITE_RESP && !withoutResponse) { + throw new GattError(this.peripheral, `Long write failed, invalid opcode ${opcode}`); + } } - broadcast(serviceUUID, characteristicUUID, broadcast) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); - } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new models_1.GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); - } - const data = yield this.readByTypeRequest(characteristic.startHandle, characteristic.endHandle, CONST.GATT_SERVER_CHARAC_CFG_UUID); - const opcode = data[0]; - if (opcode !== CONST.ATT_OP_READ_BY_TYPE_RESP) { - throw new models_1.GattError(this.peripheral, `Broadcast error, opcode ${opcode}`); - } + async broadcast(serviceUUID, characteristicUUID, broadcast) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const data = await this.readByTypeRequest(characteristic.startHandle, characteristic.endHandle, CONST.GATT_SERVER_CHARAC_CFG_UUID); + const opcode = data[0]; + if (opcode !== CONST.ATT_OP_READ_BY_TYPE_RESP) { + throw new GattError(this.peripheral, `Broadcast error, opcode ${opcode}`); + } + const handle = data.readUInt16LE(2); + let value = data.readUInt16LE(4); + // tslint:disable: no-bitwise + if (broadcast) { + value |= 0x0001; + } + else { + value &= 0xfffe; + } + // tslint:enable: no-bitwise + const valueBuffer = Buffer.alloc(2); + valueBuffer.writeUInt16LE(value, 0); + const moreData = await this.writeRequest(handle, valueBuffer, false); + const moreOpcode = moreData[0]; + if (moreOpcode !== CONST.ATT_OP_WRITE_RESP) { + throw new GattError(this.peripheral, `Broadcast error, opcode ${opcode}`); + } + } + async notify(serviceUUID, characteristicUUID, notify) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const data = await this.readByTypeRequest(characteristic.startHandle, characteristic.endHandle, CONST.GATT_CLIENT_CHARAC_CFG_UUID); + const opcode = data[0]; + if (opcode === CONST.ATT_OP_READ_BY_TYPE_RESP) { const handle = data.readUInt16LE(2); let value = data.readUInt16LE(4); + const useNotify = characteristic.properties.includes('notify'); + const useIndicate = characteristic.properties.includes('indicate'); // tslint:disable: no-bitwise - if (broadcast) { - value |= 0x0001; + if (notify) { + if (useNotify) { + value |= 0x0001; + } + else if (useIndicate) { + value |= 0x0002; + } } else { - value &= 0xfffe; + if (useNotify) { + value &= 0xfffe; + } + else if (useIndicate) { + value &= 0xfffd; + } } // tslint:enable: no-bitwise const valueBuffer = Buffer.alloc(2); valueBuffer.writeUInt16LE(value, 0); - const moreData = yield this.writeRequest(handle, valueBuffer, false); + const moreData = await this.writeRequest(handle, valueBuffer, false); const moreOpcode = moreData[0]; if (moreOpcode !== CONST.ATT_OP_WRITE_RESP) { - throw new models_1.GattError(this.peripheral, `Broadcast error, opcode ${opcode}`); + throw new GattError(this.peripheral, `Notify error, opcode ${opcode}`); } - }); + } } - notify(serviceUUID, characteristicUUID, notify) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); - } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new models_1.GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); - } - const data = yield this.readByTypeRequest(characteristic.startHandle, characteristic.endHandle, CONST.GATT_CLIENT_CHARAC_CFG_UUID); + async discoverDescriptors(serviceUUID, characteristicUUID) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const newDescs = []; + let startHandle = characteristic.valueHandle + 1; + const run = true; + while (run) { + const data = await this.findInfoRequest(startHandle, characteristic.endHandle); const opcode = data[0]; - if (opcode === CONST.ATT_OP_READ_BY_TYPE_RESP) { - const handle = data.readUInt16LE(2); - let value = data.readUInt16LE(4); - const useNotify = characteristic.properties.includes('notify'); - const useIndicate = characteristic.properties.includes('indicate'); - // tslint:disable: no-bitwise - if (notify) { - if (useNotify) { - value |= 0x0001; - } - else if (useIndicate) { - value |= 0x0002; - } - } - else { - if (useNotify) { - value &= 0xfffe; - } - else if (useIndicate) { - value &= 0xfffd; - } - } - // tslint:enable: no-bitwise - const valueBuffer = Buffer.alloc(2); - valueBuffer.writeUInt16LE(value, 0); - const moreData = yield this.writeRequest(handle, valueBuffer, false); - const moreOpcode = moreData[0]; - if (moreOpcode !== CONST.ATT_OP_WRITE_RESP) { - throw new models_1.GattError(this.peripheral, `Notify error, opcode ${opcode}`); + if (opcode === CONST.ATT_OP_FIND_INFO_RESP) { + const num = data[1]; + for (let i = 0; i < num; i++) { + const descHandle = data.readUInt16LE(2 + i * 4 + 0); + const uuid = data.readUInt16LE(2 + i * 4 + 2).toString(16); + const newDescriptor = new HciGattDescriptorRemote(characteristic, uuid, descHandle); + newDescs.push(newDescriptor); } } - }); - } - discoverDescriptors(serviceUUID, characteristicUUID) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); - } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new models_1.GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + if (opcode !== CONST.ATT_OP_FIND_INFO_RESP || newDescs[newDescs.length - 1].handle === characteristic.endHandle) { + break; } - const newDescs = []; - let startHandle = characteristic.valueHandle + 1; - const run = true; - while (run) { - const data = yield this.findInfoRequest(startHandle, characteristic.endHandle); - const opcode = data[0]; - if (opcode === CONST.ATT_OP_FIND_INFO_RESP) { - const num = data[1]; - for (let i = 0; i < num; i++) { - const descHandle = data.readUInt16LE(2 + i * 4 + 0); - const uuid = data.readUInt16LE(2 + i * 4 + 2).toString(16); - const newDescriptor = new Descriptor_1.HciGattDescriptorRemote(characteristic, uuid, descHandle); - newDescs.push(newDescriptor); - } - } - if (opcode !== CONST.ATT_OP_FIND_INFO_RESP || newDescs[newDescs.length - 1].handle === characteristic.endHandle) { - break; - } - else { - startHandle = newDescs[newDescs.length - 1].handle + 1; - } + else { + startHandle = newDescs[newDescs.length - 1].handle + 1; } - return newDescs; - }); + } + return newDescs; } - readValue(serviceUUID, characteristicUUID, descriptorUUID) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); - } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new models_1.GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); - } - const descriptor = characteristic.descriptors.get(descriptorUUID); - if (!descriptor) { - throw new models_1.GattError(this.peripheral, `Descriptor ${descriptorUUID} in characteristic ${characteristicUUID} in service ${serviceUUID} not found`); - } - let readData = Buffer.alloc(0); - let data = yield this.readRequest(descriptor.handle); - let opcode = data[0]; - const run = true; - while (run) { - if (opcode !== CONST.ATT_OP_READ_RESP && opcode !== CONST.ATT_OP_READ_BLOB_RESP) { - return readData; - } - readData = Buffer.concat([readData, data.slice(1)]); - if (data.length !== this.mtu) { - return readData; - } - data = yield this.readBlobRequest(descriptor.handle, readData.length); - opcode = data[0]; - } - }); + async readValue(serviceUUID, characteristicUUID, descriptorUUID) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const descriptor = characteristic.descriptors.get(descriptorUUID); + if (!descriptor) { + throw new GattError(this.peripheral, `Descriptor ${descriptorUUID} in characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + let readData = Buffer.alloc(0); + let data = await this.readRequest(descriptor.handle); + let opcode = data[0]; + const run = true; + while (run) { + if (opcode !== CONST.ATT_OP_READ_RESP && opcode !== CONST.ATT_OP_READ_BLOB_RESP) { + return readData; + } + readData = Buffer.concat([readData, data.slice(1)]); + if (data.length !== this.mtu) { + return readData; + } + data = await this.readBlobRequest(descriptor.handle, readData.length); + opcode = data[0]; + } } - writeValue(serviceUUID, characteristicUUID, descriptorUUID, data) { - return __awaiter(this, void 0, void 0, function* () { - const service = this.services.get(serviceUUID); - if (!service) { - throw new models_1.GattError(this.peripheral, `Service ${serviceUUID} not found`); - } - const characteristic = service.characteristics.get(characteristicUUID); - if (!characteristic) { - throw new models_1.GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); - } - const descriptor = characteristic.descriptors.get(descriptorUUID); - if (!descriptor) { - throw new models_1.GattError(this.peripheral, `Descriptor ${descriptorUUID} in characteristic ${characteristicUUID} in service ${serviceUUID} not found`); - } - const respData = yield this.writeRequest(descriptor.handle, data, false); - const opcode = respData[0]; - if (opcode !== CONST.ATT_OP_WRITE_RESP) { - throw new models_1.GattError(this.peripheral, `WriteValue error, opcode ${opcode}`); - } - }); + async writeValue(serviceUUID, characteristicUUID, descriptorUUID, data) { + const service = this.services.get(serviceUUID); + if (!service) { + throw new GattError(this.peripheral, `Service ${serviceUUID} not found`); + } + const characteristic = service.characteristics.get(characteristicUUID); + if (!characteristic) { + throw new GattError(this.peripheral, `Characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const descriptor = characteristic.descriptors.get(descriptorUUID); + if (!descriptor) { + throw new GattError(this.peripheral, `Descriptor ${descriptorUUID} in characteristic ${characteristicUUID} in service ${serviceUUID} not found`); + } + const respData = await this.writeRequest(descriptor.handle, data, false); + const opcode = respData[0]; + if (opcode !== CONST.ATT_OP_WRITE_RESP) { + throw new GattError(this.peripheral, `WriteValue error, opcode ${opcode}`); + } } } -exports.HciGattRemote = HciGattRemote; //# sourceMappingURL=Gatt.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/Gatt.js.map b/lib/bindings/hci/gatt/remote/Gatt.js.map index 9bf0b915..db0f9fbc 100644 --- a/lib/bindings/hci/gatt/remote/Gatt.js.map +++ b/lib/bindings/hci/gatt/remote/Gatt.js.map @@ -1 +1 @@ -{"version":3,"file":"Gatt.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/Gatt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiE;AAEjE,+CAAuE;AAEvE,oDAAsC;AAEtC,qDAA+D;AAC/D,6CAAuD;AACvD,uCAAiD;AAEjD,MAAM,gBAAgB,GAAG,KAAK,CAAC,CAAC,kBAAkB;AAOlD,MAAa,aAAc,SAAQ,mBAAU;IAe5C,YAAmB,UAAsB,EAAE,GAAQ,EAAE,MAAc,EAAE,aAAqB,gBAAgB;QACzG,KAAK,CAAC,UAAU,CAAC,CAAC;QANX,eAAU,GAAgB,IAAI,CAAC;QAGhC,aAAQ,GAAsC,IAAI,GAAG,EAAE,CAAC;QAgDvD,oBAAe,GAAG,CAAC,MAAc,EAAE,GAAW,EAAE,IAAY,EAAE,EAAE;YACvE,IAAI,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,OAAO,EAAE;gBACpD,OAAO;aACP;YAED,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBACvF,QAAQ;gBACR,4DAA4D;aAC5D;iBAAM,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBAC7B,uCAAuC;gBACvC,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC5B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,sBAAsB,CA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,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,WAAW,YAAY,CAAC,CAAC;SACzE;QAED,MAAM,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QACvE,IAAI,CAAC,cAAc,EAAE;YACpB,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,kBAAkB,eAAe,WAAW,YAAY,CAAC,CAAC;SACjH;QAED,MAAM,UAAU,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAClE,IAAI,CAAC,UAAU,EAAE;YAChB,MAAM,IAAI,SAAS,CAClB,IAAI,CAAC,UAAU,EACf,cAAc,cAAc,sBAAsB,kBAAkB,eAAe,WAAW,YAAY,CAC1G,CAAC;SACF;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACzE,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAE3B,IAAI,MAAM,KAAK,KAAK,CAAC,iBAAiB,EAAE;YACvC,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,4BAA4B,MAAM,EAAE,CAAC,CAAC;SAC3E;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/Service.js b/lib/bindings/hci/gatt/remote/Service.js index c2270d58..27eb94bc 100644 --- a/lib/bindings/hci/gatt/remote/Service.js +++ b/lib/bindings/hci/gatt/remote/Service.js @@ -1,8 +1,5 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattServiceRemote = void 0; -const models_1 = require("../../../../models"); -class HciGattServiceRemote extends models_1.GattServiceRemote { +import { GattServiceRemote } from '../../../../models'; +export class HciGattServiceRemote extends GattServiceRemote { constructor(gatt, uuid, startHandle, endHandle) { super(gatt, uuid); this.characteristics = new Map(); @@ -10,5 +7,4 @@ class HciGattServiceRemote extends models_1.GattServiceRemote { this.endHandle = endHandle; } } -exports.HciGattServiceRemote = HciGattServiceRemote; //# sourceMappingURL=Service.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/Service.js.map b/lib/bindings/hci/gatt/remote/Service.js.map index 0cceec49..2d7f6fd5 100644 --- a/lib/bindings/hci/gatt/remote/Service.js.map +++ b/lib/bindings/hci/gatt/remote/Service.js.map @@ -1 +1 @@ -{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/Service.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAKvD,MAAa,oBAAqB,SAAQ,0BAAiB;IAQ1D,YAAmB,IAAmB,EAAE,IAAY,EAAE,WAAmB,EAAE,SAAiB;QAC3F,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAHZ,oBAAe,GAA6C,IAAI,GAAG,EAAE,CAAC;QAK5E,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;CACD;AAdD,oDAcC"} \ No newline at end of file +{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAKvD,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IAQ1D,YAAmB,IAAmB,EAAE,IAAY,EAAE,WAAmB,EAAE,SAAiB;QAC3F,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAHZ,oBAAe,GAA6C,IAAI,GAAG,EAAE,CAAC;QAK5E,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/index.js b/lib/bindings/hci/gatt/remote/index.js index 1c00f5d9..d1af3936 100644 --- a/lib/bindings/hci/gatt/remote/index.js +++ b/lib/bindings/hci/gatt/remote/index.js @@ -1,12 +1,5 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattServiceRemote = exports.HciGattRemote = exports.HciGattDescriptorRemote = exports.HciGattCharacteristicRemote = void 0; -var Characteristic_1 = require("./Characteristic"); -Object.defineProperty(exports, "HciGattCharacteristicRemote", { enumerable: true, get: function () { return Characteristic_1.HciGattCharacteristicRemote; } }); -var Descriptor_1 = require("./Descriptor"); -Object.defineProperty(exports, "HciGattDescriptorRemote", { enumerable: true, get: function () { return Descriptor_1.HciGattDescriptorRemote; } }); -var Gatt_1 = require("./Gatt"); -Object.defineProperty(exports, "HciGattRemote", { enumerable: true, get: function () { return Gatt_1.HciGattRemote; } }); -var Service_1 = require("./Service"); -Object.defineProperty(exports, "HciGattServiceRemote", { enumerable: true, get: function () { return Service_1.HciGattServiceRemote; } }); +export { HciGattCharacteristicRemote } from './Characteristic'; +export { HciGattDescriptorRemote } from './Descriptor'; +export { HciGattRemote } from './Gatt'; +export { HciGattServiceRemote } from './Service'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/hci/gatt/remote/index.js.map b/lib/bindings/hci/gatt/remote/index.js.map index bf98fa95..c19cb51e 100644 --- a/lib/bindings/hci/gatt/remote/index.js.map +++ b/lib/bindings/hci/gatt/remote/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/index.ts"],"names":[],"mappings":";;;AAAA,mDAA+D;AAAtD,6HAAA,2BAA2B,OAAA;AACpC,2CAAuD;AAA9C,qHAAA,uBAAuB,OAAA;AAChC,+BAAuC;AAA9B,qGAAA,aAAa,OAAA;AACtB,qCAAiD;AAAxC,+GAAA,oBAAoB,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/bindings/hci/gatt/remote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/lib/bindings/hci/index.js b/lib/bindings/hci/index.js index 8f789917..dc1917c2 100644 --- a/lib/bindings/hci/index.js +++ b/lib/bindings/hci/index.js @@ -1,16 +1,5 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciGattDescriptorRemote = exports.HciGattCharacteristicRemote = exports.HciGattServiceRemote = exports.HciGattLocal = exports.HciGattRemote = exports.HciPeripheral = exports.HciMODblue = exports.HciAdapter = void 0; -var Adapter_1 = require("./Adapter"); -Object.defineProperty(exports, "HciAdapter", { enumerable: true, get: function () { return Adapter_1.HciAdapter; } }); -var MODblue_1 = require("./MODblue"); -Object.defineProperty(exports, "HciMODblue", { enumerable: true, get: function () { return MODblue_1.HciMODblue; } }); -var Peripheral_1 = require("./Peripheral"); -Object.defineProperty(exports, "HciPeripheral", { enumerable: true, get: function () { return Peripheral_1.HciPeripheral; } }); -var gatt_1 = require("./gatt"); -Object.defineProperty(exports, "HciGattRemote", { enumerable: true, get: function () { return gatt_1.HciGattRemote; } }); -Object.defineProperty(exports, "HciGattLocal", { enumerable: true, get: function () { return gatt_1.HciGattLocal; } }); -Object.defineProperty(exports, "HciGattServiceRemote", { enumerable: true, get: function () { return gatt_1.HciGattServiceRemote; } }); -Object.defineProperty(exports, "HciGattCharacteristicRemote", { enumerable: true, get: function () { return gatt_1.HciGattCharacteristicRemote; } }); -Object.defineProperty(exports, "HciGattDescriptorRemote", { enumerable: true, get: function () { return gatt_1.HciGattDescriptorRemote; } }); +export { HciAdapter } from './Adapter'; +export { HciMODblue } from './MODblue'; +export { HciPeripheral } from './Peripheral'; +export { HciGattRemote, HciGattLocal, HciGattServiceRemote, HciGattCharacteristicRemote, HciGattDescriptorRemote } from './gatt'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/hci/index.js.map b/lib/bindings/hci/index.js.map index b8acabf0..296c1411 100644 --- a/lib/bindings/hci/index.js.map +++ b/lib/bindings/hci/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bindings/hci/index.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AACnB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AACnB,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAEtB,+BAMgB;AALf,qGAAA,aAAa,OAAA;AACb,oGAAA,YAAY,OAAA;AACZ,4GAAA,oBAAoB,OAAA;AACpB,mHAAA,2BAA2B,OAAA;AAC3B,+GAAA,uBAAuB,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bindings/hci/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EACN,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACvB,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib/bindings/hci/misc/Advertisement.js b/lib/bindings/hci/misc/Advertisement.js index 66008df5..fcb3cc5e 100644 --- a/lib/bindings/hci/misc/Advertisement.js +++ b/lib/bindings/hci/misc/Advertisement.js @@ -1,3 +1,2 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //# sourceMappingURL=Advertisement.js.map \ No newline at end of file diff --git a/lib/bindings/hci/misc/Gap.js b/lib/bindings/hci/misc/Gap.js index 6cbcbe23..5472d325 100644 --- a/lib/bindings/hci/misc/Gap.js +++ b/lib/bindings/hci/misc/Gap.js @@ -1,30 +1,15 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Gap = void 0; -const os_1 = __importDefault(require("os")); -const tiny_typed_emitter_1 = require("tiny-typed-emitter"); -const IS_NTC_CHIP = os_1.default.platform() === 'linux' && os_1.default.release().indexOf('-ntc') !== -1; -const IS_LINUX = os_1.default.platform() === 'linux'; -const IS_INTEL_EDISON = IS_LINUX && os_1.default.release().indexOf('edison') !== -1; -const IS_YOCTO = IS_LINUX && os_1.default.release().indexOf('yocto') !== -1; -class Gap extends tiny_typed_emitter_1.TypedEmitter { +import os from 'os'; +import { TypedEmitter } from 'tiny-typed-emitter'; +const IS_NTC_CHIP = os.platform() === 'linux' && os.release().indexOf('-ntc') !== -1; +const IS_LINUX = os.platform() === 'linux'; +const IS_INTEL_EDISON = IS_LINUX && os.release().indexOf('edison') !== -1; +const IS_YOCTO = IS_LINUX && os.release().indexOf('yocto') !== -1; +export class Gap extends TypedEmitter { constructor(hci) { super(); this.onHciLeAdvertisingReport = (type, address, addressType, eir, rssi) => { const previouslyDiscovered = this.discoveries.get(address); - const advertisement = (previouslyDiscovered === null || previouslyDiscovered === void 0 ? void 0 : previouslyDiscovered.advertisement) || { + const advertisement = previouslyDiscovered?.advertisement || { localName: undefined, txPowerLevel: undefined, manufacturerData: undefined, @@ -32,8 +17,8 @@ class Gap extends tiny_typed_emitter_1.TypedEmitter { serviceUuids: [], solicitationServiceUuids: [] }; - let discoveryCount = (previouslyDiscovered === null || previouslyDiscovered === void 0 ? void 0 : previouslyDiscovered.count) || 0; - let hasScanResponse = (previouslyDiscovered === null || previouslyDiscovered === void 0 ? void 0 : previouslyDiscovered.hasScanResponse) || false; + let discoveryCount = previouslyDiscovered?.count || 0; + let hasScanResponse = previouslyDiscovered?.hasScanResponse || false; if (type === 0x04) { hasScanResponse = true; } @@ -179,137 +164,126 @@ class Gap extends tiny_typed_emitter_1.TypedEmitter { this.discoveries = new Map(); this.hci.on('leAdvertisingReport', this.onHciLeAdvertisingReport); } - startScanning(allowDuplicates) { - return __awaiter(this, void 0, void 0, function* () { - this.scanState = 'starting'; - this.scanFilterDuplicates = !allowDuplicates; - // Always set scan parameters before scanning - // https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=229737 - // p106 - p107 - try { - yield this.hci.setScanEnabled(false, true); - } - catch (_a) { - // NO-OP - } - yield this.hci.setScanParameters(); - if (IS_NTC_CHIP) { - // work around for Next Thing Co. C.H.I.P, always allow duplicates, to get scan response - this.scanFilterDuplicates = false; - } - yield this.hci.setScanEnabled(true, this.scanFilterDuplicates); - this.scanState = 'started'; - }); + async startScanning(allowDuplicates) { + this.scanState = 'starting'; + this.scanFilterDuplicates = !allowDuplicates; + // Always set scan parameters before scanning + // https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=229737 + // p106 - p107 + try { + await this.hci.setScanEnabled(false, true); + } + catch { + // NO-OP + } + await this.hci.setScanParameters(); + if (IS_NTC_CHIP) { + // work around for Next Thing Co. C.H.I.P, always allow duplicates, to get scan response + this.scanFilterDuplicates = false; + } + await this.hci.setScanEnabled(true, this.scanFilterDuplicates); + this.scanState = 'started'; } - stopScanning() { - return __awaiter(this, void 0, void 0, function* () { - this.scanState = 'stopping'; - yield this.hci.setScanEnabled(false, this.scanFilterDuplicates); - this.scanState = 'stopped'; - }); + async stopScanning() { + this.scanState = 'stopping'; + await this.hci.setScanEnabled(false, this.scanFilterDuplicates); + this.scanState = 'stopped'; } - startAdvertising(name, serviceUuids) { - return __awaiter(this, void 0, void 0, function* () { - let advertisementDataLength = 3; - let scanDataLength = 0; - const serviceUuids16bit = []; - const serviceUuids128bit = []; - let i = 0; - if (name && name.length) { - scanDataLength += 2 + name.length; - } - if (serviceUuids && serviceUuids.length) { - for (i = 0; i < serviceUuids.length; i++) { - const serviceUuid = Buffer.from(serviceUuids[i] - .match(/.{1,2}/g) - .reverse() - .join(''), 'hex'); - if (serviceUuid.length === 2) { - serviceUuids16bit.push(serviceUuid); - } - else if (serviceUuid.length === 16) { - serviceUuids128bit.push(serviceUuid); - } + async startAdvertising(name, serviceUuids) { + let advertisementDataLength = 3; + let scanDataLength = 0; + const serviceUuids16bit = []; + const serviceUuids128bit = []; + let i = 0; + if (name && name.length) { + scanDataLength += 2 + name.length; + } + if (serviceUuids && serviceUuids.length) { + for (i = 0; i < serviceUuids.length; i++) { + const serviceUuid = Buffer.from(serviceUuids[i] + .match(/.{1,2}/g) + .reverse() + .join(''), 'hex'); + if (serviceUuid.length === 2) { + serviceUuids16bit.push(serviceUuid); } - } - if (serviceUuids16bit.length) { - advertisementDataLength += 2 + 2 * serviceUuids16bit.length; - } - if (serviceUuids128bit.length) { - advertisementDataLength += 2 + 16 * serviceUuids128bit.length; - } - const advertisementData = Buffer.alloc(advertisementDataLength); - const scanData = Buffer.alloc(scanDataLength); - // flags - advertisementData.writeUInt8(2, 0); - advertisementData.writeUInt8(0x01, 1); - advertisementData.writeUInt8(0x06, 2); - let advertisementDataOffset = 3; - if (serviceUuids16bit.length) { - advertisementData.writeUInt8(1 + 2 * serviceUuids16bit.length, advertisementDataOffset); - advertisementDataOffset++; - advertisementData.writeUInt8(0x03, advertisementDataOffset); - advertisementDataOffset++; - for (i = 0; i < serviceUuids16bit.length; i++) { - serviceUuids16bit[i].copy(advertisementData, advertisementDataOffset); - advertisementDataOffset += serviceUuids16bit[i].length; + else if (serviceUuid.length === 16) { + serviceUuids128bit.push(serviceUuid); } } - if (serviceUuids128bit.length) { - advertisementData.writeUInt8(1 + 16 * serviceUuids128bit.length, advertisementDataOffset); - advertisementDataOffset++; - advertisementData.writeUInt8(0x06, advertisementDataOffset); - advertisementDataOffset++; - for (i = 0; i < serviceUuids128bit.length; i++) { - serviceUuids128bit[i].copy(advertisementData, advertisementDataOffset); - advertisementDataOffset += serviceUuids128bit[i].length; - } + } + if (serviceUuids16bit.length) { + advertisementDataLength += 2 + 2 * serviceUuids16bit.length; + } + if (serviceUuids128bit.length) { + advertisementDataLength += 2 + 16 * serviceUuids128bit.length; + } + const advertisementData = Buffer.alloc(advertisementDataLength); + const scanData = Buffer.alloc(scanDataLength); + // flags + advertisementData.writeUInt8(2, 0); + advertisementData.writeUInt8(0x01, 1); + advertisementData.writeUInt8(0x06, 2); + let advertisementDataOffset = 3; + if (serviceUuids16bit.length) { + advertisementData.writeUInt8(1 + 2 * serviceUuids16bit.length, advertisementDataOffset); + advertisementDataOffset++; + advertisementData.writeUInt8(0x03, advertisementDataOffset); + advertisementDataOffset++; + for (i = 0; i < serviceUuids16bit.length; i++) { + serviceUuids16bit[i].copy(advertisementData, advertisementDataOffset); + advertisementDataOffset += serviceUuids16bit[i].length; } - // name - if (name && name.length) { - const nameBuffer = Buffer.from(name); - scanData.writeUInt8(1 + nameBuffer.length, 0); - scanData.writeUInt8(0x08, 1); - nameBuffer.copy(scanData, 2); + } + if (serviceUuids128bit.length) { + advertisementData.writeUInt8(1 + 16 * serviceUuids128bit.length, advertisementDataOffset); + advertisementDataOffset++; + advertisementData.writeUInt8(0x06, advertisementDataOffset); + advertisementDataOffset++; + for (i = 0; i < serviceUuids128bit.length; i++) { + serviceUuids128bit[i].copy(advertisementData, advertisementDataOffset); + advertisementDataOffset += serviceUuids128bit[i].length; } - yield this.startAdvertisingWithEIRData(advertisementData, scanData); - }); + } + // name + if (name && name.length) { + const nameBuffer = Buffer.from(name); + scanData.writeUInt8(1 + nameBuffer.length, 0); + scanData.writeUInt8(0x08, 1); + nameBuffer.copy(scanData, 2); + } + await this.startAdvertisingWithEIRData(advertisementData, scanData); } - startAdvertisingWithEIRData(advertisementData = Buffer.alloc(0), scanData = Buffer.alloc(0)) { - return __awaiter(this, void 0, void 0, function* () { - if (advertisementData.length > 31) { - throw new Error('Advertisement data is over maximum limit of 31 bytes'); - } - else if (scanData.length > 31) { - throw new Error('Scan data is over maximum limit of 31 bytes'); - } - this.advertiseState = 'starting'; - try { - yield this.hci.setAdvertisingEnabled(false); - } - catch (_a) { - // NO-OP - } - if (IS_INTEL_EDISON || IS_YOCTO) { - // work around for Intel Edison - } - else { - yield this.hci.setScanResponseData(scanData); - yield this.hci.setAdvertisingData(advertisementData); - } - yield this.hci.setAdvertisingEnabled(true); - yield this.hci.setScanResponseData(scanData); - yield this.hci.setAdvertisingData(advertisementData); - this.advertiseState = 'started'; - }); + async startAdvertisingWithEIRData(advertisementData = Buffer.alloc(0), scanData = Buffer.alloc(0)) { + if (advertisementData.length > 31) { + throw new Error('Advertisement data is over maximum limit of 31 bytes'); + } + else if (scanData.length > 31) { + throw new Error('Scan data is over maximum limit of 31 bytes'); + } + this.advertiseState = 'starting'; + try { + await this.hci.setAdvertisingEnabled(false); + } + catch { + // NO-OP + } + if (IS_INTEL_EDISON || IS_YOCTO) { + // work around for Intel Edison + } + else { + await this.hci.setScanResponseData(scanData); + await this.hci.setAdvertisingData(advertisementData); + } + await this.hci.setAdvertisingEnabled(true); + await this.hci.setScanResponseData(scanData); + await this.hci.setAdvertisingData(advertisementData); + this.advertiseState = 'started'; } - stopAdvertising() { - return __awaiter(this, void 0, void 0, function* () { - this.advertiseState = 'stopping'; - yield this.hci.setAdvertisingEnabled(false); - this.advertiseState = 'stopped'; - }); + async stopAdvertising() { + this.advertiseState = 'stopping'; + await this.hci.setAdvertisingEnabled(false); + this.advertiseState = 'stopped'; } } -exports.Gap = Gap; //# sourceMappingURL=Gap.js.map \ No newline at end of file diff --git a/lib/bindings/hci/misc/Gap.js.map b/lib/bindings/hci/misc/Gap.js.map index f07595f2..99c7b1d3 100644 --- a/lib/bindings/hci/misc/Gap.js.map +++ b/lib/bindings/hci/misc/Gap.js.map @@ -1 +1 @@ -{"version":3,"file":"Gap.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/Gap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,2DAAkD;AAMlD,MAAM,WAAW,GAAG,YAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,IAAI,YAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrF,MAAM,QAAQ,GAAG,YAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC;AAC3C,MAAM,eAAe,GAAG,QAAQ,IAAI,YAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1E,MAAM,QAAQ,GAAG,QAAQ,IAAI,YAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AA+BlE,MAAa,GAAI,SAAQ,iCAAuB;IAO/C,YAAmB,GAAQ;QAC1B,KAAK,EAAE,CAAC;QAuKD,6BAAwB,GAAG,CAClC,IAAY,EACZ,OAAe,EACf,WAAwB,EACxB,GAAW,EACX,IAAY,EACX,EAAE;YACH,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAE3D,MAAM,aAAa,GAAG,CAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,aAAa,KAAI;gBAC5D,SAAS,EAAE,SAAS;gBACpB,YAAY,EAAE,SAAS;gBACvB,gBAAgB,EAAE,SAAS;gBAC3B,WAAW,EAAE,EAAE;gBACf,YAAY,EAAE,EAAE;gBAChB,wBA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A+B;SAC/B;aAAM;YACN,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YAC7C,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;SACrD;QAED,MAAM,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;QAErD,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,eAAe;QAC3B,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC;QAEjC,MAAM,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IACjC,CAAC;CAwLD"} \ No newline at end of file diff --git a/lib/bindings/hci/misc/Hci.js b/lib/bindings/hci/misc/Hci.js index 40dae7ec..737a6d56 100644 --- a/lib/bindings/hci/misc/Hci.js +++ b/lib/bindings/hci/misc/Hci.js @@ -1,19 +1,7 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Hci = void 0; -const async_mutex_1 = require("async-mutex"); -const tiny_typed_emitter_1 = require("tiny-typed-emitter"); -const HciError_1 = require("./HciError"); -const HciStatus_1 = require("./HciStatus"); +import { Mutex, withTimeout } from 'async-mutex'; +import { TypedEmitter } from 'tiny-typed-emitter'; +import { HciError } from './HciError'; +import { HciStatus } from './HciStatus'; // eslint-disable-next-line @typescript-eslint/no-var-requires const BluetoothHciSocket = require('@abandonware/bluetooth-hci-socket'); // tslint:disable: no-bitwise @@ -86,12 +74,12 @@ const LE_SET_ADVERTISE_ENABLE_CMD = OCF_LE_SET_ADVERTISE_ENABLE | (OGF_LE_CTL << // const LE_LTK_NEG_REPLY_CMD = OCF_LE_LTK_NEG_REPLY | (OGF_LE_CTL << 10); const HCI_OE_USER_ENDED_CONNECTION = 0x13; const HCI_CMD_TIMEOUT = 10000; // in milliseconds -class Hci extends tiny_typed_emitter_1.TypedEmitter { +export class Hci extends TypedEmitter { constructor(deviceId, cmdTimeout = HCI_CMD_TIMEOUT) { super(); this.aclPacketQueue = []; this.isInitializing = false; - this.checkSocketState = () => __awaiter(this, void 0, void 0, function* () { + this.checkSocketState = async () => { const isUp = this.socket && this.socket.isDevUp(); if (isUp !== this.isSocketUp) { // If the hci socket state changed the initialize or cleanup our connection @@ -101,23 +89,23 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { try { // Socket is now up this.setSocketFilter(); - yield this.reset(); + await this.reset(); if (this.state === 'unauthorized') { - throw new HciError_1.HciError('Not authorized'); + throw new HciError('Not authorized'); } - yield this.setEventMask(); - yield this.setLeEventMask(); - const { hciVer, hciRev } = yield this.readLocalVersion(); + await this.setEventMask(); + await this.setLeEventMask(); + const { hciVer, hciRev } = await this.readLocalVersion(); this.hciVersion = hciVer; this.hciRevision = hciRev; if (hciVer < 0x06) { - throw new HciError_1.HciError(`HCI version ${hciVer}.${hciRev} not supported`); + throw new HciError(`HCI version ${hciVer}.${hciRev} not supported`); } - yield this.writeLeHostSupported(); - yield this.readLeHostSupported(); - yield this.readBufferSize(); - yield this.readLeBufferSize(); - yield this.readBdAddr(); + await this.writeLeHostSupported(); + await this.readLeHostSupported(); + await this.readBufferSize(); + await this.readLeBufferSize(); + await this.readBdAddr(); this.state = 'poweredOn'; this.emit('stateChange', this.state); } @@ -138,7 +126,7 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { this.emit('stateChange', this.state); } } - }); + }; this.onSocketData = (data) => { const eventType = data.readUInt8(0); const eventData = data.slice(1); @@ -173,71 +161,64 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { this.setMaxListeners(40); this.handles = new Map(); this.cmdTimeout = cmdTimeout; - this.mutex = async_mutex_1.withTimeout(new async_mutex_1.Mutex(), this.cmdTimeout, new HciError_1.HciError(`HCI command mutex timeout`)); + this.mutex = withTimeout(new Mutex(), this.cmdTimeout, new HciError(`HCI command mutex timeout`)); this.currentCmd = null; } static getDeviceList() { const socket = new BluetoothHciSocket(); return socket.getDeviceList(); } - acquireMutex() { - var _a; - return __awaiter(this, void 0, void 0, function* () { - try { - const release = yield this.mutex.acquire(); - this.mutexStack = new Error(); - return release; - } - catch (_b) { - throw new HciError_1.HciError(`Could not acquire HCI command mutex`, (_a = this.mutexStack) === null || _a === void 0 ? void 0 : _a.stack); - } - }); + async acquireMutex() { + try { + const release = await this.mutex.acquire(); + this.mutexStack = new Error(); + return release; + } + catch { + throw new HciError(`Could not acquire HCI command mutex`, this.mutexStack?.stack); + } } - init(timeoutInSeconds = 2) { - return __awaiter(this, void 0, void 0, function* () { - if (this.isSocketUp) { - return; - } - if (this.isInitializing) { - return this.waitForInit(timeoutInSeconds); - } - this.socket = new BluetoothHciSocket(); - this.socket.on('data', this.onSocketData); - this.socket.on('error', this.onSocketError); - this.deviceId = this.socket.bindRaw(this.deviceId); - this.socket.start(); - this.isInitializing = true; - this.socketTimer = setInterval(this.checkSocketState, 1000); - this.checkSocketState(); + async init(timeoutInSeconds = 2) { + if (this.isSocketUp) { + return; + } + if (this.isInitializing) { return this.waitForInit(timeoutInSeconds); - }); - } - waitForInit(timeoutInSeconds) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - this.off('error', errorHandler); - this.off('stateChange', stateChangeHandler); - reject(new HciError_1.HciError(`Initializing socket timed out - Are you sure it's running?`, `On unix try \`sudo hciconfig hci${this.deviceId} up\``)); - }, timeoutInSeconds * 1000); - const stateChangeHandler = (newState) => { - clearTimeout(timeout); - this.off('error', errorHandler); - if (newState === 'poweredOn') { - resolve(); - } - else { - reject(new Error(`Socket state is ${newState}`)); - } - }; - this.once('stateChange', stateChangeHandler); - const errorHandler = (error) => { - clearTimeout(timeout); - this.off('stateChange', stateChangeHandler); - reject(new Error(`Error while initializing: ${error}`)); - }; - this.once('error', errorHandler); - }); + } + this.socket = new BluetoothHciSocket(); + this.socket.on('data', this.onSocketData); + this.socket.on('error', this.onSocketError); + this.deviceId = this.socket.bindRaw(this.deviceId); + this.socket.start(); + this.isInitializing = true; + this.socketTimer = setInterval(this.checkSocketState, 1000); + this.checkSocketState(); + return this.waitForInit(timeoutInSeconds); + } + async waitForInit(timeoutInSeconds) { + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => { + this.off('error', errorHandler); + this.off('stateChange', stateChangeHandler); + reject(new HciError(`Initializing socket timed out - Are you sure it's running?`, `On unix try \`sudo hciconfig hci${this.deviceId} up\``)); + }, timeoutInSeconds * 1000); + const stateChangeHandler = (newState) => { + clearTimeout(timeout); + this.off('error', errorHandler); + if (newState === 'poweredOn') { + resolve(); + } + else { + reject(new Error(`Socket state is ${newState}`)); + } + }; + this.once('stateChange', stateChangeHandler); + const errorHandler = (error) => { + clearTimeout(timeout); + this.off('stateChange', stateChangeHandler); + reject(new Error(`Error while initializing: ${error}`)); + }; + this.once('error', errorHandler); }); } trackSentAclPackets(handleId, packets) { @@ -259,72 +240,70 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { this.isSocketUp = false; this.mutex.cancel(); } - sendCommand(data, statusOnly, customMutex) { - return __awaiter(this, void 0, void 0, function* () { - // Check if our socket is available - if (!this.isSocketUp) { - throw new HciError_1.HciError('HCI socket not available'); + async sendCommand(data, statusOnly, customMutex) { + // Check if our socket is available + if (!this.isSocketUp) { + throw new HciError('HCI socket not available'); + } + const release = customMutex ? null : await this.acquireMutex(); + // Our socket might have been disposed while waiting for the mutex + if (!this.isSocketUp) { + if (release) { + release(); } - const release = customMutex ? null : yield this.acquireMutex(); - // Our socket might have been disposed while waiting for the mutex - if (!this.isSocketUp) { - if (release) { - release(); + throw new HciError('HCI socket not available'); + } + const origScope = new Error(); + return new Promise((resolve, reject) => { + let timeout; + const onComplete = (status, responseData) => { + if (status !== 0) { + const errStatus = `${HciStatus[status]} (0x${status.toString(16).padStart(2, '0')})`; + rejectHandler(new HciError(`HCI Command ${this.currentCmd.cmd} failed`, errStatus)); } - throw new HciError_1.HciError('HCI socket not available'); - } - const origScope = new Error(); - return new Promise((resolve, reject) => { - let timeout; - const onComplete = (status, responseData) => { - if (status !== 0) { - const errStatus = `${HciStatus_1.HciStatus[status]} (0x${status.toString(16).padStart(2, '0')})`; - rejectHandler(new HciError_1.HciError(`HCI Command ${this.currentCmd.cmd} failed`, errStatus)); - } - else { - resolveHandler(responseData); - } - }; - const cleanup = () => { - if (statusOnly) { - this.off('cmdStatus', onComplete); - } - else { - this.off('cmdComplete', onComplete); - } - this.mutexStack = null; - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - this.currentCmd = null; - if (release) { - release(); - } - }; - const resolveHandler = (response) => { - cleanup(); - resolve(response); - }; - const rejectHandler = (error) => { - if (error) { - error.stack = error.stack + '\n' + origScope.stack; - } - cleanup(); - reject(error); - }; - this.currentCmd = { cmd: data.readUInt16LE(1), data }; + else { + resolveHandler(responseData); + } + }; + const cleanup = () => { if (statusOnly) { - this.once('cmdStatus', onComplete); + this.off('cmdStatus', onComplete); } else { - this.once('cmdComplete', onComplete); + this.off('cmdComplete', onComplete); } - const timeoutError = new HciError_1.HciError(`HCI command timed out`); - timeout = setTimeout(() => rejectHandler(timeoutError), this.cmdTimeout); - // console.log('->', 'hci', data); - this.socket.write(data); - }); + this.mutexStack = null; + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + this.currentCmd = null; + if (release) { + release(); + } + }; + const resolveHandler = (response) => { + cleanup(); + resolve(response); + }; + const rejectHandler = (error) => { + if (error) { + error.stack = error.stack + '\n' + origScope.stack; + } + cleanup(); + reject(error); + }; + this.currentCmd = { cmd: data.readUInt16LE(1), data }; + if (statusOnly) { + this.once('cmdStatus', onComplete); + } + else { + this.once('cmdComplete', onComplete); + } + const timeoutError = new HciError(`HCI command timed out`); + timeout = setTimeout(() => rejectHandler(timeoutError), this.cmdTimeout); + // console.log('->', 'hci', data); + this.socket.write(data); }); } setSocketFilter() { @@ -343,317 +322,289 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { filter.writeUInt16LE(opcode, 12); this.socket.setFilter(filter); } - setEventMask() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(12); - const eventMask = Buffer.from('fffffbff07f8bf3d', 'hex'); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(SET_EVENT_MASK_CMD, 1); - // length - cmd.writeUInt8(eventMask.length, 3); - eventMask.copy(cmd, 4); - yield this.sendCommand(cmd); - }); - } - reset() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(4); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(RESET_CMD, 1); - // length - cmd.writeUInt8(0x00, 3); - yield this.sendCommand(cmd); - }); - } - readLocalVersion() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(4); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(READ_LOCAL_VERSION_CMD, 1); - // length - cmd.writeUInt8(0x0, 3); - const result = yield this.sendCommand(cmd); - const hciVer = result.readUInt8(0); - const hciRev = result.readUInt16LE(1); - const lmpVer = result.readInt8(3); - const manufacturer = result.readUInt16LE(4); - const lmpSubVer = result.readUInt16LE(6); - return { hciVer, hciRev, lmpVer, manufacturer, lmpSubVer }; - }); - } - readBdAddr() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(4); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(READ_BD_ADDR_CMD, 1); - // length - cmd.writeUInt8(0x0, 3); - const result = yield this.sendCommand(cmd); - this.addressType = 'public'; - this.address = result - .toString('hex') - .match(/.{1,2}/g) - .reverse() - .join(':') - .toLowerCase(); - }); - } - setLeEventMask() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(12); - const leEventMask = Buffer.from('1f00000000000000', 'hex'); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_SET_EVENT_MASK_CMD, 1); - // length - cmd.writeUInt8(leEventMask.length, 3); - leEventMask.copy(cmd, 4); - yield this.sendCommand(cmd); - }); - } - readLeHostSupported() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(4); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(READ_LE_HOST_SUPPORTED_CMD, 1); - // length - cmd.writeUInt8(0x00, 3); - const result = yield this.sendCommand(cmd); - const le = result.readUInt8(0) === 0x01; - const simul = result.readUInt8(1); - return { le, simul }; - }); - } - writeLeHostSupported() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(6); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(WRITE_LE_HOST_SUPPORTED_CMD, 1); - // length - cmd.writeUInt8(0x02, 3); - // data - cmd.writeUInt8(0x01, 4); // le - cmd.writeUInt8(0x00, 5); // simul - yield this.sendCommand(cmd); - }); - } - setScanParameters() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(11); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_SET_SCAN_PARAMETERS_CMD, 1); - // length - cmd.writeUInt8(0x07, 3); - // data - cmd.writeUInt8(0x01, 4); // type: 0 -> passive, 1 -> active - cmd.writeUInt16LE(0x0010, 5); // internal, ms * 1.6 - cmd.writeUInt16LE(0x0010, 7); // window, ms * 1.6 - cmd.writeUInt8(0x00, 9); // own address type: 0 -> public, 1 -> random - cmd.writeUInt8(0x00, 10); // filter: 0 -> all event types - yield this.sendCommand(cmd); - }); - } - setScanEnabled(enabled, filterDuplicates) { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(6); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_SET_SCAN_ENABLE_CMD, 1); - // length - cmd.writeUInt8(0x02, 3); - // data - cmd.writeUInt8(enabled ? 0x01 : 0x00, 4); // enable: 0 -> disabled, 1 -> enabled - cmd.writeUInt8(filterDuplicates ? 0x01 : 0x00, 5); // duplicates: 0 -> yes, 1 -> no - yield this.sendCommand(cmd); - }); - } - createLeConn(address, addressType, minInterval = 0x0006, maxInterval = 0x000c, latency = 0x0000, supervisionTimeout = 0x00c8) { - return __awaiter(this, void 0, void 0, function* () { - address = address.toLowerCase(); - const cmd = Buffer.alloc(29); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_CREATE_CONN_CMD, 1); - // length - cmd.writeUInt8(0x19, 3); - // data - cmd.writeUInt16LE(0x0060, 4); // interval - cmd.writeUInt16LE(0x0030, 6); // window - cmd.writeUInt8(0x00, 8); // initiator filter - cmd.writeUInt8(addressType === 'random' ? 0x01 : 0x00, 9); // peer address type - Buffer.from(address.split(':').reverse().join(''), 'hex').copy(cmd, 10); // peer address - cmd.writeUInt8(0x00, 16); // own address type - cmd.writeUInt16LE(minInterval, 17); // min interval - cmd.writeUInt16LE(maxInterval, 19); // max interval - cmd.writeUInt16LE(latency, 21); // latency - cmd.writeUInt16LE(supervisionTimeout, 23); // supervision timeout - cmd.writeUInt16LE(0x0004, 25); // min ce length - cmd.writeUInt16LE(0x0006, 27); // max ce length - const release = yield this.acquireMutex(); - try { - yield this.cancelLeConn(true); - } - catch (_a) { - // NO-OP - } - const origScope = new Error(); - return new Promise((resolve, reject) => { - let timeout; - const onComplete = (status, handle, role, _addressType, _address) => { - if (_address !== address || _addressType !== addressType) { - return; - } - if (status !== 0) { - const errStatus = `${HciStatus_1.HciStatus[status]} (0x${status.toString(16).padStart(2, '0')})`; - rejectHandler(new HciError_1.HciError(`LE conn failed`, errStatus)); - return; - } - if (role !== 0) { - rejectHandler(new HciError_1.HciError(`Could not acquire le connection as master role`)); - return; - } - resolveHandler(handle); - }; - const cleanup = () => { - this.off('leConnComplete', onComplete); - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - release(); - }; - const resolveHandler = (handle) => { - cleanup(); - resolve(handle); - }; - const rejectHandler = (error) => __awaiter(this, void 0, void 0, function* () { - cleanup(); - try { - yield this.cancelLeConn(true); - } - catch (_a) { - // NO-OP - } - if (error) { - error.stack = error.stack + '\n' + origScope.stack; - } - reject(error); - }); - this.on('leConnComplete', onComplete); - const timeoutError = new HciError_1.HciError(`Creating connection timed out`); - timeout = setTimeout(() => rejectHandler(timeoutError), 2 * this.cmdTimeout); - this.sendCommand(cmd, true, true).catch((err) => rejectHandler(err)); - }); - }); - } - cancelLeConn(customMutex) { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(4); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_CANCEL_CONN_CMD, 1); - // length - cmd.writeUInt8(0x00, 3); - yield this.sendCommand(cmd, false, customMutex); - }); + async setEventMask() { + const cmd = Buffer.alloc(12); + const eventMask = Buffer.from('fffffbff07f8bf3d', 'hex'); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(SET_EVENT_MASK_CMD, 1); + // length + cmd.writeUInt8(eventMask.length, 3); + eventMask.copy(cmd, 4); + await this.sendCommand(cmd); + } + async reset() { + const cmd = Buffer.alloc(4); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(RESET_CMD, 1); + // length + cmd.writeUInt8(0x00, 3); + await this.sendCommand(cmd); + } + async readLocalVersion() { + const cmd = Buffer.alloc(4); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(READ_LOCAL_VERSION_CMD, 1); + // length + cmd.writeUInt8(0x0, 3); + const result = await this.sendCommand(cmd); + const hciVer = result.readUInt8(0); + const hciRev = result.readUInt16LE(1); + const lmpVer = result.readInt8(3); + const manufacturer = result.readUInt16LE(4); + const lmpSubVer = result.readUInt16LE(6); + return { hciVer, hciRev, lmpVer, manufacturer, lmpSubVer }; + } + async readBdAddr() { + const cmd = Buffer.alloc(4); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(READ_BD_ADDR_CMD, 1); + // length + cmd.writeUInt8(0x0, 3); + const result = await this.sendCommand(cmd); + this.addressType = 'public'; + this.address = result + .toString('hex') + .match(/.{1,2}/g) + .reverse() + .join(':') + .toLowerCase(); } - connUpdateLe(handle, minInterval, maxInterval, latency, supervisionTimeout) { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(18); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_CONN_UPDATE_CMD, 1); - // length - cmd.writeUInt8(0x0e, 3); - // data - cmd.writeUInt16LE(handle, 4); - cmd.writeUInt16LE(Math.floor(minInterval / 1.25), 6); // min interval - cmd.writeUInt16LE(Math.floor(maxInterval / 1.25), 8); // max interval - cmd.writeUInt16LE(latency, 10); // latency - cmd.writeUInt16LE(Math.floor(supervisionTimeout / 10), 12); // supervision timeout - cmd.writeUInt16LE(0x0000, 14); // min ce length - cmd.writeUInt16LE(0x0000, 16); // max ce length - yield this.sendCommand(cmd, true); + async setLeEventMask() { + const cmd = Buffer.alloc(12); + const leEventMask = Buffer.from('1f00000000000000', 'hex'); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_SET_EVENT_MASK_CMD, 1); + // length + cmd.writeUInt8(leEventMask.length, 3); + leEventMask.copy(cmd, 4); + await this.sendCommand(cmd); + } + async readLeHostSupported() { + const cmd = Buffer.alloc(4); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(READ_LE_HOST_SUPPORTED_CMD, 1); + // length + cmd.writeUInt8(0x00, 3); + const result = await this.sendCommand(cmd); + const le = result.readUInt8(0) === 0x01; + const simul = result.readUInt8(1); + return { le, simul }; + } + async writeLeHostSupported() { + const cmd = Buffer.alloc(6); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(WRITE_LE_HOST_SUPPORTED_CMD, 1); + // length + cmd.writeUInt8(0x02, 3); + // data + cmd.writeUInt8(0x01, 4); // le + cmd.writeUInt8(0x00, 5); // simul + await this.sendCommand(cmd); + } + async setScanParameters() { + const cmd = Buffer.alloc(11); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_SET_SCAN_PARAMETERS_CMD, 1); + // length + cmd.writeUInt8(0x07, 3); + // data + cmd.writeUInt8(0x01, 4); // type: 0 -> passive, 1 -> active + cmd.writeUInt16LE(0x0010, 5); // internal, ms * 1.6 + cmd.writeUInt16LE(0x0010, 7); // window, ms * 1.6 + cmd.writeUInt8(0x00, 9); // own address type: 0 -> public, 1 -> random + cmd.writeUInt8(0x00, 10); // filter: 0 -> all event types + await this.sendCommand(cmd); + } + async setScanEnabled(enabled, filterDuplicates) { + const cmd = Buffer.alloc(6); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_SET_SCAN_ENABLE_CMD, 1); + // length + cmd.writeUInt8(0x02, 3); + // data + cmd.writeUInt8(enabled ? 0x01 : 0x00, 4); // enable: 0 -> disabled, 1 -> enabled + cmd.writeUInt8(filterDuplicates ? 0x01 : 0x00, 5); // duplicates: 0 -> yes, 1 -> no + await this.sendCommand(cmd); + } + async createLeConn(address, addressType, minInterval = 0x0006, maxInterval = 0x000c, latency = 0x0000, supervisionTimeout = 0x00c8) { + address = address.toLowerCase(); + const cmd = Buffer.alloc(29); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_CREATE_CONN_CMD, 1); + // length + cmd.writeUInt8(0x19, 3); + // data + cmd.writeUInt16LE(0x0060, 4); // interval + cmd.writeUInt16LE(0x0030, 6); // window + cmd.writeUInt8(0x00, 8); // initiator filter + cmd.writeUInt8(addressType === 'random' ? 0x01 : 0x00, 9); // peer address type + Buffer.from(address.split(':').reverse().join(''), 'hex').copy(cmd, 10); // peer address + cmd.writeUInt8(0x00, 16); // own address type + cmd.writeUInt16LE(minInterval, 17); // min interval + cmd.writeUInt16LE(maxInterval, 19); // max interval + cmd.writeUInt16LE(latency, 21); // latency + cmd.writeUInt16LE(supervisionTimeout, 23); // supervision timeout + cmd.writeUInt16LE(0x0004, 25); // min ce length + cmd.writeUInt16LE(0x0006, 27); // max ce length + const release = await this.acquireMutex(); + try { + await this.cancelLeConn(true); + } + catch { + // NO-OP + } + const origScope = new Error(); + return new Promise((resolve, reject) => { + let timeout; + const onComplete = (status, handle, role, _addressType, _address) => { + if (_address !== address || _addressType !== addressType) { + return; + } + if (status !== 0) { + const errStatus = `${HciStatus[status]} (0x${status.toString(16).padStart(2, '0')})`; + rejectHandler(new HciError(`LE conn failed`, errStatus)); + return; + } + if (role !== 0) { + rejectHandler(new HciError(`Could not acquire le connection as master role`)); + return; + } + resolveHandler(handle); + }; + const cleanup = () => { + this.off('leConnComplete', onComplete); + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + release(); + }; + const resolveHandler = (handle) => { + cleanup(); + resolve(handle); + }; + const rejectHandler = async (error) => { + cleanup(); + try { + await this.cancelLeConn(true); + } + catch { + // NO-OP + } + if (error) { + error.stack = error.stack + '\n' + origScope.stack; + } + reject(error); + }; + this.on('leConnComplete', onComplete); + const timeoutError = new HciError(`Creating connection timed out`); + timeout = setTimeout(() => rejectHandler(timeoutError), 2 * this.cmdTimeout); + this.sendCommand(cmd, true, true).catch((err) => rejectHandler(err)); }); } - disconnect(handle, reason = HCI_OE_USER_ENDED_CONNECTION) { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(7); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(DISCONNECT_CMD, 1); - // length - cmd.writeUInt8(0x03, 3); - // data - cmd.writeUInt16LE(handle, 4); // handle - cmd.writeUInt8(reason, 6); // reason - const origScope = new Error(); - return new Promise((resolve, reject) => { - let timeout; - const onComplete = (status, _handle) => { - if (_handle !== handle) { - return; - } - this.off('disconnectComplete', onComplete); - if (status !== 0) { - const errStatus = `${HciStatus_1.HciStatus[status]} (0x${status.toString(16).padStart(2, '0')})`; - rejectHandler(new HciError_1.HciError(`Disconnect failed`, errStatus)); - return; - } - resolveHandler(); - }; - const cleanup = () => { - this.off('disconnectComplete', onComplete); - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - }; - const resolveHandler = () => { - cleanup(); - resolve(); - }; - const rejectHandler = (error) => { - if (error) { - error.stack = error.stack + '\n' + origScope.stack; - } - cleanup(); - reject(error); - }; - this.on('disconnectComplete', onComplete); - this.sendCommand(cmd, true).catch((err) => rejectHandler(err)); - }); + async cancelLeConn(customMutex) { + const cmd = Buffer.alloc(4); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_CANCEL_CONN_CMD, 1); + // length + cmd.writeUInt8(0x00, 3); + await this.sendCommand(cmd, false, customMutex); + } + async connUpdateLe(handle, minInterval, maxInterval, latency, supervisionTimeout) { + const cmd = Buffer.alloc(18); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_CONN_UPDATE_CMD, 1); + // length + cmd.writeUInt8(0x0e, 3); + // data + cmd.writeUInt16LE(handle, 4); + cmd.writeUInt16LE(Math.floor(minInterval / 1.25), 6); // min interval + cmd.writeUInt16LE(Math.floor(maxInterval / 1.25), 8); // max interval + cmd.writeUInt16LE(latency, 10); // latency + cmd.writeUInt16LE(Math.floor(supervisionTimeout / 10), 12); // supervision timeout + cmd.writeUInt16LE(0x0000, 14); // min ce length + cmd.writeUInt16LE(0x0000, 16); // max ce length + await this.sendCommand(cmd, true); + } + async disconnect(handle, reason = HCI_OE_USER_ENDED_CONNECTION) { + const cmd = Buffer.alloc(7); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(DISCONNECT_CMD, 1); + // length + cmd.writeUInt8(0x03, 3); + // data + cmd.writeUInt16LE(handle, 4); // handle + cmd.writeUInt8(reason, 6); // reason + const origScope = new Error(); + return new Promise((resolve, reject) => { + let timeout; + const onComplete = (status, _handle) => { + if (_handle !== handle) { + return; + } + this.off('disconnectComplete', onComplete); + if (status !== 0) { + const errStatus = `${HciStatus[status]} (0x${status.toString(16).padStart(2, '0')})`; + rejectHandler(new HciError(`Disconnect failed`, errStatus)); + return; + } + resolveHandler(); + }; + const cleanup = () => { + this.off('disconnectComplete', onComplete); + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + }; + const resolveHandler = () => { + cleanup(); + resolve(); + }; + const rejectHandler = (error) => { + if (error) { + error.stack = error.stack + '\n' + origScope.stack; + } + cleanup(); + reject(error); + }; + this.on('disconnectComplete', onComplete); + this.sendCommand(cmd, true).catch((err) => rejectHandler(err)); }); } - readRssi(handle) { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(6); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(READ_RSSI_CMD, 1); - // length - cmd.writeUInt8(0x02, 3); - // data - cmd.writeUInt16LE(handle, 4); // handle - const result = yield this.sendCommand(cmd); - const rssi = result.readInt8(2); - return rssi; - }); + async readRssi(handle) { + const cmd = Buffer.alloc(6); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(READ_RSSI_CMD, 1); + // length + cmd.writeUInt8(0x02, 3); + // data + cmd.writeUInt16LE(handle, 4); // handle + const result = await this.sendCommand(cmd); + const rssi = result.readInt8(2); + return rssi; } writeAclDataPkt(handleId, cid, data) { if (!this.isSocketUp) { - throw new HciError_1.HciError('HCI socket not available'); + throw new HciError('HCI socket not available'); } const handle = this.handles.get(handleId); if (!handle) { - throw new HciError_1.HciError(`Could not write ACL data`, 'Unknown handle id'); + throw new HciError(`Could not write ACL data`, 'Unknown handle id'); } let hf = handleId | (ACL_START_NO_FLUSH << 12); // l2cap PDU may be fragmented on hci level @@ -690,82 +641,72 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { this.socket.write(pkt); } } - readBufferSize() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(4); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(READ_BUFFER_SIZE_CMD, 1); - // length - cmd.writeUInt8(0x0, 3); - const response = yield this.sendCommand(cmd); - this.aclDataPacketLength = response.readUInt16LE(0); - // const syncDataPacketLength = response.readInt8(2); - this.totalNumAclDataPackets = response.readUInt16LE(3); - // const totalNumSyncDataPackets = response.readUInt16LE(5); - }); - } - readLeBufferSize() { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(4); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_READ_BUFFER_SIZE_CMD, 1); - // length - cmd.writeUInt8(0x0, 3); - const response = yield this.sendCommand(cmd); - this.aclLeDataPacketLength = response.readUInt16LE(0); - if (this.aclLeDataPacketLength === 0) { - this.aclLeDataPacketLength = this.aclDataPacketLength; - } - this.totalNumAclLeDataPackets = response.readUInt8(2); - if (this.totalNumAclLeDataPackets === 0) { - this.totalNumAclLeDataPackets = this.totalNumAclDataPackets; - } - }); - } - setScanResponseData(data) { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(36); - cmd.fill(0x00); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_SET_SCAN_RESPONSE_DATA_CMD, 1); - // length - cmd.writeUInt8(32, 3); - // data - cmd.writeUInt8(data.length, 4); - data.copy(cmd, 5); - yield this.sendCommand(cmd); - }); - } - setAdvertisingData(data) { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(36); - cmd.fill(0x00); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_SET_ADVERTISING_DATA_CMD, 1); - // length - cmd.writeUInt8(32, 3); - // data - cmd.writeUInt8(data.length, 4); - data.copy(cmd, 5); - yield this.sendCommand(cmd); - }); + async readBufferSize() { + const cmd = Buffer.alloc(4); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(READ_BUFFER_SIZE_CMD, 1); + // length + cmd.writeUInt8(0x0, 3); + const response = await this.sendCommand(cmd); + this.aclDataPacketLength = response.readUInt16LE(0); + // const syncDataPacketLength = response.readInt8(2); + this.totalNumAclDataPackets = response.readUInt16LE(3); + // const totalNumSyncDataPackets = response.readUInt16LE(5); + } + async readLeBufferSize() { + const cmd = Buffer.alloc(4); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_READ_BUFFER_SIZE_CMD, 1); + // length + cmd.writeUInt8(0x0, 3); + const response = await this.sendCommand(cmd); + this.aclLeDataPacketLength = response.readUInt16LE(0); + if (this.aclLeDataPacketLength === 0) { + this.aclLeDataPacketLength = this.aclDataPacketLength; + } + this.totalNumAclLeDataPackets = response.readUInt8(2); + if (this.totalNumAclLeDataPackets === 0) { + this.totalNumAclLeDataPackets = this.totalNumAclDataPackets; + } } - setAdvertisingEnabled(enabled) { - return __awaiter(this, void 0, void 0, function* () { - const cmd = Buffer.alloc(5); - // header - cmd.writeUInt8(HCI_COMMAND_PKT, 0); - cmd.writeUInt16LE(LE_SET_ADVERTISE_ENABLE_CMD, 1); - // length - cmd.writeUInt8(0x01, 3); - // data - cmd.writeUInt8(enabled ? 0x01 : 0x00, 4); // enable: 0 -> disabled, 1 -> enabled - yield this.sendCommand(cmd); - }); + async setScanResponseData(data) { + const cmd = Buffer.alloc(36); + cmd.fill(0x00); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_SET_SCAN_RESPONSE_DATA_CMD, 1); + // length + cmd.writeUInt8(32, 3); + // data + cmd.writeUInt8(data.length, 4); + data.copy(cmd, 5); + await this.sendCommand(cmd); + } + async setAdvertisingData(data) { + const cmd = Buffer.alloc(36); + cmd.fill(0x00); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_SET_ADVERTISING_DATA_CMD, 1); + // length + cmd.writeUInt8(32, 3); + // data + cmd.writeUInt8(data.length, 4); + data.copy(cmd, 5); + await this.sendCommand(cmd); + } + async setAdvertisingEnabled(enabled) { + const cmd = Buffer.alloc(5); + // header + cmd.writeUInt8(HCI_COMMAND_PKT, 0); + cmd.writeUInt16LE(LE_SET_ADVERTISE_ENABLE_CMD, 1); + // length + cmd.writeUInt8(0x01, 3); + // data + cmd.writeUInt8(enabled ? 0x01 : 0x00, 4); // enable: 0 -> disabled, 1 -> enabled + await this.sendCommand(cmd); } handleEventPkt(data) { const eventType = data.readUInt8(0); @@ -808,7 +749,7 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { this.handles.delete(handleId); // Remove all pending packets for this handle from the queue this.aclPacketQueue = this.aclPacketQueue.filter(({ handle }) => handle.id !== handleId); - const reasonStr = `${HciStatus_1.HciStatus[reason]} (0x${reason.toString(16).padStart(2, '0')})`; + const reasonStr = `${HciStatus[reason]} (0x${reason.toString(16).padStart(2, '0')})`; this.emit('disconnectComplete', status, handleId, reasonStr); // Process acl packet queue because we may have more space now this.processAclPacketQueue(); @@ -897,7 +838,7 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { const supervisionTimeout = data.readUInt16LE(6) * 10; const handle = this.handles.get(handleId); if (!handle) { - this.emit('error', new HciError_1.HciError(`Received connection update packet for unknown handle ${handleId}`)); + this.emit('error', new HciError(`Received connection update packet for unknown handle ${handleId}`)); } if (status === 0) { handle.interval = interval; @@ -925,7 +866,7 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { data = data.slice(eirLength + 10); } } - catch (_a) { + catch { // TODO } } @@ -947,7 +888,7 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { } handleHardwareErrorPkt(data) { const errorCode = data.readUInt8(0); - this.emit('error', new HciError_1.HciError(`Hardware error`, `${errorCode}`)); + this.emit('error', new HciError(`Hardware error`, `${errorCode}`)); } handleAclDataPkt(data) { const flags = data.readUInt16LE(0) >> 12; @@ -1015,5 +956,4 @@ class Hci extends tiny_typed_emitter_1.TypedEmitter { this.emit('leAdvertiseEnable', advertiseEnabled); } } -exports.Hci = Hci; //# sourceMappingURL=Hci.js.map \ No newline at end of file diff --git a/lib/bindings/hci/misc/Hci.js.map b/lib/bindings/hci/misc/Hci.js.map index 5d8f6979..0e1bd07d 100644 --- a/lib/bindings/hci/misc/Hci.js.map +++ b/lib/bindings/hci/misc/Hci.js.map @@ -1 +1 @@ -{"version":3,"file":"Hci.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/Hci.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAiE;AACjE,2DAAkD;AAIlD,yCAAsC;AACtC,2CAAwC;AAExC,8DAA8D;AAC9D,MAAM,kBAAkB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAExE,6BAA6B;AAE7B,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,QAAQ,GAAG,IAAI,CAAC;AACtB,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,MAAM,oBAAoB,GAAG,IAAI,CA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CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;IAClD,CAAC;CAUD"} \ No newline at end of file diff --git a/lib/bindings/hci/misc/HciError.js b/lib/bindings/hci/misc/HciError.js index d0c4e114..892a5a9e 100644 --- a/lib/bindings/hci/misc/HciError.js +++ b/lib/bindings/hci/misc/HciError.js @@ -1,12 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciError = void 0; -class HciError extends Error { +export class HciError extends Error { constructor(message, details) { super(message); this.name = 'HciError'; this.details = details; } } -exports.HciError = HciError; //# sourceMappingURL=HciError.js.map \ No newline at end of file diff --git a/lib/bindings/hci/misc/HciError.js.map b/lib/bindings/hci/misc/HciError.js.map index 398068e2..a7e9a841 100644 --- a/lib/bindings/hci/misc/HciError.js.map +++ b/lib/bindings/hci/misc/HciError.js.map @@ -1 +1 @@ -{"version":3,"file":"HciError.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/HciError.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAS,SAAQ,KAAK;IAGlC,YAAmB,OAAe,EAAE,OAAgB;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD;AATD,4BASC"} \ No newline at end of file +{"version":3,"file":"HciError.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/HciError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGlC,YAAmB,OAAe,EAAE,OAAgB;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/misc/HciStatus.js b/lib/bindings/hci/misc/HciStatus.js index 403813f2..1b7d0ee5 100644 --- a/lib/bindings/hci/misc/HciStatus.js +++ b/lib/bindings/hci/misc/HciStatus.js @@ -1,7 +1,4 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HciStatus = void 0; -exports.HciStatus = [ +export const HciStatus = [ 'Success', 'Unknown HCI Command', 'Unknown Connection Identifier', diff --git a/lib/bindings/hci/misc/HciStatus.js.map b/lib/bindings/hci/misc/HciStatus.js.map index 5fbfeb08..df9b49d9 100644 --- a/lib/bindings/hci/misc/HciStatus.js.map +++ b/lib/bindings/hci/misc/HciStatus.js.map @@ -1 +1 @@ -{"version":3,"file":"HciStatus.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/HciStatus.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACxB,SAAS;IACT,qBAAqB;IACrB,+BAA+B;IAC/B,kBAAkB;IAClB,cAAc;IACd,wBAAwB;IACxB,oBAAoB;IACpB,0BAA0B;IAC1B,oBAAoB;IACpB,2BAA2B;IAC3B,mDAAmD;IACnD,+BAA+B;IAC/B,oBAAoB;IACpB,8CAA8C;IAC9C,6CAA6C;IAC7C,iDAAiD;IACjD,oCAAoC;IACpC,wCAAwC;IACxC,gCAAgC;IAChC,mCAAmC;IACnC,+CAA+C;IAC/C,2CAA2C;IAC3C,qCAAqC;IACrC,mBAAmB;IACnB,qBAAqB;IACrB,iBAAiB;IACjB,sDAAsD;IACtD,qBAAqB;IACrB,uBAAuB;IACvB,uBAAuB;IACvB,gDAAgD;IAChD,mBAAmB;IACnB,kEAAkE;IAClE,yBAAyB;IACzB,4CAA4C;IAC5C,iCAAiC;IACjC,qBAAqB;IACrB,gCAAgC;IAChC,4BAA4B;IAC5B,6BAA6B;IAC7B,gBAAgB;IAChB,qCAAqC;IACrC,iCAAiC;IACjC,UAAU;IACV,4BAA4B;IAC5B,cAAc;IACd,sCAAsC;IACtC,uBAAuB;IACvB,mCAAmC;IACnC,UAAU;IACV,qBAAqB;IACrB,UAAU;IACV,yBAAyB;IACzB,oBAAoB;IACpB,qCAAqC;IACrC,6CAA6C;IAC7C,qBAAqB;IACrB,sDAAsD;IACtD,iBAAiB;IACjB,oCAAoC;IACpC,8BAA8B;IAC9B,0CAA0C;IAC1C,qCAAqC;IACrC,uBAAuB;IACvB,8EAA8E;CAC9E,CAAC"} \ No newline at end of file +{"version":3,"file":"HciStatus.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/HciStatus.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,SAAS;IACT,qBAAqB;IACrB,+BAA+B;IAC/B,kBAAkB;IAClB,cAAc;IACd,wBAAwB;IACxB,oBAAoB;IACpB,0BAA0B;IAC1B,oBAAoB;IACpB,2BAA2B;IAC3B,mDAAmD;IACnD,+BAA+B;IAC/B,oBAAoB;IACpB,8CAA8C;IAC9C,6CAA6C;IAC7C,iDAAiD;IACjD,oCAAoC;IACpC,wCAAwC;IACxC,gCAAgC;IAChC,mCAAmC;IACnC,+CAA+C;IAC/C,2CAA2C;IAC3C,qCAAqC;IACrC,mBAAmB;IACnB,qBAAqB;IACrB,iBAAiB;IACjB,sDAAsD;IACtD,qBAAqB;IACrB,uBAAuB;IACvB,uBAAuB;IACvB,gDAAgD;IAChD,mBAAmB;IACnB,kEAAkE;IAClE,yBAAyB;IACzB,4CAA4C;IAC5C,iCAAiC;IACjC,qBAAqB;IACrB,gCAAgC;IAChC,4BAA4B;IAC5B,6BAA6B;IAC7B,gBAAgB;IAChB,qCAAqC;IACrC,iCAAiC;IACjC,UAAU;IACV,4BAA4B;IAC5B,cAAc;IACd,sCAAsC;IACtC,uBAAuB;IACvB,mCAAmC;IACnC,UAAU;IACV,qBAAqB;IACrB,UAAU;IACV,yBAAyB;IACzB,oBAAoB;IACpB,qCAAqC;IACrC,6CAA6C;IAC7C,qBAAqB;IACrB,sDAAsD;IACtD,iBAAiB;IACjB,oCAAoC;IACpC,8BAA8B;IAC9B,0CAA0C;IAC1C,qCAAqC;IACrC,uBAAuB;IACvB,8EAA8E;CAC9E,CAAC"} \ No newline at end of file diff --git a/lib/bindings/hci/misc/Signaling.js b/lib/bindings/hci/misc/Signaling.js index f75c6e64..729cb6d5 100644 --- a/lib/bindings/hci/misc/Signaling.js +++ b/lib/bindings/hci/misc/Signaling.js @@ -1,14 +1,8 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Signaling = void 0; -const os_1 = __importDefault(require("os")); +import os from 'os'; const CONNECTION_PARAMETER_UPDATE_REQUEST = 0x12; const CONNECTION_PARAMETER_UPDATE_RESPONSE = 0x13; const SIGNALING_CID = 0x0005; -class Signaling { +export class Signaling { constructor(hci, handle) { this.onAclStreamData = (handle, cid, data) => { if (handle !== this.handle || cid !== SIGNALING_CID) { @@ -38,7 +32,7 @@ class Signaling { const maxInterval = data.readUInt16LE(2) * 1.25; const latency = data.readUInt16LE(4); const supervisionTimeout = data.readUInt16LE(6) * 10; - if (os_1.default.platform() !== 'linux') { + if (os.platform() !== 'linux') { const response = Buffer.alloc(6); response.writeUInt8(CONNECTION_PARAMETER_UPDATE_RESPONSE, 0); // code response.writeUInt8(identifier, 1); // identifier @@ -52,5 +46,4 @@ class Signaling { } } } -exports.Signaling = Signaling; //# sourceMappingURL=Signaling.js.map \ No newline at end of file diff --git a/lib/bindings/hci/misc/Signaling.js.map b/lib/bindings/hci/misc/Signaling.js.map index 90f39e14..42fb9ce4 100644 --- a/lib/bindings/hci/misc/Signaling.js.map +++ b/lib/bindings/hci/misc/Signaling.js.map @@ -1 +1 @@ -{"version":3,"file":"Signaling.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/Signaling.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAIpB,MAAM,mCAAmC,GAAG,IAAI,CAAC;AACjD,MAAM,oCAAoC,GAAG,IAAI,CAAC;AAElD,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,M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AAQ,EAAE,KAAK,OAAO,EAAE;YAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAEjC,QAAQ,CAAC,UAAU,CAAC,oCAAoC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO;YACrE,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa;YACjD,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;YACvC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAE7B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;YAE/D,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;SAC5G;aAAM;YACN,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;SAC7C;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/hci/misc/hci-status.json b/lib/bindings/hci/misc/hci-status.json deleted file mode 100644 index 52283592..00000000 --- a/lib/bindings/hci/misc/hci-status.json +++ /dev/null @@ -1,67 +0,0 @@ -[ - "Success", - "Unknown HCI Command", - "Unknown Connection Identifier", - "Hardware Failure", - "Page Timeout", - "Authentication Failure", - "PIN or Key Missing", - "Memory Capacity Exceeded", - "Connection Timeout", - "Connection Limit Exceeded", - "Synchronous Connection Limit to a Device Exceeded", - "ACL Connection Already Exists", - "Command Disallowed", - "Connection Rejected due to Limited Resources", - "Connection Rejected due to Security Reasons", - "Connection Rejected due to Unacceptable BD_ADDR", - "Connection Accept Timeout Exceeded", - "Unsupported Feature or Parameter Value", - "Invalid HCI Command Parameters", - "Remote User Terminated Connection", - "Remote Device Terminated due to Low Resources", - "Remote Device Terminated due to Power Off", - "Connection Terminated By Local Host", - "Repeated Attempts", - "Pairing Not Allowed", - "Unknown LMP PDU", - "Unsupported Remote Feature / Unsupported LMP Feature", - "SCO Offset Rejected", - "SCO Interval Rejected", - "SCO Air Mode Rejected", - "Invalid LMP Parameters / Invalid LL Parameters", - "Unspecified Error", - "Unsupported LMP Parameter Value / Unsupported LL Parameter Value", - "Role Change Not Allowed", - "LMP Response Timeout / LL Response Timeout", - "LMP Error Transaction Collision", - "LMP PDU Not Allowed", - "Encryption Mode Not Acceptable", - "Link Key cannot be Changed", - "Requested QoS Not Supported", - "Instant Passed", - "Pairing With Unit Key Not Supported", - "Different Transaction Collision", - "Reserved", - "QoS Unacceptable Parameter", - "QoS Rejected", - "Channel Classification Not Supported", - "Insufficient Security", - "Parameter Out Of Manadatory Range", - "Reserved", - "Role Switch Pending", - "Reserved", - "Reserved Slot Violation", - "Role Switch Failed", - "Extended Inquiry Response Too Large", - "Secure Simple Pairing Not Supported By Host", - "Host Busy - Pairing", - "Connection Rejected due to No Suitable Channel Found", - "Controller Busy", - "Unacceptable Connection Parameters", - "Directed Advertising Timeout", - "Connection Terminated due to MIC Failure", - "Connection Failed to be Established", - "MAC Connection Failed", - "Coarse Clock Adjustment Rejected but Will Try to Adjust Using Clock Dragging" -] diff --git a/lib/bindings/hci/misc/index.js b/lib/bindings/hci/misc/index.js index bb42ce08..23cc7b45 100644 --- a/lib/bindings/hci/misc/index.js +++ b/lib/bindings/hci/misc/index.js @@ -1,10 +1,4 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Signaling = exports.Hci = exports.Gap = void 0; -var Gap_1 = require("./Gap"); -Object.defineProperty(exports, "Gap", { enumerable: true, get: function () { return Gap_1.Gap; } }); -var Hci_1 = require("./Hci"); -Object.defineProperty(exports, "Hci", { enumerable: true, get: function () { return Hci_1.Hci; } }); -var Signaling_1 = require("./Signaling"); -Object.defineProperty(exports, "Signaling", { enumerable: true, get: function () { return Signaling_1.Signaling; } }); +export { Gap } from './Gap'; +export { Hci } from './Hci'; +export { Signaling } from './Signaling'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/hci/misc/index.js.map b/lib/bindings/hci/misc/index.js.map index 1a20cbc3..a862d0f9 100644 --- a/lib/bindings/hci/misc/index.js.map +++ b/lib/bindings/hci/misc/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/index.ts"],"names":[],"mappings":";;;AACA,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,yCAAwC;AAA/B,sGAAA,SAAS,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bindings/hci/misc/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/lib/bindings/web/Adapter.js b/lib/bindings/web/Adapter.js index d5272fec..e59393fe 100644 --- a/lib/bindings/web/Adapter.js +++ b/lib/bindings/web/Adapter.js @@ -1,17 +1,5 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebAdapter = void 0; -const models_1 = require("../../models"); -class WebAdapter extends models_1.Adapter { +import { Adapter } from '../../models'; +export class WebAdapter extends Adapter { addDashes(uuid) { return (`${uuid.substring(0, 8)}-` + `${uuid.substring(8, 12)}-` + @@ -22,24 +10,22 @@ class WebAdapter extends models_1.Adapter { isScanning() { throw new Error('Method not implemented.'); } - startScanning(serviceUUIDs) { - return __awaiter(this, void 0, void 0, function* () { - const opts = { filters: [] }; - if (serviceUUIDs) { - // web bluetooth requires 4 char hex service names to be passed in as integers - const mappedServiceUUIDs = serviceUUIDs.map((service) => { - if (service.length === 4) { - return parseInt(`0x${service}`); - } - else if (service.length === 6 && service.indexOf('0x') === 0) { - return parseInt(service); - } - return this.addDashes(service); - }); - opts.filters = mappedServiceUUIDs.map((srv) => ({ services: [srv] })); - } - navigator.bluetooth.requestDevice(opts).then((dev) => console.log(dev)); - }); + async startScanning(serviceUUIDs) { + const opts = { filters: [] }; + if (serviceUUIDs) { + // web bluetooth requires 4 char hex service names to be passed in as integers + const mappedServiceUUIDs = serviceUUIDs.map((service) => { + if (service.length === 4) { + return parseInt(`0x${service}`); + } + else if (service.length === 6 && service.indexOf('0x') === 0) { + return parseInt(service); + } + return this.addDashes(service); + }); + opts.filters = mappedServiceUUIDs.map((srv) => ({ services: [srv] })); + } + navigator.bluetooth.requestDevice(opts).then((dev) => console.log(dev)); } stopScanning() { throw new Error('Method not implemented.'); @@ -60,5 +46,4 @@ class WebAdapter extends models_1.Adapter { throw new Error('Method not implemented.'); } } -exports.WebAdapter = WebAdapter; //# sourceMappingURL=Adapter.js.map \ No newline at end of file diff --git a/lib/bindings/web/Adapter.js.map b/lib/bindings/web/Adapter.js.map index 46bf2c70..ceb6843a 100644 --- a/lib/bindings/web/Adapter.js.map +++ b/lib/bindings/web/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../../src/bindings/web/Adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA8D;AAE9D,MAAa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AAE,YAAuB;QAClE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,eAAe;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS,CAAC,MAAe;QAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/web/MODblue.js b/lib/bindings/web/MODblue.js index 0417d7d4..a7dccc18 100644 --- a/lib/bindings/web/MODblue.js +++ b/lib/bindings/web/MODblue.js @@ -1,34 +1,17 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebMODblue = void 0; -const models_1 = require("../../models"); -const Adapter_1 = require("./Adapter"); +import { MODblue } from '../../models'; +import { WebAdapter } from './Adapter'; /** * Use the web-bluetooth bindings to access BLE functions. */ -class WebMODblue extends models_1.MODblue { - dispose() { - return __awaiter(this, void 0, void 0, function* () { - this.adapter = null; - }); +export class WebMODblue extends MODblue { + async dispose() { + this.adapter = null; } - getAdapters() { - return __awaiter(this, void 0, void 0, function* () { - if (!this.adapter) { - this.adapter = new Adapter_1.WebAdapter(this, 'web', 'web'); - } - return [this.adapter]; - }); + async getAdapters() { + if (!this.adapter) { + this.adapter = new WebAdapter(this, 'web', 'web'); + } + return [this.adapter]; } } -exports.WebMODblue = WebMODblue; //# sourceMappingURL=MODblue.js.map \ No newline at end of file diff --git a/lib/bindings/web/MODblue.js.map b/lib/bindings/web/MODblue.js.map index f280f40b..3f9a73fe 100644 --- a/lib/bindings/web/MODblue.js.map +++ b/lib/bindings/web/MODblue.js.map @@ -1 +1 @@ -{"version":3,"file":"MODblue.js","sourceRoot":"","sources":["../../../src/bindings/web/MODblue.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAgD;AAEhD,uCAAuC;AAEvC;;GAEG;AACH,MAAa,UAAW,SAAQ,gBAAO;IAGzB,OAAO;;YACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACrB,CAAC;KAAA;IAEY,WAAW;;YACvB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBAClB,IAAI,CAAC,OAAO,GAAG,IAAI,oBAAU,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;aAClD;YAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KAAA;CACD;AAdD,gCAcC"} \ No newline at end of file +{"version":3,"file":"MODblue.js","sourceRoot":"","sources":["../../../src/bindings/web/MODblue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAO;IAG/B,KAAK,CAAC,OAAO;QACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YAClB,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAClD;QAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/bindings/web/index.js b/lib/bindings/web/index.js index 6bf93ffa..9cba3ed2 100644 --- a/lib/bindings/web/index.js +++ b/lib/bindings/web/index.js @@ -1,8 +1,3 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebMODblue = exports.WebAdapter = void 0; -var Adapter_1 = require("./Adapter"); -Object.defineProperty(exports, "WebAdapter", { enumerable: true, get: function () { return Adapter_1.WebAdapter; } }); -var MODblue_1 = require("./MODblue"); -Object.defineProperty(exports, "WebMODblue", { enumerable: true, get: function () { return MODblue_1.WebMODblue; } }); +export { WebAdapter } from './Adapter'; +export { WebMODblue } from './MODblue'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/bindings/web/index.js.map b/lib/bindings/web/index.js.map index b91f5d31..6ec54ab5 100644 --- a/lib/bindings/web/index.js.map +++ b/lib/bindings/web/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bindings/web/index.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AACnB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bindings/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/lib/dbus.js b/lib/dbus.js index 8b00006d..32b6bb4a 100644 --- a/lib/dbus.js +++ b/lib/dbus.js @@ -1,14 +1,2 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./bindings/dbus"), exports); +export * from './bindings/dbus'; //# sourceMappingURL=dbus.js.map \ No newline at end of file diff --git a/lib/dbus.js.map b/lib/dbus.js.map index 043adb7f..0ee10236 100644 --- a/lib/dbus.js.map +++ b/lib/dbus.js.map @@ -1 +1 @@ -{"version":3,"file":"dbus.js","sourceRoot":"","sources":["../src/dbus.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAgC"} \ No newline at end of file +{"version":3,"file":"dbus.js","sourceRoot":"","sources":["../src/dbus.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"} \ No newline at end of file diff --git a/lib/hci.js b/lib/hci.js index be3cacde..bc085b8a 100644 --- a/lib/hci.js +++ b/lib/hci.js @@ -1,14 +1,2 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./bindings/hci"), exports); +export * from './bindings/hci'; //# sourceMappingURL=hci.js.map \ No newline at end of file diff --git a/lib/hci.js.map b/lib/hci.js.map index 26969b83..4f172669 100644 --- a/lib/hci.js.map +++ b/lib/hci.js.map @@ -1 +1 @@ -{"version":3,"file":"hci.js","sourceRoot":"","sources":["../src/hci.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B"} \ No newline at end of file +{"version":3,"file":"hci.js","sourceRoot":"","sources":["../src/hci.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index 4c149e14..10e504ef 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,14 +1,2 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./models"), exports); +export * from './models'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/index.js.map b/lib/index.js.map index 5cdde711..cd0094de 100644 --- a/lib/index.js.map +++ b/lib/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"} \ No newline at end of file diff --git a/lib/models/Adapter.js b/lib/models/Adapter.js index d7305066..2347ddaa 100644 --- a/lib/models/Adapter.js +++ b/lib/models/Adapter.js @@ -1,24 +1,12 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Adapter = void 0; -const tiny_typed_emitter_1 = require("tiny-typed-emitter"); -const util_1 = require("util"); -class Adapter extends tiny_typed_emitter_1.TypedEmitter { +import { TypedEmitter } from 'tiny-typed-emitter'; +import { inspect } from 'util'; +export class Adapter extends TypedEmitter { constructor(modblue, id, name, address) { super(); this.modblue = modblue; this.id = id; this._name = name || `hci${id.replace('hci', '')}`; - this._address = address === null || address === void 0 ? void 0 : address.toLowerCase(); + this._address = address?.toLowerCase(); } /** * The public name of this adapter. @@ -45,40 +33,38 @@ class Adapter extends tiny_typed_emitter_1.TypedEmitter { * @param timeoutInSeconds The timeout in seconds. The returned promise will reject once the timeout is reached. * @param serviceUUIDs The UUIDs of the {@link GattServiceRemote}s that must be contained in the advertisement data. */ - scanFor(isTarget, timeoutInSeconds = 10, serviceUUIDs) { - return __awaiter(this, void 0, void 0, function* () { - const origScope = new Error(); - return new Promise((resolve, reject) => { - let timeout; - const onDiscover = (peripheral) => { - if (isTarget(peripheral)) { - resolveHandler(peripheral); - } - }; - const cleanup = () => { - this.stopScanning(); - this.off('discover', onDiscover); - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - }; - const resolveHandler = (peripheral) => { - cleanup(); - resolve(peripheral); - }; - const rejectHandler = (error) => __awaiter(this, void 0, void 0, function* () { - cleanup(); - if (error) { - error.stack = error.stack + '\n' + origScope.stack; - } - reject(error); - }); - this.on('discover', onDiscover); - this.startScanning(serviceUUIDs, true).catch((err) => rejectHandler(err)); - const timeoutError = new Error(`Scanning timed out`); - timeout = setTimeout(() => rejectHandler(timeoutError), timeoutInSeconds * 1000); - }); + async scanFor(isTarget, timeoutInSeconds = 10, serviceUUIDs) { + const origScope = new Error(); + return new Promise((resolve, reject) => { + let timeout; + const onDiscover = (peripheral) => { + if (isTarget(peripheral)) { + resolveHandler(peripheral); + } + }; + const cleanup = () => { + this.stopScanning(); + this.off('discover', onDiscover); + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + }; + const resolveHandler = (peripheral) => { + cleanup(); + resolve(peripheral); + }; + const rejectHandler = async (error) => { + cleanup(); + if (error) { + error.stack = error.stack + '\n' + origScope.stack; + } + reject(error); + }; + this.on('discover', onDiscover); + this.startScanning(serviceUUIDs, true).catch((err) => rejectHandler(err)); + const timeoutError = new Error(`Scanning timed out`); + timeout = setTimeout(() => rejectHandler(timeoutError), timeoutInSeconds * 1000); }); } toString() { @@ -91,16 +77,15 @@ class Adapter extends tiny_typed_emitter_1.TypedEmitter { address: this.address }; } - [util_1.inspect.custom](depth, options) { + [inspect.custom](depth, options) { const name = this.constructor.name; if (depth < 0) { return options.stylize(`[${name}]`, 'special'); } - const newOptions = Object.assign(Object.assign({}, options), { depth: options.depth === null ? null : options.depth - 1 }); + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; const padding = ' '.repeat(name.length + 1); - const inner = util_1.inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); + const inner = inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); return `${options.stylize(name, 'special')} ${inner}`; } } -exports.Adapter = Adapter; //# sourceMappingURL=Adapter.js.map \ No newline at end of file diff --git a/lib/models/Adapter.js.map b/lib/models/Adapter.js.map index 6cff01ba..6678edfe 100644 --- a/lib/models/Adapter.js.map +++ b/lib/models/Adapter.js.map @@ -1 +1 @@ -{"version":3,"file":"Adapter.js","sourceRoot":"","sources":["../../src/models/Adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAkD;AAClD,+BAA+B;AAc/B,MAAsB,OAAQ,SAAQ,iCAA2B;IAmChE,YAAmB,OAAgB,EAAE,EAAU,EAAE,IAAa,EAAE,OAAgB;QAC/E,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAE,CAAC;IACxC,CAAC;IA9BD;;OAEG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,CAAC;IA8CM,QAAQ;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,CAAC;IAEM,MAAM;QACZ,OAAO;YACN,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;IAEM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAa,EAAE,OAAY;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEnC,IAAI,KAAK,GAAG,CAAC,EAAE;YACd,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,EAAE,SAAS,CAAC,CAAC;SAC/C;QAED,MAAM,UAAU,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;QAE5F,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC,CAAC;QAChF,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE,CAAC;IACvD,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/AddressType.js b/lib/models/AddressType.js index 933739f3..4f618b78 100644 --- a/lib/models/AddressType.js +++ b/lib/models/AddressType.js @@ -1,3 +1,2 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //# sourceMappingURL=AddressType.js.map \ No newline at end of file diff --git a/lib/models/MODblue.js b/lib/models/MODblue.js index a7748f3f..8c799332 100644 --- a/lib/models/MODblue.js +++ b/lib/models/MODblue.js @@ -1,19 +1,15 @@ -"use strict"; /* eslint-disable @typescript-eslint/no-var-requires */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MODblue = void 0; /** * Main class to interface with BLE. * Scan for adapters and use an adapter to perform specific actions. */ -class MODblue { +export class MODblue { /** * Tries to automatically detect the current platform and use the most appropriate BLE bindings. * @returns The MODblue instance for this platform */ static autoDetectBindings() { - var _a; - const platform = (_a = require('os')) === null || _a === void 0 ? void 0 : _a.platform(); + const platform = require('os')?.platform(); if (typeof navigator !== 'undefined' && navigator.bluetooth) { console.log('using web'); return new (require('../bindings/web').WebMODblue)(); @@ -31,5 +27,4 @@ class MODblue { } } } -exports.MODblue = MODblue; //# sourceMappingURL=MODblue.js.map \ No newline at end of file diff --git a/lib/models/MODblue.js.map b/lib/models/MODblue.js.map index 34f7d426..9336677e 100644 --- a/lib/models/MODblue.js.map +++ b/lib/models/MODblue.js.map @@ -1 +1 @@ -{"version":3,"file":"MODblue.js","sourceRoot":"","sources":["../../src/models/MODblue.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAIvD;;;GAGG;AACH,MAAsB,OAAO;IAW5B;;;OAGG;IACI,MAAM,CAAC,kBAAkB;;QAC/B,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,0CAAE,QAAQ,EAAE,CAAC;QAE3C,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,SAAS,EAAE;YAC5D,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;SACrD,CAAC;;;WAGC;aAAM,IACR,QAAQ,KAAK,OAAO;YACpB,QAAQ,KAAK,SAAS;YACtB,QAAQ,KAAK,OAAO,EACnB;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;SACrD;aAAM;YACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACxC;IACF,CAAC;CACD;AAlCD,0BAkCC"} \ No newline at end of file +{"version":3,"file":"MODblue.js","sourceRoot":"","sources":["../../src/models/MODblue.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAIvD;;;GAGG;AACH,MAAM,OAAgB,OAAO;IAW5B;;;OAGG;IACI,MAAM,CAAC,kBAAkB;QAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;QAE3C,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,SAAS,EAAE;YAC5D,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;SACrD,CAAC;;;WAGC;aAAM,IACR,QAAQ,KAAK,OAAO;YACpB,QAAQ,KAAK,SAAS;YACtB,QAAQ,KAAK,OAAO,EACnB;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;SACrD;aAAM;YACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACxC;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/Peripheral.js b/lib/models/Peripheral.js index de550465..c7555636 100644 --- a/lib/models/Peripheral.js +++ b/lib/models/Peripheral.js @@ -1,11 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Peripheral = void 0; -const util_1 = require("util"); +import { inspect } from 'util'; /** * Represents a peripheral that was found during scanning. */ -class Peripheral { +export class Peripheral { constructor(adapter, uuid, addressType, address, advertisement, rssi) { this.adapter = adapter; this.uuid = uuid; @@ -34,16 +31,15 @@ class Peripheral { adapter: this.adapter }; } - [util_1.inspect.custom](depth, options) { + [inspect.custom](depth, options) { const name = this.constructor.name; if (depth < 0) { return options.stylize(`[${name}]`, 'special'); } - const newOptions = Object.assign(Object.assign({}, options), { depth: options.depth === null ? null : options.depth - 1 }); + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; const padding = ' '.repeat(name.length + 1); - const inner = util_1.inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); + const inner = inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); return `${options.stylize(name, 'special')} ${inner}`; } } -exports.Peripheral = Peripheral; //# sourceMappingURL=Peripheral.js.map \ No newline at end of file diff --git a/lib/models/Peripheral.js.map b/lib/models/Peripheral.js.map index 677e3d21..e791d749 100644 --- a/lib/models/Peripheral.js.map +++ b/lib/models/Peripheral.js.map @@ -1 +1 @@ -{"version":3,"file":"Peripheral.js","sourceRoot":"","sources":["../../src/models/Peripheral.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAW/B;;GAEG;AACH,MAAsB,UAAU;IAoC/B,YACC,OAAgB,EAChB,IAAY,EACZ,WAAwB,EACxB,OAAe,EACf,aAAuC,EACvC,IAAa;QAEb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC;IAC9B,CAAC;IAxBD;;OAEG;IACH,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAwDM,QAAQ;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,CAAC;IAEM,MAAM;QACZ,OAAO;YACN,IAAI,EAAE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AAG,CAAC,CAAC,CAAC;QAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC,CAAC;QAChF,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE,CAAC;IACvD,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/Characteristic.js b/lib/models/gatt/Characteristic.js index a5e52711..19dcc788 100644 --- a/lib/models/gatt/Characteristic.js +++ b/lib/models/gatt/Characteristic.js @@ -1,12 +1,9 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattCharacteristic = void 0; -const tiny_typed_emitter_1 = require("tiny-typed-emitter"); -const util_1 = require("util"); +import { TypedEmitter } from 'tiny-typed-emitter'; +import { inspect } from 'util'; /** * Represents a GATT Characteristic. */ -class GattCharacteristic extends tiny_typed_emitter_1.TypedEmitter { +export class GattCharacteristic extends TypedEmitter { constructor(service, uuid, propsOrFlag, secureOrFlag) { super(); this.service = service; @@ -121,16 +118,15 @@ class GattCharacteristic extends tiny_typed_emitter_1.TypedEmitter { service: this.service }; } - [util_1.inspect.custom](depth, options) { + [inspect.custom](depth, options) { const name = this.constructor.name; if (depth < 0) { return options.stylize(`[${name}]`, 'special'); } - const newOptions = Object.assign(Object.assign({}, options), { depth: options.depth === null ? null : options.depth - 1 }); + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; const padding = ' '.repeat(name.length + 1); - const inner = util_1.inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); + const inner = inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); return `${options.stylize(name, 'special')} ${inner}`; } } -exports.GattCharacteristic = GattCharacteristic; //# sourceMappingURL=Characteristic.js.map \ No newline at end of file diff --git a/lib/models/gatt/Characteristic.js.map b/lib/models/gatt/Characteristic.js.map index db860535..9ae03030 100644 --- a/lib/models/gatt/Characteristic.js.map +++ b/lib/models/gatt/Characteristic.js.map @@ -1 +1 @@ -{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../src/models/gatt/Characteristic.ts"],"names":[],"mappings":";;;AAAA,2DAAkD;AAClD,+BAA+B;AAuB/B;;GAEG;AACH,MAAsB,kBAAmB,SAAQ,iCAAsC;IA4BtF,YACC,OAAoB,EACpB,IAAY,EACZ,WAAkD,EAClD,YAAmD;QAEnD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,UAAU,GAAiC,EAAE,CAAC;QAClD,IAAI,MAAM,GAAiC,EAAE,CAAC;QAC9C,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,IAAI,UAAU,GAAG,CAAC,CAAC;QAEnB,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YACpC,UAAU,GAAG,WAAW,CAAC;YAEzB,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBACjC,YAAY,IAAI,IAAI,CAAC;aACrB;YACD,IAAI,WAAW,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE;gBACnD,YAAY,IAAI,IAAI,CAAC;aACrB;YACD,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;gBAClC,YAAY,IAAI,IAAI,CAAC;aACrB;YACD,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;gBACnC,YAAY,IAAI,IAAI,CAAC;aACrB;YACD,IAAI,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;gBACrC,YAAY,IAAI,IAAI,CAAC;aACrB;SACD;aAAM;YACN,YAAY,GAAG,WAAW,CAAC;YAE3B,IAAI,WAAW,GAAG,IAAI,EAAE;gBACvB,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;aAC7B;Y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C,CAAC,KAAa,EAAE,OAAY;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEnC,IAAI,KAAK,GAAG,CAAC,EAAE;YACd,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,EAAE,SAAS,CAAC,CAAC;SAC/C;QAED,MAAM,UAAU,mCAAQ,OAAO,KAAE,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,GAAE,CAAC;QAE5F,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5C,MAAM,KAAK,GAAG,cAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC,CAAC;QAChF,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE,CAAC;IACvD,CAAC;CACD;AA3KD,gDA2KC"} \ No newline at end of file +{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../src/models/gatt/Characteristic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAuB/B;;GAEG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,YAAsC;IA4BtF,YACC,OAAoB,EACpB,IAAY,EACZ,WAAkD,EAClD,YAAmD;QAEnD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,UAAU,GAAiC,EAAE,CAAC;QAClD,IAAI,MAAM,GAAiC,EAAE,CAAC;QAC9C,IAAI,YAAY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CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC,CAAC;QAChF,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE,CAAC;IACvD,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/Descriptor.js b/lib/models/gatt/Descriptor.js index a9434562..cbd9bbeb 100644 --- a/lib/models/gatt/Descriptor.js +++ b/lib/models/gatt/Descriptor.js @@ -1,11 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattDescriptor = void 0; -const util_1 = require("util"); +import { inspect } from 'util'; /** * Represents a GATT Descriptor. */ -class GattDescriptor { +export class GattDescriptor { constructor(characteristic, uuid) { this.characteristic = characteristic; this.uuid = uuid; @@ -19,16 +16,15 @@ class GattDescriptor { characteristic: this.characteristic }; } - [util_1.inspect.custom](depth, options) { + [inspect.custom](depth, options) { const name = this.constructor.name; if (depth < 0) { return options.stylize(`[${name}]`, 'special'); } - const newOptions = Object.assign(Object.assign({}, options), { depth: options.depth === null ? null : options.depth - 1 }); + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; const padding = ' '.repeat(name.length + 1); - const inner = util_1.inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); + const inner = inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); return `${options.stylize(name, 'special')} ${inner}`; } } -exports.GattDescriptor = GattDescriptor; //# sourceMappingURL=Descriptor.js.map \ No newline at end of file diff --git a/lib/models/gatt/Descriptor.js.map b/lib/models/gatt/Descriptor.js.map index a33647ce..e3a1b332 100644 --- a/lib/models/gatt/Descriptor.js.map +++ b/lib/models/gatt/Descriptor.js.map @@ -1 +1 @@ -{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../src/models/gatt/Descriptor.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAI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f86aa..e6752ea6 100644 --- a/lib/models/gatt/Gatt.js +++ b/lib/models/gatt/Gatt.js @@ -1,27 +1,23 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Gatt = void 0; -const util_1 = require("util"); +import { inspect } from 'util'; /** * A local or remote GATT server. */ -class Gatt { +export class Gatt { toString() { return JSON.stringify(this.toJSON()); } toJSON() { return {}; } - [util_1.inspect.custom](depth, options) { + [inspect.custom](depth, options) { const name = this.constructor.name; if (depth < 0) { return options.stylize(`[${name}]`, 'special'); } - const newOptions = Object.assign(Object.assign({}, options), { depth: options.depth === null ? null : options.depth - 1 }); + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; const padding = ' '.repeat(name.length + 1); - const inner = util_1.inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); + const inner = inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); return `${options.stylize(name, 'special')} ${inner}`; } } -exports.Gatt = Gatt; //# sourceMappingURL=Gatt.js.map \ No newline at end of file diff --git a/lib/models/gatt/Gatt.js.map b/lib/models/gatt/Gatt.js.map index 937a3456..43cce74a 100644 --- a/lib/models/gatt/Gatt.js.map +++ b/lib/models/gatt/Gatt.js.map @@ -1 +1 @@ -{"version":3,"file":"Gatt.js","sourceRoot":"","sources":["../../../src/models/gatt/Gatt.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B;;GAEG;AACH,MAAsB,IAAI;IAClB,QAAQ;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,CAAC;IAEM,MAAM;QACZ,OAAO,EAAE,CAAC;IACX,CAAC;IAEM,CAAC,cAAO,CAAC,MAAM,CAAC,CAAC,KAAa,EAAE,OAAY;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEnC,IAAI,KAAK,GAAG,CAAC,EAAE;YACd,OAAO,OAAO,CAAC,OAAO,CAAC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,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;QAE5F,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC,CAAC;QAChF,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE,CAAC;IACvD,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/GattError.js b/lib/models/gatt/GattError.js index ed2eb7fd..205cc622 100644 --- a/lib/models/gatt/GattError.js +++ b/lib/models/gatt/GattError.js @@ -1,7 +1,4 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattError = void 0; -class GattError extends Error { +export class GattError extends Error { constructor(peripheral, message, details) { super(message); this.name = 'GattError'; @@ -9,5 +6,4 @@ class GattError extends Error { this.details = details; } } -exports.GattError = GattError; //# sourceMappingURL=GattError.js.map \ No newline at end of file diff --git a/lib/models/gatt/GattError.js.map b/lib/models/gatt/GattError.js.map index 646b1f2f..92692abd 100644 --- a/lib/models/gatt/GattError.js.map +++ b/lib/models/gatt/GattError.js.map @@ -1 +1 @@ -{"version":3,"file":"GattError.js","sourceRoot":"","sources":["../../../src/models/gatt/GattError.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAU,SAAQ,KAAK;IAInC,YAAmB,UAAsB,EAAE,OAAe,EAAE,OAAgB;QAC3E,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD;AAXD,8BAWC"} \ No newline at end of file +{"version":3,"file":"GattError.js","sourceRoot":"","sources":["../../../src/models/gatt/GattError.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,SAAU,SAAQ,KAAK;IAInC,YAAmB,UAAsB,EAAE,OAAe,EAAE,OAAgB;QAC3E,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/Service.js b/lib/models/gatt/Service.js index 3895bd7b..30e78189 100644 --- a/lib/models/gatt/Service.js +++ b/lib/models/gatt/Service.js @@ -1,11 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattService = void 0; -const util_1 = require("util"); +import { inspect } from 'util'; /** * Represents a GATT service. */ -class GattService { +export class GattService { constructor(gatt, uuid) { this.gatt = gatt; this.uuid = uuid; @@ -19,16 +16,15 @@ class GattService { gatt: this.gatt }; } - [util_1.inspect.custom](depth, options) { + [inspect.custom](depth, options) { const name = this.constructor.name; if (depth < 0) { return options.stylize(`[${name}]`, 'special'); } - const newOptions = Object.assign(Object.assign({}, options), { depth: options.depth === null ? null : options.depth - 1 }); + const newOptions = { ...options, depth: options.depth === null ? null : options.depth - 1 }; const padding = ' '.repeat(name.length + 1); - const inner = util_1.inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); + const inner = inspect(this.toJSON(), newOptions).replace(/\n/g, `\n${padding}`); return `${options.stylize(name, 'special')} ${inner}`; } } -exports.GattService = GattService; //# sourceMappingURL=Service.js.map \ No newline at end of file diff --git a/lib/models/gatt/Service.js.map b/lib/models/gatt/Service.js.map index 4ed574f6..091070e5 100644 --- a/lib/models/gatt/Service.js.map +++ b/lib/models/gatt/Service.js.map @@ -1 +1 @@ -{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../src/models/g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models/gatt/index.js b/lib/models/gatt/index.js index 69fda5b2..6d7b35af 100644 --- a/lib/models/gatt/index.js +++ b/lib/models/gatt/index.js @@ -1,26 +1,8 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattService = exports.GattError = exports.Gatt = exports.GattDescriptor = exports.GattCharacteristic = void 0; -var Characteristic_1 = require("./Characteristic"); -Object.defineProperty(exports, "GattCharacteristic", { enumerable: true, get: function () { return Characteristic_1.GattCharacteristic; } }); -var Descriptor_1 = require("./Descriptor"); -Object.defineProperty(exports, "GattDescriptor", { enumerable: true, get: function () { return Descriptor_1.GattDescriptor; } }); -var Gatt_1 = require("./Gatt"); -Object.defineProperty(exports, "Gatt", { enumerable: true, get: function () { return Gatt_1.Gatt; } }); -var GattError_1 = require("./GattError"); -Object.defineProperty(exports, "GattError", { enumerable: true, get: function () { return GattError_1.GattError; } }); -var Service_1 = require("./Service"); -Object.defineProperty(exports, "GattService", { enumerable: true, get: function () { return Service_1.GattService; } }); -__exportStar(require("./local"), exports); -__exportStar(require("./remote"), exports); +export { GattCharacteristic } from './Characteristic'; +export { GattDescriptor } from './Descriptor'; +export { Gatt } from './Gatt'; +export { GattError } from './GattError'; +export { GattService } from './Service'; +export * from './local'; +export * from './remote'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/models/gatt/index.js.map b/lib/models/gatt/index.js.map index d23ec5ab..252d7ebf 100644 --- a/lib/models/gatt/index.js.map +++ b/lib/models/gatt/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/gatt/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAAkF;AAAzE,oHAAA,kBAAkB,OAAA;AAC3B,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AACvB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AAEpB,0CAAwB;AACxB,2CAAyB"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/gatt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA8B,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"} \ No newline at end of file diff --git a/lib/models/gatt/local/Characteristic.js b/lib/models/gatt/local/Characteristic.js index c0e188d1..93cd098d 100644 --- a/lib/models/gatt/local/Characteristic.js +++ b/lib/models/gatt/local/Characteristic.js @@ -1,33 +1,16 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattCharacteristicLocal = void 0; -const Characteristic_1 = require("../Characteristic"); -class GattCharacteristicLocal extends Characteristic_1.GattCharacteristic { +import { GattCharacteristic } from '../Characteristic'; +export class GattCharacteristicLocal extends GattCharacteristic { constructor(service, uuid, properties, secure, readFunc, writeFunc, descriptors) { super(service, uuid, properties, secure); this.descriptors = descriptors; this.readFunc = readFunc; this.writeFunc = writeFunc; } - readRequest(offset) { - return __awaiter(this, void 0, void 0, function* () { - return this.readFunc(offset); - }); + async readRequest(offset) { + return this.readFunc(offset); } - writeRequest(offset, data, withoutResponse) { - return __awaiter(this, void 0, void 0, function* () { - return this.writeFunc(offset, data, withoutResponse); - }); + async writeRequest(offset, data, withoutResponse) { + return this.writeFunc(offset, data, withoutResponse); } } -exports.GattCharacteristicLocal = GattCharacteristicLocal; //# sourceMappingURL=Characteristic.js.map \ No newline at end of file diff --git a/lib/models/gatt/local/Characteristic.js.map b/lib/models/gatt/local/Characteristic.js.map index 2fa87f65..d5afcedd 100644 --- a/lib/models/gatt/local/Characteristic.js.map +++ b/lib/models/gatt/local/Characteristic.js.map @@ -1 +1 @@ -{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/Characteristic.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAmF;AAQnF,MAAa,uBAAwB,SAAQ,mCAAkB;IAQ9D,YACC,OAAyB,EACzB,IAAY,EACZ,UAAwC,EACxC,MAAoC,EACpC,QAAsB,EACtB,SAAwB,EACxB,WAAkC;QAElC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAEzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAEY,WAAW,CAAC,MAAc;;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;KAAA;IAEY,YAAY,CAAC,MAAc,EAAE,IAAY,EAAE,eAAwB;;YAC/E,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QACtD,CAAC;KAAA;CACD;AA/BD,0DA+BC"} \ No newline at end of file +{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/Characteristic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA8B,MAAM,mBAAmB,CAAC;AAQnF,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;IAQ9D,YACC,OAAyB,EACzB,IAAY,EACZ,UAAwC,EACxC,MAAoC,EACpC,QAAsB,EACtB,SAAwB,EACxB,WAAkC;QAElC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAEzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,MAAc;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,IAAY,EAAE,eAAwB;QAC/E,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;IACtD,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/local/Descriptor.js b/lib/models/gatt/local/Descriptor.js index 478184ac..2102a012 100644 --- a/lib/models/gatt/local/Descriptor.js +++ b/lib/models/gatt/local/Descriptor.js @@ -1,12 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattDescriptorLocal = void 0; -const Descriptor_1 = require("../Descriptor"); -class GattDescriptorLocal extends Descriptor_1.GattDescriptor { +import { GattDescriptor } from '../Descriptor'; +export class GattDescriptorLocal extends GattDescriptor { constructor(characteristic, uuid, value) { super(characteristic, uuid); this.value = value; } } -exports.GattDescriptorLocal = GattDescriptorLocal; //# sourceMappingURL=Descriptor.js.map \ No newline at end of file diff --git a/lib/models/gatt/local/Descriptor.js.map b/lib/models/gatt/local/Descriptor.js.map index a3cdd6b9..ed8a6929 100644 --- a/lib/models/gatt/local/Descriptor.js.map +++ b/lib/models/gatt/local/Descriptor.js.map @@ -1 +1 @@ -{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/Descriptor.ts"],"names":[],"mappings":";;;AAAA,8CAA+C;AAI/C,MAAa,mBAAoB,SAAQ,2BAAc;IAKtD,YAAmB,cAAuC,EAAE,IAAY,EAAE,KAAa;QACtF,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAE5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;CACD;AAVD,kDAUC"} \ No newline at end of file +{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/Descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IAKtD,YAAmB,cAAuC,EAAE,IAAY,EAAE,KAAa;QACtF,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAE5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/local/Gatt.js b/lib/models/gatt/local/Gatt.js index 478fd1ec..7867dc10 100644 --- a/lib/models/gatt/local/Gatt.js +++ b/lib/models/gatt/local/Gatt.js @@ -1,20 +1,8 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattLocal = void 0; -const Gatt_1 = require("../Gatt"); -const Characteristic_1 = require("./Characteristic"); -const Descriptor_1 = require("./Descriptor"); -const Service_1 = require("./Service"); -class GattLocal extends Gatt_1.Gatt { +import { Gatt } from '../Gatt'; +import { GattCharacteristicLocal } from './Characteristic'; +import { GattDescriptorLocal } from './Descriptor'; +import { GattServiceLocal } from './Service'; +export class GattLocal extends Gatt { constructor(adapter, maxMtu = 256) { super(); this.adapter = adapter; @@ -68,7 +56,7 @@ class GattLocal extends Gatt_1.Gatt { let handle = 1; for (const service of allServices) { const newChars = []; - const newService = new Service_1.GattServiceLocal(this, service.uuid, newChars); + const newService = new GattServiceLocal(this, service.uuid, newChars); const serviceStartHandle = handle++; const serviceHandle = { type: 'service', @@ -84,13 +72,13 @@ class GattLocal extends Gatt_1.Gatt { } const onRead = char.onRead ? char.onRead - : (offset) => __awaiter(this, void 0, void 0, function* () { return [0, char.value.slice(offset)]; }); + : async (offset) => [0, char.value.slice(offset)]; if ((char.properties.includes('write') || char.properties.includes('write-without-response')) && !char.onWrite) { throw new Error(`Characteristic ${char.uuid} has the 'write' or 'write-without-response' property and needs an 'onWrite' function`); } const onWrite = char.onWrite; - const newChar = new Characteristic_1.GattCharacteristicLocal(newService, char.uuid, char.properties, char.secure, onRead, onWrite, newDescriptors); + const newChar = new GattCharacteristicLocal(newService, char.uuid, char.properties, char.secure, onRead, onWrite, newDescriptors); const charStartHandle = handle++; const charValueHandle = handle++; handles[charStartHandle] = { @@ -107,7 +95,7 @@ class GattLocal extends Gatt_1.Gatt { }; if (char.properties.includes('indicate') || char.properties.includes('notify')) { // notify or indicate: add client characteristic configuration descriptor - const newDescr = new Descriptor_1.GattDescriptorLocal(newChar, '2902', Buffer.from([0x00, 0x00])); + const newDescr = new GattDescriptorLocal(newChar, '2902', Buffer.from([0x00, 0x00])); const clientCharacteristicConfigurationDescriptorHandle = handle++; handles[clientCharacteristicConfigurationDescriptorHandle] = { type: 'descriptor', @@ -117,7 +105,7 @@ class GattLocal extends Gatt_1.Gatt { } if (char.descriptors) { for (const descr of char.descriptors) { - const newDescr = new Descriptor_1.GattDescriptorLocal(newChar, descr.uuid, descr.value); + const newDescr = new GattDescriptorLocal(newChar, descr.uuid, descr.value); const descrHandle = handle++; handles[descrHandle] = { type: 'descriptor', value: descrHandle, object: newDescr }; newDescriptors.push(newDescr); @@ -131,8 +119,11 @@ class GattLocal extends Gatt_1.Gatt { this.handles = handles; } toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { maxMtu: this.maxMtu, adapter: this.adapter }); + return { + ...super.toJSON(), + maxMtu: this.maxMtu, + adapter: this.adapter + }; } } -exports.GattLocal = GattLocal; //# sourceMappingURL=Gatt.js.map \ No newline at end of file diff --git a/lib/models/gatt/local/Gatt.js.map b/lib/models/gatt/local/Gatt.js.map index 6c67a54d..9636ec54 100644 --- a/lib/models/gatt/local/Gatt.js.map +++ b/lib/models/gatt/local/Gatt.js.map @@ -1 +1 @@ -{"version":3,"file":"Gatt.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/Gatt.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,kCAA+B;AAE/B,qDAAwF;AACxF,6CAAmD;AACnD,uCAA6C;AA0C7C,MAAsB,SAAU,SAAQ,WAAI;IAoB3C,YAAmB,OAAgB,EAAE,MAAM,GAAG,GAAG;QAChD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACnB,CAAC;IApBD,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAGD,IAAW,U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AW,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;wBAEpF,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;qBAC9B;iBACD;gBAED,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACvB;YAED,iBAAiB;YACjB,aAAa,CAAC,GAAG,GAAG,MAAM,GAAG,CAAC,CAAC;SAC/B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAEM,MAAM;QACZ,uCACI,KAAK,CAAC,MAAM,EAAE,KACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,IACpB;IACH,CAAC;CACD;AA3KD,8BA2KC"} \ No newline at end of file +{"version":3,"file":"Gatt.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/Gatt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAA+B,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AA0C7C,MAAM,OAAgB,SAAU,SAAQ,IAAI;IAoB3C,YAAmB,OAAgB,EAAE,MAAM,GAAG,GAAG;QAChD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACnB,CAAC;IApBD,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAGD,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAGD,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC5B,CAAC;IAUM,OAAO,CAAC,UAAkB,EAAE,QAA4B;QA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;YACjB,aAAa,CAAC,GAAG,GAAG,MAAM,GAAG,CAAC,CAAC;SAC/B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAEM,MAAM;QACZ,OAAO;YACN,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/local/Service.js b/lib/models/gatt/local/Service.js index 89345ace..9bf06358 100644 --- a/lib/models/gatt/local/Service.js +++ b/lib/models/gatt/local/Service.js @@ -1,12 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattServiceLocal = void 0; -const Service_1 = require("../Service"); -class GattServiceLocal extends Service_1.GattService { +import { GattService } from '../Service'; +export class GattServiceLocal extends GattService { constructor(gatt, uuid, characteristics) { super(gatt, uuid); this.characteristics = characteristics; } } -exports.GattServiceLocal = GattServiceLocal; //# sourceMappingURL=Service.js.map \ No newline at end of file diff --git a/lib/models/gatt/local/Service.js.map b/lib/models/gatt/local/Service.js.map index cf788894..018315d5 100644 --- a/lib/models/gatt/local/Service.js.map +++ b/lib/models/gatt/local/Service.js.map @@ -1 +1 @@ -{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/Service.ts"],"names":[],"mappings":";;;AAAA,wCAAyC;AAKzC,MAAa,gBAAiB,SAAQ,qBAAW;IAKhD,YAAmB,IAAe,EAAE,IAAY,EAAE,eAA0C;QAC3F,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACxC,CAAC;CACD;AAVD,4CAUC"} \ No newline at end of file +{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAKzC,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAKhD,YAAmB,IAAe,EAAE,IAAY,EAAE,eAA0C;QAC3F,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACxC,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/local/index.js b/lib/models/gatt/local/index.js index 077c5991..b16e8ac6 100644 --- a/lib/models/gatt/local/index.js +++ b/lib/models/gatt/local/index.js @@ -1,12 +1,5 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattServiceLocal = exports.GattLocal = exports.GattDescriptorLocal = exports.GattCharacteristicLocal = void 0; -var Characteristic_1 = require("./Characteristic"); -Object.defineProperty(exports, "GattCharacteristicLocal", { enumerable: true, get: function () { return Characteristic_1.GattCharacteristicLocal; } }); -var Descriptor_1 = require("./Descriptor"); -Object.defineProperty(exports, "GattDescriptorLocal", { enumerable: true, get: function () { return Descriptor_1.GattDescriptorLocal; } }); -var Gatt_1 = require("./Gatt"); -Object.defineProperty(exports, "GattLocal", { enumerable: true, get: function () { return Gatt_1.GattLocal; } }); -var Service_1 = require("./Service"); -Object.defineProperty(exports, "GattServiceLocal", { enumerable: true, get: function () { return Service_1.GattServiceLocal; } }); +export { GattCharacteristicLocal } from './Characteristic'; +export { GattDescriptorLocal } from './Descriptor'; +export { GattLocal } from './Gatt'; +export { GattServiceLocal } from './Service'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/models/gatt/local/index.js.map b/lib/models/gatt/local/index.js.map index 19ac4fb1..74747b41 100644 --- a/lib/models/gatt/local/index.js.map +++ b/lib/models/gatt/local/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/index.ts"],"names":[],"mappings":";;;AAAA,mDAA2D;AAAlD,yHAAA,uBAAuB,OAAA;AAChC,2CAAmD;AAA1C,iHAAA,mBAAmB,OAAA;AAC5B,+BAAmG;AAA1F,iGAAA,SAAS,OAAA;AAClB,qCAA6C;AAApC,2GAAA,gBAAgB,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/gatt/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAkE,MAAM,QAAQ,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/lib/models/gatt/remote/Characteristic.js b/lib/models/gatt/remote/Characteristic.js index 0eb74b3a..9d9f1f0d 100644 --- a/lib/models/gatt/remote/Characteristic.js +++ b/lib/models/gatt/remote/Characteristic.js @@ -1,20 +1,8 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattCharacteristicRemote = void 0; -const Characteristic_1 = require("../Characteristic"); +import { GattCharacteristic } from '../Characteristic'; /** * Represents a characteristic connected to a remote GATT service. */ -class GattCharacteristicRemote extends Characteristic_1.GattCharacteristic { +export class GattCharacteristicRemote extends GattCharacteristic { constructor() { super(...arguments); /** @@ -28,53 +16,38 @@ class GattCharacteristicRemote extends Characteristic_1.GattCharacteristic { /** * Read the current value of this characteristic. */ - read() { - return __awaiter(this, void 0, void 0, function* () { - return this.gatt.read(this.service.uuid, this.uuid); - }); + async read() { + return this.gatt.read(this.service.uuid, this.uuid); } /** * Write the specified data to this characteristic. * @param data The data to write. * @param withoutResponse Do not require a response from the remote GATT server for this write. */ - write(data, withoutResponse) { - return __awaiter(this, void 0, void 0, function* () { - yield this.gatt.write(this.service.uuid, this.uuid, data, withoutResponse); - }); + async write(data, withoutResponse) { + await this.gatt.write(this.service.uuid, this.uuid, data, withoutResponse); } - broadcast(broadcast) { - return __awaiter(this, void 0, void 0, function* () { - yield this.gatt.broadcast(this.service.uuid, this.uuid, broadcast); - }); + async broadcast(broadcast) { + await this.gatt.broadcast(this.service.uuid, this.uuid, broadcast); } - notify(notify) { - return __awaiter(this, void 0, void 0, function* () { - yield this.gatt.notify(this.service.uuid, this.uuid, notify); - }); + async notify(notify) { + await this.gatt.notify(this.service.uuid, this.uuid, notify); } - subscribe() { - return __awaiter(this, void 0, void 0, function* () { - yield this.notify(true); - }); + async subscribe() { + await this.notify(true); } - unsubscribe() { - return __awaiter(this, void 0, void 0, function* () { - yield this.notify(false); - }); + async unsubscribe() { + await this.notify(false); } /** * Discover all descriptors of this characteristic. */ - discoverDescriptors() { - return __awaiter(this, void 0, void 0, function* () { - const descriptors = yield this.gatt.discoverDescriptors(this.service.uuid, this.uuid); - for (const descriptor of descriptors) { - this.descriptors.set(descriptor.uuid, descriptor); - } - return [...this.descriptors.values()]; - }); + async discoverDescriptors() { + const descriptors = await this.gatt.discoverDescriptors(this.service.uuid, this.uuid); + for (const descriptor of descriptors) { + this.descriptors.set(descriptor.uuid, descriptor); + } + return [...this.descriptors.values()]; } } -exports.GattCharacteristicRemote = GattCharacteristicRemote; //# sourceMappingURL=Characteristic.js.map \ No newline at end of file diff --git a/lib/models/gatt/remote/Characteristic.js.map b/lib/models/gatt/remote/Characteristic.js.map index 581aa513..86336a28 100644 --- a/lib/models/gatt/remote/Characteristic.js.map +++ b/lib/models/gatt/remote/Characteristic.js.map @@ -1 +1 @@ -{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/Characteristic.ts"],"names":[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AO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACtF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;gBACrC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;aAClD;YACD,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC;KAAA;CACD;AApDD,4DAoDC"} \ No newline at end of file +{"version":3,"file":"Characteristic.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/Characteristic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMvD;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,kBAAkB;IAAhE;;QASC;;WAEG;QACa,gBAAW,GAAsC,IAAI,GAAG,EAAE,CAAC;IAwC5E,CAAC;IA/CA,IAAc,IAAI;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;IAOD;;OAEG;IACI,KAAK,CAAC,IAAI;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IACD;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,eAAwB;QACxD,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;IAC5E,CAAC;IACM,KAAK,CAAC,SAAS,CAAC,SAAkB;QACxC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,MAAe;QAClC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IACM,KAAK,CAAC,SAAS;QACrB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACM,KAAK,CAAC,WAAW;QACvB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,mBAAmB;QAC/B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACtF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACrC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;SAClD;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/remote/Descriptor.js b/lib/models/gatt/remote/Descriptor.js index b20b7df3..016a5fbc 100644 --- a/lib/models/gatt/remote/Descriptor.js +++ b/lib/models/gatt/remote/Descriptor.js @@ -1,11 +1,8 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattDescriptorRemote = void 0; -const Descriptor_1 = require("../Descriptor"); +import { GattDescriptor } from '../Descriptor'; /** * Represents a descriptor of a remote GATT characterstic. */ -class GattDescriptorRemote extends Descriptor_1.GattDescriptor { +export class GattDescriptorRemote extends GattDescriptor { get gatt() { return this.characteristic.service.gatt; } @@ -23,5 +20,4 @@ class GattDescriptorRemote extends Descriptor_1.GattDescriptor { return this.gatt.writeValue(this.characteristic.service.uuid, this.characteristic.uuid, this.uuid, data); } } -exports.GattDescriptorRemote = GattDescriptorRemote; //# sourceMappingURL=Descriptor.js.map \ No newline at end of file diff --git a/lib/models/gatt/remote/Descriptor.js.map b/lib/models/gatt/remote/Descriptor.js.map index 027f8e9a..1e1ddda2 100644 --- a/lib/models/gatt/remote/Descriptor.js.map +++ b/lib/models/gatt/remote/Descriptor.js.map @@ -1 +1 @@ -{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/Descriptor.ts"],"names":[],"mappings":";;;AAAA,8CAA+C;AAK/C;;GAEG;AACH,MAAa,oBAAqB,SAAQ,2BAAc;IAKvD,IAAc,IAAI;QACjB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,SAAS;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACnG,CAAC;IACD;;;OAGG;IACI,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1G,CAAC;CACD;AAtBD,oDAsBC"} \ No newline at end of file +{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/Descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IAKvD,IAAc,IAAI;QACjB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,SAAS;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACnG,CAAC;IACD;;;OAGG;IACI,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1G,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/remote/Gatt.js b/lib/models/gatt/remote/Gatt.js index 3d220639..9c362f05 100644 --- a/lib/models/gatt/remote/Gatt.js +++ b/lib/models/gatt/remote/Gatt.js @@ -1,20 +1,8 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattRemote = void 0; -const Gatt_1 = require("../Gatt"); +import { Gatt } from '../Gatt'; /** * Represents a GATT server on a remote {@link Peripheral}. */ -class GattRemote extends Gatt_1.Gatt { +export class GattRemote extends Gatt { constructor(peripheral) { super(); /** @@ -32,18 +20,19 @@ class GattRemote extends Gatt_1.Gatt { /** * Discover all services of this GATT server. */ - discoverServices() { - return __awaiter(this, void 0, void 0, function* () { - const services = yield this.doDiscoverServices(); - for (const service of services) { - this.services.set(service.uuid, service); - } - return [...this.services.values()]; - }); + async discoverServices() { + const services = await this.doDiscoverServices(); + for (const service of services) { + this.services.set(service.uuid, service); + } + return [...this.services.values()]; } toJSON() { - return Object.assign(Object.assign({}, super.toJSON()), { mtu: this.mtu, peripheral: this.peripheral }); + return { + ...super.toJSON(), + mtu: this.mtu, + peripheral: this.peripheral + }; } } -exports.GattRemote = GattRemote; //# sourceMappingURL=Gatt.js.map \ No newline at end of file diff --git a/lib/models/gatt/remote/Gatt.js.map b/lib/models/gatt/remote/Gatt.js.map index 49a39e2c..fc616976 100644 --- a/lib/models/gatt/remote/Gatt.js.map +++ b/lib/models/gatt/remote/Gatt.js.map @@ -1 +1 @@ -{"version":3,"file":"Gatt.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/Gatt.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kCAA+B;AAM/B;;GAEG;AACH,MAAsB,UAAW,SAAQ,WAAI;IAmB5C,YAAmB,UAAsB;QACxC,KAAK,EAAE,CAAC;QAdT;;WAEG;QACa,aAAQ,GAAmC,IAAI,GAAG,EAAE,CAAC;QAapE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAXD;;OAEG;IACH,IAAW,GAAG;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAQD;;OAEG;IACU,gBAAgB;;YAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACjD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aACzC;YACD,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACpC,CAAC;KAAA;IAgEM,MAAM;QACZ,uCACI,KAAK,CAAC,MAAM,EAAE,KACjB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,UAAU,EAAE,IAAI,CAAC,UAAU,IAC1B;IACH,CAAC;CACD;AAzGD,gCAyGC"} \ No newline at end of file +{"version":3,"file":"Gatt.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/Gatt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B;;GAEG;AACH,MAAM,OAAgB,UAAW,SAAQ,IAAI;IAmB5C,YAAmB,UAAsB;QACxC,KAAK,EAAE,CAAC;QAdT;;WAEG;QACa,aAAQ,GAAmC,IAAI,GAAG,EAAE,CAAC;QAapE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAXD;;OAEG;IACH,IAAW,GAAG;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAQD;;OAEG;IACI,KAAK,CAAC,gBAAgB;QAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACjD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACzC;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACpC,CAAC;IAgEM,MAAM;QACZ,OAAO;YACN,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,UAAU,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC;IACH,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/remote/Service.js b/lib/models/gatt/remote/Service.js index ef2f8d4d..b82ac677 100644 --- a/lib/models/gatt/remote/Service.js +++ b/lib/models/gatt/remote/Service.js @@ -1,20 +1,8 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattServiceRemote = void 0; -const Service_1 = require("../Service"); +import { GattService } from '../Service'; /** * Represents a GATT service of a remote GATT server. */ -class GattServiceRemote extends Service_1.GattService { +export class GattServiceRemote extends GattService { constructor() { super(...arguments); /** @@ -25,15 +13,12 @@ class GattServiceRemote extends Service_1.GattService { /** * Discover all charactersitics of this service. */ - discoverCharacteristics() { - return __awaiter(this, void 0, void 0, function* () { - const characteristics = yield this.gatt.discoverCharacteristics(this.uuid); - for (const characteristic of characteristics) { - this.characteristics.set(characteristic.uuid, characteristic); - } - return [...this.characteristics.values()]; - }); + async discoverCharacteristics() { + const characteristics = await this.gatt.discoverCharacteristics(this.uuid); + for (const characteristic of characteristics) { + this.characteristics.set(characteristic.uuid, characteristic); + } + return [...this.characteristics.values()]; } } -exports.GattServiceRemote = GattServiceRemote; //# sourceMappingURL=Service.js.map \ No newline at end of file diff --git a/lib/models/gatt/remote/Service.js.map b/lib/models/gatt/remote/Service.js.map index 281061b9..a83d238a 100644 --- a/lib/models/gatt/remote/Service.js.map +++ b/lib/models/gatt/remote/Service.js.map @@ -1 +1 @@ -{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/Service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAyC;AAKzC;;GAEG;AACH,MAAa,iBAAkB,SAAQ,qBAAW;IAAlD;;QAMC;;WAEG;QACa,oBAAe,GAA0C,IAAI,GAAG,EAAE,CAAC;IAYpF,CAAC;IAVA;;OAEG;IACU,uBAAuB;;YACnC,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3E,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE;gBAC7C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;aAC9D;YACD,OAAO,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3C,CAAC;KAAA;CACD;AArBD,8CAqBC"} \ No newline at end of file +{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAKzC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAAlD;;QAMC;;WAEG;QACa,oBAAe,GAA0C,IAAI,GAAG,EAAE,CAAC;IAYpF,CAAC;IAVA;;OAEG;IACI,KAAK,CAAC,uBAAuB;QACnC,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3E,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE;YAC7C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;SAC9D;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;CACD"} \ No newline at end of file diff --git a/lib/models/gatt/remote/index.js b/lib/models/gatt/remote/index.js index 9af88826..f8efe144 100644 --- a/lib/models/gatt/remote/index.js +++ b/lib/models/gatt/remote/index.js @@ -1,12 +1,5 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GattServiceRemote = exports.GattRemote = exports.GattDescriptorRemote = exports.GattCharacteristicRemote = void 0; -var Characteristic_1 = require("./Characteristic"); -Object.defineProperty(exports, "GattCharacteristicRemote", { enumerable: true, get: function () { return Characteristic_1.GattCharacteristicRemote; } }); -var Descriptor_1 = require("./Descriptor"); -Object.defineProperty(exports, "GattDescriptorRemote", { enumerable: true, get: function () { return Descriptor_1.GattDescriptorRemote; } }); -var Gatt_1 = require("./Gatt"); -Object.defineProperty(exports, "GattRemote", { enumerable: true, get: function () { return Gatt_1.GattRemote; } }); -var Service_1 = require("./Service"); -Object.defineProperty(exports, "GattServiceRemote", { enumerable: true, get: function () { return Service_1.GattServiceRemote; } }); +export { GattCharacteristicRemote } from './Characteristic'; +export { GattDescriptorRemote } from './Descriptor'; +export { GattRemote } from './Gatt'; +export { GattServiceRemote } from './Service'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/models/gatt/remote/index.js.map b/lib/models/gatt/remote/index.js.map index 35afe472..3ab468fa 100644 --- a/lib/models/gatt/remote/index.js.map +++ b/lib/models/gatt/remote/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/index.ts"],"names":[],"mappings":";;;AAAA,mDAA4D;AAAnD,0HAAA,wBAAwB,OAAA;AACjC,2CAAoD;AAA3C,kHAAA,oBAAoB,OAAA;AAC7B,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,qCAA8C;AAArC,4GAAA,iBAAiB,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/gatt/remote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/lib/models/index.js b/lib/models/index.js index 3a7402ba..89d7a0e5 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -1,21 +1,5 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Peripheral = exports.MODblue = exports.Adapter = void 0; -var Adapter_1 = require("./Adapter"); -Object.defineProperty(exports, "Adapter", { enumerable: true, get: function () { return Adapter_1.Adapter; } }); -var MODblue_1 = require("./MODblue"); -Object.defineProperty(exports, "MODblue", { enumerable: true, get: function () { return MODblue_1.MODblue; } }); -var Peripheral_1 = require("./Peripheral"); -Object.defineProperty(exports, "Peripheral", { enumerable: true, get: function () { return Peripheral_1.Peripheral; } }); -__exportStar(require("./gatt"), exports); +export { Adapter } from './Adapter'; +export { MODblue } from './MODblue'; +export { Peripheral } from './Peripheral'; +export * from './gatt'; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/models/index.js.map b/lib/models/index.js.map index de7eff7a..fd0ede2f 100644 --- a/lib/models/index.js.map +++ b/lib/models/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,2CAA2D;AAAlD,wGAAA,UAAU,OAAA;AAEnB,yCAAuB"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAE3D,cAAc,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib/web.js b/lib/web.js index 401b21d3..bd4f39bd 100644 --- a/lib/web.js +++ b/lib/web.js @@ -1,14 +1,2 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./bindings/web"), exports); +export * from './bindings/web'; //# sourceMappingURL=web.js.map \ No newline at end of file diff --git a/lib/web.js.map b/lib/web.js.map index 9a967356..eda5c243 100644 --- a/lib/web.js.map +++ b/lib/web.js.map @@ -1 +1 @@ -{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B"} \ No newline at end of file +{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 817756ed..c384044a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "moduleResolution": "Node", - "module": "CommonJS", - "target": "ES2015", + "module": "ES2020", + "target": "ES2020", "outDir": "lib", "types": ["node", "web-bluetooth"], "noImplicitAny": true,