Cellular: Replace UARTSerial references with BufferedSerial

`BufferedSerial` is `UARTSerial` renamed to convey the original purpose
of the class. It is the recommended buffered I/O serial class.
pull/12211/head
Hugues Kamba 2020-01-08 09:56:19 +00:00
parent 18c941cc84
commit 9e11e5b43d
40 changed files with 197 additions and 205 deletions

View File

@ -531,7 +531,7 @@ TEST_F(TestAT_CellularContext, set_file_handle)
AT_CellularContext ctx(at, &dev);
ctx.set_file_handle(&fh1);
UARTSerial ss(NC, NC);
BufferedSerial ss(NC, NC);
ctx.set_file_handle(&ss, PTC0, true);
ctx.enable_hup(true);

View File

@ -37,7 +37,7 @@ set(unittest-test-sources
stubs/randLIB_stub.cpp
stubs/Semaphore_stub.cpp
stubs/us_ticker_stub.cpp
stubs/UARTSerial_stub.cpp
stubs/BufferedSerial_stub.cpp
stubs/SerialBase_stub.cpp
stubs/CellularContext_stub.cpp
stubs/CellularUtil_stub.cpp

View File

@ -38,7 +38,7 @@ set(unittest-test-sources
stubs/NetworkStack_stub.cpp
stubs/AT_CellularContext_stub.cpp
stubs/Semaphore_stub.cpp
stubs/UARTSerial_stub.cpp
stubs/BufferedSerial_stub.cpp
stubs/SerialBase_stub.cpp
stubs/CellularStateMachine_stub.cpp
stubs/CellularContext_stub.cpp

View File

@ -24,7 +24,7 @@ set(unittest-test-sources
stubs/EventQueue_stub.cpp
stubs/FileHandle_stub.cpp
stubs/us_ticker_stub.cpp
stubs/UARTSerial_stub.cpp
stubs/BufferedSerial_stub.cpp
stubs/SerialBase_stub.cpp
stubs/mbed_assert_stub.cpp
stubs/mbed_poll_stub.cpp

View File

@ -165,7 +165,7 @@ public:
}
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
virtual void set_file_handle(UARTSerial *serial, PinName dcd_pin = NC, bool active_high = false)
virtual void set_file_handle(BufferedSerial *serial, PinName dcd_pin = NC, bool active_high = false)
{
}

View File

@ -29,7 +29,7 @@ set(unittest-test-sources
stubs/CellularStateMachine_stub.cpp
stubs/EventQueue_stub.cpp
stubs/mbed_assert_stub.cpp
stubs/UARTSerial_stub.cpp
stubs/BufferedSerial_stub.cpp
stubs/SerialBase_stub.cpp
stubs/ATHandler_stub.cpp
stubs/AT_CellularNetwork_stub.cpp

View File

@ -23,7 +23,7 @@ set(unittest-test-sources
stubs/CellularStateMachine_stub.cpp
stubs/EventQueue_stub.cpp
stubs/mbed_assert_stub.cpp
stubs/UARTSerial_stub.cpp
stubs/BufferedSerial_stub.cpp
stubs/SerialBase_stub.cpp
stubs/ATHandler_stub.cpp
stubs/AT_CellularNetwork_stub.cpp

View File

@ -23,7 +23,7 @@ set(unittest-test-sources
stubs/CellularDevice_stub.cpp
stubs/EventQueue_stub.cpp
stubs/mbed_assert_stub.cpp
stubs/UARTSerial_stub.cpp
stubs/BufferedSerial_stub.cpp
stubs/SerialBase_stub.cpp
stubs/ATHandler_stub.cpp
stubs/AT_CellularNetwork_stub.cpp

View File

@ -51,7 +51,7 @@ AT_CellularContext::~AT_CellularContext()
{
}
void AT_CellularContext::set_file_handle(UARTSerial *serial, PinName dcd_pin, bool active_high)
void AT_CellularContext::set_file_handle(BufferedSerial *serial, PinName dcd_pin, bool active_high)
{
}

View File

@ -65,7 +65,7 @@ nsapi_error_t AT_CellularDevice::release_at_handler(ATHandler *at_handler)
}
}
CellularContext *AT_CellularDevice::create_context(UARTSerial *serial, const char *const apn, PinName dcd_pin,
CellularContext *AT_CellularDevice::create_context(BufferedSerial *serial, const char *const apn, PinName dcd_pin,
bool active_high, bool cp_req, bool nonip_req)
{
}

View File

@ -0,0 +1,132 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* 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 "drivers/BufferedSerial.h"
namespace mbed {
BufferedSerial::BufferedSerial(PinName tx, PinName rx, int baud) : SerialBase(tx, rx, baud)
{
}
BufferedSerial::~BufferedSerial()
{
}
ssize_t BufferedSerial::read(void *buffer, size_t length)
{
return 0;
}
ssize_t BufferedSerial::write(const void *buffer, size_t length)
{
return 0;
}
off_t BufferedSerial::seek(off_t offset, int whence)
{
return -ESPIPE;
}
int BufferedSerial::close()
{
return 0;
}
void BufferedSerial::dcd_irq()
{
}
void BufferedSerial::set_baud(int baud)
{
}
void BufferedSerial::set_data_carrier_detect(PinName dcd_pin, bool active_high)
{
}
void BufferedSerial::set_format(int bits, Parity parity, int stop_bits)
{
}
int BufferedSerial::isatty()
{
return 1;
}
int BufferedSerial::sync()
{
return 0;
}
void BufferedSerial::sigio(Callback<void()> func)
{
}
ssize_t BufferedSerial::write_unbuffered(const char *buf_ptr, size_t length)
{
return 0;
}
bool BufferedSerial::hup() const
{
}
void BufferedSerial::wake()
{
}
short BufferedSerial::poll(short events) const
{
return 0;
}
void BufferedSerial::api_lock(void)
{
}
void BufferedSerial::api_unlock(void)
{
}
void BufferedSerial::rx_irq(void)
{
}
void BufferedSerial::tx_irq(void)
{
}
int BufferedSerial::enable_input(bool enabled)
{
return 0;
}
int BufferedSerial::enable_output(bool enabled)
{
return 0;
}
#if DEVICE_SERIAL_FC
void BufferedSerial::set_flow_control(mbed::SerialBase::Flow, PinName, PinName)
{
}
#endif
}

View File

@ -1,140 +0,0 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* 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 "UARTSerial.h"
namespace mbed {
UARTSerial::UARTSerial(PinName tx, PinName rx, int baud) : SerialBase(tx, rx, baud)
{
}
UARTSerial::~UARTSerial()
{
}
ssize_t UARTSerial::read(void *buffer, size_t length)
{
return 0;
}
ssize_t UARTSerial::write(const void *buffer, size_t length)
{
return 0;
}
off_t UARTSerial::seek(off_t offset, int whence)
{
return -ESPIPE;
}
int UARTSerial::close()
{
return 0;
}
void UARTSerial::dcd_irq()
{
}
void UARTSerial::set_baud(int baud)
{
}
void UARTSerial::set_data_carrier_detect(PinName dcd_pin, bool active_high)
{
}
void UARTSerial::set_format(int bits, Parity parity, int stop_bits)
{
}
int UARTSerial::isatty()
{
return 1;
}
int UARTSerial::sync()
{
return 0;
}
void UARTSerial::sigio(Callback<void()> func)
{
}
ssize_t UARTSerial::write_unbuffered(const char *buf_ptr, size_t length)
{
return 0;
}
bool UARTSerial::hup() const
{
}
void UARTSerial::wake()
{
}
short UARTSerial::poll(short events) const
{
return 0;
}
void UARTSerial::lock()
{
}
void UARTSerial::unlock()
{
}
void UARTSerial::api_lock(void)
{
}
void UARTSerial::api_unlock(void)
{
}
void UARTSerial::rx_irq(void)
{
}
void UARTSerial::tx_irq(void)
{
}
int UARTSerial::enable_input(bool enabled)
{
return 0;
}
int UARTSerial::enable_output(bool enabled)
{
return 0;
}
#if DEVICE_SERIAL_FC
void UARTSerial::set_flow_control(mbed::SerialBase::Flow, PinName, PinName)
{
}
#endif
}

View File

@ -39,7 +39,7 @@ public:
}
}
void set_file_handle(UARTSerial *serial, PinName dcd_pin, bool active_high)
void set_file_handle(BufferedSerial *serial, PinName dcd_pin, bool active_high)
{
};

View File

@ -23,7 +23,7 @@
#include "ATHandler_stub.h"
#include "AT_CellularContext.h"
#include "gtest/gtest.h"
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
using namespace events;
@ -53,7 +53,7 @@ public:
return NSAPI_ERROR_OK;
}
virtual CellularContext *create_context(UARTSerial *serial, const char *const apn, PinName dcd_pin,
virtual CellularContext *create_context(BufferedSerial *serial, const char *const apn, PinName dcd_pin,
bool active_high, bool cp_req = false, bool nonip_req = false)
{
if (_context_list) {

View File

@ -27,7 +27,7 @@
#include <cstdarg>
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
/**
* If application calls associated FileHandle only from single thread context
@ -204,7 +204,7 @@ public:
*/
void set_send_delay(uint16_t send_delay);
/** Sets UARTSerial filehandle to given baud rate
/** Sets BufferedSerial filehandle to given baud rate
*
* @param baud_rate
*/

View File

@ -271,11 +271,11 @@ public: // from NetworkInterface
/** Set the UART serial used to communicate with the modem. Can be used to change default file handle.
* File handle set with this method will use data carrier detect to be able to detect disconnection much faster in PPP mode.
*
* @param serial UARTSerial used in communication to modem. If null then the default file handle is used.
* @param serial BufferedSerial used in communication to modem. If null then the default file handle is used.
* @param dcd_pin Pin used to set data carrier detect on/off for the given UART
* @param active_high a boolean set to true if DCD polarity is active low
*/
virtual void set_file_handle(UARTSerial *serial, PinName dcd_pin = NC, bool active_high = false) = 0;
virtual void set_file_handle(BufferedSerial *serial, PinName dcd_pin = NC, bool active_high = false) = 0;
#endif // #if DEVICE_SERIAL
/** Returns the control plane AT command interface

View File

@ -23,7 +23,7 @@
#include "ATHandler.h"
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
#endif // #if DEVICE_SERIAL
#ifdef MBED_CONF_RTOS_PRESENT
@ -237,9 +237,9 @@ public: //Pure virtual functions
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
/** Creates a new CellularContext interface. This API should be used if serial is UART and PPP mode used.
* CellularContext created will use data carrier detect to be able to detect disconnection much faster in PPP mode.
* UARTSerial usually is the same which was given for the CellularDevice.
* BufferedSerial usually is the same which was given for the CellularDevice.
*
* @param serial UARTSerial used in communication to modem. If null then the default file handle is used.
* @param serial BufferedSerial used in communication to modem. If null then the default file handle is used.
* @param apn access point to use with context, can be null.
* @param dcd_pin Pin used to set data carrier detect on/off for the given UART
* @param active_high a boolean set to true if DCD polarity is active low
@ -249,7 +249,7 @@ public: //Pure virtual functions
* @return new instance of class CellularContext or NULL in case of failure
*
*/
virtual CellularContext *create_context(UARTSerial *serial, const char *apn, PinName dcd_pin = NC,
virtual CellularContext *create_context(BufferedSerial *serial, const char *apn, PinName dcd_pin = NC,
bool active_high = false, bool cp_req = false, bool nonip_req = false) = 0;
#endif // #if DEVICE_SERIAL

View File

@ -23,7 +23,7 @@
#include "AT_CellularDevice.h"
#include "CellularLog.h"
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
#endif // #if DEVICE_SERIAL
#include "ThisThread.h"
@ -79,7 +79,7 @@ void AT_CellularContext::set_file_handle(FileHandle *fh)
}
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
void AT_CellularContext::set_file_handle(UARTSerial *serial, PinName dcd_pin, bool active_high)
void AT_CellularContext::set_file_handle(BufferedSerial *serial, PinName dcd_pin, bool active_high)
{
tr_info("CellularContext serial %p", serial);
_dcd_pin = dcd_pin;
@ -94,7 +94,7 @@ void AT_CellularContext::enable_hup(bool enable)
{
if (_dcd_pin != NC) {
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
static_cast<UARTSerial *>(_fh)->set_data_carrier_detect(enable ? _dcd_pin : NC, _active_high);
static_cast<BufferedSerial *>(_fh)->set_data_carrier_detect(enable ? _dcd_pin : NC, _active_high);
#endif // #if DEVICE_SERIAL
}
}

View File

@ -64,7 +64,7 @@ public:
virtual nsapi_error_t attach_to_network();
virtual void set_file_handle(FileHandle *fh);
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
virtual void set_file_handle(UARTSerial *serial, PinName dcd_pin = NC, bool active_high = false);
virtual void set_file_handle(BufferedSerial *serial, PinName dcd_pin = NC, bool active_high = false);
#endif // #if DEVICE_SERIAL
virtual void enable_hup(bool enable);

View File

@ -26,7 +26,7 @@
#include "CellularLog.h"
#include "ATHandler.h"
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
#endif // #if DEVICE_SERIAL
#include "FileHandle.h"
#include <ctype.h>
@ -286,7 +286,7 @@ CellularContext *AT_CellularDevice::get_context_list() const
}
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
CellularContext *AT_CellularDevice::create_context(UARTSerial *serial, const char *const apn, PinName dcd_pin,
CellularContext *AT_CellularDevice::create_context(BufferedSerial *serial, const char *const apn, PinName dcd_pin,
bool active_high, bool cp_req, bool nonip_req)
{
// Call FileHandle base version - explict upcast to avoid recursing into ourselves

View File

@ -83,7 +83,7 @@ public:
virtual CellularContext *create_context(FileHandle *fh = NULL, const char *apn = NULL, bool cp_req = false, bool nonip_req = false);
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
virtual CellularContext *create_context(UARTSerial *serial, const char *const apn, PinName dcd_pin = NC, bool active_high = false, bool cp_req = false, bool nonip_req = false);
virtual CellularContext *create_context(BufferedSerial *serial, const char *const apn, PinName dcd_pin = NC, bool active_high = false, bool cp_req = false, bool nonip_req = false);
#endif // #if DEVICE_SERIAL
virtual void delete_context(CellularContext *context);

View File

@ -1657,6 +1657,6 @@ void ATHandler::write_hex_string(const char *str, size_t size)
void ATHandler::set_baud(int baud_rate)
{
static_cast<UARTSerial *>(_fileHandle)->set_baud(baud_rate);
static_cast<BufferedSerial *>(_fileHandle)->set_baud(baud_rate);
}

View File

@ -35,7 +35,7 @@ MBED_WEAK CellularContext *CellularContext::get_default_instance()
static CellularContext *context = dev->create_context(NULL, NULL, MBED_CONF_CELLULAR_CONTROL_PLANE_OPT);
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#if defined(MDMDCD) && defined(MDM_PIN_POLARITY)
context->set_file_handle(static_cast<UARTSerial *>(&dev->get_file_handle()), MDMDCD, MDM_PIN_POLARITY);
context->set_file_handle(static_cast<BufferedSerial *>(&dev->get_file_handle()), MDMDCD, MDM_PIN_POLARITY);
#endif // #if defined(MDMDCD) && defined(MDM_PIN_POLARITY)
#endif // #if DEVICE_SERIAL
return context;
@ -52,7 +52,7 @@ MBED_WEAK CellularContext *CellularContext::get_default_nonip_instance()
static CellularContext *context = dev->create_context(NULL, NULL, MBED_CONF_CELLULAR_CONTROL_PLANE_OPT, true);
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#if defined(MDMDCD) && defined(MDM_PIN_POLARITY)
context->set_file_handle(static_cast<UARTSerial *>(&dev->get_file_handle()), MDMDCD, MDM_PIN_POLARITY);
context->set_file_handle(static_cast<BufferedSerial *>(&dev->get_file_handle()), MDMDCD, MDM_PIN_POLARITY);
#endif // #if defined(MDMDCD) && defined(MDM_PIN_POLARITY)
#endif // #if DEVICE_SERIAL
return context;

View File

@ -194,10 +194,10 @@ void GEMALTO_CINTERION::init_module_ehs5e()
}
#if MBED_CONF_GEMALTO_CINTERION_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_GEMALTO_CINTERION_TX, MBED_CONF_GEMALTO_CINTERION_RX, MBED_CONF_GEMALTO_CINTERION_BAUDRATE);
static BufferedSerial serial(MBED_CONF_GEMALTO_CINTERION_TX, MBED_CONF_GEMALTO_CINTERION_RX, MBED_CONF_GEMALTO_CINTERION_BAUDRATE);
#if defined(MBED_CONF_GEMALTO_CINTERION_RTS) && defined(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);

View File

@ -46,10 +46,10 @@ GENERIC_AT3GPP::GENERIC_AT3GPP(FileHandle *fh) : AT_CellularDevice(fh)
}
#if MBED_CONF_GENERIC_AT3GPP_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_GENERIC_AT3GPP_TX, MBED_CONF_GENERIC_AT3GPP_RX, MBED_CONF_GENERIC_AT3GPP_BAUDRATE);
static BufferedSerial 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_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);

View File

@ -51,10 +51,10 @@ AT_CellularNetwork *SARA4_PPP::open_network_impl(ATHandler &at)
}
#if MBED_CONF_SARA4_PPP_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_SARA4_PPP_TX, MBED_CONF_SARA4_PPP_RX, MBED_CONF_SARA4_PPP_BAUDRATE);
static BufferedSerial 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_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);

View File

@ -109,10 +109,10 @@ nsapi_error_t QUECTEL_BC95::set_baud_rate_impl(int baud_rate)
}
#if MBED_CONF_QUECTEL_BC95_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_QUECTEL_BC95_TX, MBED_CONF_QUECTEL_BC95_RX, MBED_CONF_QUECTEL_BC95_BAUDRATE);
static BufferedSerial serial(MBED_CONF_QUECTEL_BC95_TX, MBED_CONF_QUECTEL_BC95_RX, MBED_CONF_QUECTEL_BC95_BAUDRATE);
#if defined(MBED_CONF_QUECTEL_BC95_RTS) && defined(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);

