Added cellular stack API

pull/6082/head
Ari Parkkila 2018-02-12 12:41:56 +02:00
parent 60f7054a45
commit db2c5cff20
6 changed files with 31 additions and 1 deletions

View File

@ -533,3 +533,8 @@ CellularDevice* CellularConnectionUtil::get_device()
return NULL;
}
}
NetworkStack *CellularConnectionUtil::get_stack()
{
return _cellularDevice->get_stack();
}

View File

@ -76,6 +76,10 @@ protected:
bool get_attach_network(CellularNetwork::AttachStatus &status);
bool set_attach_network();
protected:
friend class EasyCellularConnection;
NetworkStack *get_stack();
private:
void device_ready();
void report_failure(const char* msg);

View File

@ -149,6 +149,6 @@ NetworkStack *EasyCellularConnection::get_stack()
#if NSAPI_PPP_AVAILABLE
return nsapi_ppp_get_stack();
#else
return NULL;//cellularConnection.get_network();
return cellularConnection.get_stack();
#endif // #if NSAPI_PPP_AVAILABLE
}

View File

@ -26,6 +26,7 @@
#include "CellularPower.h"
#include "CellularMultiplexer.h"
#include "CellularInformation.h"
#include "NetworkStack.h"
namespace mbed {
@ -114,6 +115,12 @@ public:
* @param timeout milliseconds to wait response from modem
*/
virtual void set_timeout(int timeout) = 0;
/** Get network stack.
*
* @return network stack
*/
virtual NetworkStack *get_stack() = 0;
};
} // namespace mbed

View File

@ -246,3 +246,11 @@ void AT_CellularDevice::set_timeout(int timeout)
atHandler = atHandler->_nextATHandler;
}
}
NetworkStack *AT_CellularDevice::get_stack()
{
if (!_network) {
return NULL;
}
return _network->get_stack();
}

View File

@ -127,6 +127,12 @@ public: // CellularDevice
*/
virtual void set_timeout(int timeout);
/** Get network stack.
*
* @return network stack
*/
NetworkStack *get_stack();
protected:
AT_CellularNetwork *_network;
AT_CellularSMS *_sms;