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