Cellular: Update API description to match better onboard_modem_api

pull/9472/head
Ari Parkkila 2019-01-15 06:15:54 -08:00
parent c4de2f2f0e
commit af0d2cf61d
16 changed files with 46 additions and 26 deletions

View File

@ -84,10 +84,16 @@ public:
*/
virtual ~CellularDevice();
/** Set cellular device power supply on.
/** Sets the modem up for powering on
* This is equivalent to plugging in the device, i.e., attaching power and serial port.
* In general, hard_power_on and soft_power_on provides a simple hardware abstraction layer
* on top of the modem drivers written for Mbed OS; they can be overridden
* in a derived class to perform custom power controls in a particular board configuration.
* In many boards this will be a no-op if there is no separate power supply control circuitry.
*
* CellularStateMachine calls hard_power_on, soft_power_on and init when requested to connect
* if the modem is not responding.
* @remark CellularStateMachine calls hard_power_on at first until successful,
* then soft_power_on and init until the modem responds.
* If you are not using CellularStateMachine then you need to call these functions yourself.
*
* @post You must call soft_power_on to power on the modem after calling hard_power_on.
*
@ -95,9 +101,15 @@ public:
*/
virtual nsapi_error_t hard_power_on() = 0;
/** Set cellular device power supply off.
/** Sets the modem in unplugged state
*
* CellularStateMachine disconnect does not shutdown or power off the modem.
* This is equivalent to pulling the plug off of the device, i.e.,
* detaching power and serial port.
*
* This puts the modem in the lowest power state.
*
* @remark CellularStateMachine disconnect or destruct does not shutdown or power off the modem,
* but you need to do that yourself.
*
* @pre You must call soft_power_off to power off the modem before calling hard_power_off.
*
@ -105,7 +117,15 @@ public:
*/
virtual nsapi_error_t hard_power_off() = 0;
/** Set cellular device power on, i.e. start the modem.
/** Powers up the modem
*
* This is equivalent to pressing the "power button" to activate or reset the modem
* and usually implemented as a short pulse on a dedicated GPIO signal.
* It is expected to be present to make it possible to reset the modem.
* The driver may repeat this if the modem is not responsive to AT commands.
*
* @remark CellularStateMachine calls this when requested to connect.
* If you are not using CellularStateMachine then you need to call this function yourself.
*
* @post You must call init to setup the modem.
*
@ -113,7 +133,12 @@ public:
*/
virtual nsapi_error_t soft_power_on() = 0;
/** Set cellular device power off.
/** Powers down the modem
*
* This is equivalent to turning off the modem by button press.
*
* @remark CellularStateMachine disconnect or destruct does not shutdown or power off the modem,
* but you need to do that yourself.
*
* @pre You must call shutdown to prepare the modem for power off.
*
@ -314,7 +339,7 @@ public:
* For example, when multiple cellular modules are supported in a single driver this function
* detects and adapts to an actual module at runtime.
*
* CellularStateMachine calls soft_power_on and init repeatedly when starting to connect
* @remark CellularStateMachine calls soft_power_on and init repeatedly when starting to connect
* until the modem responds.
*
* @return NSAPI_ERROR_OK on success

View File

@ -141,7 +141,7 @@ 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);
tr_debug("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);

View File

@ -44,7 +44,7 @@ CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_GENERIC_AT3GPP_TX, MBED_CONF_GENERIC_AT3GPP_RX, MBED_CONF_GENERIC_AT3GPP_BAUDRATE);
#if defined (MBED_CONF_GENERIC_AT3GPP_RTS) && defined(MBED_CONF_GENERIC_AT3GPP_CTS)
tr_info("GENERIC_AT3GPP flow control: RTS %d CTS %d", MBED_CONF_GENERIC_AT3GPP_RTS, MBED_CONF_GENERIC_AT3GPP_CTS);
tr_debug("GENERIC_AT3GPP flow control: RTS %d CTS %d", MBED_CONF_GENERIC_AT3GPP_RTS, MBED_CONF_GENERIC_AT3GPP_CTS);
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_GENERIC_AT3GPP_RTS, MBED_CONF_GENERIC_AT3GPP_CTS);
#endif
static GENERIC_AT3GPP device(&serial);

View File

@ -49,7 +49,7 @@ CellularDevice *CellularDevice::get_default_instance()
{
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);
tr_debug("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
static SARA4_PPP device(&serial);

View File

@ -97,7 +97,7 @@ 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);
tr_debug("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);

View File

@ -74,7 +74,7 @@ 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);
tr_debug("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);

View File

@ -55,7 +55,7 @@ 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);
tr_debug("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);

View File

@ -62,7 +62,7 @@ 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);
tr_debug("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);

View File

@ -70,7 +70,7 @@ 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);
tr_debug("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);

View File

@ -63,7 +63,7 @@ CellularDevice *CellularDevice::get_default_instance()
{
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);
tr_debug("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
static UBLOX_PPP device(&serial);

View File

@ -54,7 +54,7 @@ CellularDevice *CellularDevice::get_target_default_instance()
static UARTSerial serial(MDMTXD, MDMRXD, 115200);
#if DEVICE_SERIAL_FC
if (MDMRTS != NC && MDMCTS != NC) {
tr_info("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
tr_debug("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
}
#endif

View File

@ -54,7 +54,7 @@ CellularDevice *CellularDevice::get_target_default_instance()
static UARTSerial serial(MDMTXD, MDMRXD, 115200);
#if DEVICE_SERIAL_FC
if (MDMRTS != NC && MDMCTS != NC) {
tr_info("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
tr_debug("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
}
#endif

View File

@ -25,10 +25,6 @@ ONBOARD_QUECTEL_BG96::ONBOARD_QUECTEL_BG96(FileHandle *fh) : QUECTEL_BG96(fh)
{
}
ONBOARD_QUECTEL_BG96::~ONBOARD_QUECTEL_BG96()
{
}
nsapi_error_t ONBOARD_QUECTEL_BG96::hard_power_on()
{
::onboard_modem_init();

View File

@ -24,7 +24,6 @@ namespace mbed {
class ONBOARD_QUECTEL_BG96 : public QUECTEL_BG96 {
public:
ONBOARD_QUECTEL_BG96(FileHandle *fh);
virtual ~ONBOARD_QUECTEL_BG96();
virtual nsapi_error_t hard_power_on();
virtual nsapi_error_t hard_power_off();

View File

@ -54,7 +54,7 @@ CellularDevice *CellularDevice::get_target_default_instance()
static UARTSerial serial(MDMTXD, MDMRXD, 115200);
#if DEVICE_SERIAL_FC
if (MDMRTS != NC && MDMCTS != NC) {
tr_info("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
tr_debug("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
}
#endif

View File

@ -55,7 +55,7 @@ CellularDevice *CellularDevice::get_target_default_instance()
static UARTSerial serial(MDMTXD, MDMRXD, 9600);
#if DEVICE_SERIAL_FC
if (MDMRTS != NC && MDMCTS != NC) {
tr_info("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
tr_debug("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
}
#endif