is there an example .c file of a central that also advertises?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Do any of the examples support a central that advertises while its also communicating to slaves?

Central should never connect to another central; it's just advertising as a way to broadcast its ID and status.

0 Likes
1 Solution
VictorZ_46
Employee
Employee
5 comments on blog 25 sign-ins 250 likes received

A BLE connection is always between a central (master) and a peripheral (slave).  Meanwhile a device can support 2 or more connections performing as a master in some and as a slave in others.  Hello_client sample app shows how to create 2 simultaneous connections.  It stops advertisements when it connects to the master and stops scanning when it connects to a slave, so it is 2 connections.  But if you need to support more it should be straight forward.  For example your application can continue scanning and when correct advertisement is detected, connect another slave.  20736/20737 supports up to 8 connected slaves, or 1 connected master and 7 connected slaves, or 1 connected master and doing advertisements and 6 connected slaves, or 2 connected masters and 6 connected slaves.

View solution in original post

4 Replies
VictorZ_46
Employee
Employee
5 comments on blog 25 sign-ins 250 likes received

A BLE connection is always between a central (master) and a peripheral (slave).  Meanwhile a device can support 2 or more connections performing as a master in some and as a slave in others.  Hello_client sample app shows how to create 2 simultaneous connections.  It stops advertisements when it connects to the master and stops scanning when it connects to a slave, so it is 2 connections.  But if you need to support more it should be straight forward.  For example your application can continue scanning and when correct advertisement is detected, connect another slave.  20736/20737 supports up to 8 connected slaves, or 1 connected master and 7 connected slaves, or 1 connected master and doing advertisements and 6 connected slaves, or 2 connected masters and 6 connected slaves.

Anonymous
Not applicable

I don't think this answered my question.

Can a central advertise while also, at the same time, scanning, connecting, communicating, disconnecting with multiple peripherals?

At boot, we want central to start advertising indefinitely while it also scans, connects, communicates, disconnects, and then scans/connects/communicates/disconnects to other peripherals, up to 6 simultaneously, again and again.

0 Likes

dbell, the answer is yes.  Please check hello_client app.  It performs as a central in a connection to a hello_sensor app.  It also advertises and allows connection from other devices (for example an iPhone).

0 Likes
Anonymous
Not applicable

Centrals typically do not advertise. I'm not sure how this works when devices can act as both central and peripheral (20736 supports this).

0 Likes