Skip to content

Commit

Permalink
Upgrade Noble (#1242)
Browse files Browse the repository at this point in the history
* Comment out "reset" for now because crashing

* fix ble "supports" usage

We can connect to any address so do not check that

* upgrade noble

* package lock

* try adding npm i after ci

* Revert "try adding npm i after ci"

This reverts commit 167d279.

* fix noble and use 1.15.0
  • Loading branch information
Apollon77 authored Oct 1, 2024
1 parent 0f23660 commit d2e06b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 2 additions & 11 deletions packages/nodejs-ble/src/NobleBleChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
Logger,
NetInterface,
ServerAddress,
ServerAddressBle,
Time,
TransportInterface,
createPromise,
Expand Down Expand Up @@ -214,19 +213,11 @@ export class NobleBleCentralInterface implements NetInterface {
}
}

supports(type: ChannelType, address?: string) {
supports(type: ChannelType, _address?: string) {
if (type !== ChannelType.BLE) {
return false;
}
if (address === undefined) {
return false;
}
for (const key of this.openChannels.keys()) {
if ((key as ServerAddressBle).peripheralAddress === address) {
return true;
}
}
return false;
return true;
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/nodejs-ble/src/NobleBleClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export class NobleBleClient {

constructor(options?: BleOptions) {
loadNoble(options?.hciId);
try {
/*try {
noble.reset();
} catch (error: any) {
logger.debug(
`Error resetting BLE device via noble (can be ignored, we just tried): ${
(error as unknown as Error).message
}`,
);
}
}*/
noble.on("stateChange", state => {
this.nobleState = state;
logger.debug(`Noble state changed to ${state}`);
Expand Down

0 comments on commit d2e06b2

Please sign in to comment.