Nordic Semiconductor nRF5 AirFuel SDK  version 2.2.0
advertiser_beacon.h File Reference

Advertiser module. This module shows an example of using periodic timeslots on the radio when the SoftDevice is running. More...

#include <stdint.h>
#include <stdbool.h>
#include "ble_types.h"
#include "ble_gap.h"
#include "ble_srv_common.h"

Go to the source code of this file.

Data Structures

struct  ble_beacon_init_t
 BLE beacon init type. More...
 

Functions

void app_beacon_init (ble_beacon_init_t *p_init)
 Function for initializing the advertiser module. More...
 
void app_beacon_start (void)
 Function for starting the advertisement. More...
 
void app_beacon_stop (void)
 Function for stopping the advertisement. More...
 

Detailed Description

Advertiser module. This module shows an example of using periodic timeslots on the radio when the SoftDevice is running.

This module implements an advertiser which can be run in parallel with the S110 (thus allowing, for example, to advertise while in a connection) This module shows an example of using periodic timeslots on the radio when the SoftDevice is running

Note
This module is experimental.

Definition in file advertiser_beacon.h.

Function Documentation

void app_beacon_init ( ble_beacon_init_t p_init)

Function for initializing the advertiser module.

Parameters
[in]p_initstructure containing advertiser configuration information.

Definition at line 71 of file advertiser_beacon.c.

72 {
73  uint32_t err_code;
74  uint8_t data_length;
75 
76  memcpy(&m_beacon.init_vals, p_init, sizeof(m_beacon.init_vals));
77  memset(&m_beacon.adv_params, 0, sizeof(ble_gap_adv_params_t));
78  m_beacon.adv_params.interval=m_beacon.init_vals.adv_interval;
79  m_beacon.adv_params.type=BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
80 
81  err_code=sd_ble_gap_adv_data_set(m_get_adv_data(&data_length), data_length, 0, 0);
82  APP_ERROR_CHECK(err_code);
83 }
static uint8_t * m_get_adv_data(uint8_t *data_length)
Initialize adv packet.
static struct @2 m_beacon
Struct containing all variables of this module.
void app_beacon_start ( void  )

Function for starting the advertisement.

Definition at line 85 of file advertiser_beacon.c.

86 {
87  uint32_t err_code;
88  err_code=sd_ble_gap_adv_start(&m_beacon.adv_params);
89  APP_ERROR_CHECK(err_code);
90 }
static struct @2 m_beacon
Struct containing all variables of this module.
void app_beacon_stop ( void  )

Function for stopping the advertisement.

Note
This functions returns immediately, but the advertisement is actually stopped after the next radio slot.

Definition at line 92 of file advertiser_beacon.c.

93 {
94  uint32_t err_code;
95  err_code=sd_ble_gap_adv_stop();
96  APP_ERROR_CHECK(err_code);
97 }