View File

@ -137,10 +137,10 @@ nsapi_error_t QUECTEL_BG96::soft_power_off()
}
#if MBED_CONF_QUECTEL_BG96_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_QUECTEL_BG96_TX, MBED_CONF_QUECTEL_BG96_RX, MBED_CONF_QUECTEL_BG96_BAUDRATE);
static BufferedSerial serial(MBED_CONF_QUECTEL_BG96_TX, MBED_CONF_QUECTEL_BG96_RX, MBED_CONF_QUECTEL_BG96_BAUDRATE);
#if defined (MBED_CONF_QUECTEL_BG96_RTS) && defined(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);

View File

@ -20,7 +20,7 @@
#include "PinNames.h"
#include "AT_CellularNetwork.h"
#include "rtos/ThisThread.h"
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
using namespace mbed;
using namespace rtos;
@ -77,9 +77,9 @@ QUECTEL_EC2X::QUECTEL_EC2X(FileHandle *fh, PinName pwr, bool active_high, PinNam
#if MBED_CONF_QUECTEL_EC2X_PROVIDE_DEFAULT
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_QUECTEL_EC2X_TX,
MBED_CONF_QUECTEL_EC2X_RX,
MBED_CONF_QUECTEL_EC2X_BAUDRATE);
static BufferedSerial serial(MBED_CONF_QUECTEL_EC2X_TX,
MBED_CONF_QUECTEL_EC2X_RX,
MBED_CONF_QUECTEL_EC2X_BAUDRATE);
#if defined(MBED_CONF_QUECTEL_EC2X_RTS) && defined(MBED_CONF_QUECTEL_EC2X_CTS)
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_QUECTEL_EC2X_RTS, MBED_CONF_QUECTEL_EC2X_CTS);
#endif

