Re: Are Parameter types in GATT meaningless?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi John,

On Thu, Aug 11, 2022 at 8:16 AM John Klug <John.Klug@xxxxxxxxxxxxx> wrote:
>
> The manufacturer of the GATT service gives the types of two different services:
>
> uint16
>
> uint8[32]
>
> Should uint16 be uint8[2]?
>
>
> I am using the libgio interface to D-BUS.  This uses GVariants.
> I am using the WriteValue method of GattCharacteristic1.
>
> For the uint16 case, I find that if I use:
>
> (aya{sv})
>
> then I do not get an immediate error from a bad parameter type list (signature).
>
> If I use:
>
> (qa{sv})
>
> Then I get the error:
>
> Error message: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method "WriteValue" with signature "qa{sv}" on interface "org.bluez.GattCharacteristic1" doesn't exist
>
> For the uint8[32] case I use (aya{sv}) which is what I would expect, and I get no error from the WriteValue.
>
> Are byte arrays used in all cases with GATT from a D-Bus perspective?
>
> Here is the message that fails which was logged by dbus-monitor:
>
>   uint16 2
>    array [
>       dict entry(
>          string "type"
>          variant             string "request"
>       )
>    ]
> error time=1660229364.819130 sender=:1.0 -> destination=:1.197 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=16
>    string "Method "WriteValue" with signature "qa{sv}" on interface "org.bluez.GattCharacteristic1" doesn't exist
> "
>
> While this message/parameter list does not provoke an error:
>
>    array of bytes [
>       00 02
>    ]
>    array [
>       dict entry(
>          string "type"
>          variant             string "request"
>       )
>    ]

WriteValue always expects a byte array (ay) as the first argument
which follows ATT/GATT Write/WriteLong procedures so the attribute
specific data need to be encoded as byte array (little-endian), btw
this is documented in the D-Bus API and you can check how it done by
the likes of bluetoothctl.



--
Luiz Augusto von Dentz



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux