diff --git a/cores/arduino/mbed/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.h b/cores/arduino/mbed/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.h index cfa675217..ecc280b2f 100644 --- a/cores/arduino/mbed/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.h +++ b/cores/arduino/mbed/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.h @@ -148,6 +148,13 @@ class STM32_EMAC : public EMAC { */ virtual void set_memory_manager(EMACMemoryManager &mem_mngr); + /* return the status of the interface as integer */ + int get_interface_status() override; + /* return true if the interface is in the correct state to transmit */ + bool is_ready_to_tx() override; + /* restart only if the interface is in error state */ + void restart() override; + // Called from driver functions ETH_HandleTypeDef EthHandle; osThreadId_t thread; /**< Processing thread */ diff --git a/cores/arduino/mbed/connectivity/netsocket/include/netsocket/EMAC.h b/cores/arduino/mbed/connectivity/netsocket/include/netsocket/EMAC.h index 515629b5a..885bc92c0 100644 --- a/cores/arduino/mbed/connectivity/netsocket/include/netsocket/EMAC.h +++ b/cores/arduino/mbed/connectivity/netsocket/include/netsocket/EMAC.h @@ -176,6 +176,17 @@ class EMAC { * @param mem_mngr Pointer to memory manager */ virtual void set_memory_manager(EMACMemoryManager &mem_mngr) = 0; + + virtual bool is_ready_to_tx() { + return true; + } + + virtual void restart() { + } + + virtual int get_interface_status() { + return -1; + } }; diff --git a/cores/arduino/mbed/connectivity/netsocket/include/netsocket/EMACInterface.h b/cores/arduino/mbed/connectivity/netsocket/include/netsocket/EMACInterface.h index 8cf47cb70..c06aeb850 100644 --- a/cores/arduino/mbed/connectivity/netsocket/include/netsocket/EMACInterface.h +++ b/cores/arduino/mbed/connectivity/netsocket/include/netsocket/EMACInterface.h @@ -83,6 +83,12 @@ class EMACInterface : public virtual NetworkInterface { /** @copydoc NetworkInterface::disconnect */ nsapi_error_t disconnect() override; + /** @copydoc NetworkInterface::get_hostname */ + const char *get_hostname() override; + + /** @copydoc NetworkInterface::set_hostname */ + nsapi_error_t set_hostname(const char *hostname) override; + /** @copydoc NetworkInterface::get_mac_address */ const char *get_mac_address() override; @@ -146,6 +152,8 @@ class EMACInterface : public virtual NetworkInterface { OnboardNetworkStack::Interface *_interface = nullptr; bool _dhcp = true; bool _blocking = true; + bool _hostname_set = false; + char _hostname[NSAPI_HOSTNAME_SIZE]; bool _hw_mac_addr_set = false; char _mac_address[NSAPI_MAC_SIZE]; char _ip_address[NSAPI_IPv6_SIZE] {}; diff --git a/cores/arduino/mbed/connectivity/netsocket/include/netsocket/NetworkInterface.h b/cores/arduino/mbed/connectivity/netsocket/include/netsocket/NetworkInterface.h index 9071a1e40..0e2aa64c9 100644 --- a/cores/arduino/mbed/connectivity/netsocket/include/netsocket/NetworkInterface.h +++ b/cores/arduino/mbed/connectivity/netsocket/include/netsocket/NetworkInterface.h @@ -90,6 +90,22 @@ class NetworkInterface: public DNS { */ virtual void set_as_default(); + /** Get hostname. + * + * @return Hostname if configured, null otherwise + */ + virtual const char *get_hostname(); + + /** Set hostname. + * + * @param hostname Hostname string + * @retval NSAPI_ERROR_OK on success + * @retval NSAPI_ERROR_UNSUPPORTED if this feature is not supported + * @retval NSAPI_ERROR_PARAMETER if hostname is not valid + * @retval NSAPI_ERROR_BUSY if hostname can't be set + */ + virtual nsapi_error_t set_hostname(const char *hostname); + /** Get the local MAC address. * * Provided MAC address is intended for info or debug purposes and diff --git a/cores/arduino/mbed/connectivity/netsocket/include/netsocket/nsapi_types.h b/cores/arduino/mbed/connectivity/netsocket/include/netsocket/nsapi_types.h index 3b496d508..28dbcc9a3 100644 --- a/cores/arduino/mbed/connectivity/netsocket/include/netsocket/nsapi_types.h +++ b/cores/arduino/mbed/connectivity/netsocket/include/netsocket/nsapi_types.h @@ -196,6 +196,16 @@ typedef enum nsapi_security { */ #define NSAPI_IP_BYTES NSAPI_IPv6_BYTES +/** Maximum size of hostname + * + * According to RFC 1034 [1], Section 3.1 "Name space specifications and + * terminology", 63 is the maximum size of a hostname. +1 for the string + * terminator. + * + * [1] https://www.rfc-editor.org/rfc/rfc1034 + */ +#define NSAPI_HOSTNAME_SIZE 64 + /** Maximum size of MAC address representation */ #define NSAPI_MAC_SIZE 18 diff --git a/variants/OPTA/defines.txt b/variants/OPTA/defines.txt index d2bdfafe1..45906d2cb 100644 --- a/variants/OPTA/defines.txt +++ b/variants/OPTA/defines.txt @@ -44,7 +44,7 @@ -DFEATURE_BLE=1 -D__FPU_PRESENT=1 -D__MBED__=1 --DMBED_BUILD_TIMESTAMP=1719929630.0019104 +-DMBED_BUILD_TIMESTAMP=1720562782.5913384 -D__MBED_CMSIS_RTOS_CM -DMBED_TICKLESS -DMBEDTLS_FS_IO diff --git a/variants/OPTA/libs/libmbed.a b/variants/OPTA/libs/libmbed.a index c65f0bde3..9302f489b 100644 Binary files a/variants/OPTA/libs/libmbed.a and b/variants/OPTA/libs/libmbed.a differ