I was trying around some experiments with the Sdk 5.1 Hrs Example code. I want to do something special (e.g. turn on a led on the nRF6100 board) when the devicename was changed by a ble central to a specific value.
For that, I think I have to hook into ble_evt_dispatch() and must check the parameter p_ble_evt against anything, right? E.g.
static void ble_evt_dispatch(ble_evt_t * p_ble_evt) {
ble_bondmngr_on_ble_evt(p_ble_evt);
ble_hrs_on_ble_evt(&m_hrs, p_ble_evt);
ble_bas_on_ble_evt(&m_bas, p_ble_evt);
ble_conn_params_on_ble_evt(p_ble_evt);
on_ble_evt(p_ble_evt);
{ // Joe: My own experimental code starts here
ble_gatts_evt_write_t* p_evt_write =
&p_ble_evt->evt.gatts_evt.params.write;
// 3 = device name handle
// TODO JM: is there a better way?
if (p_evt_write->handle == 3) {
// TODO: How to access the Device Name?
if (strcmp("?!?", "LED") == 0) {
nrf_gpio_cfg_output(LED_4);
nrf_gpio_pin_set(LED_4);
}
}
}
}
Could someone tell me how I can retrive the device name?