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

Implicate blinky in relay example

Hey,

I'm currently doing the relay example on the nordic info centre. I'm trying to manipulate the example so that I can transform it into a range extender.

The goal here is to get one peripheral blinky to connect to relay and the relay to connect to the central. In result will have peripheral send signal directly to central with a range extender (relay)

In the relay example I need call, set the blinky example.

infocenter.nordicsemi.com/index.jsp

I noticed in the above website is that I need to call these functions. Can someone show me how to call these functions in the relay example and make it the relay connect to a central/peripheral?

  • @Binh: Are you familiar with the single connection example ? With just one central and one peripheral ? I would suggest you to study the normal example first. And understand the way it work and how to use the function, before you start to add the relay in.

    The Relay is the combination of the client and server, with one extra function, is to forward the data it receive from the server to the client on the other side. This is done inside hrs_c_evt_handler() and rscs_c_evt_handler().

    Basically, in your case, the relay would instead of change the LED voltage level, it forward (send) the write command/notification to the other side.

  • yes I'm familiar with the original example of just central and peripheral. what you said about the led voltage being sent forward is exactly what I am trying to do. Can you tell me how I would approach that?

  • My suggetion is:

    • Start with the ble_app_blinky_c central code
    • Add advertising from the peripheral code
    • Add service setup from the peripheral code
    • Inside lbs_c_evt_handler() when receive BLE_LBS_C_EVT_BUTTON_NOTIFICATION, instead of printing out on UART, you send a notification , like what we have in the button_event_handler() in the peripheral code (where we call ble_lbs_on_button_change() ). This will forward the notification from the peripheral to the central via the relay.
    • On the opposite direction, you implement led_write_handler() in your relay code so that instead of setting the LED on or off you send a ble_lbs_led_status_send() like what you have in the button_event_handler() in relay code. Of course you need to remove button_event_handler() in the relay code.

    That's it. I think above is the fundamental that you can follow to create your own relay code. Please also refer to what we have inside the relay example.

Related