diff --git a/UNITTESTS/features/cellular/framework/AT/at_cellularcontext/at_cellularcontexttest.cpp b/UNITTESTS/features/cellular/framework/AT/at_cellularcontext/at_cellularcontexttest.cpp index c965457ddb..e939ae486b 100644 --- a/UNITTESTS/features/cellular/framework/AT/at_cellularcontext/at_cellularcontexttest.cpp +++ b/UNITTESTS/features/cellular/framework/AT/at_cellularcontext/at_cellularcontexttest.cpp @@ -81,10 +81,6 @@ public: { return 200; } - virtual bool is_protocol_supported(nsapi_protocol_t protocol) - { - return true; - } virtual nsapi_error_t socket_close_impl(int sock_id) { return NSAPI_ERROR_OK; diff --git a/UNITTESTS/features/cellular/framework/AT/at_cellularstack/at_cellularstacktest.cpp b/UNITTESTS/features/cellular/framework/AT/at_cellularstack/at_cellularstacktest.cpp index 4076e25e4a..4b070baab7 100644 --- a/UNITTESTS/features/cellular/framework/AT/at_cellularstack/at_cellularstacktest.cpp +++ b/UNITTESTS/features/cellular/framework/AT/at_cellularstack/at_cellularstacktest.cpp @@ -44,11 +44,6 @@ public: create_error = NSAPI_ERROR_OK; } - virtual bool is_protocol_supported(nsapi_protocol_t protocol) - { - return bool_value; - } - virtual nsapi_error_t socket_close_impl(int sock_id) { return NSAPI_ERROR_OK; @@ -201,10 +196,10 @@ TEST_F(TestAT_CellularStack, test_AT_CellularStack_socket_open) ATHandler at(&fh1, que, 0, ","); MyStack st(at, 0, IPV6_STACK, *_dev); - st.bool_value = false; + AT_CellularDevice_stub::supported_bool = 0; EXPECT_EQ(st.socket_open(NULL, NSAPI_TCP), NSAPI_ERROR_UNSUPPORTED); - st.bool_value = true; + AT_CellularDevice_stub::supported_bool = 1; AT_CellularDevice_stub::max_sock_value = 0; nsapi_socket_t sock = &st.socket; EXPECT_EQ(st.socket_open(&sock, NSAPI_TCP), NSAPI_ERROR_NO_SOCKET); diff --git a/features/cellular/framework/AT/AT_CellularDevice.h b/features/cellular/framework/AT/AT_CellularDevice.h index 6881d3f828..c7959703ce 100755 --- a/features/cellular/framework/AT/AT_CellularDevice.h +++ b/features/cellular/framework/AT/AT_CellularDevice.h @@ -59,6 +59,8 @@ public: PROPERTY_AT_CGEREP, // 0 = not supported, 1 = supported. Does modem support AT command AT+CGEREP. PROPERTY_AT_COPS_FALLBACK_AUTO, // 0 = not supported, 1 = supported. Does modem support mode 4 of AT+COPS= ? PROPERTY_SOCKET_COUNT, // The number of sockets of modem IP stack + PROPERTY_IP_TCP, // 0 = not supported, 1 = supported. Modem IP stack has support for TCP + PROPERTY_IP_UDP, // 0 = not supported, 1 = supported. Modem IP stack has support for TCP PROPERTY_MAX }; diff --git a/features/cellular/framework/AT/AT_CellularStack.cpp b/features/cellular/framework/AT/AT_CellularStack.cpp index 149a1519e8..fa539ae209 100644 --- a/features/cellular/framework/AT/AT_CellularStack.cpp +++ b/features/cellular/framework/AT/AT_CellularStack.cpp @@ -157,13 +157,28 @@ nsapi_error_t AT_CellularStack::socket_stack_init() nsapi_error_t AT_CellularStack::socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto) { - if (!is_protocol_supported(proto) || !handle) { + if (!handle) { + return NSAPI_ERROR_UNSUPPORTED; + } + + if (proto == NSAPI_UDP) { + if (!_device.get_property(AT_CellularDevice::PROPERTY_IP_UDP)) { + return NSAPI_ERROR_UNSUPPORTED; + } + } else if (proto == NSAPI_TCP) { + if (!_device.get_property(AT_CellularDevice::PROPERTY_IP_TCP)) { + return NSAPI_ERROR_UNSUPPORTED; + } + } else { return NSAPI_ERROR_UNSUPPORTED; } _socket_mutex.lock(); if (!_socket) { + if (_device.get_property(AT_CellularDevice::PROPERTY_SOCKET_COUNT) == 0) { + return NSAPI_ERROR_NO_SOCKET; + } if (socket_stack_init() != NSAPI_ERROR_OK) { _socket_mutex.unlock(); return NSAPI_ERROR_NO_SOCKET; diff --git a/features/cellular/framework/AT/AT_CellularStack.h b/features/cellular/framework/AT/AT_CellularStack.h index 598f66d381..fe89084e77 100644 --- a/features/cellular/framework/AT/AT_CellularStack.h +++ b/features/cellular/framework/AT/AT_CellularStack.h @@ -135,13 +135,6 @@ protected: bool txfull_event; // socket event after wouldblock }; - /** - * Checks if modem supports the given protocol - * - * @param protocol Protocol type - */ - virtual bool is_protocol_supported(nsapi_protocol_t protocol) = 0; - /** * Implements modem specific AT command set for socket closing * diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp index 1f719d0f10..e7ebd7e5fd 100644 --- a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp @@ -114,6 +114,8 @@ void GEMALTO_CINTERION::init_module_bgs2() 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 10, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; set_cellular_properties(cellular_properties); _module = ModuleBGS2; @@ -140,6 +142,8 @@ void GEMALTO_CINTERION::init_module_els61() 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 10, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; set_cellular_properties(cellular_properties); _module = ModuleELS61; @@ -166,6 +170,8 @@ void GEMALTO_CINTERION::init_module_ems31() 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 10, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; set_cellular_properties(cellular_properties); _module = ModuleEMS31; @@ -192,6 +198,8 @@ void GEMALTO_CINTERION::init_module_ehs5e() 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 10, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; set_cellular_properties(cellular_properties); _module = ModuleEHS5E; diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp index 80609ffeda..f4553b5bda 100644 --- a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp @@ -132,11 +132,6 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_stack_init() return err; } -bool GEMALTO_CINTERION_CellularStack::is_protocol_supported(nsapi_protocol_t protocol) -{ - return (protocol == NSAPI_UDP || protocol == NSAPI_TCP); -} - nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_close_impl(int sock_id) { tr_debug("Cinterion close %d", sock_id); diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h index c7445d7e38..e6a178e4af 100644 --- a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.h @@ -32,8 +32,6 @@ protected: virtual nsapi_error_t socket_stack_init(); - virtual bool is_protocol_supported(nsapi_protocol_t protocol); - virtual nsapi_error_t socket_close_impl(int sock_id); virtual nsapi_error_t create_socket_impl(CellularSocket *socket); diff --git a/features/cellular/framework/targets/GENERIC/GENERIC_AT3GPP/GENERIC_AT3GPP.cpp b/features/cellular/framework/targets/GENERIC/GENERIC_AT3GPP/GENERIC_AT3GPP.cpp index 94b6ddbfa2..1460b1cb25 100644 --- a/features/cellular/framework/targets/GENERIC/GENERIC_AT3GPP/GENERIC_AT3GPP.cpp +++ b/features/cellular/framework/targets/GENERIC/GENERIC_AT3GPP/GENERIC_AT3GPP.cpp @@ -39,6 +39,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; GENERIC_AT3GPP::GENERIC_AT3GPP(FileHandle *fh) : AT_CellularDevice(fh) diff --git a/features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.cpp b/features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.cpp index a905e3f680..72ba25bd58 100644 --- a/features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.cpp +++ b/features/cellular/framework/targets/MultiTech/DragonflyNano/PPP/SARA4_PPP.cpp @@ -39,6 +39,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; SARA4_PPP::SARA4_PPP(FileHandle *fh) : AT_CellularDevice(fh) diff --git a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95.cpp b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95.cpp index 31c2aea137..2b052ac1e3 100644 --- a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95.cpp +++ b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95.cpp @@ -46,6 +46,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 0, // PROPERTY_AT_CGEREP, 0, // PROPERTY_AT_COPS_FALLBACK_AUTO 7, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; QUECTEL_BC95::QUECTEL_BC95(FileHandle *fh) : AT_CellularDevice(fh) diff --git a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp index 7cf17c3148..93adaa1ed0 100644 --- a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp +++ b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp @@ -128,11 +128,6 @@ void QUECTEL_BC95_CellularStack::urc_nsocli() } -bool QUECTEL_BC95_CellularStack::is_protocol_supported(nsapi_protocol_t protocol) -{ - return (protocol == NSAPI_UDP || protocol == NSAPI_TCP); -} - nsapi_error_t QUECTEL_BC95_CellularStack::socket_close_impl(int sock_id) { CellularSocket *sock = find_socket(sock_id); diff --git a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.h b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.h index b99767b78c..d3231c2946 100644 --- a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.h +++ b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.h @@ -38,8 +38,6 @@ protected: // NetworkStack protected: // AT_CellularStack - virtual bool is_protocol_supported(nsapi_protocol_t protocol); - virtual nsapi_error_t socket_close_impl(int sock_id); virtual nsapi_error_t create_socket_impl(CellularSocket *socket); diff --git a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp index be0ce8d3fb..7447901634 100644 --- a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp +++ b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp @@ -63,6 +63,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP, 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 12, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; QUECTEL_BG96::QUECTEL_BG96(FileHandle *fh, PinName pwr, bool active_high, PinName rst) diff --git a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.cpp b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.cpp index 3fbce61aad..5ac23bb403 100644 --- a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.cpp +++ b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.cpp @@ -222,11 +222,6 @@ void QUECTEL_BG96_CellularStack::urc_qiurc(urc_type_t urc_type) } } -bool QUECTEL_BG96_CellularStack::is_protocol_supported(nsapi_protocol_t protocol) -{ - return (protocol == NSAPI_UDP || protocol == NSAPI_TCP); -} - nsapi_error_t QUECTEL_BG96_CellularStack::socket_close_impl(int sock_id) { _at.set_at_timeout(BG96_CLOSE_SOCKET_TIMEOUT); diff --git a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.h b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.h index 4289c0b010..316ebdddc8 100644 --- a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.h +++ b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.h @@ -59,8 +59,6 @@ protected: // NetworkStack protected: // AT_CellularStack - virtual bool is_protocol_supported(nsapi_protocol_t protocol); - virtual nsapi_error_t socket_close_impl(int sock_id); virtual nsapi_error_t create_socket_impl(CellularSocket *socket); diff --git a/features/cellular/framework/targets/QUECTEL/EC2X/QUECTEL_EC2X.cpp b/features/cellular/framework/targets/QUECTEL/EC2X/QUECTEL_EC2X.cpp index a134c9f639..75edc8c1a5 100644 --- a/features/cellular/framework/targets/QUECTEL/EC2X/QUECTEL_EC2X.cpp +++ b/features/cellular/framework/targets/QUECTEL/EC2X/QUECTEL_EC2X.cpp @@ -64,6 +64,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP, 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; QUECTEL_EC2X::QUECTEL_EC2X(FileHandle *fh, PinName pwr, bool active_high, PinName rst) diff --git a/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26.cpp b/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26.cpp index 5138d122f0..ff32ec09ac 100644 --- a/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26.cpp +++ b/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26.cpp @@ -42,6 +42,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 6, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; QUECTEL_M26::QUECTEL_M26(FileHandle *fh) : AT_CellularDevice(fh) diff --git a/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp b/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp index b0c9325858..872ade83f9 100644 --- a/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp +++ b/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp @@ -217,11 +217,6 @@ nsapi_error_t QUECTEL_M26_CellularStack::socket_stack_init() return NSAPI_ERROR_OK; } -bool QUECTEL_M26_CellularStack::is_protocol_supported(nsapi_protocol_t protocol) -{ - return (protocol == NSAPI_UDP || protocol == NSAPI_TCP); -} - nsapi_error_t QUECTEL_M26_CellularStack::socket_close_impl(int sock_id) { tr_debug("QUECTEL_M26_CellularStack:%s:%u:", __FUNCTION__, __LINE__); diff --git a/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.h b/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.h index 2bf449d45b..3ea591f31b 100644 --- a/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.h +++ b/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.h @@ -46,8 +46,6 @@ protected: // AT_CellularStack virtual nsapi_error_t socket_stack_init(); - virtual bool is_protocol_supported(nsapi_protocol_t protocol); - virtual nsapi_error_t socket_close_impl(int sock_id); virtual nsapi_error_t create_socket_impl(CellularSocket *socket); diff --git a/features/cellular/framework/targets/QUECTEL/UG96/QUECTEL_UG96.cpp b/features/cellular/framework/targets/QUECTEL/UG96/QUECTEL_UG96.cpp index 41f44c207e..11121f4cc4 100644 --- a/features/cellular/framework/targets/QUECTEL/UG96/QUECTEL_UG96.cpp +++ b/features/cellular/framework/targets/QUECTEL/UG96/QUECTEL_UG96.cpp @@ -44,6 +44,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP, 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; QUECTEL_UG96::QUECTEL_UG96(FileHandle *fh) : AT_CellularDevice(fh) diff --git a/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT.cpp b/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT.cpp index 2186b39927..66a3f6ad19 100644 --- a/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT.cpp +++ b/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT.cpp @@ -46,6 +46,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 0, // PROPERTY_AT_CGEREP 0, // PROPERTY_AT_COPS_FALLBACK_AUTO 7, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; RM1000_AT::RM1000_AT(FileHandle *fh) : AT_CellularDevice(fh) diff --git a/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.cpp b/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.cpp index 3cb93d7ca9..70ac5a2de8 100644 --- a/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.cpp +++ b/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.cpp @@ -87,11 +87,6 @@ void RM1000_AT_CellularStack::RUSOCL_URC() clear_socket(socket); } -bool RM1000_AT_CellularStack::is_protocol_supported(nsapi_protocol_t protocol) -{ - return (protocol == NSAPI_UDP || protocol == NSAPI_TCP); -} - nsapi_error_t RM1000_AT_CellularStack::create_socket_impl(CellularSocket *socket) { tr_debug("RM1000_AT_CellularStack::create_socket_impl"); @@ -103,7 +98,7 @@ nsapi_error_t RM1000_AT_CellularStack::create_socket_impl(CellularSocket *socket err = _at.at_cmd_int("+RSOCR", "=0", sock_id); } else if (socket->proto == NSAPI_TCP) { err = _at.at_cmd_int("+RSOCR", "=1", sock_id); - } // Unsupported protocol is checked in "is_protocol_supported" function + } // Unsupported protocol is checked in socket_open() if ((err != NSAPI_ERROR_OK) || (sock_id == -1)) { tr_error("RM1000_AT_CellularStack::create_socket_impl error sock_id=%d err=%d", sock_id, err); diff --git a/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.h b/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.h index 07278302eb..5f28c1ec0e 100644 --- a/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.h +++ b/features/cellular/framework/targets/RiotMicro/AT/RM1000_AT_CellularStack.h @@ -61,8 +61,6 @@ protected: // AT_CellularStack */ static const int RM1000_MAX_PACKET_SIZE = 1024; - virtual bool is_protocol_supported(nsapi_protocol_t protocol); - virtual nsapi_error_t create_socket_impl(CellularSocket *socket); virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address); diff --git a/features/cellular/framework/targets/TELIT/HE910/TELIT_HE910.cpp b/features/cellular/framework/targets/TELIT/HE910/TELIT_HE910.cpp index e492440d0d..172c4d4055 100644 --- a/features/cellular/framework/targets/TELIT/HE910/TELIT_HE910.cpp +++ b/features/cellular/framework/targets/TELIT/HE910/TELIT_HE910.cpp @@ -39,6 +39,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP, 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; TELIT_HE910::TELIT_HE910(FileHandle *fh) : AT_CellularDevice(fh) diff --git a/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp index cb31eb19cf..a65b44b199 100644 --- a/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp +++ b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp @@ -60,6 +60,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; //the delay between sending AT commands diff --git a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.cpp b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.cpp index 3a47c2b562..649ff66bff 100644 --- a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.cpp +++ b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.cpp @@ -39,6 +39,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 7, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; #elif defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_G3XX) static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { @@ -63,6 +65,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 7, // PROPERTY_SOCKET_COUNT + 1, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; #else static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { @@ -83,6 +87,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 0, // PROPERTY_AT_CGEREP 0, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; #endif diff --git a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp index ac9345ff97..4de6cce2ef 100644 --- a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp +++ b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp @@ -107,11 +107,6 @@ void UBLOX_AT_CellularStack::UUPSDD_URC() clear_socket(socket); } -bool UBLOX_AT_CellularStack::is_protocol_supported(nsapi_protocol_t protocol) -{ - return (protocol == NSAPI_UDP || protocol == NSAPI_TCP); -} - nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket) { int sock_id = SOCKET_UNUSED; @@ -121,7 +116,7 @@ nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket) err = _at.at_cmd_int("+USOCR", "=17", sock_id); } else if (socket->proto == NSAPI_TCP) { err = _at.at_cmd_int("+USOCR", "=6", sock_id); - } // Unsupported protocol is checked in "is_protocol_supported" function + } // Unsupported protocol is checked in socket_open() if ((err != NSAPI_ERROR_OK) || (sock_id == -1)) { return NSAPI_ERROR_NO_SOCKET; diff --git a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h index 94408e5980..fef9e11d2b 100644 --- a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h +++ b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h @@ -65,8 +65,6 @@ protected: */ static const int UBLOX_MAX_PACKET_SIZE = 1024; - virtual bool is_protocol_supported(nsapi_protocol_t protocol); - virtual nsapi_error_t create_socket_impl(CellularSocket *socket); virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address); diff --git a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp index 9ab0fae8e2..689d881649 100644 --- a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp +++ b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp @@ -38,6 +38,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 0, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 7, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 1, // PROPERTY_IP_UDP }; UBLOX_N2XX::UBLOX_N2XX(FileHandle *fh): AT_CellularDevice(fh) diff --git a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.cpp b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.cpp index 8a09261cf7..c9fdb2bd40 100644 --- a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.cpp +++ b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.cpp @@ -64,11 +64,6 @@ void UBLOX_N2XX_CellularStack::NSONMI_URC() } } -bool UBLOX_N2XX_CellularStack::is_protocol_supported(nsapi_protocol_t protocol) -{ - return (protocol == NSAPI_UDP); -} - nsapi_error_t UBLOX_N2XX_CellularStack::create_socket_impl(CellularSocket *socket) { int sock_id = -1; diff --git a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.h b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.h index 43ce7ac236..8e9e1e5315 100644 --- a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.h +++ b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.h @@ -52,8 +52,6 @@ protected: */ static const int N2XX_MAX_PACKET_SIZE = 512; - virtual bool is_protocol_supported(nsapi_protocol_t protocol); - virtual nsapi_error_t create_socket_impl(CellularSocket *socket); virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address, diff --git a/features/cellular/framework/targets/UBLOX/PPP/UBLOX_PPP.cpp b/features/cellular/framework/targets/UBLOX/PPP/UBLOX_PPP.cpp index 78b0cd7a6e..29a4fa842a 100644 --- a/features/cellular/framework/targets/UBLOX/PPP/UBLOX_PPP.cpp +++ b/features/cellular/framework/targets/UBLOX/PPP/UBLOX_PPP.cpp @@ -40,6 +40,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; #elif defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_G3XX) static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { @@ -64,6 +66,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 1, // PROPERTY_AT_CGEREP 1, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; #else static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { @@ -84,6 +88,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 0, // PROPERTY_AT_CGEREP 0, // PROPERTY_AT_COPS_FALLBACK_AUTO 0, // PROPERTY_SOCKET_COUNT + 0, // PROPERTY_IP_TCP + 0, // PROPERTY_IP_UDP }; #endif