mirror of https://github.com/ARMmbed/mbed-os.git
Enable connection status callback with EasyCellularConnection
parent
58c8176247
commit
331a27df63
|
@ -498,9 +498,6 @@ events::EventQueue *CellularConnectionUtil::get_queue()
|
|||
|
||||
CellularNetwork* CellularConnectionUtil::get_network()
|
||||
{
|
||||
if (_state != STATE_CONNECTED) {
|
||||
return NULL;
|
||||
}
|
||||
return _network;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,6 +154,14 @@ const char *EasyCellularConnection::get_gateway()
|
|||
return cellularConnection.get_network()->get_gateway();
|
||||
}
|
||||
|
||||
void EasyCellularConnection::attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
|
||||
{
|
||||
CellularNetwork * network = cellularConnection.get_network();
|
||||
if (network) {
|
||||
network->attach(status_cb);
|
||||
}
|
||||
}
|
||||
|
||||
NetworkStack *EasyCellularConnection::get_stack()
|
||||
{
|
||||
#if NSAPI_PPP_AVAILABLE
|
||||
|
|
|
@ -117,6 +117,12 @@ public:
|
|||
*/
|
||||
virtual const char *get_gateway();
|
||||
|
||||
/** Register callback for status reporting
|
||||
*
|
||||
* @param status_cb The callback for status changes
|
||||
*/
|
||||
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
|
||||
|
||||
protected:
|
||||
|
||||
/** Provide access to the NetworkStack object
|
||||
|
|
Loading…
Reference in New Issue