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

Relay Defination and Question

Hey, Just had a quick question... I was doing the Relay example and I don't totally understand what a "relay" is. Can you explain what the purpose and usage of relay is for?

On the same note, if my prediction is correct about what a relay is, is it possible to make a blinky example with a relay where the peripheral blinky is on one side and the relay would help extend the bluetooth the connection (recieve the command from the peripheral and send to the central blinky). image description

Something like this image

  • Yes, relay basically extends the link in general, now there might be differen types of relays depending on what layer and how they do the job. Your question "can I relay GATT Handle Value Notification or Write command" the answer is yes. You can do "relay" which on one side will look like "client" (\examples\ble_central\experimental\ble_app_blinky_c) on one side (so it can connect to BLE blinky example) and "server" (examples\ble_peripheral\experimental_ble_app_blinky) on the other. Typical life-cycle of such "relay" would be:

    1. Boot and scan for devices advertising LED Service availability (= BLE Blinky peripherals).
    2. Once suitable Peripheral is found connect to it.
    3. Once connection and GATT Service Discovery passes start second GAP role, this time Peripheral (and advertise LED Service capability). Wait for any Central to connect.
    4. Once some Central connects it can write/read LED Service handles and "relay" will just mirror these actions on the other link.

    It can be malicious relay, or intended range extension (on GATT layer instead of doing some simple repeating on Link Layer) or you can even "aggregate" several servers or clients and control numerous LED Service devices at once or even be processing commands from several "masters" commanding LED Service device(s).

  • this is great! thanks for the response :) is there an example code that I could refer to to modify and use to be the intended range extension?

  • Sure there is example of relay on GATT layer which works as "service collector" but in principle it could work as range extender as well. See it in nRF5 SDK.

  • Hey endnode, I really appreciate your responses. They're very helpful

    Can you explain what a "service collector" is and what the example you tagged me in is?

    I'm assuming the two peripherals are transmitting their data into the collector so you can read both at once. To change it to a range extender then I would have to turn one of the peripherals into a central.

  • It should be visible from the picture in the link: "relay" in this example is connecting to two different devices (GATT Servers - doesn't really matter if they are GAP Peripheral or Central but I guess they are traditionally GAP Peripherals hence "relay" plays GAP Central towards both of them) and offers their services to third device on the "other" side (being GATT Server, again doesn't matter much if GAP Peripheral or Central but I guess it keeps traditional "GATT Server + GAP Peripheral" scheme). So to be simple "range extender" you need simply one connection on each side, it should be easy to modify the FW (it might even work like that out of the box: simply if it sees only one GAP Peripheral + GATT Server then it connects to it and offers on the "other" side).

Related