Updated to new esp-idf
This commit is contained in:
@ -14,7 +14,6 @@ set(dependencies
|
||||
espchrono
|
||||
espcpputils
|
||||
espwifistack
|
||||
expected
|
||||
fmt
|
||||
)
|
||||
|
||||
|
@ -26,19 +26,19 @@ AsyncMdnsSearch &AsyncMdnsSearch::operator=(AsyncMdnsSearch &&other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
tl::expected<void, std::string> AsyncMdnsSearch::startSearch(const char *name, const char *service, const char *proto, uint16_t type, std::chrono::milliseconds timeout, size_t max_results)
|
||||
std::expected<void, std::string> AsyncMdnsSearch::startSearch(const char *name, const char *service, const char *proto, uint16_t type, std::chrono::milliseconds timeout, size_t max_results)
|
||||
{
|
||||
ESP_LOGD(TAG, "starting search...");
|
||||
|
||||
if (searchStarted())
|
||||
return tl::make_unexpected("last scan not finished yet");
|
||||
return std::unexpected("last scan not finished yet");
|
||||
|
||||
if (!max_results)
|
||||
return tl::make_unexpected("max_results should be greater than 0");
|
||||
return std::unexpected("max_results should be greater than 0");
|
||||
|
||||
m_mdnsScan = mdns_query_async_new(name, service, proto, type, timeout.count(), max_results, nullptr);
|
||||
if (!searchStarted())
|
||||
return tl::make_unexpected("mdns_query_async_new() returned invalid");
|
||||
return std::unexpected("mdns_query_async_new() returned invalid");
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -4,13 +4,11 @@
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
#include <expected>
|
||||
|
||||
// esp-idf includes
|
||||
#include <mdns.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <tl/expected.hpp>
|
||||
|
||||
// local includes
|
||||
#include "asyncmdnsresults.h"
|
||||
|
||||
@ -27,7 +25,7 @@ public:
|
||||
|
||||
bool searchStarted() const { return m_mdnsScan; }
|
||||
|
||||
tl::expected<void, std::string> startSearch(const char *name, const char *service, const char *proto, uint16_t type, std::chrono::milliseconds timeout, size_t max_results);
|
||||
std::expected<void, std::string> startSearch(const char *name, const char *service, const char *proto, uint16_t type, std::chrono::milliseconds timeout, size_t max_results);
|
||||
std::optional<AsyncMdnsResults> getResults();
|
||||
void deleteSearch();
|
||||
|
||||
|
Reference in New Issue
Block a user