add connection handle for central callback

This commit is contained in:
hathach committed 2017-03-31 22:58:04 +07:00
1 parent 006f74aade
commit 13571bfb7a
3 files changed
+4 -3

No files matched your search

@@ -61,8 +61,9 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
}
}
void connect_callback(void)
void connect_callback(uint16_t conn_handle)
{
(void) conn_handle;
Serial.println("Connected");
}
+1 -1
View File
@@ -242,7 +242,7 @@ void BLECentral::_event_handler(ble_evt_t* evt)
// TODO multiple connections
_conn_hdl = evt->evt.gap_evt.conn_handle;
if ( _connect_cb ) _connect_cb();
if ( _connect_cb ) _connect_cb(evt->evt.gap_evt.conn_handle);
}
}
break;
+1 -1
View File
@@ -86,7 +86,7 @@ class BLECentral
/*------------------------------------------------------------------*/
/* CALLBACKS
*------------------------------------------------------------------*/
typedef void (*connect_callback_t) (void);
typedef void (*connect_callback_t) (uint16_t conn_handle);
typedef void (*disconnect_callback_t) (uint8_t reason);
void setConnectCallback ( connect_callback_t fp);