Reputation: 876
I'm not sure this would be better on Electronics Stack Exchange.
I've seen a few questions similar to this, but pre BLE 4.2 days, before it was possible to have characters of greater than 20 bytes, but these questions are outdated now.
To anyone who's not aware, from BLE 4.2 onwards, you have been able to send far more than 20 bytes in a characteristic. So, if you've not come across this, I have successfully been transferring characteristics of 240 odd bytes between iOS and a Silicon Labs device for well over a year.
I have recently set up a Nordic embedded device and knocked up a Qt GUI to transfer data between the Nordic device and the Qt app running on Linux, using the Bluez stack. It will transfer 20 byte characteristics just fine.
So, I increased the Nordic's characteristics to 40 bytes, but Qt is not playing at all with it.
I am confident things are right at the Nordic end because if I use a little Android app and query the 40 byte characteristic it reads all 40 bytes. This makes me think that the issue is at the Laptop end.
I have various unknowns:
hciconfig tells me that I am running HCI Version 4.2 and LMP Version 4.2. That, to me, suggests larger characteristics should work.
Can Linux itself cope with characteristics of greater than 20 bytes?
Can Qt cope with characteristics of greater than 20 bytes?
I am running Mageia 6 and Qt Creator 4.2.1 with Qt 5.9.4 kit.
I have no Windows or iOS device with LE new enough for larger characteristics. Also, Windows is a bit of a pain when it comes to LE...
Edit:
btmon gives this when it receives a 40 byte chatacteristic:
ACL Data RX: Handle 3585 flags 0x02 dlen 27 #1026 [hci0] 577.032058
ATT: Handle Value Notification (0x1b) len 22
Handle: 0x0010
Data: 35303120546869732069732061206c6f6e672063
This is sending out a string from the Nordic:
"%1 This is a long characterstic %1",Messno,MessNo
MessNo gets incremented every time the Noridic sends out a message. This gets truncated to xxxx This is a long
So, this suggests to me that it's getting truncated either by the BT stack on the assumption that this is what the Qt app is digesting.
Upvotes: 1
Views: 729
Reputation: 18452
You should increase the MTU size from the nordic device. It has nothing to do with Qt.
Upvotes: 1