Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion gattc_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,21 @@ func (s DeviceService) DiscoverCharacteristics(uuids []UUID) ([]DeviceCharacteri
// writes can be in flight at any given time. This call is also known as a
// "write command" (as opposed to a write request).
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
args := make(map[string]any)
err = c.characteristic.Call("org.bluez.GattCharacteristic1.WriteValue", 0, p, args).Err
args["type"] = "command"
if err != nil {
return 0, err
}
return len(p), nil
}

// Write replaces the characteristic value with a new value. The
// call will return after all data has been written.
func (c DeviceCharacteristic) Write(p []byte) (n int, err error) {
args := make(map[string]any)
args["type"] = "request"
err = c.characteristic.Call("org.bluez.GattCharacteristic1.WriteValue", 0, p, args).Err
if err != nil {
return 0, err
}
Expand Down
Loading