Simple Broadcaster Application.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
#include "simple_broadcaster_app.h"
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
| |
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 |
Referenced by brd_start_broadcast().
|
static |
Set advertisement data with appearance of the device.
[in] | appearance | appearance of the device |
[in] | length | length of the local name |
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 |
Set advertisement data with complete list of service uuid of 128bits.
[in] | list_uuid128 | list of service uuid of 128bits |
[in] | length | length of the list |
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 |
Set advertisement data with complete list of service uuid of 16bits.
[in] | list_uuid16 | list of service uuid of 16bits |
[in] | length | length of the list |
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 |
Set advertisement data with complete list of service uuid of 32bits.
[in] | list_uuid32 | list of service uuid of 32bits |
[in] | length | length of the list |
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 |
Set advertisement data with complete local name.
[in] | local_name | local name of the device |
[in] | length | length of the local name |
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 |
Set advertisement data with incomplete list of service uuid of 32bits.
[in] | list_uuid128 | list of service uuid of 128bits |
[in] | length | length of the list |
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 |
Set advertisement data with incomplete list of service uuid of 16bits.
[in] | list_uuid16 | list of service uuid of 16bits |
[in] | length | length of the list |
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 |
Set advertisement data with incomplete list of service uuid of 32bits.
[in] | list_uuid32 | list of service uuid of 32bits |
[in] | length | length of the list |
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 |
initialize the broadcaster event
References ADV_DATA_TYPE_APPEARANCE, ADV_DATA_TYPE_COMPLETE_LOCAL_NAME, ADV_DATA_TYPE_COMPLETE_SERVICE_UUID16, ADV_DATA_TYPE_MANUFACTURER_DATA, ADV_TYPE_SCANNABLE_UNDIRECTED, ADVERTISEMENT_DATA, BRD_ADV_DATA_APPEARANCE_DATA, BRD_ADV_DATA_APPEARANCE_LEN, BRD_ADV_DATA_MANUFACTURER_DATA, BRD_ADV_DATA_MANUFACTURER_LEN, BRD_ADV_DATA_NAME_DATA, BRD_ADV_DATA_NAME_LEN, BRD_ADV_DATA_UUID_DATA, BRD_ADV_DATA_UUID_LEN, brd_set_advertisement_data(), brd_set_advertisement_type(), brd_set_data_type(), DBG_LOG, SCAN_RESP_DATA, STATUS_FAILED, and STATUS_SUCCESS.
Referenced by main().
|
static |
Set advertisement data with manufacturer data.
[in] | data | manufacturer data of the device |
[in] | length | length of the local name |
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 |
Set advertisement data with shortened local name.
[in] | local_name | local name of the device |
[in] | length | length of the 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 |
Set advertisement data.
[in] | adv_data_type | type of the advertisement data type |
[in] | adv_usr_data | reference to a user data corresponding to the advertisement data type |
References ADV_DATA_TYPE_APPEARANCE, ADV_DATA_TYPE_COMPLETE_LOCAL_NAME, ADV_DATA_TYPE_COMPLETE_SERVICE_UUID128, ADV_DATA_TYPE_COMPLETE_SERVICE_UUID16, ADV_DATA_TYPE_COMPLETE_SERVICE_UUID32, ADV_DATA_TYPE_INCOMPLETE_SERVICE_UUID128, ADV_DATA_TYPE_INCOMPLETE_SERVICE_UUID16, ADV_DATA_TYPE_INCOMPLETE_SERVICE_UUID32, ADV_DATA_TYPE_MANUFACTURER_DATA, ADV_DATA_TYPE_SHORTENED_LOCAL_NAME, brd_adv_appearance(), brd_adv_comp_list_service_uuid128(), brd_adv_comp_list_service_uuid16(), brd_adv_comp_list_service_uuid32(), brd_adv_comp_local_name(), brd_adv_incomp_list_service_uuid128(), brd_adv_incomp_list_service_uuid16(), brd_adv_incomp_list_service_uuid32(), brd_adv_manufacturer_data(), brd_adv_shortened_local_name(), DBG_LOG, STATUS_INVALID_PARAM, and STATUS_SUCCESS.
Referenced by brd_adv_init().
|
static |
Set advertisement type.
[in] | type | type can be ADV_TYPE_SCANNABLE_UNDIRECTED or ADV_TYPE_NONCONN_UNDIRECTED |
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 |
References adv_type, ADV_TYPE_SCANNABLE_UNDIRECTED, ADVERTISEMENT_DATA, data_type, SCAN_RESP_DATA, STATUS_INVALID_PARAM, and STATUS_SUCCESS.
Referenced by brd_adv_init().
|
static |
Starts advertising.
[in] | none |
References adv_data, adv_length, adv_type, APP_BROADCAST_ADV_TIMEOUT, APP_BROADCAST_FAST_ADV, AT_BLE_ADV_BROADCASTER_MODE, at_ble_adv_data_set(), AT_BLE_ADV_FP_ANY, at_ble_adv_start(), AT_BLE_SUCCESS, ble_device_broadcaster_ind(), BRD_ADV_DATA_NAME_DATA, BRD_ADV_DATA_NAME_LEN, DBG_LOG, NULL, scan_length, and scan_rsp_data.
Referenced by main().
int main | ( | void | ) |
uint8_t adv_data[MAX_ADV_LEN] |
Referenced by altbeacon_init(), app_adv_param_set(), app_disconnected_cb(), beacon_init(), brd_adv_appearance(), brd_adv_comp_list_service_uuid128(), brd_adv_comp_list_service_uuid16(), brd_adv_comp_list_service_uuid32(), brd_adv_comp_local_name(), brd_adv_incomp_list_service_uuid128(), brd_adv_incomp_list_service_uuid16(), brd_adv_incomp_list_service_uuid32(), brd_adv_manufacturer_data(), brd_adv_shortened_local_name(), brd_start_broadcast(), eddystone_adv_start(), and main().
uint8_t adv_length |
Referenced by brd_adv_appearance(), brd_adv_comp_list_service_uuid128(), brd_adv_comp_list_service_uuid16(), brd_adv_comp_list_service_uuid32(), brd_adv_comp_local_name(), brd_adv_incomp_list_service_uuid128(), brd_adv_incomp_list_service_uuid16(), brd_adv_incomp_list_service_uuid32(), brd_adv_manufacturer_data(), brd_adv_shortened_local_name(), and brd_start_broadcast().
uint32_t adv_type = ADV_TYPE_NONCONN_UNDIRECTED |
Referenced by brd_set_advertisement_type(), brd_set_data_type(), and brd_start_broadcast().
data_type_t data_type = ADVERTISEMENT_DATA |
Referenced by brd_adv_appearance(), brd_adv_comp_list_service_uuid128(), brd_adv_comp_list_service_uuid16(), brd_adv_comp_list_service_uuid32(), brd_adv_comp_local_name(), brd_adv_incomp_list_service_uuid128(), brd_adv_incomp_list_service_uuid16(), brd_adv_incomp_list_service_uuid32(), brd_adv_manufacturer_data(), brd_adv_shortened_local_name(), and brd_set_data_type().
uint8_t scan_length |
uint8_t scan_rsp_data[MAX_SCAN_LEN] |