Skip to content

Commit

Permalink
Merge pull request #10 from rosek86/dev
Browse files Browse the repository at this point in the history
v1.1.1
  • Loading branch information
rosek86 authored Dec 3, 2023
2 parents 031ff02 + b862ebc commit 422d769
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [1.1.1] - 2023-12-03

- Fixes

## [1.1.0] - 2023-12-03

- Fix the problem of connection attempts using an incorrect address type
Expand Down
5 changes: 4 additions & 1 deletion examples/le-discover-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class App extends NbleGapCentral {
},
},
});

this.on('error', (err) => console.log('NbleGapCentral Error:', err));
}

protected async onAdvert(report: GapAdvertReport): Promise<void> {
Expand Down Expand Up @@ -107,7 +109,8 @@ class App extends NbleGapCentral {
console.log(e);
} finally {
console.log('Disconnecting...');
await this.disconnect(event.connectionHandle);
await this.disconnect(event.connectionHandle)
.catch(() => {});
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bluetooth-hci",
"version": "1.1.0",
"version": "1.1.1",
"description": "Bluetooth HCI host implementation",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
Expand Down
14 changes: 1 addition & 13 deletions src/gap/GapCentral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,21 +449,9 @@ export class GapCentral extends EventEmitter {
}

private async getRemoteInfo(connComplete: LeConnectionCompleteEvent | LeEnhConnectionCompleteEvent) {
// NOTE: don't know why but sometimes first request to remote device gives no response
// so we try to read remote version information twice
// problem occurs on nRF52840 Dongle with HCI controller

const timeoutMs = connComplete.connectionIntervalMs * 10;

let version: ReadRemoteVersionInformationCompleteEvent;
try {
version = await this.hci.readRemoteVersionInformationAwait(connComplete.connectionHandle, timeoutMs);
} catch {
version = await this.hci.readRemoteVersionInformationAwait(connComplete.connectionHandle, timeoutMs);
}

const version = await this.hci.readRemoteVersionInformationAwait(connComplete.connectionHandle, timeoutMs);
const features = await this.hci.leReadRemoteFeaturesAwait(connComplete.connectionHandle, timeoutMs);

return { version, features };
}

Expand Down
6 changes: 3 additions & 3 deletions src/gatt/GattClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class GattClient extends EventEmitter {
}

public async read(char: GattCharacteristic.AsObject): Promise<Buffer> {
const handle = char.valueHandle;
const handle = char.handle + 1;
const blob = await this.att.readReq({ attributeHandle: handle });

let part = blob.attributeValue;
Expand All @@ -203,12 +203,12 @@ export class GattClient extends EventEmitter {
}

public async write(char: GattCharacteristic.AsObject, value: Buffer): Promise<void> {
const handle = char.valueHandle;
const handle = char.handle + 1;
await this.att.writeReq({ attributeHandle: handle, attributeValue: value });
}

public async writeWithoutResponse(char: GattCharacteristic.AsObject, value: Buffer): Promise<void> {
const handle = char.valueHandle;
const handle = char.handle + 1;
await this.att.writeCmd({ attributeHandle: handle, attributeValue: value });
}

Expand Down

0 comments on commit 422d769

Please sign in to comment.