I'm developing a BLE App. When I connect to a peripheral, the system will pop a “Bluetooth Pairing Request” alert. now,I want to know how to get the Cancel button or the pairing button for the user tapped,Because it is important to me,Thank you.
Related
I am trying to keep the bluetooth sco connected for a device running android from the time the bluetooth headset is connected to when the headset is disconnected or more specifically I would like the sco link not torn down by an app while the bluetooth headset is connected. It is okay for a user while in the VOIP call menu to select the BT/speaker icon button and tear down and bring back up the sco link (as it is user initiated).
When a VOIP call ends (eg whatsApp, google hangouts, skype, viber etc) while using a bluetooth headset, the sco link gets torn down. I would like the sco link to be either not torn down when the VOIP call ends (preferred operation) or re-established through "some" mechanism.
Things I have tried (with no success):
1) Trying to detect VOIP call start/end but reading other SO posts, looks like this is not possible. There are a lot of hooks to detect a sim-based call and end but not for VOIP based calls.
2) Start sco using startVoiceRecognition() like below. This seemed to work...almost...
audioManager.setMode(MODE_IN_COMMUNICATION)
audioManager.startVoiceRecognition()
There were two problems with this approach.
An incoming whatsApp call tears down the sco established by using
the startVoiceRecognition() api
While in a VOIP call (hangouts, whatsApp etc), the in-call audio route options do not work
I have gone over several SO posts on this but with no success.
3) I observed that Audiomanager.setMode gets set to MODE_NORMAL (0) when a VOIP call ends and I can startBlueToothSco() there but there is no listener for AudioManager mode changes and I do not want to poll it.
I also observed that depends on the VOIP app attempting to stop sco on a call end, checking the mode may not work as the app could call stopBluetoothSco after the mode change.
4) Make a dummy call using ConnectionService api's that makes android think its in a call but that prevents VOIP calls from being established and hence the sco link will not be disconnected. (not desirable as I need VOIP calls to happen)
Any ideas/suggestions will be appreciated.
I'm creating a web app which connects to a control device. I want to secure it to make sure no one but the user can control it. for that I want to use LE secure connection pairing with numeric comparison. But my control device doesn't have a display, so I want to send the security code to my web app so the user can check the code's there and 'ok' the connection on the web app.
I wonder if this is possible and if I don't lose security while doing it this way
How do you plan to send the security code to the web app? To do it programatically implies that you already have a secure channel to the device.
On devices without a screen I've seen the security code printed on a sticker. It isn't as secure as a code which can change every time a new pairing occurs but is better than no code at all.
If the device has a button you can require the user press it before pairing or other privileged actions are taken.
I use nrf51822 sdk130 (central device) and nrf51822 sdk110(peripheral device). I want to continuously get rssi value of the peripheral device using the central device without connection. Normally I start the scan_start function using button_handler function. Then connection establish occurs. But I dont want to do that. I want to Connect automatically device without press the button (without button_handler function). And I want the device not to reconnect until it leaves the bluetooth signal range.(think like KEYLESS GO - Mercedes). Is it possible?
it is possible to send non-connectable advertisement from the peripheral. This is intended to broadcast some information without being connected. using this central device can read the rssi of the peripheral's advertisement. The second part of your question is not very clear.if the application in the central does not see an advertisement it is possible to detect the absence of the peripheral.
see passive scanning sequence below.
see active scanning sequence below, the only requirement is that the active scanner should send at least one scan Request.
active vs passive scanning:
Once connection is established, RSSI can be read using following HCI command.
The relevant section for LE connection is as follows.
We are testing Bluetooth in WEC2013 with a USB based dongle from generic vendor on iMx6 platform. We are using the default HCI Transport layer provided with WEC2013 BSP.
BT is turned on and able to scan all the nearby devices.
We have enabled following set of sysgen variables and registry entry.
Sysgen Variables:
SYSGEN_BTH (Bluetooth stack with universal loadable driver)
SYSGEN_BTH_BTHUTIL (Bluetooth Profile Management APIs)
SYSGEN_BTH_HID_KEYBOARD (Bluetooth HID - Keyboard)
SYSGEN_BTH_HID_MOUSE (Bluetooth HID - Mouse)
SYSGEN_BTH_AG (Bluetooth HS/HF and Audio gateway service)
SYSGEN_BTH_SETTINGS (Bluetooth settings UI)
SYSGEN_OBEX_CLIENT (Obex client)
SYSGEN_OBEX_SERVER (Obex server)
SYSGEN_OBEX_FILEBROWSER (OBEX file browser)
SYSGEN_OBEX_INBOX (OBEX Inbox)
SYSGEN_FTPD (FTP server)
SYSGEN_BTH_BTHSSVC(Support Secure Simple Pairing)
Registry entry:
[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\Default\224_1_1\Default\Bluetooth_USB_Driver]
"DLL"="bthusb.dll"
[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\Default\Default\224_1_1\Bluetooth_USB_Driver]
"DLL"="bthusb.dll"
[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transports\PnP\{B3DD867A-1E6E-4215-8AA7-EAC1DFC46548}]
"flags"=dword:80000000
"driver"="bthusb.dll"
"resetdelay"=dword:0
"PacketSize"=dword:200
"BlockSize"=dword:5
[HKEY_LOCAL_MACHINE\ControlPanel\Bluetooth]
"PinAttemptInterval"=dword:200000
"PinEntries"=multi_sz:"0000","8888"
We observed different scenario's in pairing to a device.
Connecting to mobile from board(imx6+usb dongle running with WEC2013)
Here pairing is success when pair is initiated through bthsettings UI. It will trigger the 6-digit automated passkey on both the sides.
Connecting from mobile to board without opening bthsettings UI.
Here pairing is success once. When the UI is not open (BT is ON in background), pairing is initiated from mobile, both will be paired using automated
6-digit passkey method. But this will internally invoke bthsettings UI, so next time when we give pairing from mobile, mobile side will ask for manual
key insertion. As soon as the key is entered on mobile and pair is pressed, pairing rejected notification will be observed on mobile terminal.
So pairing is failed in this case.
Connecting from mobile to board when bthsettings is opened.
Here pairing is failed. When pair is initiated from mobile, manual key insertion UI will be invoked and when key is inserted and pair is pressed,
pairing rejected notification will be displayed on mobile terminal and pairing is failed.
In these failed senarios, the upper layer is responding with "Pin code request negative reply command" for "Pin code request event" from chip.
We need input on this pairing process. Why this automated key and manual key generation methods are invoked based on whether UI is open or never opened? And why manual key case is failing?
Are we missing any registry entry or stack feature ?
It all got to do with SSP(Secured Simple Pairing), which decides the pairing authentication model. This is affected in WEC8(2013) through the changes under bthsettings.
Under WEC8 they disable SSP(via function EnbaleSSP()) whenever a connection is initiated from external device and enable back SSP when conenction is initiated internally. Though this is the logic, I'm not aware of why this is introduced(and is it a bug, that'll be fixed in upcoming updates as they initially did for NDIS 5 wireless driver connection).
And as a workaround to this, disable EnableSSP().
Also SYSGEN_BTH_BTHSSVC is implicitly needed by SYSGEN_BTH_SETTINGS component, and the link is broken under WEC8.
Microsoft has provided the fix in April 2015 update. Details available here.
I have an Java application on my PC and database.There are some MAC
and PIN data in DB.
I'm sending messages (now it's text files over OBEX put method, but in
future it will be SMS messages i hope :) ), so when i discover some
device, then discover needed service i'm looking to the DB and if the
phone MAC in the DB i need to start PAIRING with predefined PIN.
I've coded all the process, except the PAIRING... How to initialize
it ?
You have to register a passkey-agent which inputs the PIN when it is requested. More info here.