mirror of https://github.com/ARMmbed/mbed-os.git
Removed mbed.h
parent
065326135e
commit
e8a26f3f54
|
@ -15,10 +15,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <mbed.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "CellularConnectionUtil.h"
|
#include "CellularConnectionUtil.h"
|
||||||
|
#ifdef CELLULAR_DEVICE
|
||||||
|
|
||||||
#ifndef MBED_TRACE_MAX_LEVEL
|
#ifndef MBED_TRACE_MAX_LEVEL
|
||||||
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_INFO
|
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_INFO
|
||||||
|
@ -36,7 +34,9 @@
|
||||||
#define TIMEOUT_NETWORK (10*1000)
|
#define TIMEOUT_NETWORK (10*1000)
|
||||||
#define TIMEOUT_REGISTRATION (180*1000)
|
#define TIMEOUT_REGISTRATION (180*1000)
|
||||||
|
|
||||||
static EventQueue at_queue(8 * EVENTS_EVENT_SIZE);
|
namespace mbed {
|
||||||
|
|
||||||
|
static events::EventQueue at_queue(8 * EVENTS_EVENT_SIZE);
|
||||||
static CELLULAR_DEVICE cellularDevice(at_queue);
|
static CELLULAR_DEVICE cellularDevice(at_queue);
|
||||||
|
|
||||||
CellularConnectionUtil::CellularConnectionUtil() : _serial(0), _state(STATE_POWER_ON), _next_state(_state),
|
CellularConnectionUtil::CellularConnectionUtil() : _serial(0), _state(STATE_POWER_ON), _next_state(_state),
|
||||||
|
@ -463,12 +463,12 @@ nsapi_error_t CellularConnectionUtil::start_dispatch()
|
||||||
|
|
||||||
MBED_ASSERT(!_queue_thread);
|
MBED_ASSERT(!_queue_thread);
|
||||||
|
|
||||||
_queue_thread = new Thread();
|
_queue_thread = new rtos::Thread();
|
||||||
if (!_queue_thread) {
|
if (!_queue_thread) {
|
||||||
stop();
|
stop();
|
||||||
return NSAPI_ERROR_NO_MEMORY;
|
return NSAPI_ERROR_NO_MEMORY;
|
||||||
}
|
}
|
||||||
if (_queue_thread->start(callback(&_queue, &EventQueue::dispatch_forever)) != osOK) {
|
if (_queue_thread->start(callback(&_queue, &events::EventQueue::dispatch_forever)) != osOK) {
|
||||||
stop();
|
stop();
|
||||||
return NSAPI_ERROR_NO_MEMORY;
|
return NSAPI_ERROR_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@ void CellularConnectionUtil::set_callback(mbed::Callback<bool(int, int)> status_
|
||||||
_status_callback = status_callback;
|
_status_callback = status_callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventQueue *CellularConnectionUtil::get_queue()
|
events::EventQueue *CellularConnectionUtil::get_queue()
|
||||||
{
|
{
|
||||||
return &_queue;
|
return &_queue;
|
||||||
}
|
}
|
||||||
|
@ -524,3 +524,7 @@ NetworkStack *CellularConnectionUtil::get_stack()
|
||||||
{
|
{
|
||||||
return _cellularDevice->get_stack();
|
return _cellularDevice->get_stack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // CELLULAR_DEVICE
|
||||||
|
|
|
@ -18,9 +18,13 @@
|
||||||
#ifndef _CELLULAR_CONNECTION_UTIL_H
|
#ifndef _CELLULAR_CONNECTION_UTIL_H
|
||||||
#define _CELLULAR_CONNECTION_UTIL_H
|
#define _CELLULAR_CONNECTION_UTIL_H
|
||||||
|
|
||||||
|
#include "CellularTargets.h"
|
||||||
|
#ifdef CELLULAR_DEVICE
|
||||||
|
|
||||||
#include <UARTSerial.h>
|
#include <UARTSerial.h>
|
||||||
#include <NetworkInterface.h>
|
#include <NetworkInterface.h>
|
||||||
#include <EventQueue.h>
|
#include <EventQueue.h>
|
||||||
|
#include <Thread.h>
|
||||||
|
|
||||||
#include "CellularNetwork.h"
|
#include "CellularNetwork.h"
|
||||||
#include "CellularPower.h"
|
#include "CellularPower.h"
|
||||||
|
@ -28,9 +32,10 @@
|
||||||
// modem type is defined as CELLULAR_DEVICE macro
|
// modem type is defined as CELLULAR_DEVICE macro
|
||||||
#define _CELLULAR_STRINGIFY(a) #a
|
#define _CELLULAR_STRINGIFY(a) #a
|
||||||
#define CELLULAR_STRINGIFY(a) _CELLULAR_STRINGIFY(a)
|
#define CELLULAR_STRINGIFY(a) _CELLULAR_STRINGIFY(a)
|
||||||
#include "CellularTargets.h"
|
|
||||||
#include CELLULAR_STRINGIFY(CELLULAR_DEVICE.h)
|
#include CELLULAR_STRINGIFY(CELLULAR_DEVICE.h)
|
||||||
|
|
||||||
|
namespace mbed {
|
||||||
|
|
||||||
const int PIN_SIZE = 8;
|
const int PIN_SIZE = 8;
|
||||||
|
|
||||||
/** CellularConnectionUtil class
|
/** CellularConnectionUtil class
|
||||||
|
@ -79,7 +84,7 @@ public:
|
||||||
/** Get event queue that can be chained to main event queue (or use start_dispatch)
|
/** Get event queue that can be chained to main event queue (or use start_dispatch)
|
||||||
* @return event queue
|
* @return event queue
|
||||||
*/
|
*/
|
||||||
EventQueue* get_queue();
|
events::EventQueue* get_queue();
|
||||||
|
|
||||||
/** Start event queue dispatching
|
/** Start event queue dispatching
|
||||||
* @return see nsapi_error_t, 0 on success
|
* @return see nsapi_error_t, 0 on success
|
||||||
|
@ -133,15 +138,18 @@ private:
|
||||||
CellularState _state;
|
CellularState _state;
|
||||||
CellularState _next_state;
|
CellularState _next_state;
|
||||||
|
|
||||||
mbed::Callback<bool(int, int)> _status_callback;
|
Callback<bool(int, int)> _status_callback;
|
||||||
|
|
||||||
CellularNetwork *_network;
|
CellularNetwork *_network;
|
||||||
CellularPower *_power;
|
CellularPower *_power;
|
||||||
EventQueue _queue;
|
events::EventQueue _queue;
|
||||||
Thread *_queue_thread;
|
rtos::Thread *_queue_thread;
|
||||||
CellularDevice *_cellularDevice;
|
CellularDevice *_cellularDevice;
|
||||||
char _sim_pin[PIN_SIZE+1];
|
char _sim_pin[PIN_SIZE+1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // CELLULAR_DEVICE
|
||||||
|
|
||||||
#endif /* _CELLULAR_CONNECTION_UTIL_H */
|
#endif /* _CELLULAR_CONNECTION_UTIL_H */
|
||||||
|
|
|
@ -15,19 +15,24 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <mbed.h>
|
#include "CellularTargets.h"
|
||||||
|
#ifdef CELLULAR_DEVICE
|
||||||
|
|
||||||
|
#if NSAPI_PPP_AVAILABLE
|
||||||
|
#include "nsapi_ppp.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "CellularConnectionUtil.h"
|
#include "CellularConnectionUtil.h"
|
||||||
#include "CellularTargets.h"
|
|
||||||
#include "CellularUtil.h"
|
#include "CellularUtil.h"
|
||||||
|
|
||||||
#include "EasyCellularConnection.h"
|
#include "EasyCellularConnection.h"
|
||||||
|
|
||||||
#include "CellularLog.h"
|
#include "CellularLog.h"
|
||||||
|
|
||||||
#include "CellularConnectionUtil.h"
|
namespace mbed {
|
||||||
|
|
||||||
static CellularConnectionUtil cellularConnection;
|
static CellularConnectionUtil cellularConnection;
|
||||||
static Semaphore cellularSemaphore(0);
|
static rtos::Semaphore cellularSemaphore(0);
|
||||||
static UARTSerial cellularSerial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
|
static UARTSerial cellularSerial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,3 +162,7 @@ NetworkStack *EasyCellularConnection::get_stack()
|
||||||
return cellularConnection.get_stack();
|
return cellularConnection.get_stack();
|
||||||
#endif // #if NSAPI_PPP_AVAILABLE
|
#endif // #if NSAPI_PPP_AVAILABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // CELLULAR_DEVICE
|
||||||
|
|
|
@ -18,9 +18,13 @@
|
||||||
#ifndef EASY_CELLULAR_CONNECTION_H
|
#ifndef EASY_CELLULAR_CONNECTION_H
|
||||||
#define EASY_CELLULAR_CONNECTION_H
|
#define EASY_CELLULAR_CONNECTION_H
|
||||||
|
|
||||||
#include "netsocket/CellularBase.h"
|
|
||||||
#include "CellularConnectionUtil.h"
|
#include "CellularConnectionUtil.h"
|
||||||
|
#ifdef CELLULAR_DEVICE
|
||||||
|
|
||||||
|
#include "netsocket/CellularBase.h"
|
||||||
|
|
||||||
|
namespace mbed {
|
||||||
|
|
||||||
/** EasyCellularConnection class
|
/** EasyCellularConnection class
|
||||||
*
|
*
|
||||||
* Simplified adapter for cellular connection
|
* Simplified adapter for cellular connection
|
||||||
|
@ -132,6 +136,10 @@ private:
|
||||||
CellularConnectionUtil::CellularState _target_state;
|
CellularConnectionUtil::CellularState _target_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // CELLULAR_DEVICE
|
||||||
|
|
||||||
#endif // EASY_CELLULAR_CONNECTION_H
|
#endif // EASY_CELLULAR_CONNECTION_H
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
|
|
|
@ -34,9 +34,8 @@ namespace mbed {
|
||||||
#define CELLULAR_DEVICE UBLOX_C027
|
#define CELLULAR_DEVICE UBLOX_C027
|
||||||
#elif TARGET_UBLOX_C027
|
#elif TARGET_UBLOX_C027
|
||||||
#define CELLULAR_DEVICE UBLOX_C027
|
#define CELLULAR_DEVICE UBLOX_C027
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error Cellular target not defined, see cellular/targets.h
|
//#error Cellular target not defined, see cellular/targets.h
|
||||||
//#define CELLULAR_TARGET <target-modem>
|
//#define CELLULAR_TARGET <target-modem>
|
||||||
//#define MDMTXD <pin-name>
|
//#define MDMTXD <pin-name>
|
||||||
//#define MDMRXD <pin-name>
|
//#define MDMRXD <pin-name>
|
||||||
|
|
Loading…
Reference in New Issue