From b2f2ad72dde521670b71554f0bc56dd5c385d9cf Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Mon, 27 Feb 2023 17:27:15 +0100 Subject: [PATCH] Updated to new esp-idf --- CMakeLists.txt | 1 - src/espwifistack.cpp | 78 ++++++++++++++++++++-------------------- src/espwifistack.h | 18 +++++----- src/espwifistackconfig.h | 2 +- src/espwifiutils.cpp | 16 ++++----- src/espwifiutils.h | 10 +++--- src/udpsender.cpp | 36 +++++++++---------- src/udpsender.h | 18 +++++----- 8 files changed, 87 insertions(+), 92 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef5c67f..118a0ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,6 @@ set(dependencies cpputils espchrono espcpputils - expected fmt ) diff --git a/src/espwifistack.cpp b/src/espwifistack.cpp index 27efcbe..6d7f4bd 100644 --- a/src/espwifistack.cpp +++ b/src/espwifistack.cpp @@ -144,7 +144,7 @@ mac_t _currentConnectPlanEntry; std::vector _connectPlan; #ifdef CONFIG_ETH_ENABLED -std::optional> _eth_init_status; +std::optional> _eth_init_status; #endif } // namespace @@ -163,7 +163,7 @@ const mac_t ¤tConnectPlanEntry{_currentConnectPlanEntry}; const std::vector &connectPlan{_connectPlan}; #ifdef CONFIG_ETH_ENABLED -const std::optional> ð_init_status{_eth_init_status}; +const std::optional> ð_init_status{_eth_init_status}; #endif namespace { @@ -280,8 +280,8 @@ esp_err_t wifi_low_level_init(const config &config); esp_err_t wifi_start(); esp_err_t wifi_low_level_deinit(); esp_err_t wifi_stop(); -tl::expected applyBaseMac(const mac_t &mac); -tl::expected expectedBaseMac(const config &config); +std::expected applyBaseMac(const mac_t &mac); +std::expected expectedBaseMac(const config &config); esp_err_t wifi_set_ap_ip(const config &config, const static_ip_config &ip); wifi_config_t make_sta_config(std::string_view ssid, std::string_view password, int8_t min_rssi, std::optional bssid, uint8_t channel); @@ -293,7 +293,7 @@ bool nextConnectPlanItem(const config &config, const sta_config &sta_config); bool nextConnectPlanItem(const config &config, const sta_config &sta_config, const scan_result &scanResult); void handleWifiEvents(const config &config, TickType_t xTicksToWait); #ifdef CONFIG_ETH_ENABLED -tl::expected eth_begin(const config &config, const eth_config ð); +std::expected eth_begin(const config &config, const eth_config ð); #endif #ifdef CONFIG_PPP_SUPPORT esp_err_t modem_init(); @@ -816,13 +816,13 @@ WiFiStaStatus get_sta_status() return _sta_status.load(); } -tl::expected begin_scan(const sta_config &sta_config) +std::expected begin_scan(const sta_config &sta_config) { if (!(get_wifi_mode() & WIFI_MODE_STA)) - return tl::make_unexpected("STA mode missing"); + return std::unexpected("STA mode missing"); if (wifi_get_status_bits() & WIFI_SCANNING_BIT) - return tl::make_unexpected("already scanning"); + return std::unexpected("already scanning"); delete_scan_result(); @@ -850,10 +850,10 @@ tl::expected begin_scan(const sta_config &sta_config) scanTimeout = time.max_per_chan * 20; } else - return tl::make_unexpected("invalid scan settings (not active nor passive)!"); + return std::unexpected("invalid scan settings (not active nor passive)!"); if (const auto result = esp_wifi_scan_start(&scan_config, false) != ESP_OK) - return tl::make_unexpected(fmt::format("esp_wifi_scan_start() failed with: {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_wifi_scan_start() failed with: {}", esp_err_to_name(result))); scanStarted = espchrono::millis_clock::now(); @@ -901,7 +901,7 @@ void delete_scan_result() } } -tl::expected get_sta_ap_info() +std::expected get_sta_ap_info() { wifi_ap_record_t info; if (const auto result = esp_wifi_sta_get_ap_info(&info); result == ESP_OK) @@ -909,7 +909,7 @@ tl::expected get_sta_ap_info() else { ESP_LOGW(TAG, "esp_wifi_sta_get_ap_info() failed with %s", esp_err_to_name(result)); - return tl::make_unexpected(fmt::format("esp_wifi_sta_get_ap_info() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_wifi_sta_get_ap_info() failed with {}", esp_err_to_name(result))); } } @@ -921,7 +921,7 @@ mac_or_error get_mac_addr(wifi_interface_t ifx) else { ESP_LOGW(TAG, "esp_wifi_get_mac() failed with %s", esp_err_to_name(result)); - return tl::make_unexpected(fmt::format("esp_wifi_get_mac() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_wifi_get_mac() failed with {}", esp_err_to_name(result))); } } @@ -934,7 +934,7 @@ mac_or_error get_default_mac_addr() else { //ESP_LOGE(TAG, "esp_efuse_mac_get_default() failed with %s", esp_err_to_name(result)); - return tl::make_unexpected(fmt::format("esp_efuse_mac_get_default() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_efuse_mac_get_default() failed with {}", esp_err_to_name(result))); } }(); @@ -950,7 +950,7 @@ mac_or_error get_custom_mac_addr() else { //ESP_LOGE(TAG, "esp_efuse_mac_get_custom() failed with %s", esp_err_to_name(result)); - return tl::make_unexpected(fmt::format("esp_efuse_mac_get_custom() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_efuse_mac_get_custom() failed with {}", esp_err_to_name(result))); } }(); @@ -965,22 +965,22 @@ mac_or_error get_base_mac_addr() else { ESP_LOGE(TAG, "esp_base_mac_addr_get() failed with %s", esp_err_to_name(result)); - return tl::make_unexpected(fmt::format("esp_base_mac_addr_get() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_base_mac_addr_get() failed with {}", esp_err_to_name(result))); } } -tl::expected set_base_mac_addr(mac_t mac_addr) +std::expected set_base_mac_addr(mac_t mac_addr) { if (const auto result = esp_base_mac_addr_set(std::cbegin(mac_addr)); result == ESP_OK) return {}; else { ESP_LOGE(TAG, "esp_base_mac_addr_set() failed with %s", esp_err_to_name(result)); - return tl::make_unexpected(fmt::format("esp_base_mac_addr_set() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_base_mac_addr_set() failed with {}", esp_err_to_name(result))); } } -tl::expected get_ip_info(esp_netif_t *esp_netif) +std::expected get_ip_info(esp_netif_t *esp_netif) { esp_netif_ip_info_t ip; if (const auto result = esp_netif_get_ip_info(esp_netif, &ip); result == ESP_OK) @@ -988,26 +988,26 @@ tl::expected get_ip_info(esp_netif_t *esp_neti else { ESP_LOGE(TAG, "esp_netif_get_ip_info() failed with %s", esp_err_to_name(result)); - return tl::make_unexpected(fmt::format("tcpip_adapter_get_ip_info() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("tcpip_adapter_get_ip_info() failed with {}", esp_err_to_name(result))); } } -tl::expected get_hostname_for_interface(esp_interface_t interf) +std::expected get_hostname_for_interface(esp_interface_t interf) { if (const auto netif = esp_netifs[interf]) return get_hostname_for_interface(netif); else - return tl::make_unexpected(fmt::format("netif for {} is invalid", std::to_underlying(interf))); + return std::unexpected(fmt::format("netif for {} is invalid", std::to_underlying(interf))); } -tl::expected get_hostname_for_interface(esp_netif_t *esp_netif) +std::expected get_hostname_for_interface(esp_netif_t *esp_netif) { const char *hostname{}; if (const auto result = esp_netif_get_hostname(esp_netif, &hostname)) - return tl::make_unexpected(fmt::format("esp_netif_get_hostname() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_netif_get_hostname() failed with {}", esp_err_to_name(result))); if (!hostname) - return tl::make_unexpected("esp_netif_get_hostname() returned a nullptr string"); + return std::unexpected("esp_netif_get_hostname() returned a nullptr string"); return std::string_view{hostname}; } @@ -2078,7 +2078,7 @@ esp_err_t wifi_stop() return ESP_OK; } -tl::expected applyBaseMac(const mac_t &mac) +std::expected applyBaseMac(const mac_t &mac) { if (const auto result = set_base_mac_addr(mac); result) return {}; @@ -2086,11 +2086,11 @@ tl::expected applyBaseMac(const mac_t &mac) { const auto msg = fmt::format("set_base_mac_addr() {} failed: {}", toString(mac), result.error()); ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(msg); + return std::unexpected(msg); } } -tl::expected expectedBaseMac(const config &config) +std::expected expectedBaseMac(const config &config) { if (config.base_mac_override) { @@ -2111,7 +2111,7 @@ tl::expected expectedBaseMac(const config &config) { const auto msg = fmt::format("no base mac fuse or override set and get_default_mac_addr() failed: {}", mac.error()); ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(msg); + return std::unexpected(msg); } } @@ -2698,7 +2698,7 @@ void handleWifiEvents(const config &config, TickType_t xTicksToWait) } #ifdef CONFIG_ETH_ENABLED -tl::expected eth_begin(const config &config, const eth_config ð) +std::expected eth_begin(const config &config, const eth_config ð) { esp_netif_config_t cfg ESP_NETIF_DEFAULT_ETH(); esp_netif_inherent_config_t newBase = *cfg.base; @@ -2710,7 +2710,7 @@ tl::expected eth_begin(const config &config, const eth_config { auto msg = std::string{"esp_netif_new() failed"}; ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } esp_eth_mac_t *eth_mac{}; @@ -2728,7 +2728,7 @@ tl::expected eth_begin(const config &config, const eth_config { auto msg = std::string{"esp_eth_mac_new_esp32() failed"}; ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } eth_phy_config_t phy_config ETH_PHY_DEFAULT_CONFIG(); @@ -2744,7 +2744,7 @@ tl::expected eth_begin(const config &config, const eth_config { auto msg = std::string{"esp_eth_phy_new_lan8720() failed"}; ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } } else @@ -2754,7 +2754,7 @@ tl::expected eth_begin(const config &config, const eth_config { auto msg = std::string{"esp_eth_phy_new_ksz8041() failed"}; ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } } @@ -2766,14 +2766,14 @@ tl::expected eth_begin(const config &config, const eth_config { auto msg = fmt::format("esp_eth_driver_install() failed with {}", esp_err_to_name(result)); ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } if (!eth_handle) { auto msg = std::string{"esp_eth_driver_install() invalid eth_handle"}; ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } /* attach Ethernet driver to TCP/IP stack */ @@ -2782,14 +2782,14 @@ tl::expected eth_begin(const config &config, const eth_config { auto msg = std::string{"esp_eth_new_netif_glue() failed"}; ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } if (const auto result = esp_netif_attach(esp_netifs[ESP_IF_ETH], ptr); result != ESP_OK) { auto msg = fmt::format("esp_netif_attach() failed with {}", esp_err_to_name(result)); ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } eth_initialized = true; @@ -2800,7 +2800,7 @@ tl::expected eth_begin(const config &config, const eth_config { auto msg = fmt::format("esp_eth_start() failed with {}", esp_err_to_name(result)); ESP_LOGE(TAG, "%.*s", msg.size(), msg.data()); - return tl::make_unexpected(std::move(msg)); + return std::unexpected(std::move(msg)); } eth_started = true; diff --git a/src/espwifistack.h b/src/espwifistack.h index 2a30bd2..3555be1 100644 --- a/src/espwifistack.h +++ b/src/espwifistack.h @@ -7,6 +7,7 @@ #include #include #include +#include // esp-idf includes #include @@ -17,7 +18,6 @@ #endif // 3rdparty lib includes -#include #include #include #include @@ -71,7 +71,7 @@ extern const mac_t ¤tConnectPlanEntry; extern const std::vector &connectPlan; #ifdef CONFIG_ETH_ENABLED -extern const std::optional> ð_init_status; +extern const std::optional> ð_init_status; #endif wifi_mode_t get_wifi_mode(); @@ -80,7 +80,7 @@ wifi_mode_t get_wifi_mode(); WiFiStaStatus get_sta_status(); //! Tries to begin a new scan, if succeeds clears the old scan result -tl::expected begin_scan(const sta_config &sta_config); +std::expected begin_scan(const sta_config &sta_config); //! Tells the status of the currently running scan (finished, ...) WiFiScanStatus get_scan_status(); @@ -93,16 +93,16 @@ const std::optional &get_scan_result(); void delete_scan_result(); //! Util wrappers -using mac_or_error = tl::expected; -tl::expected get_sta_ap_info(); +using mac_or_error = std::expected; +std::expected get_sta_ap_info(); mac_or_error get_mac_addr(wifi_interface_t ifx); mac_or_error get_default_mac_addr(); mac_or_error get_custom_mac_addr(); mac_or_error get_base_mac_addr(); -tl::expected set_base_mac_addr(mac_t mac_addr); -tl::expected get_ip_info(esp_netif_t *esp_netif); -tl::expected get_hostname_for_interface(esp_interface_t interf); -tl::expected get_hostname_for_interface(esp_netif_t *esp_netif); +std::expected set_base_mac_addr(mac_t mac_addr); +std::expected get_ip_info(esp_netif_t *esp_netif); +std::expected get_hostname_for_interface(esp_interface_t interf); +std::expected get_hostname_for_interface(esp_netif_t *esp_netif); #ifdef CONFIG_ETH_ENABLED esp_eth_handle_t getEthHandle(); diff --git a/src/espwifistackconfig.h b/src/espwifistackconfig.h index a8a35f2..b4733b5 100644 --- a/src/espwifistackconfig.h +++ b/src/espwifistackconfig.h @@ -21,7 +21,7 @@ inline bool operator==(const wifi_country_t &left, const wifi_country_t &right) { - return left.cc == right.cc && + return std::equal(std::begin(left.cc), std::end(left.cc), std::begin(right.cc)) && left.schan == right.schan && left.nchan == right.nchan && left.max_tx_power == right.max_tx_power && diff --git a/src/espwifiutils.cpp b/src/espwifiutils.cpp index b3e3aae..6907345 100644 --- a/src/espwifiutils.cpp +++ b/src/espwifiutils.cpp @@ -184,14 +184,14 @@ const char * toString(wifi_err_reason_t reason) return "UNKNOWN"; } -template<> tl::expected fromString(std::string_view str) +template<> std::expected fromString(std::string_view str) { - mac_t result; + mac_t result{}; if (std::sscanf(str.data(), "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", &result[0], &result[1], &result[2], &result[3], &result[4], &result[5]) == 6) return result; - return tl::make_unexpected(fmt::format("invalid format ({})", str)); + return std::unexpected(fmt::format("invalid format ({})", str)); } std::string toString(const mac_t &val) @@ -205,7 +205,7 @@ std::string toString(const std::optional &val) return val ? toString(*val) : "nullopt"; } -template<> tl::expected fromString(std::string_view str) +template<> std::expected fromString(std::string_view str) { // TODO: add support for "a", "a.b", "a.b.c" formats // TODO: replace with scanf for better performance @@ -221,22 +221,22 @@ template<> tl::expected fromString(std: { acc = acc * 10 + (c - '0'); if (acc > 255) - return tl::make_unexpected("Value out of [0..255] range"); + return std::unexpected("Value out of [0..255] range"); } else if (c == '.') { if (dots == 3) - return tl::make_unexpected("Too many dots (there must be 3 dots)"); + return std::unexpected("Too many dots (there must be 3 dots)"); result[dots++] = acc; acc = 0; } else - return tl::make_unexpected("Invalid char"); + return std::unexpected("Invalid char"); } if (dots != 3) - return tl::make_unexpected("Too few dots (there must be 3 dots)"); + return std::unexpected("Too few dots (there must be 3 dots)"); result[3] = acc; diff --git a/src/espwifiutils.h b/src/espwifiutils.h index d684e9b..c118fae 100644 --- a/src/espwifiutils.h +++ b/src/espwifiutils.h @@ -6,6 +6,7 @@ #include #include #include +#include // esp-idf includes #include @@ -13,9 +14,6 @@ #include #include -// 3rdparty lib includes -#include - namespace wifi_stack { bool wifi_ap_config_equal(const wifi_ap_config_t& lhs, const wifi_ap_config_t& rhs); bool wifi_sta_config_equal(const wifi_sta_config_t& lhs, const wifi_sta_config_t& rhs); @@ -26,7 +24,7 @@ std::string toString(esp_interface_t interface); std::string toString(esp_netif_dhcp_status_t status); const char * toString(wifi_err_reason_t reason); -template tl::expected fromString(std::string_view str) = delete; +template std::expected fromString(std::string_view str) = delete; // A class to make it easier to handle and pass around mac addresses / bssids @@ -49,7 +47,7 @@ public: } }; -template<> tl::expected fromString(std::string_view str); +template<> std::expected fromString(std::string_view str); std::string toString(const mac_t &val); std::string toString(const std::optional &val); @@ -100,7 +98,7 @@ public: constexpr ip_address_t& operator=(value_t value) noexcept { _value = value; return *this; } }; -template<> tl::expected fromString(std::string_view str); +template<> std::expected fromString(std::string_view str); std::string toString(ip_address_t val); std::string toString(const std::optional &val); diff --git a/src/udpsender.cpp b/src/udpsender.cpp index 8c681c2..e301f83 100644 --- a/src/udpsender.cpp +++ b/src/udpsender.cpp @@ -38,28 +38,28 @@ UdpSender::~UdpSender() close(m_udp_server); } -tl::expected UdpSender::send(esp_interface_t interf, uint16_t port, std::string_view buf) +std::expected UdpSender::send(esp_interface_t interf, uint16_t port, std::string_view buf) { const auto interfPtr = esp_netifs[interf]; if (!interfPtr) - return tl::make_unexpected(fmt::format("esp_netifs[{}] is invalid", std::to_underlying(interf))); + return std::unexpected(fmt::format("esp_netifs[{}] is invalid", std::to_underlying(interf))); return send(interfPtr, port, buf); } -tl::expected UdpSender::send(esp_netif_t *interf, uint16_t port, std::string_view buf) +std::expected UdpSender::send(esp_netif_t *interf, uint16_t port, std::string_view buf) { if (!interf) - return tl::make_unexpected("invalid interf"); + return std::unexpected("invalid interf"); esp_netif_ip_info_t ip; if (const auto result = esp_netif_get_ip_info(interf, &ip); result != ESP_OK) - return tl::make_unexpected(fmt::format("esp_netif_get_ip_info() failed with {}", esp_err_to_name(result))); + return std::unexpected(fmt::format("esp_netif_get_ip_info() failed with {}", esp_err_to_name(result))); return send(ip, port, buf); } -tl::expected UdpSender::send(const esp_netif_ip_info_t &ip, uint16_t port, std::string_view buf) +std::expected UdpSender::send(const esp_netif_ip_info_t &ip, uint16_t port, std::string_view buf) { struct sockaddr_in recipient; @@ -71,33 +71,33 @@ tl::expected UdpSender::send(const esp_netif_ip_info_t &ip, u return send(recipient, buf); } -tl::expected UdpSender::send(const struct sockaddr_in &recipient, std::string_view buf) +std::expected UdpSender::send(const struct sockaddr_in &recipient, std::string_view buf) { if (!ready()) - return tl::make_unexpected("initializing failed, not ready to send"); + return std::unexpected("initializing failed, not ready to send"); if (const ssize_t sent = sendto(m_udp_server, buf.data(), buf.size(), 0, (const struct sockaddr*)&recipient, sizeof(recipient)); sent < 0) - return tl::make_unexpected(fmt::format("send failed with {} (errno={})", sent, errno)); + return std::unexpected(fmt::format("send failed with {} (errno={})", sent, errno)); else if (sent != buf.size()) - return tl::make_unexpected(fmt::format("sent bytes does not match, expected={}, sent={}", buf.size(), sent)); + return std::unexpected(fmt::format("sent bytes does not match, expected={}, sent={}", buf.size(), sent)); return {}; } -tl::expected UdpSender::send(const struct sockaddr_in6 &recipient, std::string_view buf) +std::expected UdpSender::send(const struct sockaddr_in6 &recipient, std::string_view buf) { if (!ready()) - return tl::make_unexpected("initializing failed, not ready to send"); + return std::unexpected("initializing failed, not ready to send"); if (const ssize_t sent = sendto(m_udp_server, buf.data(), buf.size(), 0, (const struct sockaddr*)&recipient, sizeof(recipient)); sent < 0) - return tl::make_unexpected(fmt::format("send failed with {} (errno={})", sent, errno)); + return std::unexpected(fmt::format("send failed with {} (errno={})", sent, errno)); else if (sent != buf.size()) - return tl::make_unexpected(fmt::format("sent bytes does not match, expected={}, sent={}", buf.size(), sent)); + return std::unexpected(fmt::format("sent bytes does not match, expected={}, sent={}", buf.size(), sent)); return {}; } -tl::expected UdpSender::send(ip_addr_t ip, uint16_t port, std::string_view buf) +std::expected UdpSender::send(ip_addr_t ip, uint16_t port, std::string_view buf) { switch (ip.type) { @@ -122,11 +122,11 @@ tl::expected UdpSender::send(ip_addr_t ip, uint16_t port, std return send(recipient, buf); } default: - return tl::make_unexpected(fmt::format("unsupported ip type {}", ip.type)); + return std::unexpected(fmt::format("unsupported ip type {}", ip.type)); } } -tl::expected UdpSender::send(esp_ip_addr_t ip, uint16_t port, std::string_view buf) +std::expected UdpSender::send(esp_ip_addr_t ip, uint16_t port, std::string_view buf) { switch (ip.type) { @@ -151,7 +151,7 @@ tl::expected UdpSender::send(esp_ip_addr_t ip, uint16_t port, return send(recipient, buf); } default: - return tl::make_unexpected(fmt::format("unsupported ip type {}", ip.type)); + return std::unexpected(fmt::format("unsupported ip type {}", ip.type)); } } diff --git a/src/udpsender.h b/src/udpsender.h index 2481d98..c87735d 100644 --- a/src/udpsender.h +++ b/src/udpsender.h @@ -3,6 +3,7 @@ // system includes #include #include +#include // esp-idf includes #include @@ -10,9 +11,6 @@ #include #include -// 3rdparty lib includes -#include - namespace wifi_stack { class UdpSender @@ -23,13 +21,13 @@ public: bool ready() const { return m_udp_server != -1; } - tl::expected send(esp_interface_t interf, uint16_t port, std::string_view buf); - tl::expected send(esp_netif_t *interf, uint16_t port, std::string_view buf); - tl::expected send(const esp_netif_ip_info_t &ip, uint16_t port, std::string_view buf); - tl::expected send(const struct sockaddr_in &recipient, std::string_view buf); - tl::expected send(const struct sockaddr_in6 &recipient, std::string_view buf); - tl::expected send(ip_addr_t ip, uint16_t port, std::string_view buf); - tl::expected send(esp_ip_addr_t ip, uint16_t port, std::string_view buf); + std::expected send(esp_interface_t interf, uint16_t port, std::string_view buf); + std::expected send(esp_netif_t *interf, uint16_t port, std::string_view buf); + std::expected send(const esp_netif_ip_info_t &ip, uint16_t port, std::string_view buf); + std::expected send(const struct sockaddr_in &recipient, std::string_view buf); + std::expected send(const struct sockaddr_in6 &recipient, std::string_view buf); + std::expected send(ip_addr_t ip, uint16_t port, std::string_view buf); + std::expected send(esp_ip_addr_t ip, uint16_t port, std::string_view buf); private: const int m_udp_server;