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
27public:
30 static void configure(JBLogger* log, std::string ntpServer, std::string timeOffsetString);
31
35 static int64_t getUtcOffsetInSeconds();
36
42 static bool getTime(tm* info);
43
44private:
45 static bool _isInitialized;
46 static std::string _ntpServer;
47 static std::string _timeOffsetString;
48 static JBLogger* _log;
49};
50
53public:
58 static std::string getCenteredString(const std::string str, const uint32_t length, char padChar = ' ');
59
64 static std::string getRightAlignedString(std::string str, uint32_t length, char padChar = ' ');
65
69 static std::string rgbToString(uint32_t rgbValue);
70
74 static uint32_t stringToRgb(std::string rgbString);
75
76};
77
78#endif //ARDUINO_WOPR_JBWOPRHELPERS_H
This class contains helper functions for string related tasks.
Definition jbwoprhelpers.h:52
static std::string rgbToString(uint32_t rgbValue)
Get hex coded color string.
Definition jbwoprhelpers.cpp:117
static std::string getRightAlignedString(std::string str, uint32_t length, char padChar=' ')
Get right aligned string.
Definition jbwoprhelpers.cpp:104
static std::string getCenteredString(const std::string str, const uint32_t length, char padChar=' ')
Get centered string.
Definition jbwoprhelpers.cpp:87
static uint32_t stringToRgb(std::string rgbString)
Get RGB value from hex coded color string.
Definition jbwoprhelpers.cpp:127
This class contains helper functions for time related tasks.
Definition jbwoprhelpers.h:26
static void configure(JBLogger *log, std::string ntpServer, std::string timeOffsetString)
configure helper
Definition jbwoprhelpers.cpp:17
static int64_t getUtcOffsetInSeconds()
Get UTC offset in seconds.
Definition jbwoprhelpers.cpp:23
static bool getTime(tm *info)
Get local time.
Definition jbwoprhelpers.cpp:49