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

Multirole Connection: can we send a broadcast ini advertising mode while in ble connection mode at the same time?

Hi,

I have 3 Devices that constantly broadcast their position to each other so the other can adjust the position each other. they act like master and slave but ther are no connection between them.

now i want to connect one of those 3 to a smartphone using connection mode but the problem is the smartphone can't detect the device which is now act as broadcaster in advertsing mode. is it possible to use advertising mode and connection mode at the same time?

how can i establish a connection between the device and phone while the device send message as broadcaster to another 2 devices?

is multirole still the most suitable solution to this problem?

Parents
  • Hi,

    is multirole still the most suitable solution to this problem?

     Yes ;)

    regards

    Jared

  • Hi Jared,

    thanks for your respond, now i don't want to use multirole because i don't want establish a connection between those 3 devices so there are no master and slave,

    so i already wrote a code for non-connectable advertisiment (the device as broadcaster) and before that i established the connection between the device and the phone but it return an error for function nrf_sdh_enable_request, ble_radio_notification_init, nrf_sdh_ble_enable, sd_ble_gap_adv_set_configure all retuns an invalid_state error.

  • Hi,

    The peripherals shouldn't automatically send a connection request because they've scanned the advertising peripheral. I don't see any issues with using multi-role.  The peripherals can advertise in connectable mode, and then scan the other peripherals when they act as a central without sending a connection request. 

    regards

    Jared 

  • Hi Jared,

    thanks for gettiing back to me,

    at first i also thought about multi-role but after i discussed it with my supervisor, we want to maintain the broadcaster role, we want to maintain their equal role (broadcaster and observer). because what i understood, if i use multi-role than the role between 3 devices changes to master and slave with one central.

    and then scan the other peripherals when they act as a central without sending a connection request.

    so after the connection with the phone established the central role can't broadcast the message? or i missunderstood?

  • My understanding is that you have 3 requirement for each device:

    1. It should scan the advertising packet of the other devices without sending a connection request (Observer role)
    2. It should advertise to the other devices devices without accepting a connection request from them ( Broadcaster role). This requirement might be omitted, see explanation further down. 
    3. It should accept a connection request from the smartphone ( Peripheral role)

    I assume that you want to advertise the same packet to both smartphone and the devices. 

    Andhika said:
    at first i also thought about multi-role but after i discussed it with my supervisor, we want to maintain the broadcaster role, we want to maintain their equal role (broadcaster and observer)

    I'm not sure what you mean with equal role, could you elaborate?

    You could achieve step 1 and 2 if each device scans without sending a connection request ( Observer role) and at the same time advertises. You don't need to implement the broadcast role i.e if the other devices don't send a connection request. The devices can advertise as connectable, which would make it possible for the smartphone to connect.

    I still think multi-role is the way to go. Maybe the forum has a better suggestion ;) 

    regards

    Jared 

  • thanks for your suggetion :)

    so after the connection with smartphone established (peripheral role) and it act as central to another devices, it can still act as obeserver and broadcaster role?

    You could achieve step 1 and 2 if each device scans without sending a connection request ( Observer role) and at the same time advertises. You don't need to implement the broadcast role i.e if the other devices don't send a connection request.

    really? it's a great answer but do you have any example or suggestion that i can learn from?

    I assume that you want to advertise the same packet to both smartphone and the devices. 

    honestly no, the packet is different, from smartphone to the first device we send a command such as move forward etc, and then after the first device doesn't move anymore it's send its position to another 2 devices as broadcaster role so there is no connection between them

    I'm not sure what you mean with equal role, could you elaborate?

    so there is no master and slave. there is no connection between them just broadcaster and observer. because from what i understood we use multirole so the first device could be the peripheral(slave) to the phone and central(master) to another devices.

    thanks for your help:)

    best regards

    Andhika

Reply
  • thanks for your suggetion :)

    so after the connection with smartphone established (peripheral role) and it act as central to another devices, it can still act as obeserver and broadcaster role?

    You could achieve step 1 and 2 if each device scans without sending a connection request ( Observer role) and at the same time advertises. You don't need to implement the broadcast role i.e if the other devices don't send a connection request.

    really? it's a great answer but do you have any example or suggestion that i can learn from?

    I assume that you want to advertise the same packet to both smartphone and the devices. 

    honestly no, the packet is different, from smartphone to the first device we send a command such as move forward etc, and then after the first device doesn't move anymore it's send its position to another 2 devices as broadcaster role so there is no connection between them

    I'm not sure what you mean with equal role, could you elaborate?

    so there is no master and slave. there is no connection between them just broadcaster and observer. because from what i understood we use multirole so the first device could be the peripheral(slave) to the phone and central(master) to another devices.

    thanks for your help:)

    best regards

    Andhika

Children
  • HI,

    Andhika said:
    really? it's a great answer but do you have any example or suggestion that i can learn from?

     This is the multirole example without sending a connection request.

    Andhika said:
    honestly no, the packet is different, from smartphone to the first device we send a command such as move forward etc, and then after the first device doesn't move anymore it's send its position to another 2 devices as broadcaster role so there is no connection between them

     I don't think you understood it correctly, I did not suggest that the devices are to connect to each other, but was wondering if you are going to advertise the same packet to smartphone and devices. I think most of your questions would be answered if you read the BLE documentation on roles properly.

    regards

    Jared

  • Hello Jared,

    You could achieve step 1 and 2 if each device scans without sending a connection request ( Observer role) and at the same time advertises. You don't need to implement the broadcast role i.e if the other devices don't send a connection request. The devices can advertise as connectable, which would make it possible for the smartphone to connect.

    where can i configure it? is it has something to do with ble_gap_adv_type? because previously we used ble_gap_adv_type_nonconnectable_noscanneble_undirected to configue our device as broadcaster

  • An Observer scans devices but never sends a connection request packet. This is achieved in the multi-role example by setting init_scan.connect_if_match to false. Advertising is started after scanning is started in adv_scan_start(). Again, I strongly recommend that you go through our tutorials on BLE and use some time for understanding the basics behind the Bluetooth Low Energy protocol.

Related