This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how can s130 ble_central_and_peripheral code be connected to any slave whose address is not mentioned

hi, i am working on ble project where i am trying to develop a project with master(mobile phone)-bridge(acting as master and slave,nrf board)-slave(nrf board) .i use the progam nRF51_SDK_8.1.0_b6ed55fnnn\examples\ble_central_and_peripheral\ experimental\app_s130_demo\pca10028\s130\arm4.

In this program, in order to connect with slave we have to give the address of slave at the beginning,which is undesired if you have many slaves(say100)and only with those slaves whose address is mentioned the master gets connected .(May be this code works for any slaves to be connected even with those whose address is not mentioned .For that i think that we may receive the address of any slave in some variable but i haven't understood that variable or so.)

so inorder to connect with any slave that is advertising what shall be done??

please help

Parents
  • Hi,

    You can simply start scanning first and check the advertising report if it matches something you would like to connect to, e.g. based on advertising data or address matching. You can connect directly to the device address present in the advertising report, given that it is connectable - and does not use a white-list for connect requests.

    Other modes of connection include using a white-list with up to 8 addresses and 8 identity resolving keys, but these you would need to know in advance (or remember from earlier connections). The central will then automatically connect to any of these, and the connected event will provide you with information of which device it matched.

  • This is a really fundamental question, so I would recommend you to read through the intro documentation and look at our examples before proceeding. Scanning is started with sd_ble_gap_scan_start(), and advertising report events will start arriving whenever it detects an advertiser. These events are either fetched with sd_ble_evt_get() when expected, or in an interrupt routine. Most of our SDK examples use this interrupt routine to call all event handlers. You could add an event handler for ADV_REPORT here that would start connecting to advertising devices.

Reply
  • This is a really fundamental question, so I would recommend you to read through the intro documentation and look at our examples before proceeding. Scanning is started with sd_ble_gap_scan_start(), and advertising report events will start arriving whenever it detects an advertiser. These events are either fetched with sd_ble_evt_get() when expected, or in an interrupt routine. Most of our SDK examples use this interrupt routine to call all event handlers. You could add an event handler for ADV_REPORT here that would start connecting to advertising devices.

Children
No Data
Related