38#define UNIOT_SEMVER_TO_INT(major, minor, patch) ((major * 10000) + (minor * 100) + patch)
48#define UNIOT_CORE_VERSION UNIOT_SEMVER_TO_INT(0, 9, 0)
54#ifndef UNIOT_MQTT_HOST
55#define UNIOT_MQTT_HOST "mqtt.uniot.io"
62#ifndef UNIOT_MQTT_PORT
63#define UNIOT_MQTT_PORT 1883
72#ifndef UNIOT_WIFI_AP_PREFIX
73#define UNIOT_WIFI_AP_PREFIX "UNIOT"
84#ifndef UNIOT_WIFI_AP_PASSWORD
85#define UNIOT_WIFI_AP_PASSWORD ""
103#ifndef UNIOT_WIFI_REBOOT_RESET_COUNT
104#define UNIOT_WIFI_REBOOT_RESET_COUNT 5
114#ifndef UNIOT_WIFI_REBOOT_WINDOW_MS
115#define UNIOT_WIFI_REBOOT_WINDOW_MS 10000
127#ifndef UNIOT_LISP_HEAP
130#define UNIOT_LISP_HEAP 24576
131#elif defined(ESP8266)
132#define UNIOT_LISP_HEAP 12288
134#define UNIOT_LISP_HEAP 8192
156#ifndef UNIOT_LISP_MAX_EVAL_STACK
158#define UNIOT_LISP_MAX_EVAL_STACK 1280
159#elif defined(CONFIG_IDF_TARGET_ESP32C3)
160#define UNIOT_LISP_MAX_EVAL_STACK 3072
162#define UNIOT_LISP_MAX_EVAL_STACK 3072
167#define UNIOT_LISP_MAX_EVAL_STACK 2048
179#ifndef UNIOT_WIFI_NO_SLEEP
180#define UNIOT_WIFI_NO_SLEEP 0
195template <
int a,
int b,
int c,
int d>
197 static const uint32_t
Value = (((((d << 8) | c) << 8) | b) << 8) | a;
209template <
typename... Args>
211 (void)(
sizeof...(args));
225inline uint32_t
CRC32(
const void *data,
size_t length, uint32_t crc = 0) {
226 const uint8_t *ldata = (
const uint8_t *)data;
231 for (uint8_t k = 0; k < 8; k++)
232 crc = crc & 1 ? (crc >> 1) ^ 0x82f63b78 : crc >> 1;
241#define COUNT_OF(arr) (sizeof(arr) / sizeof(arr[0]))
250#define ARRAY_ELEMENT_SAFE(arr, index) ((arr)[(((index) < COUNT_OF(arr)) ? (index) : (COUNT_OF(arr) - 1))])
260#define FOURCC(name) FourCC<ARRAY_ELEMENT_SAFE(#name, 0), ARRAY_ELEMENT_SAFE(#name, 1), ARRAY_ELEMENT_SAFE(#name, 2), ARRAY_ELEMENT_SAFE(#name, 3)>::Value
272#define ALIAS_IMPLICIT_FUNCTION(high, low) \
273 template <typename... Args> \
274 inline auto high(Args &&...args) -> decltype(low(std::forward<Args>(args)...)) { \
275 return low(std::forward<Args>(args)...); \
287#define ALIAS_EXPLICIT_FUNCTION(high, low) \
288 template <typename T, typename... Args> \
289 inline auto high(Args &&...args) -> decltype(low<T>(std::forward<Args>(args)...)) { \
290 return low<T>(std::forward<Args>(args)...); \
321template <
typename T_First,
typename T_Second>
322using Pair = std::pair<T_First, T_Second>;
auto MakePair(Args &&...args) -> decltype(std::make_pair(std::forward< Args >(args)...))
Creates a pair instance, alias for std::make_pair.
Definition Common.h:337
std::unique_ptr< T > UniquePointer
Type alias for std::unique_ptr with cleaner syntax.
Definition Common.h:305
#define ALIAS_IMPLICIT_FUNCTION(high, low)
Creates an alias for a function that forwards all arguments implicitly.
Definition Common.h:272
std::shared_ptr< T > SharedPointer
Type alias for std::shared_ptr with cleaner syntax.
Definition Common.h:313
void UNUSED(Args &&...args)
Utility function to mark function parameters as intentionally unused.
Definition Common.h:210
std::pair< T_First, T_Second > Pair
Type alias for std::pair with cleaner syntax.
Definition Common.h:322
auto MakeUnique(Args &&...args) -> decltype(std::make_unique< T >(std::forward< Args >(args)...))
Creates a unique pointer instance, alias for std::make_unique.
Definition Common.h:332
#define ALIAS_EXPLICIT_FUNCTION(high, low)
Creates an alias for a template function that forwards all arguments explicitly.
Definition Common.h:287
uint32_t CRC32(const void *data, size_t length, uint32_t crc=0)
Calculates CRC32-C (Castagnoli) checksum for data integrity verification.
Definition Common.h:225
auto MakeShared(Args &&...args) -> decltype(std::make_shared< T >(std::forward< Args >(args)...))
Creates a shared pointer instance, alias for std::make_shared.
Definition Common.h:327
Contains all classes and functions related to the Uniot Core.
Creates a four-character code (FourCC) value from template parameters.
Definition Common.h:196
static const uint32_t Value
Definition Common.h:197