View File

@ -90,10 +90,10 @@ nsapi_error_t QUECTEL_M26::shutdown()
#if MBED_CONF_QUECTEL_M26_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_QUECTEL_M26_TX, MBED_CONF_QUECTEL_M26_RX, MBED_CONF_QUECTEL_M26_BAUDRATE);
static BufferedSerial serial(MBED_CONF_QUECTEL_M26_TX, MBED_CONF_QUECTEL_M26_RX, MBED_CONF_QUECTEL_M26_BAUDRATE);
#if defined (MBED_CONF_QUECTEL_M26_RTS) && defined(MBED_CONF_QUECTEL_M26_CTS)
tr_debug("QUECTEL_M26 flow control: RTS %d CTS %d", MBED_CONF_QUECTEL_M26_RTS, MBED_CONF_QUECTEL_M26_CTS);
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_QUECTEL_M26_RTS, MBED_CONF_QUECTEL_M26_CTS);

View File

@ -56,10 +56,10 @@ AT_CellularContext *QUECTEL_UG96::create_context_impl(ATHandler &at, const char
}
#if MBED_CONF_QUECTEL_UG96_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_QUECTEL_UG96_TX, MBED_CONF_QUECTEL_UG96_RX, MBED_CONF_QUECTEL_UG96_BAUDRATE);
static BufferedSerial 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_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);

