Skip to content

Commit

Permalink
value handle for unknown reason is 0, use characteristic handle + 1
Browse files Browse the repository at this point in the history
  • Loading branch information
rosek86 committed Dec 3, 2023
1 parent 144d0c0 commit 981b4ab
Showing 1 changed file with 3 additions and 3 deletions.
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 981b4ab

Please sign in to comment.