JBWOPR
Loading...
Searching...
No Matches
jbwoprhelpers.h
1
8
9#ifndef ARDUINO_WOPR_JBWOPRHELPERS_H
10#define ARDUINO_WOPR_JBWOPRHELPERS_H
11
12#include <string>
13#include <sstream>
14#include <time.h>
15#include <jblogger.h>
16
18enum JBTextAlignment {
19 LEFT = 0,
20 CENTER,
21 RIGHT
22};
23
24
35public:
38 static void configure(JBLogger* log, std::string ntpServer = "", std::string tzString = "");
39
45 static bool getTime(tm* info);
46
47
52 static bool setTime(const std::string currentDateTime);
53
54private:
55 static bool _isInitialized;
56 static std::string _ntpServer;
57 static std::string _tzString;
58 static JBLogger* _log;
59};
60
63public:
68 static std::string getCenteredString(const std::string str, const uint32_t length, char padChar = ' ');
69
74 static std::string getRightAlignedString(std::string str, uint32_t length, char padChar = ' ');
75
79 static std::string rgbToString(uint32_t rgbValue);
80
84 static uint32_t stringToRgb(std::string rgbString);
85
86};
87
88#endif //ARDUINO_WOPR_JBWOPRHELPERS_H
This class contains helper functions for string related tasks.
Definition jbwoprhelpers.h:62
static std::string rgbToString(uint32_t rgbValue)
Get hex coded color string.
Definition jbwoprhelpers.cpp:112
static std::string getRightAlignedString(std::string str, uint32_t length, char padChar=' ')
Get right aligned string.
Definition jbwoprhelpers.cpp:99
static std::string getCenteredString(const std::string str, const uint32_t length, char padChar=' ')
Get centered string.
Definition jbwoprhelpers.cpp:82
static uint32_t stringToRgb(std::string rgbString)
Get RGB value from hex coded color string.
Definition jbwoprhelpers.cpp:122
This class contains helper functions for time related tasks.
Definition jbwoprhelpers.h:34
static void configure(JBLogger *log, std::string ntpServer="", std::string tzString="")
Configure helper with NTP Server and time offset.
Definition jbwoprhelpers.cpp:17
static bool getTime(tm *info)
Get local time.
Definition jbwoprhelpers.cpp:23
static bool setTime(const std::string currentDateTime)
Definition jbwoprhelpers.cpp:50