15#include <idfxx/net/endpoint>
16#include <idfxx/net/error>
42 ~base_channel() noexcept;
44 base_channel(const base_channel&) = delete;
45 base_channel& operator=(const base_channel&) = delete;
47 base_channel(base_channel&& other) noexcept;
48 base_channel& operator=(base_channel&& other) noexcept;
56 [[nodiscard]] ::netconn* idf_handle() const noexcept {
return _conn; }
62 [[nodiscard]]
bool is_open() const noexcept {
return _conn !=
nullptr; }
70 [[nodiscard]] std::optional<endpoint> local_endpoint() const noexcept;
72#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
81 void bind(
const endpoint& addr) {
idfxx::unwrap(try_bind(addr)); }
85 [[nodiscard]] result<void> try_bind(
const endpoint& addr);
92 template<
typename Rep,
typename Period>
93 void set_recv_timeout(
const std::chrono::duration<Rep, Period>& t)
noexcept {
94 _set_recv_timeout(std::chrono::ceil<std::chrono::milliseconds>(t));
103 void set_non_blocking(
bool on)
noexcept;
106 [[nodiscard]]
int get_recv_timeout() const noexcept;
109 base_channel() noexcept = default;
110 base_channel(::netconn* conn, address_family fam) noexcept
117 [[nodiscard]] result<endpoint> _try_getaddr(
bool local)
const;
119 void _set_recv_timeout(std::chrono::milliseconds t)
noexcept;
121 ::netconn* _conn =
nullptr;
family
DS18x20 device family identifiers.
address_family
Address family.
T unwrap(result< T > result)
Throws a std::system_error if the result is an error.
std::expected< T, std::error_code > result
result type wrapping a value or error code.