Microchip® Advanced Software Framework

simple_broadcaster_app.c File Reference

Simple Broadcaster Application.

Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.

Functions

static void ble_device_broadcaster_ind (void)
 
static status_t brd_adv_appearance (uint8_t *appearance, uint8_t length)
 Set advertisement data with appearance of the device. More...
 
static status_t brd_adv_comp_list_service_uuid128 (uint8_t *list_uuid128, uint8_t length)
 Set advertisement data with complete list of service uuid of 128bits. More...
 
static status_t brd_adv_comp_list_service_uuid16 (uint8_t *list_uuid16, uint8_t length)
 Set advertisement data with complete list of service uuid of 16bits. More...
 
static status_t brd_adv_comp_list_service_uuid32 (uint8_t *list_uuid32, uint8_t length)
 Set advertisement data with complete list of service uuid of 32bits. More...
 
static status_t brd_adv_comp_local_name (uint8_t *local_name, uint8_t length)
 Set advertisement data with complete local name. More...
 
static status_t brd_adv_incomp_list_service_uuid128 (uint8_t *list_uuid128, uint8_t length)
 Set advertisement data with incomplete list of service uuid of 32bits. More...
 
static status_t brd_adv_incomp_list_service_uuid16 (uint8_t *list_uuid16, uint8_t length)
 Set advertisement data with incomplete list of service uuid of 16bits. More...
 
static status_t brd_adv_incomp_list_service_uuid32 (uint8_t *list_uuid32, uint8_t length)
 Set advertisement data with incomplete list of service uuid of 32bits. More...
 
static status_t brd_adv_init (void)
 initialize the broadcaster event

More...
 
static status_t brd_adv_manufacturer_data (uint8_t *data, uint8_t length)
 Set advertisement data with manufacturer data. More...
 
static status_t brd_adv_shortened_local_name (uint8_t *local_name, uint8_t length)
 Set advertisement data with shortened local name. More...
 
static status_t brd_set_advertisement_data (adv_data_type_t adv_data_type, uint8_t *adv_usr_data, uint8_t length)
 Set advertisement data. More...
 
static status_t brd_set_advertisement_type (uint8_t type)
 Set advertisement type. More...
 
static status_t brd_set_data_type (uint8_t type)
 
static void brd_start_broadcast (void)
 Starts advertising. More...
 
int main (void)
 

Variables

uint8_t adv_data [MAX_ADV_LEN]
 
uint8_t adv_length
 
uint32_t adv_type = ADV_TYPE_NONCONN_UNDIRECTED
 
data_type_t data_type = ADVERTISEMENT_DATA
 
uint8_t scan_length
 
uint8_t scan_rsp_data [MAX_SCAN_LEN]
 

static void ble_device_broadcaster_ind ( void  )
static

Referenced by brd_start_broadcast().

static status_t brd_adv_appearance ( uint8_t *  appearance,
uint8_t  length 
)
static

Set advertisement data with appearance of the device.

Parameters
[in]appearanceappearance of the device
[in]lengthlength of the local name
Returns
STATUS_SUCCESS adding the appearance to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the local name
STATUS_INVALID_PARAM parameters passed are invalid

References adv_data, ADV_DATA_TYPE_APPEARANCE, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, MAX_SCAN_LEN, scan_length, scan_rsp_data, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_comp_list_service_uuid128 ( uint8_t *  list_uuid128,
uint8_t  length 
)
static

Set advertisement data with complete list of service uuid of 128bits.

Parameters
[in]list_uuid128list of service uuid of 128bits
[in]lengthlength of the list
Returns
STATUS_SUCCESS adding the list to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the list
STATUS_INVALID_PARAM parameters passed are invalid

References adv_data, ADV_DATA_TYPE_COMPLETE_SERVICE_UUID128, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, MAX_SCAN_LEN, scan_length, scan_rsp_data, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_comp_list_service_uuid16 ( uint8_t *  list_uuid16,
uint8_t  length 
)
static

Set advertisement data with complete list of service uuid of 16bits.

Parameters
[in]list_uuid16list of service uuid of 16bits
[in]lengthlength of the list
Returns
STATUS_SUCCESS adding the list to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the list
STATUS_INVALID_PARAM parameters passed are invalid

References adv_data, ADV_DATA_TYPE_COMPLETE_SERVICE_UUID16, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, MAX_SCAN_LEN, scan_length, SCAN_RESP_DATA, scan_rsp_data, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_comp_list_service_uuid32 ( uint8_t *  list_uuid32,
uint8_t  length 
)
static

Set advertisement data with complete list of service uuid of 32bits.

Parameters
[in]list_uuid32list of service uuid of 32bits
[in]lengthlength of the list
Returns
STATUS_SUCCESS adding the list to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the list
STATUS_INVALID_PARAM parameters passed are invalid

References adv_data, ADV_DATA_TYPE_COMPLETE_SERVICE_UUID32, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, MAX_SCAN_LEN, scan_length, scan_rsp_data, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_comp_local_name ( uint8_t *  local_name,
uint8_t  length 
)
static

