2021-04-07 22:22:55 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
// system includes
|
|
|
|
|
#include <string>
|
2021-09-08 01:48:20 +02:00
|
|
|
#include <string_view>
|
2021-04-07 22:22:55 +02:00
|
|
|
|
2021-11-04 01:41:02 +01:00
|
|
|
// 3rdparty lib includes
|
|
|
|
|
#include <tl/expected.hpp>
|
|
|
|
|
|
2021-04-07 22:22:55 +02:00
|
|
|
// esp-idf includes
|
|
|
|
|
#include <esp_sntp.h>
|
2021-08-09 16:15:57 +02:00
|
|
|
#include <esp_log.h>
|
2021-04-07 22:22:55 +02:00
|
|
|
|
|
|
|
|
namespace espcpputils {
|
|
|
|
|
|
|
|
|
|
std::string toString(sntp_sync_mode_t val);
|
2021-08-11 23:28:06 +02:00
|
|
|
std::string toString(sntp_sync_status_t val);
|
2021-08-09 16:15:57 +02:00
|
|
|
std::string toString(esp_log_level_t val);
|
2021-10-18 16:54:27 +02:00
|
|
|
std::string toString(esp_reset_reason_t val);
|
2021-04-07 22:22:55 +02:00
|
|
|
|
2021-09-08 01:48:20 +02:00
|
|
|
std::string toHexString(std::basic_string_view<unsigned char> buf);
|
|
|
|
|
inline std::string toHexString(std::string_view str)
|
|
|
|
|
{
|
|
|
|
|
return toHexString(std::basic_string_view<unsigned char>{reinterpret_cast<const unsigned char *>(str.data()), str.size()});
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-04 01:41:02 +01:00
|
|
|
tl::expected<std::basic_string_view<unsigned char>, std::string> fromHexString(std::string_view str);
|
|
|
|
|
inline tl::expected<std::basic_string_view<unsigned char>, std::string> fromHexString(std::basic_string_view<unsigned char> str)
|
|
|
|
|
{
|
|
|
|
|
return fromHexString(std::string_view{reinterpret_cast<const char *>(str.data()), str.size()});
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-07 22:22:55 +02:00
|
|
|
} // namespace espcpputils
|