There are two android devices:
There is also an FSC-BT616 bluetooth module, which is connected to a PC via a UART-USB converter.
Program code:
And then I send an 8-byte packet every 500ms in an endless loop and see it in the terminal on the PC.
On a Samsung tablet, this transfer can go on and on. And on the digma tablet, it comes equal to 600 bytes and then, no matter how much I call WriteData, the data is not sent. If I try to reconnect, then again I can only send 600 bytes. As if the digma tablet has some kind of buffer that limits the transfer to > 600 bytes. Is it possible to clean it periodically? Why it happens? Is it possible to somehow solve this problem?
Screen of the service I'm working with:
P.S. One might think that the matter is in the tablet, but I tried to use this tablet (digma) with another bluetooth module (HC-08) and there the transfer does not stop after 600 bytes and everything works fine.
There is also an FSC-BT616 bluetooth module, which is connected to a PC via a UART-USB converter.
Program code:
B4X:
Public SaveDeviceId As String
Public SaveServiceId As String
Public SaveCharacteristicId As String
Public ServiceIdStartsWith As String = "0000fff0"
Public CharacteristicIdStartsWith_1 As String = "0000fff1"
Public CharacteristicIdStartsWith_2 As String = "0000fff2"
Sub BleMan_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
Log("DeviceFound = " & Id.Trim & " " & Name.Trim & " " & RSSI)
If SaveDeviceId = "" Then 'if we haven't yet found the device we're looking for
If Name="FSC-BT616" Then
BleMan.StopScan
Sleep(500)
SaveDeviceId = Id
BleMan.Connect2(SaveDeviceId, False)
End If
End If
End Sub
Sub BleMan_Connected (Services As List)
Log("Connected")
Sleep(500)
For Each SS As String In Services
Log("Service = " & SS)
If SaveServiceId = "" Then 'if we haven't yet found the service we're looking for
If SS.StartsWIth(ServiceIdStartsWith) Then
SaveServiceId = SS 'then save it
BleMan.ReadData(SaveServiceId) 'and read it
End If
End If
Next
End Sub
Sub BleMan_DataAvailable (ServiceId As String, Characteristics As Map)
For Each C As String In Characteristics.Keys
Dim V() As Byte = Characteristics.Get(C)
If SaveCharacteristicId = "" Then
If ServiceId = SaveServiceId Then
If C.StartsWith(CharacteristicIdStartsWith_1) Then
BleMan.SetIndication(SaveServiceId, C, True)
else if C.StartsWith(CharacteristicIdStartsWith_2) Then
SaveCharacteristicId = C
End If
End If
End If
Next
End Sub
B4X:
For i=0 To 10000
Sleep(500)
BleMan.WriteData(SaveServiceId,SaveCharacteristicId,Array As Byte(0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07))
Next
Screen of the service I'm working with:
P.S. One might think that the matter is in the tablet, but I tried to use this tablet (digma) with another bluetooth module (HC-08) and there the transfer does not stop after 600 bytes and everything works fine.
Last edited: