refactor AdaCallback
- replace BLEGap connect_callback_t with adacb_1arg_t - replace BLEGap disconnect_callback_t with adacb_2arg_t
This commit is contained in:
1 parent
a8496fcaf1
commit
725cea11ff
4 files changed
+2
-11
No files matched your search
@@ -159,7 +159,7 @@ void BLECentral::_event_handler(ble_evt_t* evt)
|
||||
if ( Bluefruit.Gap.getRole(evt_conn_hdl) == BLE_GAP_ROLE_CENTRAL)
|
||||
{
|
||||
// Invoke callback
|
||||
if ( _disconnect_cb) ada_callback(NULL, _disconnect_cb, evt_conn_hdl);
|
||||
if ( _disconnect_cb) ada_callback_defer(NULL, _disconnect_cb, evt_conn_hdl, evt->evt.gap_evt.params.disconnected.reason);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -610,7 +610,7 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
// Save all configured cccd
|
||||
if (_bonded) _saveBondCCCD();
|
||||
|
||||
if (_disconnect_cb) ada_callback(NULL, _disconnect_cb, _conn_hdl);
|
||||
if (_disconnect_cb) ada_callback_defer(NULL, _disconnect_cb, _conn_hdl, evt->evt.gap_evt.params.disconnected.reason);
|
||||
|
||||
_conn_hdl = BLE_CONN_HANDLE_INVALID;
|
||||
_bonded = false;
|
||||
|
||||
@@ -56,11 +56,6 @@ void adafruit_callback_task(void* arg)
|
||||
|
||||
switch(cb_data->callback_type)
|
||||
{
|
||||
/*------------- BLEGap -------------*/
|
||||
case BLEGap_disconnect_callback_t:
|
||||
((BLEGap::disconnect_callback_t) func) ( (uint16_t) args[0], (uint8_t) args[1] );
|
||||
break;
|
||||
|
||||
/*------------- Client Service & Chars -------------*/
|
||||
case BLEClientCharacteristic_notify_cb_t:
|
||||
((BLEClientCharacteristic::notify_cb_t) func) ( *((BLEClientCharacteristic*) args[0]), (uint8_t*) args[1], (uint16_t) args[2] );
|
||||
|
||||
@@ -70,10 +70,6 @@ typedef void (*adacb_5arg_t) (uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||
* one instance is enough (mandatory)
|
||||
*------------------------------------------------------------------*/
|
||||
#define ADA_CB_LOOKUP(XPAND) \
|
||||
/* BLEGap */ \
|
||||
/*XPAND(BLEGap , connect_callback_t ) */\
|
||||
XPAND(BLEGap , disconnect_callback_t ) \
|
||||
/* Client Characteristic */ \
|
||||
XPAND(BLEClientCharacteristic , notify_cb_t ) \
|
||||
/*XPAND(BLEClientCharacteristic , indicate_cb_t)*/ \
|
||||
|
||||
|
||||
Reference in new issue
Block a user