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

Dynamically Redefine Central nRF52832 Peripherals To Connect To in Relay Application

Hi, 

I've developed a relay application based off of the ble_app_hrs_rscs_relay_pca10040_s132 example in SES using a Laird BL652 module (nRF52832 underlying device). Presently the program works to connect to a predefined target peripheral name/address (relay to sensor devices) and to have the relay device connected to one central as a peripheral (relay to phone connection). I have two questions: 

First  - How can I redefine the target peripheral I want to connect to from a Phone (in this case a Central to the Peripheral side of the relay)? What I'm intending is for the Phone to capture the advertisements of the sensor peripheral devices, confirm that a connection is wanted and pass the name and address on to the Relay (nRF52832 Laird BL652 device) which would redefine the target peripheral name/address which would set a filter matched event and start a connection. Is this possible? If so how would it be approached?

Second - I've been able to connect two of the same named target peripherals and receive data from both, but I would like to connect two different peripherals to the Relay device. For example "SENSOR1" and "SENSOR2". How would I define this to be able to connect to two different ones as well as be able to disconnect, redefine and reconnect to a any new combination of SENSOR devices?

/**@brief Names which the central applications will scan for, and which will be advertised by the peripherals.
 *  if these are set to empty strings, the UUIDs defined below will be used
 */
static char const m_target_periph_name[] = "SENSOR1";      /**< If you want to connect to a peripheral using a given advertising name, type its name here. */


Thanks!

Parents
  • Hi,

    Is this possible? If so how would it be approached?

    Yes, it's possible. You would somehow need to send the target name from the phone to the relay. You could e.g. use the nordic uart BLE service(NUS) for that(take a look at the ble_app_uart example). I.e. you would need to add the NUS service to the relay device.

    How would I define this to be able to connect to two different ones as well as be able to disconnect, redefine and reconnect to a any new combination of SENSOR devices?

    Just create a new variable for the other deivce, m_target_periph_name_2, and use that as a scanning filter as well. In SDK 15.2 there is an scanning module and function you can use for that(nrf_ble_scan_filter_set()).

Reply
  • Hi,

    Is this possible? If so how would it be approached?

    Yes, it's possible. You would somehow need to send the target name from the phone to the relay. You could e.g. use the nordic uart BLE service(NUS) for that(take a look at the ble_app_uart example). I.e. you would need to add the NUS service to the relay device.

    How would I define this to be able to connect to two different ones as well as be able to disconnect, redefine and reconnect to a any new combination of SENSOR devices?

    Just create a new variable for the other deivce, m_target_periph_name_2, and use that as a scanning filter as well. In SDK 15.2 there is an scanning module and function you can use for that(nrf_ble_scan_filter_set()).

Children
Related