Files
espcpputils/src/espstrutils.h

30 lines
776 B
C
Raw Normal View History

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>
#include <esp_log.h>
2021-04-07 22:22:55 +02:00
namespace espcpputils {
std::string toString(sntp_sync_mode_t val);
std::string toString(sntp_sync_status_t val);
std::string toString(esp_log_level_t val);
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()});
}
tl::expected<std::basic_string<unsigned char>, std::string> fromHexString(std::string_view hex);
2021-11-04 01:41:02 +01:00
2021-04-07 22:22:55 +02:00
} // namespace espcpputils