lambdaisland / lambdaisland/dbus-client
java.nio.BufferUnderflowException when trying to set Bluetooth SPP profile
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 10
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied start-fake-hardware example and trace dbus/write-message while comparing the osa{sv} signature with the body, especially the Channel value. Verify how variants and uint16 values are encoded; done means the message no longer raises BufferUnderflowException and the Bluetooth SPP profile registration succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100