Skip to content

Commit b0e0487

Browse files
author
Ari Parkkila
committed
Cellular Refactor get_send_delay() into CellularProperty
1 parent ceea992 commit b0e0487

File tree

22 files changed

+27
-56
lines changed

22 files changed

+27
-56
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellulardevice/at_cellulardevicetest.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,6 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_set_power_save_mode)
257257
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == dev.set_power_save_mode(0));
258258
}
259259

260-
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_get_send_delay)
261-
{
262-
FileHandle_stub fh1;
263-
AT_CellularDevice dev(&fh1);
264-
EXPECT_TRUE(0 == dev.get_send_delay());
265-
}
266-
267260
TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_create_delete_context)
268261
{
269262
FileHandle_stub fh1;

UNITTESTS/stubs/AT_CellularDevice_stub.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ AT_CellularDevice::~AT_CellularDevice()
4949

5050
ATHandler *AT_CellularDevice::get_at_handler(FileHandle *fileHandle)
5151
{
52-
return ATHandler::get_instance(fileHandle, _queue, _default_timeout, "\r", get_send_delay(), _modem_debug_on);
52+
return ATHandler::get_instance(fileHandle, _queue, _default_timeout, "\r", get_property(AT_CellularDevice::PROPERTY_AT_SEND_DELAY), _modem_debug_on);
5353
}
5454

5555
ATHandler *AT_CellularDevice::get_at_handler()
@@ -88,7 +88,7 @@ CellularNetwork *AT_CellularDevice::open_network(FileHandle *fh)
8888
_queue,
8989
_default_timeout,
9090
"\r",
91-
get_send_delay(),
91+
get_property(AT_CellularDevice::PROPERTY_AT_SEND_DELAY),
9292
_modem_debug_on), *this);
9393
return _network;
9494
}
@@ -164,11 +164,6 @@ void AT_CellularDevice::set_timeout(int timeout)
164164
_default_timeout = timeout;
165165
}
166166

167-
uint16_t AT_CellularDevice::get_send_delay() const
168-
{
169-
return 0;
170-
}
171-
172167
void AT_CellularDevice::modem_debug_on(bool on)
173168
{
174169
_modem_debug_on = on;

UNITTESTS/target_h/myCellularDevice.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ class myCellularDevice : public AT_CellularDevice {
115115

116116
virtual void set_timeout(int timeout) {}
117117

118-
virtual uint16_t get_send_delay() const
119-
{
120-
return 0;
121-
}
122-
123118
virtual void modem_debug_on(bool on) {}
124119

125120
virtual nsapi_error_t init()

features/cellular/framework/AT/AT_CellularDevice.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void AT_CellularDevice::setup_at_handler()
107107
{
108108
set_at_urcs();
109109

110-
_at->set_send_delay(get_send_delay());
110+
_at->set_send_delay(get_property(AT_CellularDevice::PROPERTY_AT_SEND_DELAY));
111111
}
112112

113113
void AT_CellularDevice::urc_nw_deact()
@@ -188,7 +188,7 @@ ATHandler *AT_CellularDevice::get_at_handler(FileHandle *fileHandle)
188188
}
189189

190190
return ATHandler::get_instance(fileHandle, _queue, _default_timeout,
191-
"\r", get_send_delay(), _modem_debug_on);
191+
"\r", get_property(AT_CellularDevice::PROPERTY_AT_SEND_DELAY), _modem_debug_on);
192192
}
193193

194194
ATHandler *AT_CellularDevice::get_at_handler()
@@ -445,11 +445,6 @@ void AT_CellularDevice::set_timeout(int timeout)
445445
}
446446
}
447447

