Auto Connect After Pairing

8 posts / 0 new
Last post
justinturley
Offline
Last seen:4 years 3 months ago
加入:2016-06-19 23:55
Auto Connect After Pairing

Hi,

I've searched the forums and ap notes, but I have not been successful in finding an example that is helpful to me. I would like to set up my peripheral device with custom service to connect automatically with the central after it has been paired. I built my project on top of the ble_app_peripheral project.

Currently I start undirected advertising after holding a button for 4 seconds. And this works well, but after power off then back on, I would like them to connect automatically.

Is the code for auto pairing implemented on the Central only, or does the Peripheral also have to have specific code for this?

I don't need a secure connection, or for this device to be the only connectable device, so I would like the most simple and efficient method possible.

Can you please direct me to an example or note that explains this better? Do I need to used Directed adv? Or do I have to have a bonded connection to make it work? Do I have to add the central's address to a whitelist?

Thanks.

Device:
MT_dialog
Offline
Last seen:1 week 6 days ago
工作人员
加入:2015-06-08 11:34
Hi justinturley,

Hi justinturley,

There are a few ways for the devices to re-connect automatically, you can either have the peripheral to perform a direct advertising to the central, in order to establish a fast reconnection, or you can perform undirected advertising and have the central filter the device through the advertising string (check for specific data in the advertising string) or the bd address and issue a connection request. In all cases only the central device sends a connection request (you not going to be able to force a connection from your peripheral). Regarding the examples you can check the keyboard example in order for your peripheral to perform a directed advertising and also you can check the DSPS host project where the host checks the advertising string of the device detected and checks for specific services on the adv string (in that specific case the DSPS service) and if the service is the one that the host is looking for then it issues a connection request.

Thanks MT_dialog

justinturley
Offline
Last seen:4 years 3 months ago
加入:2016-06-19 23:55
Thanks,

Thanks,

Just to clarify, can I do a directed advertise without bonding? I don't need or want to be bonded. If so, is there something I need to do before sending the direct adv command... i.e. do I need to get and store the clients address first, put it into a message, then send the command?

MT_dialog
Offline
Last seen:1 week 6 days ago
工作人员
加入:2015-06-08 11:34
Hi justinturley,

Hi justinturley,

In order for your peripheral to direct advertise to the device it has to know the bd address of the host that it was connected to previously, so you will have to store the bd address of your central in order to direct advertise to it. You can get this info (the bd address of the host during the connection procedure). The host's adress should be placed in the direct struct member of the gapm_adv_info union of the gapm_start_advertise_cmd you allocate when you are about to advertise. You dont need to bond with the device in order to connect to it via directed advertising.

Thanks MT_dialog

Lange
Offline
Last seen:3 years 4 months ago
加入:2016-09-14 02:59
Hi MT_dialog:

Hi MT_dialog:
I have a question, DA14580 firmware can't auto connect to APPLE IOS when reboot it. What should I do?
Looking forward to your answer!
谢谢。

MT_dialog
Offline
Last seen:1 week 6 days ago
工作人员
加入:2015-06-08 11:34
Hi Lange,

Hi Lange,

The connection procedure is something that the iOS is going to decide (the application running on the master and not the slave), normally the iOS should retain the bonding data after it has been rebooted in order to establish a secure connection and not going through the pairing procedure again. But again the connection procedure is something that it is initated from the master and not the slave (the connection command is only send from the master). Even in the directed advertising procedure the master is the one that decides if it will be connected with the peripheral or not.

Thanks MT_dialog

Lange
Offline
Last seen:3 years 4 months ago
加入:2016-09-14 02:59
Hi MT_dialog

Hi MT_dialog
Maybe something wrong with my post. Now again my question: DA14580 firmware can't auto connect to APPLE IOS after DA14580 reboot.Do you have Solutions?

Thanks Lange

MT_dialog
Offline
Last seen:1 week 6 days ago
工作人员
加入:2015-06-08 11:34
Hi Lange,

Hi Lange,

所提供的信息对我来说是不够的understand what your problem is, the question "DA14580 fw can't auto connect to APPLE iOS after da14580 reboot" is very generic:

  • As mentioned the connection procedure is initiated by the master and not from the slave (the master should start a connection, the slave can't do that).
  • What is the fw that you are using, is it any dialog reference design ?
  • The fw bonds with the iOS device ?
  • If it is bonding with the iOS device and the device is rebooted if you dont save the bonding data in a flash or in general in a NV memory the iOS device will try to connect to it without going through the pairing procedure and by using the same bonding data that had before the device was rebooted. Therefore the peripheral will decline connection with the peripheral.
  • There are quite a few reasons for a device not to be able to connect to a central, i trust that the above reason is the most probable, but you have to be more precise on what the problem is and what you observe.

Thanks MT_dialog