Difference between "connection" and "advertising" in Bluz documentation



I am super new to Bluz and I’ve been reading up on the documentation for power management, but unfortunately I am not fully grasping the different communication settings to achieve low power states.

First, in http://docs.bluz.io/tutorials/low_power/ what is the fundamental difference between “advertising” and “connecting”? There is a setadvertisingintervalinterval() function that sets the interval at which the Bluz DK send packets, how is this fundamentally different from set_connection_parameters() on the gateway? Should I think of “advertising” as the interval at which a connection is established between Bluz DK and central station, while “connection” as the interval at which data is sent across from one device to the other?

With this I would only conclude that advertising interval has to be lower than connection interval, other wise when the devices are trying to transmit data, there will be no connection between them, and that’s when a lower data throughput and latency occurs. On another note, how is BLE.disconnect() different from BLE.stopAdvertising(), wouldn’t they practically do the same thing?

I am planning to only advertise on an external interrupt using the start/stopAdvertising() functions. So I am hoping someone can clarify the devices connection aspects before I try to transmit data. I am guessing after I startAdvertise() I am going to have to wait until “BLE.getState() == BLE_CONNECTED” using delays, then I’ll Send.Data() in order to transmit data… Does that sound logical? Please let me know if I am approaching this the wrong way.




So let me try and answer your questions. Advertising is when bluz is sending out the standard BLE advertisement packet, which broadcasts the name and other data about the device. The advertising interval is strictly how often these packets are sent out. A central, like our gateway, detects these advertising packets and determines if it should connect or not.

Once a device is connected, the connection parameters are used to determine how often bluz and the central should sync up. So they will chose a connection interval, which just means that the central and bluz must talk to each other that often. This is also when data can be sent. So if the connection interval were 20 milliseconds, then bluz will transmit a data packet every 20 milliseconds to the gateway, and the rest of the time the radio is off.

The connection interval is chosen when the devices connect, and ultimately the central choses it, but it will ask the peripheral what it would like to support. So setting it on the central guarantees the right interval is chosen, but setting it on bluz may work as well with some central devices.

Once connected, bluz will stop advertising. So disconnecting and stopping advertising are two distinct actions.

Yes, waiting for a connection and then sending data will work fine. I hope that answers all your questions, but please let me know if you have more.