This library makes it very simple to advertise data through BLE. You just need to call ble.Advertise with the string that you want to advertise as the device name.
Note that it doesn't support making connections.
Usage example:
iOS app:
The clients need to scan for near by devices and check the device name.
B4i and B4A clients examples are attached.
On Android the name is cached so we need to get it from the advertising data map.
On iOS it stops scanning after a while so we restart the scanning process every 10 seconds.
Note that it doesn't support making connections.
Usage example:
B4X:
#StackBufferSize: 600
Sub Process_Globals
Public Serial1 As Serial
Private ble As ESP32SimpleBLE
Private timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
timer1.Initialize("timer1_Tick", 500)
timer1.Enabled = True
End Sub
Private Sub Timer1_Tick
Dim data As String = JoinStrings(Array As String("B4RTime: ", NumberFormat(Millis, 0, 0)))
If ble.Advertise(data) = False Then
Log("failed to set name.")
End If
End Sub
iOS app:
The clients need to scan for near by devices and check the device name.
B4i and B4A clients examples are attached.
On Android the name is cached so we need to get it from the advertising data map.
On iOS it stops scanning after a while so we restart the scanning process every 10 seconds.