Re: GattCharacteristic1 WriteValue fails parameter validation in a GATT Client

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

 



Luiz Augusto von Dentz wrote:
> This is for a GATT Server, application implements WriteValue, or for
> GATT client, bluetoothd implementation of WriteValue?
This is for the GATT client.  I have to write a password to the server from the client.

I got a little further.  I found that libgio requires the error parameter in the parameter list to be cleared before every invocation.  I don't yet have some semaphores in, and my code was in a loop doing the WriteValue until success, but the error value is not overwritten once it is set by g_dbus_connection_call_sync().

I am setting "type" to "command" in the dictionary for the 2nd parameter because I want no response.

It turns out if I clear the error on every loop, the error I see after WriteValue is issued on the characteristic:

             *  0x55e74e6ca860: print_error: Error message: GDBus.Error:org.bluez.Error.InvalidArguments: Invalid arguments in method call
             *  0x55e74e6ca860: print_error: Remote error
             *  0x55e74e6ca860: print_error: Raw message: org.bluez.Error.InvalidArguments

Unfortunately turning on debug in bluetoothd tells me nothing more.

This happens to be the characteristic path:

/org/bluez/hci0/dev_CC_F9_57_89_8C_2D/service0021/char0046:

I sent this:

method call time=1659138398.987176 sender=:1.3571 -> destination=org.bluez serial=11 path=/org/bluez/hci0/dev_CC_F9_57_89_8A_FB/service0021/char0046; interface=org.bluez.GattCharacteristic1; member=WriteValue
   array of bytes "MyPasswd" + \0
   array [
      dict entry(
         string "type"
         variant             struct {
               string "command"
            }
      )
   ]
error time=1659138398.987326 sender=:1.3568 -> destination=:1.3571 error_name=org.bluez.Error.InvalidArguments reply_serial=11
   string "Invalid arguments in method call"


Here is what was added earlier for this characteristic:

signal time=1659138398.895579 sender=:1.3568 -> destination=(null destination) serial=131 path=/; interface=org.freedesktop.DBus.ObjectManager; member=InterfacesAdded
   object path "/org/bluez/hci0/dev_CC_F9_57_89_8A_FB/service0021/char0046"
   array [
      dict entry(
         string "org.freedesktop.DBus.Introspectable"
         array [
         ]
      )
      dict entry(
         string "org.bluez.GattCharacteristic1"
         array [
            dict entry(
               string "UUID"
               variant                   string "edf50100-681e-4b92-999c-e16b3a8bc047"
            )
            dict entry(
               string "Service"
               variant                   object path "/org/bluez/hci0/dev_CC_F9_57_89_8A_FB/service0021"
            )
            dict entry(
               string "Value"
               variant                   array [
                  ]
            )
            dict entry(
               string "Flags"
               variant                   array [
                     string "read"
                     string "write"
                  ]
            )
         ]
      )


Luiz Augusto von Dentz wrote:
>You can use AcquireWrite and then write directly to the fd received.
If I do AcquireWrite, I do write(fd,buf,strlen(buf)), then close(fd)?

I am only writing 8 characters + maybe a NULL.

I will try the file handle method next.







[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