Write long data over BLE (+ than 20 bytes)
See original GitHub issueSteps to reproduce
-
use the BLE explorer application
-
modify to send more than 20 bytes
Expected behavior
I develop a long data function sender like follow :
public async void sendDataBle(List<List<Byte>> trame)
{
Task isSendCompleted = new Task();
for (Byte numPaquet = 0; numPaquet < trame.Count; numPaquet++)
{
await(isSendCompleted = WriteToTXCharacteristic(trame.ElementAt(numPaquet).ToArray())));
while (!isSendCompleted.IsCompleted) ;
}
}
the List<Byte> in list trame have a maximum of 20 Bytes.
I tried this implementation too :
public async void sendDataBle(List<List<Byte>> trame)
{
for (Byte numPaquet = 0; numPaquet < trame.Count; numPaquet++)
{
await WriteToTXCharacteristic(trame.ElementAt(numPaquet).ToArray());
}
}
this is the writeToTXCharacteristic function :
public async Task WriteToTXCharacteristic(byte [] dataTX)
{
if (_UartTXcharac.CanWrite)
await _UartTXcharac.WriteAsync(dataTX);
await Task.Delay(200); //try to get tempo between two characteristic write
}
Actual behavior
When i send less than or 20Bytes, it’s ok, i receive my packet.
When i send data (more than 20Bytes), this function try to send 2 packets. I receive one of them but after that nothing, i never receive the second.
Crashlog
There are no crash log
Configuration
Version of the Plugin: 1.2.1
Platform: e.g. iOS 10 / Android 4.4
Device: e.g. Wiko raimbow 4G
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Write long data over BLE (+ than 20 bytes) · Issue #205
Steps to reproduce use the BLE explorer application modify to send more than 20 bytes Expected behavior I develop a long data function ......
Read more >Sending more than 20 bytes with BLE
I want to send commands through BLE, which are often more than 20 bytes. How can i do to split my data, and...
Read more >BLE Sending more than 20 Bytes of Data | Thejesh GN
This works really well. But the maximum amount of data you can send is 4606 bytes (256*20 - 256*2 -2). Most of my...
Read more >How to send data more than 20 bytes over BLE
I am trying to send more than a 20 byte data through ble to an android app. But all I am able to...
Read more >BLE write long data [37031096] - Issue Tracker - Google
We try to send "long" (more than 20 bytes) data to Bluetooth smart device using the BluetoothGatt API. 1) Using write characteristic only...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I havent seen “INITIAL_MESSAGE_PACKET” at the time I was using Xamarin so I can’t help you with that.
If you consider using my method, there are serveral ways to “mark” the chunks:
1 (I used this one and never had any “false-positive” outcomes):
2:
Just be creative, Hope this helps!
@Tijgerd I have my data divided into the chunks of data. My question is: How do I mark the start and how do I mark the last chunk.
I am very confused in here, IF I look to this stackoverflow question, In the answer there is something like
initial_packet[0] = BLE.INITIAL_MESSAGE_PACKET;
Do I need to specify this somehow or just send data randomly and my characteristic should take care of it ?