Skip to content

Commit 4924264

Browse files
authored
Merge pull request #12211 from hugueskamba/hk-replace-uartserial-cellular
Cellular: Replace UARTSerial references with BufferedSerial
2 parents 49b158b + 9e11e5b commit 4924264

40 files changed

+197
-205
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellularcontext/at_cellularcontexttest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ TEST_F(TestAT_CellularContext, set_file_handle)
531531
AT_CellularContext ctx(at, &dev);
532532
ctx.set_file_handle(&fh1);
533533

534-
UARTSerial ss(NC, NC);
534+
BufferedSerial ss(NC, NC);
535535

536536
ctx.set_file_handle(&ss, PTC0, true);
537537
ctx.enable_hup(true);

UNITTESTS/features/cellular/framework/AT/at_cellularcontext/unittest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ set(unittest-test-sources
3737
stubs/randLIB_stub.cpp
3838
stubs/Semaphore_stub.cpp
3939
stubs/us_ticker_stub.cpp
40-
stubs/UARTSerial_stub.cpp
40+
stubs/BufferedSerial_stub.cpp
4141
stubs/SerialBase_stub.cpp
4242
stubs/CellularContext_stub.cpp
4343
stubs/CellularUtil_stub.cpp

UNITTESTS/features/cellular/framework/AT/at_cellulardevice/unittest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ set(unittest-test-sources
3838
stubs/NetworkStack_stub.cpp
3939
stubs/AT_CellularContext_stub.cpp
4040
stubs/Semaphore_stub.cpp
41-
stubs/UARTSerial_stub.cpp
41+
stubs/BufferedSerial_stub.cpp
4242
stubs/SerialBase_stub.cpp
4343
stubs/CellularStateMachine_stub.cpp
4444
stubs/CellularContext_stub.cpp

UNITTESTS/features/cellular/framework/device/athandler/unittest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ set(unittest-test-sources
2424
stubs/EventQueue_stub.cpp
2525
stubs/FileHandle_stub.cpp
2626
stubs/us_ticker_stub.cpp
27-
stubs/UARTSerial_stub.cpp
27+
stubs/BufferedSerial_stub.cpp
2828
stubs/SerialBase_stub.cpp
2929
stubs/mbed_assert_stub.cpp
3030
stubs/mbed_poll_stub.cpp

UNITTESTS/features/cellular/framework/device/cellularcontext/cellularcontexttest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class testContext : public CellularContext
165165

166166
}
167167
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
168-
virtual void set_file_handle(UARTSerial *serial, PinName dcd_pin = NC, bool active_high = false)
168+
virtual void set_file_handle(BufferedSerial *serial, PinName dcd_pin = NC, bool active_high = false)
169169
{
170170

171171
}

UNITTESTS/features/cellular/framework/device/cellularcontext/unittest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ set(unittest-test-sources
2929
stubs/CellularStateMachine_stub.cpp
3030
stubs/EventQueue_stub.cpp
3131
stubs/mbed_assert_stub.cpp
32-
stubs/UARTSerial_stub.cpp
32+
stubs/BufferedSerial_stub.cpp
3333
stubs/SerialBase_stub.cpp
3434
stubs/ATHandler_stub.cpp
3535
stubs/AT_CellularNetwork_stub.cpp

UNITTESTS/features/cellular/framework/device/cellulardevice/unittest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set(unittest-test-sources
2323
stubs/CellularStateMachine_stub.cpp
2424
stubs/EventQueue_stub.cpp
2525
stubs/mbed_assert_stub.cpp
26-
stubs/UARTSerial_stub.cpp
26+
stubs/BufferedSerial_stub.cpp
2727
stubs/SerialBase_stub.cpp
2828
stubs/ATHandler_stub.cpp
2929
stubs/AT_CellularNetwork_stub.cpp

UNITTESTS/features/cellular/framework/device/cellularstatemachine/unittest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set(unittest-test-sources
2323
stubs/CellularDevice_stub.cpp
2424
stubs/EventQueue_stub.cpp
2525
stubs/mbed_assert_stub.cpp
26-
stubs/UARTSerial_stub.cpp
26+
stubs/BufferedSerial_stub.cpp
2727
stubs/SerialBase_stub.cpp
2828
stubs/ATHandler_stub.cpp
2929
stubs/AT_CellularNetwork_stub.cpp

UNITTESTS/stubs/AT_CellularContext_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ AT_CellularContext::~AT_CellularContext()
5151
{
5252
}
5353

54-
void AT_CellularContext::set_file_handle(UARTSerial *serial, PinName dcd_pin, bool active_high)
54+
void AT_CellularContext::set_file_handle(BufferedSerial *serial, PinName dcd_pin, bool active_high)
5555
{
5656
}
5757

UNITTESTS/stubs/AT_CellularDevice_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ nsapi_error_t AT_CellularDevice::release_at_handler(ATHandler *at_handler)
6565
}
6666
}
6767

68-
CellularContext *AT_CellularDevice::create_context(UARTSerial *serial, const char *const apn, PinName dcd_pin,
68+
CellularContext *AT_CellularDevice::create_context(BufferedSerial *serial, const char *const apn, PinName dcd_pin,
6969
bool active_high, bool cp_req, bool nonip_req)
7070
{
7171
}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
* Copyright (c) 2018, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "drivers/BufferedSerial.h"
19+
20+
namespace mbed {
21+
22+
23+
BufferedSerial::BufferedSerial(PinName tx, PinName rx, int baud) : SerialBase(tx, rx, baud)
24+
{
25+
}
26+
27+
BufferedSerial::~BufferedSerial()
28+
{
29+
}
30+
31+
ssize_t BufferedSerial::read(void *buffer, size_t length)
32+
{
33+
return 0;
34+
}
35+
36+
ssize_t BufferedSerial::write(const void *buffer, size_t length)
37+
{
38+
return 0;
39+
}
40+
41+
off_t BufferedSerial::seek(off_t offset, int whence)
42+
{
43+
return -ESPIPE;
44+
}
45+
46+
int BufferedSerial::close()
47+
{
48+
return 0;
49+
}
50+
51+
void BufferedSerial::dcd_irq()
52+
{
53+
}
54+
55+
void BufferedSerial::set_baud(int baud)
56+
{
57+
}
58+
59+
void BufferedSerial::set_data_carrier_detect(PinName dcd_pin, bool active_high)
60+
{
61+
}
62+
63+
void BufferedSerial::set_format(int bits, Parity parity, int stop_bits)
64+
{
65+
}
66+
67+
int BufferedSerial::isatty()
68+
{
69+
return 1;
70+
}
71+
72+
int BufferedSerial::sync()
73+
{
74+
return 0;
75+
}
76+
77+
void BufferedSerial::sigio(Callback<void()> func)
78+
{
79+
}
80+
81+
ssize_t BufferedSerial::write_unbuffered(const char *buf_ptr, size_t length)
82+
{
83+
return 0;
84+
}
85+
86+
bool BufferedSerial::hup() const
87+
{
88+
}
89+
90+
void BufferedSerial::wake()
91+
{
92+
}
93+
94+
short BufferedSerial::poll(short events) const
95+
{
96+
return 0;
97+
}
98+
99+
void BufferedSerial::api_lock(void)
100+
{
101+
}
102+
103+
void BufferedSerial::api_unlock(void)
104+
{
105+
}
106+
107+
void BufferedSerial::rx_irq(void)
108+
{
109+
}
110+
111+
void BufferedSerial::tx_irq(void)
112+
{
113+
}
114+
115+
int BufferedSerial::enable_input(bool enabled)
116+
{
117+
return 0;
118+
}
119+
120+
int BufferedSerial::enable_output(bool enabled)
121+
{
122+
return 0;
123+
}
124+
125+
#if DEVICE_SERIAL_FC
126+
void BufferedSerial::set_flow_control(mbed::SerialBase::Flow, PinName, PinName)
127+
{
128+
129+
}
130+
#endif
131+
132+
}

UNITTESTS/stubs/UARTSerial_stub.cpp

Lines changed: 0 additions & 140 deletions
This file was deleted.

UNITTESTS/target_h/myCellularContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class myCellularContext : public CellularContext {
3939
}
4040
}
4141

42-
void set_file_handle(UARTSerial *serial, PinName dcd_pin, bool active_high)
42+
void set_file_handle(BufferedSerial *serial, PinName dcd_pin, bool active_high)
4343
{
4444
};
4545

UNITTESTS/target_h/myCellularDevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "ATHandler_stub.h"
2424
#include "AT_CellularContext.h"
2525
#include "gtest/gtest.h"
26-
#include "UARTSerial.h"
26+
#include "drivers/BufferedSerial.h"
2727

2828
using namespace events;
2929

@@ -53,7 +53,7 @@ class myCellularDevice : public AT_CellularDevice {
5353
return NSAPI_ERROR_OK;
5454
}
5555

56-
virtual CellularContext *create_context(UARTSerial *serial, const char *const apn, PinName dcd_pin,
56+
virtual CellularContext *create_context(BufferedSerial *serial, const char *const apn, PinName dcd_pin,
5757
bool active_high, bool cp_req = false, bool nonip_req = false)
5858
{
5959
if (_context_list) {

0 commit comments

Comments
 (0)