Skip to content

HostGattService WriteValue doesn't reply to the client #10

@muneale

Description

@muneale

Hi everyone,
firstly I would say thanks for this library, is the only one that I really appreciate in order to create your own GATT service without starting from scratch.

That said, I'm stuck in the implementation of a HTTP Proxy Service (that I can share with you as examples for other people) by following its specification provided by Bluetooth.
Currently I developed a new BaseHostInterface called HttpProxyCharacteristic which can correctly read/notify a value, however when the client asks to write a new value the WriteValue method writes correctly the new value, but doesn't reply anything.

The code for the WriteValue method is the following:

@method({ inSignature: "aya{sv}", outSignature: "" })
WriteValue(value, options) {
  value = this.onWriteValue(value, options);         #Method to elaborate data
  this.Value = [...Buffer.from(value)];              #Value is a property defined in the Gatt Characteristic
  this.emitPropertiesChanged({
    Value: new Variant("ay", [...this.Value]),
  });
}

# Must be overwritten in the characteristic implementation if you want elaborate data 
onWriteValue(value: any, options: any): any { 
  return value;
}

This is also the output when I print the options of the WriteValue method:

{
  device: Variant {
    signature: 'o',
    value: '/org/bluez/hci0/dev_00_00_00_00_00_00'  # The ID is actaully different
  },
  link: Variant { signature: 's', value: 'LE' },
  mtu: Variant { signature: 'q', value: 517 }
}

I'm currently testing it with LightBlue app which states that the write has not been performed correctly (Error 14).
Am I missing something or this is actually a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions