I want to connect Blood pressure meter (BLE), but for pairing need to do the following functions
Slave Security Request
Pairing Response
How can i implement this? My code is below, i can see device name in paired list but device not sending data.
Slave Security Request
Pairing Response
How can i implement this? My code is below, i can see device name in paired list but device not sending data.
B4X:
Sub BroadcastReceiver_OnReceive (Action As String, i As Object)
Dim intnt As Intent = i
Dim BtPairingVariant As Int
Dim BtPinBytes() As Byte
Dim Bleomronpin As String = "981180"
If (Action = "android.bluetooth.device.action.PAIRING_REQUEST") Then
If (intnt.HasExtra("android.bluetooth.device.extra.DEVICE")) Then
BtPairingVariant = myBtAutoPair.GetPairingVariant(intnt)
If ((BtPairingVariant=2) OR (BtPairingVariant=3)) Then
myBtAutoPair.SetPairingConfirmatiion(intnt)
Diag.Write(1, "BtAutoPair.GetPairingVariant=" & BtPairingVariant & "(confirmation)")
Else
'----- Send pin to device. When device accepts pin, pairing dialog closes otherwise dialog remains open
BtPinBytes = Bleomronpin.GetBytes("UTF8")
myBtAutoPair.SetPin(intnt, BtPinBytes)
myBtAutoPair.SetPairingConfirmatiion(intnt)
End If
End If
End Sub