A bit of context: Sending data from phone to a HM11 device (write characteristic -> characteristic data is sent through uart).
The HM11 is a BLE 4.0 device, so it has a limit of 20 byte per packet. This means that long packets must be divided in 20 bytes chunks, then sent in order.
In order to see if it would be feasible, i used one the "BLE Scanner" app to connect and send a long string of text. BLE Scanner has no problem in taking a long string and sending it so that the data is transmitter continously. In fact, by looking with an oscilloscope i see the 20 byte packets being sent with some 600us gaps between them. So at least in theory it's possible.
However, i can't find a way to get even close with B4A. I tried two approaches:
-calling Manager.WriteData in a loop
-calling Manager.WriteData, then on the Manager_WriteComplete event check if more data needs to be written then call Manager.WriteData again
unfortunately in both cases i get huge gaps, 20 to 100ms wide.
Is there a way i could get around the problem?
If i had to guess, it would be to implement synchronous operation: a block of native code in which i write and wait for completition, because i think the B4A event loop is getting in the middle
Suggestions?
The HM11 is a BLE 4.0 device, so it has a limit of 20 byte per packet. This means that long packets must be divided in 20 bytes chunks, then sent in order.
In order to see if it would be feasible, i used one the "BLE Scanner" app to connect and send a long string of text. BLE Scanner has no problem in taking a long string and sending it so that the data is transmitter continously. In fact, by looking with an oscilloscope i see the 20 byte packets being sent with some 600us gaps between them. So at least in theory it's possible.
However, i can't find a way to get even close with B4A. I tried two approaches:
-calling Manager.WriteData in a loop
-calling Manager.WriteData, then on the Manager_WriteComplete event check if more data needs to be written then call Manager.WriteData again
unfortunately in both cases i get huge gaps, 20 to 100ms wide.
Is there a way i could get around the problem?
If i had to guess, it would be to implement synchronous operation: a block of native code in which i write and wait for completition, because i think the B4A event loop is getting in the middle
Suggestions?