Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim manager As UsbUirtManager
Dim device As UsbUirtDevice
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
' Initialize the Manager... It does not need a Eventname
manager.Initialize("")
' Check DeviceCount
Log("USBUirtCout="&manager.UsbUirtCount)
If manager.UsbUirtCount > 0 Then
For i = 0 To manager.UsbUirtCount-1
Dim dev As UsbUirtDevice
dev = manager.openUsbUirtByIndex(i)
If dev.IsInitialized Then
' ATTENTION
' You need to set a Eventname for the Device given....
dev.EventName = "USBDev"
' After the Eventname is set a listener for Messages is set also
If dev.initHelper Then
Log("Init seems ok")
Log("FirmwareVersion = "&dev.FwVersion)
Else
Log("LastError="&dev.GetLastError)
End If
Else
Log("Device given by index is not initialized")
End If
Next
End If
' Open and get the Device asuming it name is "USB-UIRT"
device = manager.openUsbUirtByName("USB-UIRT")
If device.IsInitialized Then
' ATTENTION
' You need to set a Eventname for the Device given....
device.EventName = "USBDev"
' After the Eventname is set a listener for Messages is set also
If device.initHelper Then
Log("Init seems ok")
Log("FirmwareVersion = "&device.FwVersion)
Else
Log("LastError="&device.GetLastError)
End If
Else
Log("Device with name USB-UIRT given by manager is not initialized (or did not exists?)")
End If
End Sub
Sub Activity_Resume
manager.registerReceiver
End Sub
Sub Activity_Pause (UserClosed As Boolean)
manager.unregisterReceiver
End Sub
Sub USBDev_onLearnProgress(progress As Int, signalQuality As Int, frequenzy As Int, msg As String, data As String)
Log($"USBDev_onLearnProgress(Progress = ${progress}, Quality = ${signalQuality}, Frequenzy=${frequenzy}, MSG=${msg}, DATA=${data})"$)
End Sub
Sub USBDev_onLearnResult(result As String)
Log($"USBDev_onLearnResult(${result})"$)
End Sub
Sub USBDev_onMessage(what As Int, msg As String, data As String)
Log($"USBDev_onMessage(${what},${msg},${data})"$)
End Sub
Sub USBDev_onUirCode(what As Int, code As String)
Log($"USBDev_onUirCode(${what},${code})"$)
End Sub