mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Add get_target_default_instance in CellularDevice
parent
59972b6659
commit
75caa75a96
|
@ -53,7 +53,7 @@ TEST_F(TestCellularDevice, test_create_delete)
|
|||
dev = NULL;
|
||||
|
||||
CellularDevice *dev1 = CellularDevice::get_default_instance();
|
||||
EXPECT_TRUE(dev1);
|
||||
EXPECT_FALSE(dev1);
|
||||
}
|
||||
|
||||
TEST_F(TestCellularDevice, test_set_sim_pin)
|
||||
|
|
|
@ -43,16 +43,6 @@ AT_CellularDevice::~AT_CellularDevice()
|
|||
delete _network;
|
||||
}
|
||||
|
||||
nsapi_error_t AT_CellularDevice::power_on()
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
nsapi_error_t AT_CellularDevice::power_off()
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
ATHandler *AT_CellularDevice::get_at_handler(FileHandle *fileHandle)
|
||||
{
|
||||
return ATHandler::get_instance(fileHandle, _queue, _default_timeout, "\r", get_send_delay(), _modem_debug_on);
|
||||
|
@ -232,3 +222,13 @@ nsapi_error_t AT_CellularDevice::get_sim_state(SimState &state)
|
|||
|
||||
return AT_CellularDevice_stub::nsapi_error_value;
|
||||
}
|
||||
|
||||
nsapi_error_t AT_CellularDevice::power_on()
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
nsapi_error_t AT_CellularDevice::power_off()
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
|
|
@ -79,16 +79,6 @@ public:
|
|||
return _network;
|
||||
}
|
||||
|
||||
nsapi_error_t power_on()
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
nsapi_error_t power_off()
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
virtual CellularSMS *open_sms(FileHandle *fh = NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -137,6 +127,16 @@ public:
|
|||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
virtual nsapi_error_t power_on()
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
virtual nsapi_error_t power_off()
|
||||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
virtual void set_ready_cb(Callback<void()> callback)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -58,12 +58,22 @@ public:
|
|||
};
|
||||
|
||||
/** Returns singleton instance of CellularDevice if CELLULAR_DEVICE is defined. If CELLULAR_DEVICE is not
|
||||
* defined, then it returns NULL. Implementation is marked as weak.
|
||||
* defined, then it returns NULL. See NetworkInterface::get_default_instance for details.
|
||||
*
|
||||
* @return CellularDevice* instance if any
|
||||
* @remark Application may override this (non-weak) default implementation.
|
||||
*
|
||||
* @return default CellularDevice, NULL if not defined
|
||||
*/
|
||||
static CellularDevice *get_default_instance();
|
||||
|
||||
/** Return target onboard instance of CellularDevice
|
||||
*
|
||||
* @remark Mbed OS target shall override (non-weak) this function for an onboard modem.
|
||||
*
|
||||
* @return CellularDevice* instance, NULL if not defined
|
||||
*/
|
||||
static CellularDevice *get_target_default_instance();
|
||||
|
||||
/** Default constructor
|
||||
*
|
||||
* @param fh File handle used in communication with the modem.
|
||||
|
|
|
@ -22,10 +22,9 @@ MBED_WEAK CellularBase *CellularBase::get_target_default_instance()
|
|||
}
|
||||
|
||||
namespace mbed {
|
||||
#ifdef CELLULAR_DEVICE
|
||||
|
||||
MBED_WEAK CellularContext *CellularContext::get_default_instance()
|
||||
{
|
||||
// Uses default APN, uname, password from mbed_app.json
|
||||
CellularDevice *dev = CellularDevice::get_default_instance();
|
||||
if (!dev) {
|
||||
return NULL;
|
||||
|
@ -52,12 +51,6 @@ MBED_WEAK CellularContext *CellularContext::get_default_nonip_instance()
|
|||
#endif // #if defined(MDMDCD) && defined(MDM_PIN_POLARITY)
|
||||
return context;
|
||||
}
|
||||
#else
|
||||
MBED_WEAK CellularContext *CellularContext::get_default_instance()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif // CELLULAR_DEVICE
|
||||
|
||||
void CellularContext::cp_data_received()
|
||||
{
|
||||
|
|
|
@ -22,31 +22,17 @@
|
|||
#include "CellularTargets.h"
|
||||
#include "EventQueue.h"
|
||||
|
||||
#ifdef CELLULAR_DEVICE
|
||||
#include CELLULAR_STRINGIFY(CELLULAR_DEVICE.h)
|
||||
#endif // CELLULAR_DEVICE
|
||||
|
||||
namespace mbed {
|
||||
|
||||
#ifdef CELLULAR_DEVICE
|
||||
MBED_WEAK CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
|
||||
#if DEVICE_SERIAL_FC
|
||||
if (MDMRTS != NC && MDMCTS != NC) {
|
||||
tr_info("_USING flow control, MDMRTS: %d MDMCTS: %d", MDMRTS, MDMCTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
|
||||
}
|
||||
#endif
|
||||
static CELLULAR_DEVICE device(&serial);
|
||||
return &device;
|
||||
return get_target_default_instance();
|
||||
}
|
||||
#else
|
||||
MBED_WEAK CellularDevice *CellularDevice::get_default_instance()
|
||||
|
||||
MBED_WEAK CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif // CELLULAR_DEVICE
|
||||
|
||||
CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), _sms_ref_count(0),
|
||||
_info_ref_count(0), _fh(fh), _queue(5 * EVENTS_EVENT_SIZE), _state_machine(0), _nw(0), _status_cb(0)
|
||||
|
|
|
@ -32,10 +32,6 @@ GEMALTO_CINTERION::GEMALTO_CINTERION(FileHandle *fh) : AT_CellularDevice(fh)
|
|||
{
|
||||
}
|
||||
|
||||
GEMALTO_CINTERION::~GEMALTO_CINTERION()
|
||||
{
|
||||
}
|
||||
|
||||
AT_CellularContext *GEMALTO_CINTERION::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req)
|
||||
{
|
||||
return new GEMALTO_CINTERION_CellularContext(at, this, apn, cp_req, nonip_req);
|
||||
|
@ -138,3 +134,17 @@ void GEMALTO_CINTERION::init_module_ems31()
|
|||
AT_CellularBase::set_cellular_properties(cellular_properties);
|
||||
_module = ModuleEMS31;
|
||||
}
|
||||
|
||||
#if MBED_CONF_GEMALTO_CINTERION_DEFAULT_CELLULAR_DEVICE
|
||||
#include "UARTSerial.h"
|
||||
CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MBED_CONF_GEMALTO_CINTERION_TX, MBED_CONF_GEMALTO_CINTERION_RX, MBED_CONF_GEMALTO_CINTERION_BAUDRATE);
|
||||
#if defined (MBED_CONF_UBLOX_AT_RTS) && defined(MBED_CONF_UBLOX_AT_CTS)
|
||||
tr_info("GEMALTO_CINTERION flow control: RTS %d CTS %d", MBED_CONF_GEMALTO_CINTERION_RTS, MBED_CONF_GEMALTO_CINTERION_CTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_GEMALTO_CINTERION_RTS, MBED_CONF_GEMALTO_CINTERION_CTS);
|
||||
#endif
|
||||
static GEMALTO_CINTERION device(&serial);
|
||||
return &device;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,6 @@ class GEMALTO_CINTERION : public AT_CellularDevice {
|
|||
public:
|
||||
|
||||
GEMALTO_CINTERION(FileHandle *fh);
|
||||
virtual ~GEMALTO_CINTERION();
|
||||
|
||||
/** Actual model of cellular module is needed to make AT command adaptation at runtime
|
||||
* to support many different models in one cellular driver.
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "GEMALTO_CINTERION",
|
||||
"config": {
|
||||
"tx": {
|
||||
"help": "TX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rx": {
|
||||
"help": "RX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rts": {
|
||||
"help": "RTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"cts": {
|
||||
"help": "CTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"baudrate" : {
|
||||
"help": "Serial connection baud rate",
|
||||
"value": 115200
|
||||
},
|
||||
"default-cellular-device": {
|
||||
"help": "Provide as default CellularDevice [true/false]",
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"target_overrides": {
|
||||
"K64F": {
|
||||
"rx": "D0",
|
||||
"tx": "D1"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,11 +28,7 @@ namespace mbed {
|
|||
*
|
||||
* GENERIC_AT3GPP can be used as a shield for example on top K64F.
|
||||
* Cellular example can be used for testing: https://github.com/ARMmbed/mbed-os-example-cellular
|
||||
* Add line to mbed_app.json where you define this class as CELLULAR_DEVICE and the correct pins. In cellular example
|
||||
* line would be for example just above "target_overrides": {...
|
||||
* For example:
|
||||
* "macros": ["CELLULAR_DEVICE=GENERIC_AT3GPP", "MDMRXD=PTC16", "MDMTXD=PTC17","MDMRTS=NC", "MDMCTS=NC"],
|
||||
* You can define CELLULAR_DEVICE and pins also in ../../../common/CellularTargets.h
|
||||
* Define in mbed_app.json "target_overrides" correct pins and other setup for your modem.
|
||||
*
|
||||
* If new target don't work with GENERIC_AT3GPP then it needs some customizations.
|
||||
* First thing to try can be checking/modifying cellular_properties array in GENERIC_AT3GPP.cpp, does the module support
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "onboard_modem_api.h"
|
||||
|
||||
#include "SARA4_PPP.h"
|
||||
#include "SARA4_PPP_CellularNetwork.h"
|
||||
|
||||
|
@ -49,19 +47,16 @@ AT_CellularNetwork *SARA4_PPP::open_network_impl(ATHandler &at)
|
|||
return new SARA4_PPP_CellularNetwork(at);
|
||||
}
|
||||
|
||||
nsapi_error_t SARA4_PPP::power_on()
|
||||
#if MBED_CONF_SARA4_PPP_DEFAULT_CELLULAR_DEVICE
|
||||
#include "UARTSerial.h"
|
||||
CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
static UARTSerial serial(MBED_CONF_SARA4_PPP_TX, MBED_CONF_SARA4_PPP_RX, MBED_CONF_SARA4_PPP_BAUDRATE);
|
||||
#if defined (MBED_CONF_SARA4_PPP_RTS) && defined (MBED_CONF_SARA4_PPP_CTS)
|
||||
tr_info("SARA4_PPP flow control: RTS %d CTS %d", MBED_CONF_SARA4_PPP_RTS, MBED_CONF_SARA4_PPP_CTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_SARA4_PPP_RTS, MBED_CONF_SARA4_PPP_CTS);
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
static SARA4_PPP device(&serial);
|
||||
return &device;
|
||||
}
|
||||
|
||||
nsapi_error_t SARA4_PPP::power_off()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_power_down();
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ public:
|
|||
|
||||
public: // CellularDevice
|
||||
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "SARA4_PPP",
|
||||
"config": {
|
||||
"tx": {
|
||||
"help": "TX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rx": {
|
||||
"help": "RX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rts": {
|
||||
"help": "RTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"cts": {
|
||||
"help": "CTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"baudrate" : {
|
||||
"help": "Serial connection baud rate",
|
||||
"value": 115200
|
||||
},
|
||||
"default-cellular-device": {
|
||||
"help": "Provide as default CellularDevice [true/false]",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -104,3 +104,17 @@ nsapi_error_t QUECTEL_BC95::reset()
|
|||
_at->resp_start("REBOOTING", true);
|
||||
return _at->unlock_return_error();
|
||||
}
|
||||
|
||||
#if MBED_CONF_QUECTEL_BC95_DEFAULT_CELLULAR_DEVICE
|
||||
#include "UARTSerial.h"
|
||||
CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MBED_CONF_QUECTEL_BC95_TX, MBED_CONF_QUECTEL_BC95_RX, MBED_CONF_QUECTEL_BC95_BAUDRATE);
|
||||
#if defined (MBED_CONF_UBLOX_AT_RTS) && defined(MBED_CONF_UBLOX_AT_CTS)
|
||||
tr_info("QUECTEL_BC95 flow control: RTS %d CTS %d", MBED_CONF_QUECTEL_BC95_RTS, MBED_CONF_QUECTEL_BC95_CTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_QUECTEL_BC95_RTS, MBED_CONF_QUECTEL_BC95_CTS);
|
||||
#endif
|
||||
static QUECTEL_BC95 device(&serial);
|
||||
return &device;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "QUECTEL_BC95",
|
||||
"config": {
|
||||
"tx": {
|
||||
"help": "TX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rx": {
|
||||
"help": "RX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rts": {
|
||||
"help": "RTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"cts": {
|
||||
"help": "CTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"baudrate" : {
|
||||
"help": "Serial connection baud rate",
|
||||
"value": 9600
|
||||
},
|
||||
"default-cellular-device": {
|
||||
"help": "Provide as default CellularDevice [true/false]",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -71,3 +71,17 @@ void QUECTEL_BG96::set_ready_cb(Callback<void()> callback)
|
|||
{
|
||||
_at->set_urc_handler(DEVICE_READY_URC, callback);
|
||||
}
|
||||
|
||||
#if MBED_CONF_QUECTEL_BG96_DEFAULT_CELLULAR_DEVICE
|
||||
#include "UARTSerial.h"
|
||||
CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MBED_CONF_QUECTEL_BG96_TX, MBED_CONF_QUECTEL_BG96_RX, MBED_CONF_QUECTEL_BG96_BAUDRATE);
|
||||
#if defined (MBED_CONF_UBLOX_AT_RTS) && defined(MBED_CONF_UBLOX_AT_CTS)
|
||||
tr_info("QUECTEL_BG96 flow control: RTS %d CTS %d", MBED_CONF_QUECTEL_BG96_RTS, MBED_CONF_QUECTEL_BG96_CTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_QUECTEL_BG96_RTS, MBED_CONF_QUECTEL_BG96_CTS);
|
||||
#endif
|
||||
static QUECTEL_BG96 device(&serial);
|
||||
return &device;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "QUECTEL_BB96",
|
||||
"config": {
|
||||
"tx": {
|
||||
"help": "TX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rx": {
|
||||
"help": "RX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rts": {
|
||||
"help": "RTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"cts": {
|
||||
"help": "CTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"baudrate" : {
|
||||
"help": "Serial connection baud rate",
|
||||
"value": 115200
|
||||
},
|
||||
"default-cellular-device": {
|
||||
"help": "Provide as default CellularDevice [true/false]",
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"target_overrides": {
|
||||
"K64F": {
|
||||
"rx": "PTC16",
|
||||
"tx": "PTC17"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -48,24 +48,22 @@ QUECTEL_UG96::~QUECTEL_UG96()
|
|||
{
|
||||
}
|
||||
|
||||
nsapi_error_t QUECTEL_UG96::power_on()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t QUECTEL_UG96::power_off()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_power_down();
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
AT_CellularContext *QUECTEL_UG96::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req)
|
||||
{
|
||||
return new QUECTEL_UG96_CellularContext(at, this, apn, cp_req, nonip_req);
|
||||
}
|
||||
|
||||
#if MBED_CONF_QUECTEL_UG96_DEFAULT_CELLULAR_DEVICE
|
||||
#include "UARTSerial.h"
|
||||
CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MBED_CONF_QUECTEL_UG96_TX, MBED_CONF_QUECTEL_UG96_RX, MBED_CONF_QUECTEL_UG96_BAUDRATE);
|
||||
#if defined (MBED_CONF_QUECTEL_UG96_RTS) && defined (MBED_CONF_QUECTEL_UG96_CTS)
|
||||
tr_info("QUECTEL_UG96 flow control: RTS %d CTS %d", MBED_CONF_QUECTEL_UG96_RTS, MBED_CONF_QUECTEL_UG96_CTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_QUECTEL_UG96_RTS, MBED_CONF_QUECTEL_UG96_CTS);
|
||||
#endif
|
||||
static QUECTEL_UG96 device(&serial);
|
||||
return &device;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "QUECTEL_UB96",
|
||||
"config": {
|
||||
"tx": {
|
||||
"help": "TX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rx": {
|
||||
"help": "RX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rts": {
|
||||
"help": "RTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"cts": {
|
||||
"help": "CTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"baudrate" : {
|
||||
"help": "Serial connection baud rate",
|
||||
"value": 115200
|
||||
},
|
||||
"default-cellular-device": {
|
||||
"help": "Provide as default CellularDevice [true/false]",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "onboard_modem_api.h"
|
||||
#include "TELIT_HE910.h"
|
||||
#include "AT_CellularNetwork.h"
|
||||
|
||||
|
@ -43,23 +42,6 @@ TELIT_HE910::~TELIT_HE910()
|
|||
{
|
||||
}
|
||||
|
||||
nsapi_error_t TELIT_HE910::power_on()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t TELIT_HE910::power_off()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_power_down();
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
uint16_t TELIT_HE910::get_send_delay() const
|
||||
{
|
||||
return DEFAULT_DELAY_BETWEEN_AT_COMMANDS;
|
||||
|
@ -77,3 +59,17 @@ nsapi_error_t TELIT_HE910::init()
|
|||
|
||||
return _at->unlock_return_error();
|
||||
}
|
||||
|
||||
#if MBED_CONF_TELIT_HE910_DEFAULT_CELLULAR_DEVICE
|
||||
#include "UARTSerial.h"
|
||||
CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MBED_CONF_TELIT_HE910_TX, MBED_CONF_TELIT_HE910_RX, MBED_CONF_TELIT_HE910_BAUDRATE);
|
||||
#if defined (MBED_CONF_TELIT_HE910_RTS) && defined (MBED_CONF_TELIT_HE910_CTS)
|
||||
tr_info("TELIT_HE910 flow control: RTS %d CTS %d", MBED_CONF_TELIT_HE910_RTS, MBED_CONF_TELIT_HE910_CTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_TELIT_HE910_RTS, MBED_CONF_TELIT_HE910_CTS);
|
||||
#endif
|
||||
static TELIT_HE910 device(&serial);
|
||||
return &device;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,8 +31,6 @@ public:
|
|||
virtual ~TELIT_HE910();
|
||||
|
||||
protected: // AT_CellularDevice
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
virtual uint16_t get_send_delay() const;
|
||||
virtual nsapi_error_t init();
|
||||
};
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "TELIT_HE910",
|
||||
"config": {
|
||||
"tx": {
|
||||
"help": "TX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rx": {
|
||||
"help": "RX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rts": {
|
||||
"help": "RTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"cts": {
|
||||
"help": "CTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"baudrate" : {
|
||||
"help": "Serial connection baud rate",
|
||||
"value": 115200
|
||||
},
|
||||
"default-cellular-device": {
|
||||
"help": "Provide as default CellularDevice [true/false]",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "onboard_modem_api.h"
|
||||
#include "UBLOX_AT.h"
|
||||
#include "UBLOX_AT_CellularNetwork.h"
|
||||
#include "UBLOX_AT_CellularContext.h"
|
||||
|
@ -64,24 +63,22 @@ AT_CellularNetwork *UBLOX_AT::open_network_impl(ATHandler &at)
|
|||
return new UBLOX_AT_CellularNetwork(at);
|
||||
}
|
||||
|
||||
nsapi_error_t UBLOX_AT::power_on()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t UBLOX_AT::power_off()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_power_down();
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
AT_CellularContext *UBLOX_AT::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req)
|
||||
{
|
||||
return new UBLOX_AT_CellularContext(at, this, apn, cp_req, nonip_req);
|
||||
}
|
||||
|
||||
#if MBED_CONF_UBLOX_AT_DEFAULT_CELLULAR_DEVICE
|
||||
#include "UARTSerial.h"
|
||||
CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MBED_CONF_UBLOX_AT_TX, MBED_CONF_UBLOX_AT_RX, MBED_CONF_UBLOX_AT_BAUDRATE);
|
||||
#if defined (MBED_CONF_UBLOX_AT_RTS) && defined(MBED_CONF_UBLOX_AT_CTS)
|
||||
tr_info("UBLOX_AT flow control: RTS %d CTS %d", MBED_CONF_UBLOX_AT_RTS, MBED_CONF_UBLOX_AT_CTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_UBLOX_AT_RTS, MBED_CONF_UBLOX_AT_CTS);
|
||||
#endif
|
||||
static UBLOX_AT device(&serial);
|
||||
return &device;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "UBLOX_AT",
|
||||
"config": {
|
||||
"tx": {
|
||||
"help": "TX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rx": {
|
||||
"help": "RX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rts": {
|
||||
"help": "RTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"cts": {
|
||||
"help": "CTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"baudrate" : {
|
||||
"help": "Serial connection baud rate",
|
||||
"value": 115200
|
||||
},
|
||||
"default-cellular-device": {
|
||||
"help": "Provide as default CellularDevice [true/false]",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "onboard_modem_api.h"
|
||||
#include "UBLOX_PPP.h"
|
||||
#include "AT_CellularNetwork.h"
|
||||
|
||||
|
@ -53,23 +52,21 @@ UBLOX_PPP::UBLOX_PPP(FileHandle *fh) : AT_CellularDevice(fh)
|
|||
AT_CellularBase::set_cellular_properties(cellular_properties);
|
||||
}
|
||||
|
||||
UBLOX_PPP::~UBLOX_PPP()
|
||||
{
|
||||
}
|
||||
#if MBED_CONF_UBLOX_PPP_DEFAULT_CELLULAR_DEVICE
|
||||
|
||||
nsapi_error_t UBLOX_PPP::power_on()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
#if !NSAPI_PPP_AVAILABLE
|
||||
#error Must define lwip.ppp-enabled
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t UBLOX_PPP::power_off()
|
||||
#include "UARTSerial.h"
|
||||
CellularDevice *CellularDevice::get_default_instance()
|
||||
{
|
||||
#if MODEM_ON_BOARD
|
||||
::onboard_modem_power_down();
|
||||
static UARTSerial serial(MBED_CONF_UBLOX_PPP_TX, MBED_CONF_UBLOX_PPP_RX, MBED_CONF_UBLOX_PPP_BAUDRATE);
|
||||
#if defined (MBED_CONF_UBLOX_AT_RTS) && defined(MBED_CONF_UBLOX_AT_CTS)
|
||||
tr_info("UBLOX_PPP flow control: RTS %d CTS %d", MBED_CONF_UBLOX_PPP_RTS, MBED_CONF_UBLOX_PPP_CTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_UBLOX_PPP_RTS, MBED_CONF_UBLOX_PPP_CTS);
|
||||
#endif
|
||||
return NSAPI_ERROR_OK;
|
||||
static UBLOX_PPP device(&serial);
|
||||
return &device;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -25,11 +25,6 @@ namespace mbed {
|
|||
class UBLOX_PPP : public AT_CellularDevice {
|
||||
public:
|
||||
UBLOX_PPP(FileHandle *fh);
|
||||
virtual ~UBLOX_PPP();
|
||||
|
||||
protected: // AT_CellularDevice
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "UBLOX_PPP",
|
||||
"config": {
|
||||
"tx": {
|
||||
"help": "TX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rx": {
|
||||
"help": "RX pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"rts": {
|
||||
"help": "RTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"cts": {
|
||||
"help": "CTS pin for serial connection",
|
||||
"value": null
|
||||
},
|
||||
"baudrate" : {
|
||||
"help": "Serial connection baud rate",
|
||||
"value": 115200
|
||||
},
|
||||
"default-cellular-device": {
|
||||
"help": "Provide as default CellularDevice [true/false]",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ONBOARD_UBLOX_PPP.h"
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "UARTSerial.h"
|
||||
#include "CellularLog.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_UBLOX_PPP::ONBOARD_UBLOX_PPP(FileHandle *fh) : UBLOX_PPP(fh)
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_UBLOX_PPP::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_UBLOX_PPP::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_UBLOX_PPP_BAUDRATE);
|
||||
#if DEVICE_SERIAL_FC
|
||||
if (MDMRTS != NC && MDMCTS != NC) {
|
||||
tr_info("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
|
||||
}
|
||||
#endif
|
||||
static ONBOARD_UBLOX_PPP device(&serial);
|
||||
return &device;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_UBLOX_PPP_
|
||||
#define ONBOARD_UBLOX_PPP_
|
||||
|
||||
#include "UBLOX_PPP.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_UBLOX_PPP : public UBLOX_PPP {
|
||||
public:
|
||||
ONBOARD_UBLOX_PPP(FileHandle *fh);
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_UBLOX_PPP_
|
|
@ -0,0 +1,50 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "UARTSerial.h"
|
||||
#include "ONBOARD_TELIT_HE910.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_TELIT_HE910::ONBOARD_TELIT_HE910(FileHandle *fh) : TELIT_HE910(fh)
|
||||
{
|
||||
}
|
||||
|
||||
ONBOARD_TELIT_HE910::~ONBOARD_TELIT_HE910()
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_TELIT_HE910::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_TELIT_HE910::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_TELIT_HE910_BAUDRATE);
|
||||
static ONBOARD_TELIT_HE910 device(&serial);
|
||||
return &device;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_TELIT_HE910_
|
||||
#define ONBOARD_TELIT_HE910_
|
||||
|
||||
#include "TELIT_HE910.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_TELIT_HE910 : public TELIT_HE910 {
|
||||
public:
|
||||
ONBOARD_TELIT_HE910(FileHandle *fh);
|
||||
virtual ~ONBOARD_TELIT_HE910();
|
||||
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_TELIT_HE910_
|
|
@ -0,0 +1,53 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "UARTSerial.h"
|
||||
#include "ONBOARD_TELIT_HE910.h"
|
||||
#include "CellularLog.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_TELIT_HE910::ONBOARD_TELIT_HE910(FileHandle *fh) : TELIT_HE910(fh)
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_TELIT_HE910::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_TELIT_HE910::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_SARA4_PPP_BAUDRATE);
|
||||
#if DEVICE_SERIAL_FC
|
||||
if (MDMRTS != NC && MDMCTS != NC) {
|
||||
tr_info("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
|
||||
}
|
||||
#endif
|
||||
static ONBOARD_TELIT_HE910 device(&serial);
|
||||
return &device;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_TELIT_HE910_
|
||||
#define ONBOARD_TELIT_HE910_
|
||||
|
||||
#include "TELIT_HE910.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_TELIT_HE910 : public TELIT_HE910 {
|
||||
public:
|
||||
ONBOARD_TELIT_HE910(FileHandle *fh);
|
||||
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_TELIT_HE910_
|
|
@ -0,0 +1,33 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ONBOARD_UBLOX_AT.h"
|
||||
#include "ONBOARD_UBLOX_PPP.h"
|
||||
#include "UARTSerial.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
#if defined(TARGET_UBLOX_C030_N211) || defined(TARGET_UBLOX_C030_R410M)
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_UBLOX_AT_BAUDRATE);
|
||||
static ONBOARD_UBLOX_AT device(&serial);
|
||||
#else
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_UBLOX_PPP_BAUDRATE);
|
||||
static ONBOARD_UBLOX_PPP device(&serial);
|
||||
#endif
|
||||
return &device;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ONBOARD_UBLOX_AT.h"
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_UBLOX_AT::ONBOARD_UBLOX_AT(FileHandle *fh) : UBLOX_AT(fh)
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_UBLOX_AT::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_UBLOX_AT::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_UBLOX_AT_
|
||||
#define ONBOARD_UBLOX_AT_
|
||||
|
||||
#include "UBLOX_AT.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_UBLOX_AT : public UBLOX_AT {
|
||||
public:
|
||||
ONBOARD_UBLOX_AT(FileHandle *fh);
|
||||
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_UBLOX_AT_
|
|
@ -0,0 +1,38 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ONBOARD_UBLOX_PPP.h"
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_UBLOX_PPP::ONBOARD_UBLOX_PPP(FileHandle *fh) : UBLOX_PPP(fh)
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_UBLOX_PPP::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_UBLOX_PPP::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_UBLOX_PPP_
|
||||
#define ONBOARD_UBLOX_PPP_
|
||||
|
||||
#include "UBLOX_PPP.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_UBLOX_PPP : public UBLOX_PPP {
|
||||
public:
|
||||
ONBOARD_UBLOX_PPP(FileHandle *fh);
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_UBLOX_PPP_
|
|
@ -0,0 +1,51 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ONBOARD_QUECTEL_BG96.h"
|
||||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "UARTSerial.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_QUECTEL_BG96::ONBOARD_QUECTEL_BG96(FileHandle *fh) : QUECTEL_BG96(fh)
|
||||
{
|
||||
}
|
||||
|
||||
ONBOARD_QUECTEL_BG96::~ONBOARD_QUECTEL_BG96()
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_QUECTEL_BG96::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_QUECTEL_BG96::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_QUECTEL_BG96_BAUDRATE);
|
||||
static ONBOARD_QUECTEL_BG96 device(&serial);
|
||||
return &device;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_QUECTEL_BG96_
|
||||
#define ONBOARD_QUECTEL_BG96_
|
||||
|
||||
#include "QUECTEL_BG96.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_QUECTEL_BG96 : public QUECTEL_BG96 {
|
||||
public:
|
||||
ONBOARD_QUECTEL_BG96(FileHandle *fh);
|
||||
virtual ~ONBOARD_QUECTEL_BG96();
|
||||
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_QUECTEL_BG96_
|
|
@ -0,0 +1,47 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ONBOARD_QUECTEL_BG96.h"
|
||||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "UARTSerial.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_QUECTEL_BG96::ONBOARD_QUECTEL_BG96(FileHandle *fh) : QUECTEL_BG96(fh)
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_QUECTEL_BG96::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_QUECTEL_BG96::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_QUECTEL_BG96_BAUDRATE);
|
||||
static ONBOARD_QUECTEL_BG96 device(&serial);
|
||||
return &device;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_QUECTEL_BG96_
|
||||
#define ONBOARD_QUECTEL_BG96_
|
||||
|
||||
#include "QUECTEL_BG96.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_QUECTEL_BG96 : public QUECTEL_BG96 {
|
||||
public:
|
||||
ONBOARD_QUECTEL_BG96(FileHandle *fh);
|
||||
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_QUECTEL_BG96_
|
|
@ -0,0 +1,57 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ONBOARD_SARA4_PPP.h"
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "UARTSerial.h"
|
||||
#include "CellularLog.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_SARA4_PPP::ONBOARD_SARA4_PPP(FileHandle *fh) : SARA4_PPP(fh)
|
||||
{
|
||||
}
|
||||
|
||||
ONBOARD_SARA4_PPP::~ONBOARD_SARA4_PPP()
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_SARA4_PPP::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_SARA4_PPP::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_SARA4_PPP_BAUDRATE);
|
||||
#if DEVICE_SERIAL_FC
|
||||
if (MDMRTS != NC && MDMCTS != NC) {
|
||||
tr_info("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
|
||||
}
|
||||
#endif
|
||||
static ONBOARD_SARA4_PPP device(&serial);
|
||||
return &device;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_SARA4_PPP_
|
||||
#define ONBOARD_SARA4_PPP_
|
||||
|
||||
#include "SARA4_PPP.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_SARA4_PPP : public SARA4_PPP {
|
||||
public:
|
||||
ONBOARD_SARA4_PPP(FileHandle *fh);
|
||||
virtual ~ONBOARD_SARA4_PPP();
|
||||
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_SARA4_PPP_
|
|
@ -0,0 +1,54 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ONBOARD_QUECTEL_BC95.h"
|
||||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "UARTSerial.h"
|
||||
#include "CellularLog.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
ONBOARD_QUECTEL_BC95::ONBOARD_QUECTEL_BC95(FileHandle *fh) : QUECTEL_BC95(fh)
|
||||
{
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_QUECTEL_BC95::power_on()
|
||||
{
|
||||
::onboard_modem_init();
|
||||
::onboard_modem_power_up();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t ONBOARD_QUECTEL_BC95::power_off()
|
||||
{
|
||||
::onboard_modem_power_down();
|
||||
::onboard_modem_deinit();
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
CellularDevice *CellularDevice::get_target_default_instance()
|
||||
{
|
||||
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_QUECTEL_BC95_BAUDRATE);
|
||||
#if DEVICE_SERIAL_FC
|
||||
if (MDMRTS != NC && MDMCTS != NC) {
|
||||
tr_info("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
|
||||
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
|
||||
}
|
||||
#endif
|
||||
static ONBOARD_QUECTEL_BC95 device(&serial);
|
||||
return &device;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ONBOARD_QUECTEL_BC95_
|
||||
#define ONBOARD_QUECTEL_BC95_
|
||||
|
||||
#include "QUECTEL_BC95.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
class ONBOARD_QUECTEL_BC95 : public QUECTEL_BC95 {
|
||||
public:
|
||||
ONBOARD_QUECTEL_BC95(FileHandle *fh);
|
||||
|
||||
virtual nsapi_error_t power_on();
|
||||
virtual nsapi_error_t power_off();
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // ONBOARD_QUECTEL_BC95_
|
Loading…
Reference in New Issue