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?

  • 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

  • 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