[/
Sub Paired_Click
Dim success As Boolean = CGlobals.BT.Connect
If success = False Then
ToastMessageShow("Cannot Connect.", True)
Else
ToastMessageShow("Connected.", True)
End If
ProgressDialogHide
End Sub
]
In the "Bluetooth" Class:
[CODE=b4x][/
Public Sub Connect As Boolean
Dim PairedDevices As Map
Try
PairedDevices = Serial.GetPairedDevices
Dim list As List
list.Initialize
For i = 0 To PairedDevices.Size - 1
list.Add(PairedDevices.GetKeyAt(i))
Next
Dim Res As Int
Res = InputListAsync(list, "Select Instrument", -1,False) 'show list with paired devices
If Res <> DialogResponse.CANCEL Then
ProgressDialogShow2("Trying To Connect...", True)
Serial.Connect(PairedDevices.Get(list.Get(Res))) 'convert the name to mac address
CGlobals.Mac = PairedDevices.Get(list.Get(Res)) 'Mac Address
CGlobals.Name = PairedDevices.GetKeyAt(Res) 'Name
Return True
End If
Catch
Log(LastException)
End Try
Return False
End Sub
Under "PairedDevices" there are 4 Survey Instruments, but the program crashes at "Res=". Even the "Log(LastException" does not show anything.
It used to work, but not anymore.
Any suggestions?
Thanks
Michael
]