Exemplo n.º 1
0
/**@brief Write event handler.
 *
 * @param[in]   p_hts       Health Thermometer Service structure.
 * @param[in]   p_ble_evt   Event received from the BLE stack.
 */
static void on_write(ble_hts_t * p_hts, ble_evt_t * p_ble_evt)
{
    ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;
    
    if (p_evt_write->handle == p_hts->meas_handles.cccd_handle)
    {
        on_cccd_write(p_hts, p_evt_write);
    }
}
static void on_write(ble_sds_t * p_sds, ble_evt_t * p_ble_evt)
{
	ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;
    
    if ((p_evt_write->handle == p_sds->self_def_send_handles.cccd_handle))
    {
		on_cccd_write(p_sds, p_evt_write);
    }
	else 
	{
		if(p_sds->data_handler != NULL)
		{
			p_sds->data_handler(p_sds, p_evt_write->data, p_evt_write->len, p_evt_write->handle);
		}
	}
}