Skip to content

Commit ceea992

Browse files
author
Ari Parkkila
committed
Cellular: Refactor is_protocol_supported() into CellularProperty
1 parent e2cb180 commit ceea992

33 files changed

+64
-70
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ class my_stack : public AT_CellularStack {
8181
{
8282
return 200;
8383
}
84-
virtual bool is_protocol_supported(nsapi_protocol_t protocol)
85-
{
86-
return true;
87-
}
8884
virtual nsapi_error_t socket_close_impl(int sock_id)
8985
{
9086
return NSAPI_ERROR_OK;

UNITTESTS/features/cellular/framework/AT/at_cellularstack/at_cellularstacktest.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ class MyStack : public AT_CellularStack {
4444
create_error = NSAPI_ERROR_OK;
4545
}
4646

47-
virtual bool is_protocol_supported(nsapi_protocol_t protocol)
48-
{
49-
return bool_value;
50-
}
51-
5247
virtual nsapi_error_t socket_close_impl(int sock_id)
5348
{
5449
return NSAPI_ERROR_OK;
@@ -201,10 +196,10 @@ TEST_F(TestAT_CellularStack, test_AT_CellularStack_socket_open)
201196
ATHandler at(&fh1, que, 0, ",");
202197

203198
MyStack st(at, 0, IPV6_STACK, *_dev);
204-
st.bool_value = false;
199+
AT_CellularDevice_stub::supported_bool = 0;
205200
EXPECT_EQ(st.socket_open(NULL, NSAPI_TCP), NSAPI_ERROR_UNSUPPORTED);
206201

207-
st.bool_value = true;
202+
AT_CellularDevice_stub::supported_bool = 1;
208203
AT_CellularDevice_stub::max_sock_value = 0;
209204
nsapi_socket_t sock = &st.socket;
210205
EXPECT_EQ(st.socket_open(&sock, NSAPI_TCP), NSAPI_ERROR_NO_SOCKET);

features/cellular/framework/AT/AT_CellularDevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class AT_CellularDevice : public CellularDevice {
5959
PROPERTY_AT_CGEREP, // 0 = not supported, 1 = supported. Does modem support AT command AT+CGEREP.
6060
PROPERTY_AT_COPS_FALLBACK_AUTO, // 0 = not supported, 1 = supported. Does modem support mode 4 of AT+COPS= ?
6161
PROPERTY_SOCKET_COUNT, // The number of sockets of modem IP stack
62+
PROPERTY_IP_TCP, // 0 = not supported, 1 = supported. Modem IP stack has support for TCP
63+
PROPERTY_IP_UDP, // 0 = not supported, 1 = supported. Modem IP stack has support for TCP
6264
PROPERTY_MAX
6365
};
6466

features/cellular/framework/AT/AT_CellularStack.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,28 @@ nsapi_error_t AT_CellularStack::socket_stack_init()
157157

158158
nsapi_error_t AT_CellularStack::socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto)
159159
{
160-
if (!is_protocol_supported(proto) || !handle) {
160+
if (!handle) {
161+
return NSAPI_ERROR_UNSUPPORTED;
162+
}
163+
164+
if (proto == NSAPI_UDP) {
165+
if (!_device.get_property(AT_CellularDevice::PROPERTY_IP_UDP)) {
166+
return NSAPI_ERROR_UNSUPPORTED;
167+
}
168+
} else if (proto == NSAPI_TCP) {
169+
if (!_device.get_property(AT_CellularDevice::PROPERTY_IP_TCP)) {
170+
return NSAPI_ERROR_UNSUPPORTED;
171+
}
172+
} else {
161173
return NSAPI_ERROR_UNSUPPORTED;
162174
}
163175

164176
_socket_mutex.lock();
165177

166178
if (!_socket) {
179+
if (_device.get_property(AT_CellularDevice::PROPERTY_SOCKET_COUNT) == 0) {
180+
return NSAPI_ERROR_NO_SOCKET;
181+
}
167182
if (socket_stack_init() != NSAPI_ERROR_OK) {
168183
_socket_mutex.unlock();
169184
return NSAPI_ERROR_NO_SOCKET;

features/cellular/framework/AT/AT_CellularStack.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,6 @@ class AT_CellularStack : public NetworkStack {
135135
bool txfull_event; // socket event after wouldblock
136136
};
137137

138-
/**
139-
* Checks if modem supports the given protocol
140-
*
141-
* @param protocol Protocol type
142-
*/
143-
virtual bool is_protocol_supported(nsapi_protocol_t protocol) = 0;
144-
145138
/**
146139
* Implements modem specific AT command set for socket closing
147140
*

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ void GEMALTO_CINTERION::init_module_bgs2()
114114
1, // PROPERTY_AT_CGEREP
115115
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
116116
10, // PROPERTY_SOCKET_COUNT
117+
1, // PROPERTY_IP_TCP
118+
1, // PROPERTY_IP_UDP
117119
};
118120
set_cellular_properties(cellular_properties);
119121
_module = ModuleBGS2;
@@ -140,6 +142,8 @@ void GEMALTO_CINTERION::init_module_els61()
140142
1, // PROPERTY_AT_CGEREP
141143
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
142144
10, // PROPERTY_SOCKET_COUNT
145+
1, // PROPERTY_IP_TCP
146+
1, // PROPERTY_IP_UDP
143147
};
144148
set_cellular_properties(cellular_properties);
145149
_module = ModuleELS61;
@@ -166,6 +170,8 @@ void GEMALTO_CINTERION::init_module_ems31()
166170
1, // PROPERTY_AT_CGEREP
167171
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
168172
10, // PROPERTY_SOCKET_COUNT
173+
1, // PROPERTY_IP_TCP
174+
1, // PROPERTY_IP_UDP
169175
};
170176
set_cellular_properties(cellular_properties);
171177
_module = ModuleEMS31;
@@ -192,6 +198,8 @@ void GEMALTO_CINTERION::init_module_ehs5e()
192198
1, // PROPERTY_AT_CGEREP
193199
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
194200
10, // PROPERTY_SOCKET_COUNT
201+
1, // PROPERTY_IP_TCP
202+
1, // PROPERTY_IP_UDP
195203
};
196204
set_cellular_properties(cellular_properties);
197205
_module = ModuleEHS5E;

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_stack_init()
132132
return err;
133133
}
134134

135-
bool GEMALTO_CINTERION_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
136-
{
137-
return (protocol == NSAPI_UDP || protocol == NSAPI_TCP);
138-
}
139-
140135
nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_close_impl(int sock_id)
141136
{
142137
tr_debug("Cinterion close %d", sock_id);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ class GEMALTO_CINTERION_CellularStack : public AT_CellularStack {
3232

3333
virtual nsapi_error_t socket_stack_init();
3434

35-
virtual bool is_protocol_supported(nsapi_protocol_t protocol);
36-
3735
virtual nsapi_error_t socket_close_impl(int sock_id);
3836

3937
virtual nsapi_error_t create_socket_impl(CellularSocket *socket);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
3939
1, // PROPERTY_AT_CGEREP
4040
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
4141
0, // PROPERTY_SOCKET_COUNT
42+
0, // PROPERTY_IP_TCP
43+
0, // PROPERTY_IP_UDP
4244
};
4345

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
3939
1, // PROPERTY_AT_CGEREP
4040
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
4141
0, // PROPERTY_SOCKET_COUNT
42+
0, // PROPERTY_IP_TCP
43+
0, // PROPERTY_IP_UDP
4244
};
4345

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
4646
0, // PROPERTY_AT_CGEREP,
4747
0, // PROPERTY_AT_COPS_FALLBACK_AUTO
4848
7, // PROPERTY_SOCKET_COUNT
49+
1, // PROPERTY_IP_TCP
50+
1, // PROPERTY_IP_UDP
4951
};
5052

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

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ void QUECTEL_BC95_CellularStack::urc_nsocli()
128128
}
129129

130130

131-
bool QUECTEL_BC95_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
132-
{
133-
return (protocol == NSAPI_UDP || protocol == NSAPI_TCP);
134-
}
135-
136131
nsapi_error_t QUECTEL_BC95_CellularStack::socket_close_impl(int sock_id)
137132
{
138133
CellularSocket *sock = find_socket(sock_id);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class QUECTEL_BC95_CellularStack : public AT_CellularStack {
3838

3939
protected: // AT_CellularStack
4040

41-
virtual bool is_protocol_supported(nsapi_protocol_t protocol);
42-
4341
virtual nsapi_error_t socket_close_impl(int sock_id);
4442

4543
virtual nsapi_error_t create_socket_impl(CellularSocket *socket);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
6363
1, // PROPERTY_AT_CGEREP,
6464
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
6565
12, // PROPERTY_SOCKET_COUNT
66+
1, // PROPERTY_IP_TCP
67+
1, // PROPERTY_IP_UDP
6668
};
6769

6870
QUECTEL_BG96::QUECTEL_BG96(FileHandle *fh, PinName pwr, bool active_high, PinName rst)

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@ void QUECTEL_BG96_CellularStack::urc_qiurc(urc_type_t urc_type)
222222
}
223223
}
224224

225-
bool QUECTEL_BG96_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
226-
{
227-
return (protocol == NSAPI_UDP || protocol == NSAPI_TCP);
228-
}
229-
230225
nsapi_error_t QUECTEL_BG96_CellularStack::socket_close_impl(int sock_id)
231226
{
232227
_at.set_at_timeout(BG96_CLOSE_SOCKET_TIMEOUT);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ class QUECTEL_BG96_CellularStack : public AT_CellularStack {
5959

6060
protected: // AT_CellularStack
6161

62-
virtual bool is_protocol_supported(nsapi_protocol_t protocol);
63-
6462
virtual nsapi_error_t socket_close_impl(int sock_id);
6563

6664
virtual nsapi_error_t create_socket_impl(CellularSocket *socket);

features/cellular/framework/targets/QUECTEL/EC2X/QUECTEL_EC2X.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
6464
1, // PROPERTY_AT_CGEREP,
6565
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
6666
0, // PROPERTY_SOCKET_COUNT
67+
0, // PROPERTY_IP_TCP
68+
0, // PROPERTY_IP_UDP
6769
};
6870

6971
QUECTEL_EC2X::QUECTEL_EC2X(FileHandle *fh, PinName pwr, bool active_high, PinName rst)

features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
4242
1, // PROPERTY_AT_CGEREP
4343
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
4444
6, // PROPERTY_SOCKET_COUNT
45+
1, // PROPERTY_IP_TCP
46+
1, // PROPERTY_IP_UDP
4547
};
4648

4749
QUECTEL_M26::QUECTEL_M26(FileHandle *fh) : AT_CellularDevice(fh)

features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,6 @@ nsapi_error_t QUECTEL_M26_CellularStack::socket_stack_init()
217217
return NSAPI_ERROR_OK;
218218
}
219219

220-
bool QUECTEL_M26_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
221-
{
222-
return (protocol == NSAPI_UDP || protocol == NSAPI_TCP);
223-
}
224-
225220
nsapi_error_t QUECTEL_M26_CellularStack::socket_close_impl(int sock_id)
226221
{
227222
tr_debug("QUECTEL_M26_CellularStack:%s:%u:", __FUNCTION__, __LINE__);

features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class QUECTEL_M26_CellularStack : public AT_CellularStack {
4646

4747
virtual nsapi_error_t socket_stack_init();
4848

49-
virtual bool is_protocol_supported(nsapi_protocol_t protocol);
50-
5149
virtual nsapi_error_t socket_close_impl(int sock_id);
5250

5351
virtual nsapi_error_t create_socket_impl(CellularSocket *socket);

features/cellular/framework/targets/QUECTEL/UG96/QUECTEL_UG96.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
4444
1, // PROPERTY_AT_CGEREP,
4545
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
4646
0, // PROPERTY_SOCKET_COUNT
47+
0, // PROPERTY_IP_TCP
48+
0, // PROPERTY_IP_UDP
4749
};
4850

4951
QUECTEL_UG96::QUECTEL_UG96(FileHandle *fh) : AT_CellularDevice(fh)

features/cellular/framework/targets/RiotMicro/AT/RM1000_AT.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
4646
0, // PROPERTY_AT_CGEREP
4747
0, // PROPERTY_AT_COPS_FALLBACK_AUTO
4848
7, // PROPERTY_SOCKET_COUNT
49+
1, // PROPERTY_IP_TCP
50+
1, // PROPERTY_IP_UDP
4951
};
5052

5153
RM1000_AT::RM1000_AT(FileHandle *fh) : AT_CellularDevice(fh)

features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ void RM1000_AT_CellularStack::RUSOCL_URC()
8787
clear_socket(socket);
8888
}
8989

90-
bool RM1000_AT_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
91-
{
92-
return (protocol == NSAPI_UDP || protocol == NSAPI_TCP);
93-
}
94-
9590
nsapi_error_t RM1000_AT_CellularStack::create_socket_impl(CellularSocket *socket)
9691
{
9792
tr_debug("RM1000_AT_CellularStack::create_socket_impl");
@@ -103,7 +98,7 @@ nsapi_error_t RM1000_AT_CellularStack::create_socket_impl(CellularSocket *socket
10398
err = _at.at_cmd_int("+RSOCR", "=0", sock_id);
10499
} else if (socket->proto == NSAPI_TCP) {
105100
err = _at.at_cmd_int("+RSOCR", "=1", sock_id);
106-
} // Unsupported protocol is checked in "is_protocol_supported" function
101+
} // Unsupported protocol is checked in socket_open()
107102

108103
if ((err != NSAPI_ERROR_OK) || (sock_id == -1)) {
109104
tr_error("RM1000_AT_CellularStack::create_socket_impl error sock_id=%d err=%d", sock_id, err);

features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ class RM1000_AT_CellularStack : public AT_CellularStack {
6161
*/
6262
static const int RM1000_MAX_PACKET_SIZE = 1024;
6363

64-
virtual bool is_protocol_supported(nsapi_protocol_t protocol);
65-
6664
virtual nsapi_error_t create_socket_impl(CellularSocket *socket);
6765

6866
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address);

features/cellular/framework/targets/TELIT/HE910/TELIT_HE910.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
3939
1, // PROPERTY_AT_CGEREP,
4040
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
4141
0, // PROPERTY_SOCKET_COUNT
42+
0, // PROPERTY_IP_TCP
43+
0, // PROPERTY_IP_UDP
4244
};
4345

4446
TELIT_HE910::TELIT_HE910(FileHandle *fh) : AT_CellularDevice(fh)

features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
6060
1, // PROPERTY_AT_CGEREP
6161
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
6262
0, // PROPERTY_SOCKET_COUNT
63+
0, // PROPERTY_IP_TCP
64+
0, // PROPERTY_IP_UDP
6365
};
6466

6567
//the delay between sending AT commands

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
3939
1, // PROPERTY_AT_CGEREP
4040
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
4141
7, // PROPERTY_SOCKET_COUNT
42+
1, // PROPERTY_IP_TCP
43+
1, // PROPERTY_IP_UDP
4244
};
4345
#elif defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_G3XX)
4446
static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
@@ -63,6 +65,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
6365
1, // PROPERTY_AT_CGEREP
6466
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
6567
7, // PROPERTY_SOCKET_COUNT
68+
1, // PROPERTY_IP_TCP
69+
1, // PROPERTY_IP_UDP
6670
};
6771
#else
6872
static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
@@ -83,6 +87,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
8387
0, // PROPERTY_AT_CGEREP
8488
0, // PROPERTY_AT_COPS_FALLBACK_AUTO
8589
0, // PROPERTY_SOCKET_COUNT
90+
0, // PROPERTY_IP_TCP
91+
0, // PROPERTY_IP_UDP
8692
};
8793
#endif
8894

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ void UBLOX_AT_CellularStack::UUPSDD_URC()
107107
clear_socket(socket);
108108
}
109109