448-
uint16_t AT_CellularDevice::get_send_delay() const
449-
{
450-
return 0;
451-
}
452-
453448
void AT_CellularDevice::modem_debug_on(bool on)
454449
{
455450
_modem_debug_on = on;

features/cellular/framework/AT/AT_CellularDevice.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class AT_CellularDevice : public CellularDevice {
6161
PROPERTY_SOCKET_COUNT, // The number of sockets of modem IP stack
6262
PROPERTY_IP_TCP, // 0 = not supported, 1 = supported. Modem IP stack has support for TCP
6363
PROPERTY_IP_UDP, // 0 = not supported, 1 = supported. Modem IP stack has support for TCP
64+
PROPERTY_AT_SEND_DELAY, // Sending delay between AT commands in ms
6465
PROPERTY_MAX
6566
};
6667

@@ -100,8 +101,6 @@ class AT_CellularDevice : public CellularDevice {
100101

101102
virtual void set_timeout(int timeout);
102103

103-
virtual uint16_t get_send_delay() const;
104-
105104
virtual void modem_debug_on(bool on);
106105

107106
virtual nsapi_error_t init();

features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
using namespace mbed;
2525
using namespace events;
2626

27-
const uint16_t RESPONSE_TO_SEND_DELAY = 100; // response-to-send delay in milliseconds at bit-rate over 9600
28-
2927
GEMALTO_CINTERION::Module GEMALTO_CINTERION::_module;
3028

3129
GEMALTO_CINTERION::GEMALTO_CINTERION(FileHandle *fh) : AT_CellularDevice(fh)
@@ -83,11 +81,6 @@ nsapi_error_t GEMALTO_CINTERION::init()
8381
return NSAPI_ERROR_OK;
8482
}
8583

86-
uint16_t GEMALTO_CINTERION::get_send_delay() const
87-
{
88-
return RESPONSE_TO_SEND_DELAY;
89-
}
90-
9184
GEMALTO_CINTERION::Module GEMALTO_CINTERION::get_module()
9285
{
9386
return _module;
@@ -116,6 +109,7 @@ void GEMALTO_CINTERION::init_module_bgs2()
116109
10, // PROPERTY_SOCKET_COUNT
117110
1, // PROPERTY_IP_TCP
118111
1, // PROPERTY_IP_UDP
112+
100,// PROPERTY_AT_SEND_DELAY, if baud is below 9600 this must be longer
119113
};
120114
set_cellular_properties(cellular_properties);
121115
_module = ModuleBGS2;
@@ -144,6 +138,7 @@ void GEMALTO_CINTERION::init_module_els61()
144138
10, // PROPERTY_SOCKET_COUNT
145139
1, // PROPERTY_IP_TCP
146140
1, // PROPERTY_IP_UDP
141+
100,// PROPERTY_AT_SEND_DELAY, if baud is below 9600 this must be longer
147142
};
148143
set_cellular_properties(cellular_properties);
149144
_module = ModuleELS61;
@@ -172,6 +167,7 @@ void GEMALTO_CINTERION::init_module_ems31()
172167
10, // PROPERTY_SOCKET_COUNT
173168
1, // PROPERTY_IP_TCP
174169
1, // PROPERTY_IP_UDP
170+
100,// PROPERTY_AT_SEND_DELAY, if baud is below 9600 this must be longer
175171
};
176172
set_cellular_properties(cellular_properties);
177173
_module = ModuleEMS31;
@@ -200,6 +196,7 @@ void GEMALTO_CINTERION::init_module_ehs5e()
200196
10, // PROPERTY_SOCKET_COUNT
201197
1, // PROPERTY_IP_TCP
202198
1, // PROPERTY_IP_UDP
199+
100,// PROPERTY_AT_SEND_DELAY, if baud is below 9600 this must be longer
203200
};
204201
set_cellular_properties(cellular_properties);
205202
_module = ModuleEHS5E;

features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class GEMALTO_CINTERION : public AT_CellularDevice {
5252
virtual AT_CellularInformation *open_information_impl(ATHandler &at);
5353

5454
protected:
55-
virtual uint16_t get_send_delay() const;
5655
virtual nsapi_error_t init();
5756

5857
private:

features/cellular/framework/targets/GENERIC/GENERIC_AT3GPP/GENERIC_AT3GPP.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
4141
0, // PROPERTY_SOCKET_COUNT
4242
0, // PROPERTY_IP_TCP
4343
0, // PROPERTY_IP_UDP
44+
0, // PROPERTY_AT_SEND_DELAY
4445
};
4546

4647
GENERIC_AT3GPP::GENERIC_AT3GPP(FileHandle *fh) : AT_CellularDevice(fh)

features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
4141
0, // PROPERTY_SOCKET_COUNT
4242
0, // PROPERTY_IP_TCP
4343
0, // PROPERTY_IP_UDP
44+
0, // PROPERTY_AT_SEND_DELAY
4445
};
4546

4647
SARA4_PPP::SARA4_PPP(FileHandle *fh) : AT_CellularDevice(fh)

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
4848
7, // PROPERTY_SOCKET_COUNT
4949
1, // PROPERTY_IP_TCP
5050
1, // PROPERTY_IP_UDP
51+
0, // PROPERTY_AT_SEND_DELAY
5152
};
5253

5354
QUECTEL_BC95::QUECTEL_BC95(FileHandle *fh) : AT_CellularDevice(fh)

0 commit comments

Comments
 (0)