SEE RELATED POST
Any suggestions / pointers / solutions to the following - welcomed . . . .
In the above related post I asked about connecting to a specific device - which was not working prior to proceeding with a project.
The above was resolved.
I am now proceeding with the project still starting with @Erel s example code for BLE.
Now, being able to connect to the device, and with Erel's code now "seeing/Finding" the device - the example App attempts to connect to the device however it then, after about 5 - 10 seconds simply says Disconnected.
The Sub at which it fails is here : the line manager.Connect2(Id, False) is performed and then it just goes to the Sub Manger_Disconnected
The log for this is very short and is quoted below. I've stepped through the code and used several breakpoints to see where it stops the connection attempt, but it didn't really give anything useful. It seems obvious that this is some sort of time-out, but I haven't found anywhere to extend this - or in fact, that shows it exists as a changeable setting.
VERSION-1.0 -> is the temporary name I have given the device.
Any suggestions / pointers / solutions to the following - welcomed . . . .
In the above related post I asked about connecting to a specific device - which was not working prior to proceeding with a project.
The above was resolved.
I am now proceeding with the project still starting with @Erel s example code for BLE.
Now, being able to connect to the device, and with Erel's code now "seeing/Finding" the device - the example App attempts to connect to the device however it then, after about 5 - 10 seconds simply says Disconnected.
The Sub at which it fails is here : the line manager.Connect2(Id, False) is performed and then it just goes to the Sub Manger_Disconnected
point where it drops the connection attempt:
Sub Manager_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
Log("Found: " & Name & ", " & Id & ", RSSI = " & RSSI & ", " & AdvertisingData) 'ignore
' If Id = "6D:D4:F2:0C:A4:74" Then
ConnectedName = Name
manager.StopScan
Log("connecting")
#if B4A
manager.Connect2(Id, False) 'disabling auto connect can make the connection quicker
#else if B4I
manager.Connect(Id)
#end if
' End If
End Sub
The log for this is very short and is quoted below. I've stepped through the code and used several breakpoints to see where it stops the connection attempt, but it didn't really give anything useful. It seems obvious that this is some sort of time-out, but I haven't found anywhere to extend this - or in fact, that shows it exists as a changeable setting.
VERSION-1.0 -> is the temporary name I have given the device.
Logger connected to: samsung SM-A307FN
--------- beginning of crash
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
Found: VERSION-1.0, 50:65:83:6F:92:15, RSSI = -44, (MyMap) {1=[B@405125e, -1=[B@475a63f, 9=[B@2792b0c, 18=[B@ffd2c55, 10=[B@10bf66a, 2=[B@728675b, 0=[B@713ebf8}
connecting
Disconnected
** Activity (main) Pause event (activity is not paused). **
** Activity (main) Resume **
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**