Open nmiglio opened 1 year ago
Hi, Do you mean the connected device does not interpret the message correctly? If so, I'll try to reproduce this with an esp32 as soon as I'm able to. As far as how the plugin works; it converts the string into a bitearray before sending it to the connected device (might explain the 8 bytes length, though it still seems weird)
I need to comunicate with the device using hex sequences. I'm not sure I'm preparing the messagein the right way.
the write method takes a string as parameter and I need to send a sequence of hex values. I conver the message using fromCharCodes()
but as the size of the sent message is differentfrom the expected (sending 5 bytes I get 8 as length) I guess there is something wrong in the conversion.. I'm clearly not a dart expert :-)
Mmmh, looks like I'd need to directly send bitearray to the native interface; that would probably solve your issue but would require a bit of an architecture overhaul, but it seems feasible. Don't have an ETA for it, though
Might have to be because String in Dart are represented as UTF-16 codes? Converting the string back to bytes would then add some extra values?
Maybe a version of write that can take raw bytes is easier to implement?
I encounter a similar issue; I need to send an array of bytes to the Bluetooth module, but there is no function available for me to accomplish that
Hey all, as you might have noticed from my responsiveness, I'm afraid I don't enough time to work on this library. I'll maintain it (for now), so I'm open to Pull Requests if anyone wants to implement this method :)
Hi!
What is the proper way to send an hex sequence after connecting to the device?
I get the connection and something is sent, but I get no reply from the device. Also when sending 5 bytes I get 8 bytes out in the logs:
D/BluetoothSocket(11952): write out: android.net.LocalSocketImpl$SocketOutputStream@fdb975e length: 8
I guess I am doing something wrong.. This is the write:
Same sequence via serial terminal is working fine.
Thanks!