rename BLEService disconnect/connect handler
This commit is contained in:
1 parent
7bc06a9634
commit
1d61b33765
5 files changed
+12
-11
No files matched your search
@@ -94,10 +94,10 @@ void BLEGatt::_eventHandler(ble_evt_t* evt)
|
||||
{
|
||||
if ( evt_id == BLE_GAP_EVT_DISCONNECTED )
|
||||
{
|
||||
_server.svc_list[i]->_disconnect_cb();
|
||||
_server.svc_list[i]->svc_disconnect_hdl(evt_conn_hdl);
|
||||
}else
|
||||
{
|
||||
_server.svc_list[i]->_connect_cb();
|
||||
_server.svc_list[i]->svc_connect_hdl(evt_conn_hdl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ err_t BLEService::begin(void)
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
void BLEService::_disconnect_cb(void)
|
||||
void BLEService::svc_disconnect_hdl(uint16_t conn_hdl)
|
||||
{
|
||||
// Template for inherited class
|
||||
}
|
||||
|
||||
void BLEService::_connect_cb(void)
|
||||
void BLEService::svc_connect_hdl(uint16_t conn_hdl)
|
||||
{
|
||||
// Template for inherited class
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@
|
||||
class BLEService
|
||||
{
|
||||
protected:
|
||||
uint16_t _handle;
|
||||
uint16_t _handle; // service gatt handle
|
||||
|
||||
void _init(void);
|
||||
|
||||
virtual void _disconnect_cb(void);
|
||||
virtual void _connect_cb(void);
|
||||
virtual void svc_disconnect_hdl(uint16_t conn_hdl);
|
||||
virtual void svc_connect_hdl(uint16_t conn_hdl);
|
||||
|
||||
public:
|
||||
static BLEService* lastService;
|
||||
|
||||
@@ -204,7 +204,7 @@ bool BLEUart::notifyEnabled(uint16_t conn_hdl)
|
||||
return _txd.notifyEnabled(conn_hdl);
|
||||
}
|
||||
|
||||
void BLEUart::_disconnect_cb(void)
|
||||
void BLEUart::svc_disconnect_hdl(uint16_t conn_hdl)
|
||||
{
|
||||
if (_buffered_th)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ void BLEUart::_disconnect_cb(void)
|
||||
}
|
||||
}
|
||||
|
||||
void BLEUart::_connect_cb (void)
|
||||
void BLEUart::svc_connect_hdl (uint16_t conn_hdl)
|
||||
{
|
||||
if ( _tx_buffered )
|
||||
{
|
||||
|
||||
@@ -68,6 +68,7 @@ class BLEUart : public BLEService, public Stream
|
||||
virtual int read ( void );
|
||||
virtual int read ( uint8_t * buf, size_t size );
|
||||
int read ( char * buf, size_t size ) { return read( (uint8_t*) buf, size); }
|
||||
|
||||
virtual size_t write ( uint8_t b );
|
||||
virtual size_t write ( const uint8_t *content, size_t len);
|
||||
|
||||
@@ -98,8 +99,8 @@ class BLEUart : public BLEService, public Stream
|
||||
bool _flush_txd(uint16_t conn_hdl = BLE_CONN_HANDLE_INVALID);
|
||||
|
||||
// from BLEService
|
||||
virtual void _disconnect_cb(void);
|
||||
virtual void _connect_cb(void);
|
||||
virtual void svc_disconnect_hdl(uint16_t conn_hdl);
|
||||
virtual void svc_connect_hdl(uint16_t conn_hdl);
|
||||
|
||||
// Static Method for callbacks
|
||||
static void bleuart_rxd_cb(uint16_t conn_hdl, BLECharacteristic* chr, uint8_t* data, uint16_t len);
|
||||
|
||||
Reference in new issue
Block a user