nrf51822修改蓝牙名称
使用工程
nRF51_SDK_10.0.0\examples\ble_peripheral\ble_app_uart\pca10028\s110\arm5_no_packs
默认名称
添加
{//先关闭广播
uint32_t err_code;
err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
err_code = (uint32_t) sd_ble_gap_adv_stop();
APP_ERROR_CHECK(err_code);
}
{//修改名称
uint8_t BluetoothName[8] = {0x4D,0x30,0x31,0x32,0x33,0x34,0x35,0x36};
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 *) BluetoothName,8);
APP_ERROR_CHECK(err_code);
advertising_init();
}
{//再开始广播
uint32_t err_code;
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
}
测试
OK