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()
|
CellularNetwork* CellularConnectionUtil::get_network()
|
||||||
{
|
{
|
||||||
if (_state != STATE_CONNECTED) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return _network;
|
return _network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "CellularTargets.h"
|
#include "CellularTargets.h"
|
||||||
#ifdef CELLULAR_DEVICE
|
#ifdef CELLULAR_DEVICE
|
||||||
|
|
||||||
#if NSAPI_PPP_AVAILABLE
|
#if NSAPI_PPP_AVAILABLE
|
||||||
#include "nsapi_ppp.h"
|
#include "nsapi_ppp.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -154,6 +154,14 @@ const char *EasyCellularConnection::get_gateway()
|
||||||
return cellularConnection.get_network()->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()
|
NetworkStack *EasyCellularConnection::get_stack()
|
||||||
{
|
{
|
||||||
#if NSAPI_PPP_AVAILABLE
|
#if NSAPI_PPP_AVAILABLE
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
#include "CellularConnectionUtil.h"
|
#include "CellularConnectionUtil.h"
|
||||||
#ifdef CELLULAR_DEVICE
|
#ifdef CELLULAR_DEVICE
|
||||||
|
|
||||||
#include "netsocket/CellularBase.h"
|
#include "netsocket/CellularBase.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
/** EasyCellularConnection class
|
/** EasyCellularConnection class
|
||||||
*
|
*
|
||||||
* Simplified adapter for cellular connection
|
* Simplified adapter for cellular connection
|
||||||
|
@ -117,6 +117,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual const char *get_gateway();
|
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:
|
protected:
|
||||||
|
|
||||||
/** Provide access to the NetworkStack object
|
/** Provide access to the NetworkStack object
|
||||||
|
|
Loading…
Reference in New Issue