110-
bool UBLOX_AT_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
111-
{
112-
return (protocol == NSAPI_UDP || protocol == NSAPI_TCP);
113-
}
114-
115110
nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket)
116111
{
117112
int sock_id = SOCKET_UNUSED;
@@ -121,7 +116,7 @@ nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket)
121116
err = _at.at_cmd_int("+USOCR", "=17", sock_id);
122117
} else if (socket->proto == NSAPI_TCP) {
123118
err = _at.at_cmd_int("+USOCR", "=6", sock_id);
124-
} // Unsupported protocol is checked in "is_protocol_supported" function
119+
} // Unsupported protocol is checked in socket_open()
125120

126121
if ((err != NSAPI_ERROR_OK) || (sock_id == -1)) {
127122
return NSAPI_ERROR_NO_SOCKET;

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ class UBLOX_AT_CellularStack : public AT_CellularStack {
6565
*/
6666
static const int UBLOX_MAX_PACKET_SIZE = 1024;
6767

68-
virtual bool is_protocol_supported(nsapi_protocol_t protocol);
69-
7068
virtual nsapi_error_t create_socket_impl(CellularSocket *socket);
7169

7270
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address);

features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
3838
0, // PROPERTY_AT_CGEREP
3939
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
4040
7, // PROPERTY_SOCKET_COUNT
41+
0, // PROPERTY_IP_TCP
42+
1, // PROPERTY_IP_UDP
4143
};
4244

4345
UBLOX_N2XX::UBLOX_N2XX(FileHandle *fh): AT_CellularDevice(fh)

0 commit comments

Comments
 (0)