Help With BlueTooth Sample

SoyEli

Active Member
Licensed User
Longtime User
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Main As Panel
Dim Serial1 As Serial

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("Utilities")
Serial1.Initialize("Serial1")
End Sub

Sub ConnectToBlueTooth
Dim PairedDevices As Map
PairedDevices.Initialize
PairedDevices = Serial1.GetPairedDevices
Dim List1 As List
List1.Initialize
For i = 0 To PairedDevices.Size - 1
List1.Add(PairedDevices.GetKeyAt(i)) 'add the friendly name to the list
Next
Dim res As Int
res = InputList(List1, "Choose device", -1) 'show list with paired devices
If res <> DialogResponse.CANCEL Then
Serial1.Connect(PairedDevices.Get(List1.Get(res))) 'convert the name to mac address
End If
End Sub
Sub Serial1_Connected (Success As Boolean)
If Success Then
ToastMessageShow("Connected successfully", False)

Else
Msgbox(LastException.Message, "Error connecting.")
End If
End Sub

Log="java.io.IOException: Service discovery failed"
---------------------------------------------------
Hello:

I'm trying the Bluetooth sample but:

It lists the paired devices but it fails to connect:

Am I missing something?

Thank you:
 
Last edited:

SoyEli

Active Member
Licensed User
Longtime User
Thank you for your response.
and thank you for all your help!


I have tried that example' does not work, does not see any paired devices.

I tried the SerialExample and it gives me the list of paired devices but when I try to connect it only says after a few seconds " java.io.ioexecption.service.disvovery failed"

I have tried with headsets: ALL the same thing-
jawbone
2xxplantronics
hm100
blueAnt
 
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
I got it to work !!!!!

Thank you:

It worked with "Serial1.Connect3(PairedDevices.Get(l.Get(res)),1)"


:icon_clap:
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Hi SoyEli
Would you please explain the line:
"Serial1.Connect3(PairedDevices.Get(l.Get(res)),1) "

specially the "1" at the end...

thanx
 
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
Happy to:

Sorry getting ready for the big PARTYYYYYYYYYYYYYYYYYYYYYYYYY !


I used the "Serial example" and replaced the connect line to>"Serial1.Connect3(PairedDevices.Get(l.Get(res) ),1) "

the "1" is the port

:)
 
Last edited:
Upvote 0
Top