Skip to content

Commit 4d431cd

Browse files
Ari ParkkilaMirela Chirica
authored andcommitted
Cellular: Removed max_packet_size
1 parent 3f742c9 commit 4d431cd

File tree

7 files changed

+4
-34
lines changed

7 files changed

+4
-34
lines changed

features/cellular/UNITTESTS/at/at_cellularstack/test_at_cellularstack.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,17 @@ class MyStack : public AT_CellularStack {
3434
bool bool_value;
3535
bool max_sock_value;
3636
nsapi_error_t create_error;
37-
int max_packet_size;
3837
CellularSocket socket;
3938

4039
MyStack(ATHandler &atr, int cid, nsapi_ip_stack_t typ) : AT_CellularStack(atr, cid, typ)
4140
{
4241
bool_value = false;
4342
max_sock_value = 0;
4443
create_error = NSAPI_ERROR_OK;
45-
max_packet_size = 0;
4644
}
4745

4846
virtual int get_max_socket_count(){return max_sock_value;}
4947

50-
virtual int get_max_packet_size(){return max_packet_size;}
51-
5248
virtual bool is_protocol_supported(nsapi_protocol_t protocol){return bool_value;}
5349

5450
virtual nsapi_error_t socket_close_impl(int sock_id){return NSAPI_ERROR_OK;}
@@ -266,7 +262,6 @@ void Test_AT_CellularStack::test_AT_CellularStack_socket_sendto()
266262
CHECK(NSAPI_ERROR_CONNECTION_LOST == st.socket_sendto(sock, addr, "addr", 4));
267263

268264
st.create_error = NSAPI_ERROR_OK;
269-
st.max_packet_size = 6;
270265
CHECK(NSAPI_ERROR_OK == st.socket_sendto(sock, addr, "addr", 4));
271266
}
272267

@@ -301,7 +296,6 @@ void Test_AT_CellularStack::test_AT_CellularStack_socket_recvfrom()
301296
CHECK(NSAPI_ERROR_CONNECTION_LOST == st.socket_recvfrom(sock, &addr, table, 4));
302297

303298
st.create_error = NSAPI_ERROR_OK;
304-
st.max_packet_size = 6;
305299
CHECK(NSAPI_ERROR_OK == st.socket_recvfrom(sock, &addr, table, 4));
306300
}
307301

features/cellular/framework/AT/AT_CellularStack.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,8 @@ nsapi_size_or_error_t AT_CellularStack::socket_sendto(nsapi_socket_t handle, con
257257
}
258258
}
259259

260-
unsigned max_packet_size = get_max_packet_size();
261-
262260
/* Check parameters */
263-
if (addr.get_ip_version() == NSAPI_UNSPEC ||
264-
size > max_packet_size) {
261+
if (addr.get_ip_version() == NSAPI_UNSPEC) {
265262
return NSAPI_ERROR_DEVICE_ERROR;
266263
}
267264

features/cellular/framework/AT/AT_CellularStack.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ class AT_CellularStack : public NetworkStack, public AT_CellularBase
105105
*/
106106
virtual int get_max_socket_count() = 0;
107107

108-
/**
109-
* Gets maximum packet size
110-
*/
111-
virtual int get_max_packet_size() = 0;
112-
113108
/**
114109
* Checks if modem supports the given protocol
115110
*

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ int QUECTEL_BC95_CellularStack::get_max_socket_count()
6161
return BC95_SOCKET_MAX;
6262
}
6363

64-
int QUECTEL_BC95_CellularStack::get_max_packet_size()
65-
{
66-
return BC95_MAX_PACKET_SIZE;
67-
}
68-
6964
bool QUECTEL_BC95_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
7065
{
7166
return (protocol == NSAPI_UDP);
@@ -146,15 +141,15 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc
146141
{
147142
int sent_len = 0;
148143

149-
char *hexstr = new char[BC95_MAX_PACKET_SIZE*2+1];
144+
char *hexstr = new char[size*2+1];
150145
int hexlen = char_str_to_hex_str((const char*)data, size, hexstr);
151146
// NULL terminated for write_string
152147
hexstr[hexlen] = 0;
153148
_at.cmd_start("AT+NSOST=");
154149
_at.write_int(socket->id);
155150
_at.write_string(address.get_ip_address(), false);
156151
_at.write_int(address.get_port());
157-
_at.write_int(size <= BC95_MAX_PACKET_SIZE ? size : BC95_MAX_PACKET_SIZE);
152+
_at.write_int(size);
158153
_at.write_string(hexstr, false);
159154
_at.cmd_stop();
160155
_at.resp_start();
@@ -181,7 +176,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_recvfrom_impl(CellularS
181176

182177
_at.cmd_start("AT+NSORF=");
183178
_at.write_int(socket->id);
184-
_at.write_int(size <= BC95_MAX_PACKET_SIZE ? size : BC95_MAX_PACKET_SIZE);
179+
_at.write_int(size);
185180
_at.cmd_stop();
186181
_at.resp_start();
187182
// receiving socket id

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "AT_CellularStack.h"
2222

2323
#define BC95_SOCKET_MAX 7
24-
#define BC95_MAX_PACKET_SIZE 1358
2524

2625
namespace mbed {
2726

@@ -42,8 +41,6 @@ class QUECTEL_BC95_CellularStack : public AT_CellularStack
4241

4342
virtual int get_max_socket_count();
4443

45-
virtual int get_max_packet_size();
46-
4744
virtual bool is_protocol_supported(nsapi_protocol_t protocol);
4845

4946
virtual nsapi_error_t socket_close_impl(int sock_id);

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ int QUECTEL_BG96_CellularStack::get_max_socket_count()
6464
return BG96_SOCKET_MAX;
6565
}
6666

67-
int QUECTEL_BG96_CellularStack::get_max_packet_size()
68-
{
69-
return BG96_MAX_PACKET_SIZE;
70-
}
71-
7267
bool QUECTEL_BG96_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
7368
{
7469
return (protocol == NSAPI_UDP);

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
namespace mbed {
2424

2525
#define BG96_SOCKET_MAX 12
26-
#define BG96_MAX_PACKET_SIZE 1460
2726
#define BG96_CREATE_SOCKET_TIMEOUT 150000 //150 seconds
2827

2928
class QUECTEL_BG96_CellularStack : public AT_CellularStack
@@ -43,8 +42,6 @@ class QUECTEL_BG96_CellularStack : public AT_CellularStack
4342

4443
virtual int get_max_socket_count();
4544

46-
virtual int get_max_packet_size();
47-
4845
virtual bool is_protocol_supported(nsapi_protocol_t protocol);
4946

5047
virtual nsapi_error_t socket_close_impl(int sock_id);

0 commit comments

Comments
 (0)