Hi Merlin. Here is the code that I used. I just added a timer tick to periodically read a characteristic. I am trying to figure out where the 128-bit characteristic came from and am also trying to figure out how to write to the module.
#Region Project Attributes
#ApplicationLabel: RN_4020 Example
#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
Dim manager As BleManager
Private cs As List
Dim dataTimer As Timer
Dim s As BleService
Dim c As BleCharacteristic
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)
dataTimer.Initialize("dataTimer", 500)
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
s = Services.GetValueAt(0)
'Read the manufacturer characteristic
c = s.GetCharacteristics.Get("00002a00-0000-1000-8000-00805f9b34fb")
manager.ReadCharacteristic(c)
dataTimer.Enabled = True
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
Sub dataTimer_Tick
' cs.Initialize
' s = Services.GetValueAt(0)
'Read the manufacturer characteristic
' c = s.GetCharacteristics.Get("00002a00-0000-1000-8000-00805f9b34fb")
manager.ReadCharacteristic(c)
End Sub