Skip to content

Commit facbb9c

Browse files
author
Marco Crespi
committed
Merge branch 'develop'
2 parents 1a09e6f + 070f4c5 commit facbb9c

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

lib/bindings/hci/misc/Hci.d.ts.map

+1-1
Original file line numberDiff line numberDiff line change

lib/bindings/hci/misc/Hci.js

+14-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bindings/hci/misc/Hci.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bindings/hci/misc/Hci.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,22 @@ export class Hci extends TypedEmitter<HciEvents> {
110110
}
111111

112112
private static createSocket() {
113-
return new (require(`@modum-io/bluetooth-hci-socket`))();
113+
let Socket;
114+
try {
115+
Socket = require(`@modum-io/bluetooth-hci-socket`);
116+
} catch {
117+
try {
118+
Socket = require(`@abandonware/bluetooth-hci-socket`);
119+
} catch {}
120+
}
121+
122+
if (!Socket) {
123+
throw new Error(
124+
`Could not find any socket implementations. Please install @modum-io/bluetooth-hci-socket or @abandonware/bluetooth-hci-socket`
125+
);
126+
}
127+
128+
return new Socket();
114129
}
115130

116131
public static getDeviceList(): HciDevice[] {

0 commit comments

Comments
 (0)