Skip to content

WriteWithoutResponse in Bluez picks different write types #382

@tazjin

Description

@tazjin

Hey, thanks for this library!

Currently WriteWithoutResponse for Bluez doesn't specify a type when writing:

bluetooth/gattc_linux.go

Lines 224 to 230 in 5c61529

func (c DeviceCharacteristic) WriteWithoutResponse(p []byte) (n int, err error) {
err = c.characteristic.Call("org.bluez.GattCharacteristic1.WriteValue", 0, p, map[string]dbus.Variant(nil)).Err
if err != nil {
return 0, err
}
return len(p), nil
}

In Bluez, the type of write is set at this call: https://github.com/bluez/bluez/blob/c6dcf6b714501768ab7ea293e75d945be0eec188/doc/org.bluez.GattCharacteristic.rst#L97-L111

If it is unset, Bluez seems to chose one based on the properties of the characteristic: https://github.com/bluez/bluez/blob/c6dcf6b714501768ab7ea293e75d945be0eec188/src/gatt-client.c#L1066-L1113

I might be missing something, but it seems like the function is currently more like a WriteAuto which picks the first fitting type.

As for how to resolve it, I'm not sure. This logic is actually quite useful, but it should probably live under a different name, and explicit command/request functions could be added/fixed as needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions