Hi, all.
I'm using nRF52832 Software Development Kit, PCA10040, S132.
Using the 'ble_app_uart_c' example, I am studying to connect with my beacons and read data.
I have a question.
static void ble_nus_c_evt_handler(ble_nus_c_t * p_ble_nus_c, ble_nus_c_evt_t const * p_ble_nus_evt)
{
ret_code_t err_code;
switch (p_ble_nus_evt->evt_type)
{
case BLE_NUS_C_EVT_DISCOVERY_COMPLETE:
NRF_LOG_INFO("Discovery complete.");
err_code = ble_nus_c_handles_assign(p_ble_nus_c, p_ble_nus_evt->conn_handle, &p_ble_nus_evt->handles);
APP_ERROR_CHECK(err_code);
err_code = ble_nus_c_tx_notif_enable(p_ble_nus_c);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("Connected to device with Nordic UART Service.");
break;
...
}
}
Let me tell you what I understand about the code role 12: ble_nus_c_tx_notif_enable (p_ble_nus_c);
I understand that central uses ccd value for peripheral to activate notification.
Therefore, if the case is carried out normally,
void ble_nus_c_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context)
{
ble_nus_c_t * p_ble_nus_c = (ble_nus_c_t *)p_context;
if ((p_ble_nus_c == NULL) || (p_ble_evt == NULL))
{
return;
}
if ( (p_ble_nus_c->conn_handle == BLE_CONN_HANDLE_INVALID)
||(p_ble_nus_c->conn_handle != p_ble_evt->evt.gap_evt.conn_handle)
)
{
return;
}
switch (p_ble_evt->header.evt_id)
{
case BLE_GATTC_EVT_HVX:
on_hvx(p_ble_nus_c, p_ble_evt);
break;
...
}
}
the 19: 'case BLE_GATTC_EVT_HVX' event calls 'on_hvx()'.
1. Am I getting it right up to here?
If number one question is correct, my problem is...
The first code 'BLE_NUS_C_EVT_DISCOVERY_COMPLETE' event was successfully performed - successfully connect with the own device - but 'BLE_GATTC_EVT_HVX' event is not called.
2. Is this because of the nature of my beacons? Or is there any other room for trouble?
Best regards,
Lyrics