Hi,
I'm using ble_app_template to implement my custom solution. I can read battery values, but I can't read custom values.
As a reference, I'm using ble_app_cscs, and the function below works fine.
ble_cscs.c
void ble_cscs_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context)
{
ble_cscs_t * p_cscs = (ble_cscs_t *)p_context;
if (p_cscs == NULL || p_ble_evt == NULL)
{
return;
}
ble_sc_ctrlpt_on_ble_evt(&(p_cscs->ctrl_pt), p_ble_evt);
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
on_connect(p_cscs, p_ble_evt);
break;
case BLE_GAP_EVT_DISCONNECTED:
on_disconnect(p_cscs, p_ble_evt);
break;
case BLE_GATTS_EVT_WRITE:
on_write(p_cscs, p_ble_evt);
break;
default:
// No implementation needed.
break;
}
}
In my code, I made the same function, but the value of machine state is 0 and never enter in the first case to send data do my application.
void ble_cps_on_ble_evt(ble_cps_t * p_cps, ble_evt_t * p_ble_evt)
{
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
on_connect(p_cps, p_ble_evt);
break;
case BLE_GAP_EVT_DISCONNECTED:
on_disconnect(p_cps, p_ble_evt);
break;
case BLE_GATTS_EVT_WRITE:
on_write(p_cps, p_ble_evt);
break;
default:
// No implementation needed.
break;
}
}
I using nrf52 pca10040 dev board and sdk 17.0.2.
Can you help me to solve this?
Regards


