[/
Sub FindDevices_Click
HideParaPanels
Panel6.Visible=True
FindDevice
End Sub
Sub ExitBT_Click
HideParaPanels
Para4.Visible=True
End Sub
Sub FindAgain_Click
FindDevice
End Sub
Sub FindDevice
rp.CheckAndRequest(rp.PERMISSION_ACCESS_COARSE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission...", False)
Return
End If
Dim success As Boolean = Starter.Manager.SearchForDevices
If success = False Then
ToastMessageShow("Error starting discovery process.", True)
Starter.Service_Create
Else
ProgressDialogShow2("Searching for devices...", True)
End If
End Sub
Public Sub DiscoverFinished
ProgressDialogHide
If Starter.Manager.foundDevices.Size = 0 Then
ToastMessageShow("No device found.", True)
Else
Dim l As List
l.Initialize
For Each nm As NameAndMac In Starter.Manager.foundDevices
l.Add(nm.Name)
Next
InputListAsync(l, "Choose device to connect", -1, True)
Wait For InputList_Result (Index As Int)
If Index <> DialogResponse.CANCEL Then
Dim Condevice As NameAndMac = Starter.Manager.foundDevices.Get(Index)
Starter.Manager.ConnectTo(Condevice)
ProgressDialogShow2($"Trying to connect to: ${Condevice.Name} (${Condevice.Mac})"$, False)
End If
End If
End Sub
]