View File

@ -85,12 +85,12 @@ nsapi_error_t RM1000_AT::init()
}
#if MBED_CONF_RM1000_AT_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
tr_debug("Calling CellularDevice::get_default_instance from RM1000_AT");
static UARTSerial serial(MBED_CONF_RM1000_AT_TX, MBED_CONF_RM1000_AT_RX, MBED_CONF_RM1000_AT_BAUDRATE);
static BufferedSerial serial(MBED_CONF_RM1000_AT_TX, MBED_CONF_RM1000_AT_RX, MBED_CONF_RM1000_AT_BAUDRATE);
#if defined (MBED_CONF_RM1000_AT_RTS) && defined(MBED_CONF_RM1000_AT_CTS)
tr_debug("RM1000_AT flow control: RTS %d CTS %d", MBED_CONF_RM1000_AT_RTS, MBED_CONF_RM1000_AT_CTS);
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_RM1000_AT_RTS, MBED_CONF_RM1000_AT_CTS);

View File

@ -69,7 +69,7 @@ void RM1000_AT_CellularStack::RUSORCV_URC()
if (socket != NULL) {
socket->pending_bytes = b;
// No debug prints here as they can affect timing
// and cause data loss in UARTSerial
// and cause data loss in BufferedSerial
if (socket->_cb != NULL) {
socket->_cb(socket->_data);
}

View File

@ -60,10 +60,10 @@ nsapi_error_t TELIT_HE910::init()
}
#if MBED_CONF_TELIT_HE910_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_TELIT_HE910_TX, MBED_CONF_TELIT_HE910_RX, MBED_CONF_TELIT_HE910_BAUDRATE);
static BufferedSerial 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_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);

