Cellular: Add offload TLSSocket implementation inside feature flag

Reduce binary size (~500 bytes with GCC_ARM and developer profile) when offloaded TLSSocket is not in use.
pull/12633/head
Kimmo Vaisanen 2020-03-16 18:02:08 +02:00
parent 532654ebb3
commit 51175eed1f
2 changed files with 7 additions and 1 deletions

View File

@ -525,6 +525,8 @@ void QUECTEL_BG96_CellularStack::ip2dot(const SocketAddress &ip, char *dot)
}
}
#if defined(MBED_CONF_NSAPI_OFFLOAD_TLSSOCKET) && (MBED_CONF_NSAPI_OFFLOAD_TLSSOCKET)
nsapi_error_t QUECTEL_BG96_CellularStack::set_to_modem_impl(const char *filename, const char *config, const char *data, size_t size)
{
// Delete old file from the modem.
@ -549,7 +551,6 @@ nsapi_error_t QUECTEL_BG96_CellularStack::set_to_modem_impl(const char *filename
return _at.get_last_error();
}
nsapi_error_t QUECTEL_BG96_CellularStack::setsockopt(nsapi_socket_t handle, int level,
int optname, const void *optval, unsigned optlen)
{
@ -641,3 +642,4 @@ nsapi_error_t QUECTEL_BG96_CellularStack::setsockopt(nsapi_socket_t handle, int
return ret;
}
#endif

View File

@ -54,8 +54,10 @@ protected: // NetworkStack
virtual nsapi_error_t gethostbyname_async_cancel(int id);
#endif
#if defined(MBED_CONF_NSAPI_OFFLOAD_TLSSOCKET) && (MBED_CONF_NSAPI_OFFLOAD_TLSSOCKET)
virtual nsapi_error_t setsockopt(nsapi_socket_t handle, int level,
int optname, const void *optval, unsigned optlen);
#endif
protected: // AT_CellularStack
@ -79,7 +81,9 @@ private:
void handle_open_socket_response(int &modem_connect_id, int &err, bool tlssocket);
#if defined(MBED_CONF_NSAPI_OFFLOAD_TLSSOCKET) && (MBED_CONF_NSAPI_OFFLOAD_TLSSOCKET)
nsapi_error_t set_to_modem_impl(const char *filename, const char *config, const char *data, size_t size);
#endif
#ifdef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
// URC handler for DNS query