Set advertisement data with complete local name.

Parameters
[in]local_namelocal name of the device
[in]lengthlength of the local name
Returns
STATUS_SUCCESS adding the complete local name to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the local name
STATUS_INVALID_PARAM parameters passed are invalid

References adv_data, ADV_DATA_TYPE_COMPLETE_LOCAL_NAME, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, MAX_SCAN_LEN, scan_length, scan_rsp_data, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_incomp_list_service_uuid128 ( uint8_t *  list_uuid128,
uint8_t  length 
)
static

Set advertisement data with incomplete list of service uuid of 32bits.

Parameters
[in]list_uuid128list of service uuid of 128bits
[in]lengthlength of the list
Returns
STATUS_SUCCESS adding the list to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the list
STATUS_INVALID_PARAM parameters passed are invalid
STATUS_OPERATION_NOT_SUPPORTED trying to send incomplete list on scan response data.

References adv_data, ADV_DATA_TYPE_INCOMPLETE_SERVICE_UUID128, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, STATUS_OPERATION_NOT_SUPPORTED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_incomp_list_service_uuid16 ( uint8_t *  list_uuid16,
uint8_t  length 
)
static

Set advertisement data with incomplete list of service uuid of 16bits.

Parameters
[in]list_uuid16list of service uuid of 16bits
[in]lengthlength of the list
Returns
STATUS_SUCCESS adding the list to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the list
STATUS_INVALID_PARAM parameters passed are invalid
STATUS_OPERATION_NOT_SUPPORTED trying to send incomplete list on scan response data.

References adv_data, ADV_DATA_TYPE_INCOMPLETE_SERVICE_UUID16, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, SCAN_RESP_DATA, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, STATUS_OPERATION_NOT_SUPPORTED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_incomp_list_service_uuid32 ( uint8_t *  list_uuid32,
uint8_t  length 
)
static

Set advertisement data with incomplete list of service uuid of 32bits.

Parameters
[in]list_uuid32list of service uuid of 32bits
[in]lengthlength of the list
Returns
STATUS_SUCCESS adding the list to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the list
STATUS_INVALID_PARAM parameters passed are invalid
STATUS_OPERATION_NOT_SUPPORTED trying to send incomplete list on scan response data.

References adv_data, ADV_DATA_TYPE_INCOMPLETE_SERVICE_UUID32, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, STATUS_OPERATION_NOT_SUPPORTED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_manufacturer_data ( uint8_t *  data,
uint8_t  length 
)
static

Set advertisement data with manufacturer data.

Parameters
[in]datamanufacturer data of the device
[in]lengthlength of the local name
Returns
STATUS_SUCCESS adding the manufacturer data to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the local name
STATUS_INVALID_PARAM parameters passed are invalid

References adv_data, ADV_DATA_TYPE_MANUFACTURER_DATA, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, MAX_SCAN_LEN, scan_length, scan_rsp_data, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_adv_shortened_local_name ( uint8_t *  local_name,
uint8_t  length 
)
static

Set advertisement data with shortened local name.

Parameters
[in]local_namelocal name of the device
[in]lengthlength of the local name
Returns
STATUS_SUCCESS adding the shortened local name to advertisement data success
STATUS_MAX_LENGTH_REACHED advertisement data does not have enough space to hold the local name
STATUS_INVALID_PARAM parameters passed are invalid
STATUS_OPERATION_NOT_SUPPORTED trying to send shortened local name.

References adv_data, ADV_DATA_TYPE_SHORTENED_LOCAL_NAME, adv_length, ADV_TYPE_LEN, ADVERTISEMENT_DATA, data_type, length, MAX_ADV_LEN, STATUS_INVALID_PARAM, STATUS_MAX_LENGTH_REACHED, STATUS_OPERATION_NOT_SUPPORTED, and STATUS_SUCCESS.

Referenced by brd_set_advertisement_data().

static status_t brd_set_advertisement_data ( adv_data_type_t  adv_data_type,
uint8_t *  adv_usr_data,
uint8_t  length 
)
static
static status_t brd_set_advertisement_type ( uint8_t  type)
static

Set advertisement type.

Parameters
[in]typetype can be ADV_TYPE_SCANNABLE_UNDIRECTED or ADV_TYPE_NONCONN_UNDIRECTED
Returns
STATUS_SUCCESS successfully set advertisement type
STATUS_INVALID_PARAM parameters passed are invalid

References adv_type, ADV_TYPE_NONCONN_UNDIRECTED, ADV_TYPE_SCANNABLE_UNDIRECTED, AT_BLE_ADV_TYPE_NONCONN_UNDIRECTED, AT_BLE_ADV_TYPE_SCANNABLE_UNDIRECTED, DBG_LOG, STATUS_INVALID_PARAM, and STATUS_SUCCESS.

Referenced by brd_adv_init().

static status_t brd_set_data_type ( uint8_t  type)
static

uint8_t scan_rsp_data[MAX_SCAN_LEN]