View File

@ -144,10 +144,10 @@ nsapi_error_t TELIT_ME910::init()
}
#if MBED_CONF_TELIT_ME910_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_TELIT_ME910_TX, MBED_CONF_TELIT_ME910_RX, MBED_CONF_TELIT_ME910_BAUDRATE);
static BufferedSerial serial(MBED_CONF_TELIT_ME910_TX, MBED_CONF_TELIT_ME910_RX, MBED_CONF_TELIT_ME910_BAUDRATE);
#if defined (MBED_CONF_TELIT_ME910_RTS) && defined (MBED_CONF_TELIT_ME910_CTS)
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_TELIT_ME910_RTS, MBED_CONF_TELIT_ME910_CTS);
#endif

View File

@ -100,10 +100,10 @@ AT_CellularContext *UBLOX_AT::create_context_impl(ATHandler &at, const char *apn
}
#if MBED_CONF_UBLOX_AT_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_UBLOX_AT_TX, MBED_CONF_UBLOX_AT_RX, MBED_CONF_UBLOX_AT_BAUDRATE);
static BufferedSerial 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_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);

View File

@ -58,7 +58,7 @@ void UBLOX_AT_CellularStack::UUSORD_URC()
if (socket != NULL) {
socket->pending_bytes = b;
// No debug prints here as they can affect timing
// and cause data loss in UARTSerial
// and cause data loss in BufferedSerial
if (socket->_cb != NULL) {
socket->_cb(socket->_data);
}
@ -78,7 +78,7 @@ void UBLOX_AT_CellularStack::UUSORF_URC()
if (socket != NULL) {
socket->pending_bytes = b;
// No debug prints here as they can affect timing
// and cause data loss in UARTSerial
// and cause data loss in BufferedSerial
if (socket->_cb != NULL) {
socket->_cb(socket->_data);
}

View File

@ -157,10 +157,10 @@ nsapi_error_t UBLOX_N2XX::set_pin(const char *sim_pin)
}
#if MBED_CONF_UBLOX_N2XX_PROVIDE_DEFAULT
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_UBLOX_N2XX_TX, MBED_CONF_UBLOX_N2XX_RX, MBED_CONF_UBLOX_N2XX_BAUDRATE);
static BufferedSerial serial(MBED_CONF_UBLOX_N2XX_TX, MBED_CONF_UBLOX_N2XX_RX, MBED_CONF_UBLOX_N2XX_BAUDRATE);
#if defined (MBED_CONF_UBLOX_N2XX_RTS) && defined(MBED_CONF_UBLOX_N2XX_CTS)
tr_debug("UBLOX_N2XX flow control: RTS %d CTS %d", MBED_CONF_UBLOX_N2XX_RTS, MBED_CONF_UBLOX_N2XX_CTS);
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_UBLOX_N2XX_RTS, MBED_CONF_UBLOX_N2XX_CTS);

View File

@ -57,7 +57,7 @@ void UBLOX_N2XX_CellularStack::NSONMI_URC()
if (socket != NULL) {
socket->pending_bytes = b;
// No debug prints here as they can affect timing
// and cause data loss in UARTSerial
// and cause data loss in BufferedSerial
if (socket->_cb != NULL) {
socket->_cb(socket->_data);
}

View File

@ -95,10 +95,10 @@ UBLOX_PPP::UBLOX_PPP(FileHandle *fh) : AT_CellularDevice(fh)
#error Must define lwip.ppp-enabled
#endif
#include "UARTSerial.h"
#include "drivers/BufferedSerial.h"
CellularDevice *CellularDevice::get_default_instance()
{
static UARTSerial serial(MBED_CONF_UBLOX_PPP_TX, MBED_CONF_UBLOX_PPP_RX, MBED_CONF_UBLOX_PPP_BAUDRATE);
static BufferedSerial 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_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);