Periodic Advertising
Periodic channels are used for periodic broadcast between unconnected devices. A periodic channel is represented by a channel map and a set of hopping and timing parameters.
The set of channels is represented by the 37 data channels. A packet sent by an advertiser can also have a payload of up to 255 bytes and it can be sent on any LE PHY. Figure 1 and Figure 2.
Peripheral Setup
First set the extended advertising parameters using Gap_SetExtAdvertisingParameters. The extended advertising type must be set to non-connectable and non-scannable.
Set the periodic advertising parameters using the same handle as in the previous command.
bleResult_t **Gap\_SetPeriodicAdvParameters** ( gapPeriodicAdvParameters_t* pAdvertisingParameters );
Wait for a gPeriodicAdvParamSetupComplete_cevent in the generic callback.
Next, set the periodic advertising data by calling:
bleResult_t **Gap\_SetPeriodicAdvertisingData** ( uint8_t handle, gapAdvertisingData_t* pAdvertisingData, bool_t bUpdateDID );
pAdvertisingData cannot be NULL. If periodic advertising data must be empty, set cNumAdStructures to 0. Wait for a gPeriodicAdvDataSetupComplete_cevent in the generic callback.
Start extended advertising using Gap_StartExtAdvertising.
Last, enable Periodic Advertising. Periodic advertising starts only after extended advertising is started.
bleResult_t **Gap\_StartPeriodicAdvertising** ( uint8_t handle, bool_t bIncludeADI );
Wait for a gPeriodicAdvertisingStateChanged_cevent in the advertising callback.
Parent topic:Periodic Advertising
Central Setup
The application may decide to listen to periodic advertising by going through the following states:
[Optional] Add a known periodic advertiser to the periodic advertiser list held in the Controller by calling:
**bleResult\_t Gap\_UpdatePeriodicAdvList** ( gapPeriodicAdvListOperation_t operation, bleAddressType_t addrType, uint8_t* pAddr, uint8_t SID );
Wait for the gPeriodicAdvListUpdateComplete_c event in the Generic Callback.
Synchronize with a periodic advertiser by calling:
bleResult_t **Gap\_PeriodicAdvCreateSync** ( gapPeriodicAdvSyncReq_t* pReq, );
pReq parameter filterPolicycan be set to gUseCommandParameters_c to synchronize with the given peer, or to gUsePeriodicAdvList_c to start synchronizing with all the devices in the previously populated periodic advertiser list.
Wait for the gPeriodicAdvSyncEstablished_c event and check the status. If scanning is not enabled at the time this command is sent, synchronization occurs after scanning is started. Synchronization remains pending until gPeriodicAdvSyncEstablished_cevent is received. If synchronization was successful, the syncHandle is returned in this event.
Terminate the synchronization with the periodic advertiser by calling:
bleResult_t **Gap\_PeriodicAdvTerminateSync** ( uint16_t syncHandle );
To cancel a pending synchronization, the application should call Gap_PeriodicAdvTerminateSync with syncHandle set to the reserved value gBlePeriodicAdvOngoingSyncCancelHandle and wait for gPeriodicAdvCreateSyncCancelled_c event.
Otherwise, to terminate an already established sync with an advertiser, use the syncHandle value from the gPeriodicAdvSyncEstablished_c event and wait for a gPeriodicAdvSyncTerminated_c event.
Parent topic:Periodic Advertising
Parent topic:Generic Access Profile (GAP) Layer