Skip to content

java.nio.BufferUnderflowException when trying to set Bluetooth SPP profile #1

Description

@eraserhd

Hi!

This code gets the buffer underflow exception.

(defn start-fake-hardware []
  (let [client (dbus/init-client! (dbus/system-sock)
                                  (fn [v]
                                    (println "DBus Reply: " v)))
        result (dbus/write-message
                 client
                 {:type    :method-call
                  :headers {:path "/org/bluez"
                            :member "RegisterProfile"
                            :interface "org.bluez.ProfileManager1"
                            :destination "org.bluez"
                            :signature "osa{sv}"}
                  :body    ["/org/bluez/spp"                       ; Profile path
                            "00001101-0000-1000-8000-00805f9b34fb" ; SPP UUID
                            {"Name"    "Serial Port"
                             "Channel" 1}]})]
    (prn @result)))

One thing to note is that the "Channel" value that is sent should be a variant containing a uint16, and it seems like the code will encode it wrong. I don't know if that's the problem.

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