bluetoothctl creating gatt server - cant write more than one byte

96 Views Asked by At

I've added a service and charecteristic with bluetoothctl (bluez v5.64). I have some issues:

  1. I can only write one byte. attempting write "0x11 0x22" results in "Unable to write local attribute /org/bluez/app/service0/chrc0". see below.

  2. I saw in gatt-api I can set mtu when performing read/write, is that option available via bluetoothctl?

  3. not sure why attribute-info is not honored. any idea why?

thanks!

#list-attributes local

Primary Service (Handle 0x0029)
    /org/bluez/app/service0
    00071100-f0d4-469d-afd3-605a6ebbdb13
    Vendor specific
Characteristic (Handle 0x002b)
    /org/bluez/app/service0/chrc0
    0d271100-1111-469d-afd3-605a6ebbdb13
    Vendor specific


[/org/bluez/app/service0/chrc0]# select-attribute 0d271100-1111-469d-afd3-605a6ebbdb13
[/org/bluez/app/service0/chrc0]# write "0x1 0x2"
Unable to write local attribute /org/bluez/app/service0/chrc0
[/org/bluez/app/service0/chrc0]# write "0x3"
[CHG] Attribute /org/bluez/app/service0/chrc0 (Vendor specific) written


attribute-info 0d271100-1111-469d-afd3-605a6ebbdb13
Attribute 0d271100-1111-469d-afd3-605a6ebbdb13 not available
1

There are 1 best solutions below

0
Ordit Gross On BEST ANSWER

well, looked in the bluetoothctl code. it seems that when creating the charecteristic (register-characteristic) the enter value sets the maximum characteristic length..

eg.

[bluetooth]# register-characteristic 0xff12 read,write,notify

[NEW] Characteristic (Handle 0x0000)

/org/bluez/app/service0/chrc0

0xff12

Unknown

[/org/bluez/app/service0/chrc0] Enter value: 0x11 0x22 0x33 0x44 0x55

..

[/org/bluez/app/service0/chrc0]# write "0x3 0x6"

[CHG] Attribute /org/bluez/app/service0/chrc0 (Unknown) written