Last active
June 12, 2017 06:16
-
-
Save electronut/72410bcc0cea24ae65e85c8757f4c08a to your computer and use it in GitHub Desktop.
bluey-beacon - advertising_init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void advertising_init(void) | |
{ | |
uint32_t err_code; | |
ble_gap_conn_sec_mode_t sec_mode; | |
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); | |
err_code = sd_ble_gap_device_name_set(&sec_mode, | |
(const uint8_t *)DEVICE_NAME, | |
strlen(DEVICE_NAME)); | |
APP_ERROR_CHECK(err_code); | |
set_adv_data(true); | |
// Initialize advertising parameters (used when starting advertising). | |
memset(&m_adv_params, 0, sizeof(m_adv_params)); | |
m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND; | |
m_adv_params.p_peer_addr = NULL; // Undirected advertisement. | |
m_adv_params.fp = BLE_GAP_ADV_FP_ANY; | |
m_adv_params.interval = NON_CONNECTABLE_ADV_INTERVAL; | |
m_adv_params.timeout = APP_CFG_NON_CONN_ADV_TIMEOUT; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment