Hope Erel can provide me a simple BLE project for B4A to compile & run ,thanks.

taddykao1

New Member
Licensed User
Dear Erel;
When I use the full example is available here: https://www.b4x.com/android/forum/threads/bluetooth-low-energy-ble-library.31584/#content.I Compile & Run to get error message as following. Please help me,thanks.
B4A version: 5.00
Parsing code. Error
Error parsing program.
Error description: Unknown type: blemanager
Are you missing a library reference?
Occurred on line: 19
Dim manager As BleManager
---------------------------------------------
My code :
#Region Project Attributes
#ApplicationLabel: BLE
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

Dim manager As BleManager
Private cs As List

End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
manager.Initialize("ble")
Log("Supported: " & manager.BleSupported)
End If
End Sub
Sub Activity_Click
Log("Searching for devices")
manager.Scan(10000, Null)
End Sub
Sub ble_DeviceFound (Name As String, MacAddress As String)
Log(Name & ", " & MacAddress)
manager.Connect(MacAddress, True)
End Sub
Sub BLE_Connected (Services As Map)
cs.Initialize
Dim s As BleService = Services.GetValueAt(0)
'Read the manufacturer characteristic
Dim c As BleCharacteristic = s.GetCharacteristics.Get("00002a00-0000-1000-8000-00805f9b34fb")
manager.ReadCharacteristic(c)
End Sub
Sub BLE_CharacteristicRead (Success As Boolean, Characteristic As BleCharacteristic)
Log("CR: " & Success & ": " & Characteristic.Uuid)
If Success Then Log("cr: " & Characteristic.GetStringValue(0))
End Sub
Sub ble_Disconnected
Log("Disconnected")
End Sub
Sub ble_DiscoveryFinished
Log("DiscoveryFinished")
End Sub
 
Top