Private Sub Manager_StateChanged (State As Int)
If State <> manager.STATE_POWERED_ON Then
ToastMessageShow("Please enable Bluetooth", True)
NotAvailable = True
Else
peripheral.Initialize("peripheral", manager)
'peripheral.ManufacturerData = CreateMap(123: "this is my data".GetBytes("utf8"))
peripheral.ManufacturerData = CreateMap(123: "this is my data".GetBytes("utf8"), 124: Array As Byte(1, 2, 3, 4))
If peripheral.IsPeripheralSupported = False Then
ToastMessageShow("Peripheral mode not supported.", True)
NotAvailable = True
Else
peripheral.Start("B4APeripheral")
Wait For Peripheral_Start (Success As Boolean)
Log("Peripheral started successfully? " & Success)
End If
End If
SetState(False)
End Sub