Uniot Core
0.9.0
Loading...
Searching...
No Matches
Uniot.h
Go to the documentation of this file.
1/*
2 * This is a part of the Uniot project.
3 * Copyright (C) 2016-2025 Uniot <contact@uniot.io>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <AppKit.h>
22#include <Arduino.h>
23#include <ClearQueue.h>
24#include <Credentials.h>
25#include <Date.h>
26#include <EventBus.h>
27#include <Logger.h>
28#include <TaskScheduler.h>
29
72
91class UniotCore {
92 public:
93 using TimerId = uint32_t;
94 using ListenerId = uint32_t;
95
96 static constexpr TimerId INVALID_TIMER_ID = 0;
97 static constexpr ListenerId INVALID_LISTENER_ID = 0;
98
106 UniotCore() : mScheduler(), mEventBus(FOURCC(main)), mpNetworkControllerConfig(nullptr) {}
107
122 void configWiFiResetButton(uint8_t pinBtn, uint8_t activeLevelBtn = LOW, bool registerLispBtn = true) {
123 _createNetworkControllerConfig();
124 mpNetworkControllerConfig->pinBtn = pinBtn;
125 mpNetworkControllerConfig->activeLevelBtn = activeLevelBtn;
126 mpNetworkControllerConfig->registerLispBtn = registerLispBtn;
127 }
128
141 void configWiFiStatusLed(uint8_t pinLed, uint8_t activeLevelLed = HIGH) {
142 _createNetworkControllerConfig();
143 mpNetworkControllerConfig->pinLed = pinLed;
144 mpNetworkControllerConfig->activeLevelLed = activeLevelLed;
145 }
146
158 static constexpr uint8_t REBOOT_RESET_DISABLED = UINT8_MAX;
159
182 void configWiFiResetOnReboot(uint8_t maxRebootCount = UNIOT_WIFI_REBOOT_RESET_COUNT, uint32_t rebootWindowMs = UNIOT_WIFI_REBOOT_WINDOW_MS) {
183 _createNetworkControllerConfig();
184 mpNetworkControllerConfig->maxRebootCount = maxRebootCount;
185 mpNetworkControllerConfig->rebootWindowMs = rebootWindowMs;
186 }
187
196 void configWiFiCredentials(const String& ssid, const String& password = "") {
197 auto success = getAppKit().setWiFiCredentials(ssid, password);
198 UNIOT_LOG_ERROR_IF(!success, "Failed to set WiFi credentials");
199 }
200
209 void configUser(const String& user) {
210 auto success = getAppKit().setUserId(user);
211 UNIOT_LOG_ERROR_IF(!success, "Failed to set user ID");
212 }
213
232 void addCustomPage(const String& path, const uint8_t* gzData, size_t gzLen, const String& label = "", const char* contentType = "text/html") {
233 auto success = getAppKit().addCustomPage(path, gzData, gzLen, label, contentType);
234 UNIOT_LOG_ERROR_IF(!success, "Failed to register custom page at %s", path.c_str());
235 }
236
245 void addCustomRoute(const String& path, ArRequestHandlerFunction handler) {
246 auto success = getAppKit().addCustomRoute(path, HTTP_GET, handler);
247 UNIOT_LOG_ERROR_IF(!success, "Failed to register custom route at %s", path.c_str());
248 }
249
258 void addCustomRoute(const String& path, WebRequestMethodComposite method, ArRequestHandlerFunction handler) {
259 auto success = getAppKit().addCustomRoute(path, method, handler);
260 UNIOT_LOG_ERROR_IF(!success, "Failed to register custom route at %s", path.c_str());
261 }
262
276 getAppKit().getMQTT().addDevice(device);
277 device.syncSubscriptions();
278 }
279
288 void enablePeriodicDateSave(uint32_t periodSeconds = 5 * 60) {
289 if (periodSeconds > 0) {
291 mScheduler.push("store_date", taskStoreDate);
292 taskStoreDate->attach(periodSeconds * 1000L);
293 }
294 }
295
304 void addLispPrimitive(Primitive* primitive) {
305 getAppKit().getLisp().pushPrimitive(primitive);
306 }
307
319
340
374
384 void publishLispEvent(const String& eventID, int32_t value) {
385 getAppKit().publishLispEvent(eventID, value);
386 }
387
396 template <typename... Pins>
397 void registerLispDigitalOutput(uint8_t first, Pins... pins) {
399 }
400
412 template <typename... Pins>
413 void registerLispDigitalInput(uint8_t first, Pins... pins) {
415 }
416
428 template <typename... Pins>
429 void registerLispAnalogInput(uint8_t first, Pins... pins) {
431 }
432
441 template <typename... Pins>
442 void registerLispAnalogOutput(uint8_t first, Pins... pins) {
444 }
445
458
489 int addLispButton(uint8_t pin, uint8_t activeLevel = LOW, uint32_t id = FOURCC(_btn), uniot::Button::ButtonCallback callback = nullptr) {
490 constexpr uint8_t longPressTicks = 30;
491 constexpr uint32_t pollMs = 100;
492
493 auto button = uniot::MakeShared<uniot::Button>(pin, activeLevel, longPressTicks, callback);
494
496 if (!registers.link(uniot::primitive::name::bclicked, button.get(), id)) {
497 return -1;
498 }
499 mButtons.push(button);
500
501 // One task polls every button, created with the first.
502 if (!mpTaskButtons) {
503 mpTaskButtons = uniot::TaskScheduler::make([this](uniot::SchedulerTask &, short times) {
504 mButtons.forEach([times](const uniot::SharedPointer<uniot::Button> &button) {
505 button->execute(times);
506 });
507 });
508 mScheduler.push("lisp_buttons", mpTaskButtons);
509 mpTaskButtons->attach(pollMs);
510 }
511
512 return static_cast<int>(registers.getRegisterLength(uniot::primitive::name::bclicked)) - 1;
513 }
514
532 _forEachLispButton([](uniot::Button *button) {
533 button->resetClick();
534 button->resetLongPress();
535 });
536 }
537
548 bool registerLispObject(const String& primitiveName, uniot::RecordPtr link, uint32_t id = FOURCC(____)) {
549 return uniot::PrimitiveExpeditor::getRegisterManager().link(primitiveName, link, id);
550 }
551
562 TimerId setInterval(std::function<void()> callback, uint32_t intervalMs, short times = 0) {
563 if (!callback) {
564 return INVALID_TIMER_ID;
565 }
566
567 auto id = _generateTimerId();
568 auto task = uniot::TaskScheduler::make([this, id, callback = std::move(callback)](uniot::SchedulerTask&, short remainingTimes) {
569 callback();
570
571 if (!remainingTimes) {
572 mActiveTimers.remove(id);
573 }
574 });
575
576 mActiveTimers.put(id, task);
577 mScheduler.push(nullptr, task);
578 task->attach(intervalMs, times);
579 return id;
580 }
581
591 TimerId setTimeout(std::function<void()> callback, uint32_t timeoutMs) {
592 return setInterval(std::move(callback), timeoutMs, 1);
593 }
594
603 TimerId setImmediate(std::function<void()> callback) {
604 return setTimeout(std::move(callback), 1);
605 }
606
616 if (id == INVALID_TIMER_ID) {
617 return false;
618 }
619
620 auto task = mActiveTimers.get(id, nullptr);
621 if (task) {
622 task->detach();
623 return mActiveTimers.remove(id);
624 }
625 return false;
626 }
627
636 if (id == INVALID_TIMER_ID) {
637 return false;
638 }
639
640 auto task = mActiveTimers.get(id, nullptr);
641 return task && task->isAttached();
642 }
643
652 return mActiveTimers.calcSize();
653 }
654
666 auto task = uniot::TaskScheduler::make(std::move(callback));
667 mScheduler.push(name, task);
668 return task;
669 }
670
681 template <typename... Topics>
682 ListenerId addSystemListener(std::function<void(unsigned int, int)> callback, unsigned int firstTopic, Topics... otherTopics) {
683 if (!callback) {
684 return INVALID_LISTENER_ID;
685 }
686
687 unsigned int topics[] = {firstTopic, static_cast<unsigned int>(otherTopics)...};
688 size_t count = sizeof...(otherTopics) + 1;
689
691 for (size_t i = 0; i < count; ++i) {
692 listener->listenToEvent(topics[i]);
693 }
694
695 if (mEventBus.registerEntity(listener.get())) {
696 auto id = _generateListenerId();
697 mActiveListeners.put(id, listener);
698 return id;
699 }
700
701 return INVALID_LISTENER_ID;
702 }
703
712 if (id == INVALID_LISTENER_ID) {
713 return false;
714 }
715
716 auto listener = mActiveListeners.get(id, nullptr);
717 if (listener) {
718 mEventBus.unregisterEntity(listener.get());
719 return mActiveListeners.remove(id);
720 }
721 return false;
722 }
723
733 template <typename... Topics>
734 size_t removeSystemListeners(unsigned int firstTopic, Topics... otherTopics) {
735 unsigned int topics[] = {firstTopic, static_cast<unsigned int>(otherTopics)...};
736 size_t topicCount = sizeof...(otherTopics) + 1;
737 size_t removedCount = 0;
738
739 mActiveListeners.begin();
740 while (!mActiveListeners.isEnd()) {
741 auto listener = mActiveListeners.current().second;
742 bool shouldRemove = false;
743
744 if (listener) {
745 for (size_t i = 0; i < topicCount; ++i) {
746 if (listener->isListeningToEvent(topics[i])) {
747 shouldRemove = true;
748 break;
749 }
750 }
751 }
752
753 if (shouldRemove) {
754 mEventBus.unregisterEntity(listener.get());
755 mActiveListeners.deleteCurrent();
756 removedCount++;
757 } else {
758 mActiveListeners.next();
759 }
760 }
761
762 return removedCount;
763 }
764
774 if (id == INVALID_LISTENER_ID) {
775 return false;
776 }
777
778 return mActiveListeners.exist(id);
779 }
780
789 return mActiveListeners.calcSize();
790 }
791
800 void emitSystemEvent(unsigned int topic, int message) {
801 mEventBus.emitEvent(topic, message);
802 }
803
818 ListenerId addWifiStatusLedListener(std::function<void(bool)> callback) {
819 if (!callback) {
820 return INVALID_LISTENER_ID;
821 }
822
823 return addSystemListener(
824 [callback = std::move(callback)](unsigned int topic, int message) {
826 callback(message != 0);
827 }
828 },
830 }
831
839 void begin(uint32_t eventBusTaskPeriod = 10) {
841
842 auto& app = uniot::AppKit::getInstance();
843
844 if (mpNetworkControllerConfig) {
845 app.configureNetworkController(*mpNetworkControllerConfig);
846 _deleteNetworkControllerConfig();
847 }
848
849 mEventBus.registerKit(app);
850
851 auto taskHandleEventBus = uniot::TaskScheduler::make(mEventBus);
852 mScheduler.push("event_bus", taskHandleEventBus);
853 taskHandleEventBus->attach(eventBusTaskPeriod);
854
855 // Registering a pin for dread or aread sets it to plain INPUT, which clears any pull. Every
856 // button gets its own mode back here, so the order of those calls in setup() does not
857 // matter. Before attach(), which runs the stored script.
858 _forEachLispButton([](uniot::Button *button) {
859 button->applyPinMode();
860 });
861
862 mScheduler.push(app);
863 app.attach();
864 }
865
873 void loop() {
874 mScheduler.loop();
875 }
876
887
896 return mEventBus;
897 }
898
907 return mScheduler;
908 }
909
910 private:
915 template <typename Fn>
916 void _forEachLispButton(Fn fn) {
918 auto count = registers.getRegisterLength(uniot::primitive::name::bclicked);
919 for (size_t i = 0; i < count; i++) {
920 auto button = registers.getObject<uniot::Button>(uniot::primitive::name::bclicked, i);
921 if (button) {
922 fn(button);
923 }
924 }
925 }
926
938 void _createNetworkControllerConfig() {
939 if (!mpNetworkControllerConfig) {
941 mpNetworkControllerConfig->pinBtn = UINT8_MAX; // Not used by default
942 mpNetworkControllerConfig->activeLevelBtn = LOW;
943 mpNetworkControllerConfig->pinLed = UINT8_MAX; // Not used by default
944 mpNetworkControllerConfig->activeLevelLed = HIGH;
945 mpNetworkControllerConfig->maxRebootCount = REBOOT_RESET_DISABLED;
946 mpNetworkControllerConfig->rebootWindowMs = UNIOT_WIFI_REBOOT_WINDOW_MS;
947 mpNetworkControllerConfig->registerLispBtn = true;
948 }
949 }
950
957 void _deleteNetworkControllerConfig() {
958 if (mpNetworkControllerConfig) {
959 mpNetworkControllerConfig.reset(nullptr);
960 }
961 }
962
970 TimerId _generateTimerId() {
971 static TimerId nextId = 1;
972 return nextId++;
973 }
974
982 ListenerId _generateListenerId() {
983 static ListenerId nextId = 1;
984 return nextId++;
985 }
986
987 uniot::TaskScheduler mScheduler;
988 uniot::CoreEventBus mEventBus;
989 uniot::Map<TimerId, uniot::TaskScheduler::TaskPtr> mActiveTimers;
990 uniot::Map<ListenerId, uniot::SharedPointer<uniot::CoreCallbackEventListener>> mActiveListeners;
992 ClearQueue<uniot::SharedPointer<uniot::Button>> mButtons;
993 uniot::TaskScheduler::TaskPtr mpTaskButtons;
994};
995
1003extern UniotCore Uniot;
1004
Main API class for the Uniot IoT platform.
Definition Uniot.h:91
TimerId setImmediate(std::function< void()> callback)
Execute a callback on the next scheduler cycle.
Definition Uniot.h:603
bool cancelTimer(TimerId id)
Cancel an active timer.
Definition Uniot.h:615
void loop()
Process scheduled tasks and events.
Definition Uniot.h:873
int getActiveListenersCount() const
Get the number of active event listeners.
Definition Uniot.h:788
void configUser(const String &user)
Configure user identification.
Definition Uniot.h:209
void addCustomPage(const String &path, const uint8_t *gzData, size_t gzLen, const String &label="", const char *contentType="text/html")
Register a custom gzipped page on the configuration portal.
Definition Uniot.h:232
ListenerId addWifiStatusLedListener(std::function< void(bool)> callback)
Add a WiFi status LED listener.
Definition Uniot.h:818
ListenerId addSystemListener(std::function< void(unsigned int, int)> callback, unsigned int firstTopic, Topics... otherTopics)
Add a system event listener.
Definition Uniot.h:682
void setLispEventInterceptor(uniot::LispEventInterceptor interceptor)
Set event interceptor for Lisp interpreter.
Definition Uniot.h:316
uniot::CoreEventBus & getEventBus()
Get access to the event bus.
Definition Uniot.h:895
TimerId setInterval(std::function< void()> callback, uint32_t intervalMs, short times=0)
Create a repeating timer.
Definition Uniot.h:562
static constexpr uint8_t REBOOT_RESET_DISABLED
Sentinel value for configWiFiResetOnReboot(): disables reboot-reset entirely.
Definition Uniot.h:158
UniotCore()
Construct a new UniotCore instance.
Definition Uniot.h:106
bool isTimerActive(TimerId id)
Check if a timer is currently active.
Definition Uniot.h:635
void registerLispAnalogOutput(uint8_t first, Pins... pins)
Register GPIO pins as analog outputs for Lisp access.
Definition Uniot.h:442
static constexpr TimerId INVALID_TIMER_ID
Invalid timer ID constant.
Definition Uniot.h:96
void addCustomRoute(const String &path, WebRequestMethodComposite method, ArRequestHandlerFunction handler)
Register a custom HTTP route on the configuration portal.
Definition Uniot.h:258
void registerLispDigitalOutput(uint8_t first, Pins... pins)
Register GPIO pins as digital outputs for Lisp access.
Definition Uniot.h:397
void setLispStopHook(uniot::LispStopHook hook)
Set the hook called when a Lisp script stops.
Definition Uniot.h:371
static constexpr ListenerId INVALID_LISTENER_ID
Invalid listener ID constant.
Definition Uniot.h:97
uint32_t ListenerId
Type for event listener identifiers.
Definition Uniot.h:94
uniot::TaskScheduler::TaskPtr createTask(const char *name, uniot::SchedulerTask::SchedulerTaskCallback callback)
Create a named task for custom scheduling.
Definition Uniot.h:665
bool removeSystemListener(ListenerId id)
Remove a system event listener.
Definition Uniot.h:711
void addCustomRoute(const String &path, ArRequestHandlerFunction handler)
Register a custom HTTP GET route on the configuration portal.
Definition Uniot.h:245
void addLispPrimitive(Primitive *primitive)
Add a custom primitive to the Lisp interpreter.
Definition Uniot.h:304
void registerLispAnalogInput(uint8_t first, Pins... pins)
Register GPIO pins as analog inputs for Lisp access.
Definition Uniot.h:429
int addLispButton(uint8_t pin, uint8_t activeLevel=LOW, uint32_t id=FOURCC(_btn), uniot::Button::ButtonCallback callback=nullptr)
Create a button on a pin and expose it to Lisp scripts.
Definition Uniot.h:489
void configWiFiCredentials(const String &ssid, const String &password="")
Configure WiFi network credentials.
Definition Uniot.h:196
void begin(uint32_t eventBusTaskPeriod=10)
Initialize and start the Uniot platform.
Definition Uniot.h:839
uniot::AppKit & getAppKit()
Get access to the application kit.
Definition Uniot.h:884
bool registerLispObject(const String &primitiveName, uniot::RecordPtr link, uint32_t id=FOURCC(____))
Register a generic object with the Lisp interpreter.
Definition Uniot.h:548
bool isSystemListenerActive(ListenerId id)
Check if a system listener is active.
Definition Uniot.h:773
void addMQTTDevice(uniot::MQTTDevice &device)
Register a user-defined MQTT device with the platform.
Definition Uniot.h:275
void emitSystemEvent(unsigned int topic, int message)
Emit a system event.
Definition Uniot.h:800
uniot::TaskScheduler & getScheduler()
Get access to the task scheduler.
Definition Uniot.h:906
void resetLispButtons()
Clear pending clicks and long presses on every Lisp button.
Definition Uniot.h:531
void publishLispEvent(const String &eventID, int32_t value)
Publish an event to the Lisp interpreter.
Definition Uniot.h:384
void configWiFiResetOnReboot(uint8_t maxRebootCount=UNIOT_WIFI_REBOOT_RESET_COUNT, uint32_t rebootWindowMs=UNIOT_WIFI_REBOOT_WINDOW_MS)
Configure automatic WiFi reset on repeated reboots.
Definition Uniot.h:182
void configWiFiResetButton(uint8_t pinBtn, uint8_t activeLevelBtn=LOW, bool registerLispBtn=true)
Configure WiFi reset button.
Definition Uniot.h:122
size_t removeSystemListeners(unsigned int firstTopic, Topics... otherTopics)
Remove all listeners for specific topics.
Definition Uniot.h:734
int getActiveTimersCount() const
Get the number of active timers.
Definition Uniot.h:651
uint32_t TimerId
Type for timer identifiers.
Definition Uniot.h:93
void configWiFiStatusLed(uint8_t pinLed, uint8_t activeLevelLed=HIGH)
Configure WiFi status LED.
Definition Uniot.h:141
void registerLispDigitalInput(uint8_t first, Pins... pins)
Register GPIO pins as digital inputs for Lisp access.
Definition Uniot.h:413
void setLispStartHook(uniot::LispStartHook hook)
Set the hook called when a Lisp script starts.
Definition Uniot.h:337
TimerId setTimeout(std::function< void()> callback, uint32_t timeoutMs)
Create a one-shot timer.
Definition Uniot.h:591
bool registerLispButton(uniot::Button *button, uint32_t id=FOURCC(_btn))
Register a button object with the Lisp interpreter.
Definition Uniot.h:455
void enablePeriodicDateSave(uint32_t periodSeconds=5 *60)
Enable periodic saving of date/time information.
Definition Uniot.h:288
Definition AppKit.h:84
bool setUserId(const String &userId)
Set the user identifier for device association.
Definition AppKit.h:151
MQTTKit & getMQTT()
Get the MQTT communication kit instance.
Definition AppKit.h:117
void setLispStopHook(LispStopHook hook)
Set the hook called when a Lisp script stops.
Definition AppKit.h:366
bool addCustomRoute(const String &path, WebRequestMethodComposite method, ArRequestHandlerFunction handler)
Register a custom HTTP route on the configuration portal.
Definition AppKit.h:184
bool setWiFiCredentials(const String &ssid, const String &password)
Set WiFi network credentials.
Definition AppKit.h:138
bool addCustomPage(const String &path, const uint8_t *gzData, size_t gzLen, const String &label="", const char *contentType="text/html")
Register a custom gzipped page on the configuration portal.
Definition AppKit.h:171
void setLispEventInterceptor(LispEventInterceptor interceptor)
Set event interceptor for Lisp interpreter.
Definition AppKit.h:350
void publishLispEvent(const String &eventID, int32_t value)
Publish an event to the Lisp interpreter.
Definition AppKit.h:379
unLisp & getLisp()
Get the Lisp interpreter instance.
Definition AppKit.h:109
void setLispStartHook(LispStartHook hook)
Set the hook called when a Lisp script starts.
Definition AppKit.h:358
Definition Button.h:58
std::function< void(Button *, Event)> ButtonCallback
Callback function signature for button events.
Definition Button.h:76
bool resetLongPress()
Resets the long press detection flag.
Definition Button.h:137
bool resetClick()
Definition Button.h:125
void applyPinMode()
Resets the click detection flag.
Definition Button.h:121
Definition MQTTDevice.h:37
virtual void syncSubscriptions()=0
Reconstructs subscriptions after reconnection or credential changes.
void addDevice(MQTTDevice &device)
Adds a device to be managed by this MQTT kit.
Definition MQTTKit.h:150
static RegisterManager & getRegisterManager()
Gets the static register manager instance.
Definition PrimitiveExpeditor.h:71
void setDigitalOutput(uint8_t first, Args... args)
Sets one or more pins as digital outputs.
Definition RegisterManager.h:74
void setAnalogInput(uint8_t first, Args... args)
Sets one or more pins as analog inputs.
Definition RegisterManager.h:86
void setDigitalInput(uint8_t first, Args... args)
Sets one or more pins as digital inputs.
Definition RegisterManager.h:62
void setAnalogOutput(uint8_t first, Args... args)
Sets one or more pins as analog outputs.
Definition RegisterManager.h:98
bool link(const String &name, RecordPtr link, uint32_t id=FOURCC(____))
Links an object to a named register.
Definition RegisterManager.h:111
Definition TaskScheduler.h:67
std::function< void(SchedulerTask &, short)> SchedulerTaskCallback
Callback function signature for scheduled tasks.
Definition TaskScheduler.h:75
static Date & getInstance()
Definition Singleton.h:73
Definition TaskScheduler.h:183
unLisp * pushPrimitive(Primitive *primitive)
Add a new primitive function to the Lisp environment.
Definition unLisp.h:329
std::unique_ptr< T > UniquePointer
Type alias for std::unique_ptr with cleaner syntax.
Definition Common.h:305
std::shared_ptr< T > SharedPointer
Type alias for std::shared_ptr with cleaner syntax.
Definition Common.h:313
#define UNIOT_WIFI_REBOOT_WINDOW_MS
How long after boot a reboot still counts towards the reset, in ms.
Definition Common.h:115
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 FOURCC(name)
Creates a FourCC constant from a string literal.
Definition Common.h:260
#define UNIOT_WIFI_REBOOT_RESET_COUNT
Consecutive reboots that reset the stored network configuration.
Definition Common.h:104
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
EventBus< unsigned int, int, Bytes > CoreEventBus
Standard EventBus configuration used throughout the core system.
Definition EventBus.h:211
#define UNIOT_LOG_SET_READY()
Initialize the logging system.
Definition Logger.h:127
#define UNIOT_LOG_ERROR_IF(log_cond, log...)
Conditionally log an ERROR level message Used for critical errors that may prevent normal operation....
Definition Logger.h:281
ObjectRegisterRecord * RecordPtr
Type alias for ObjectRegisterRecord pointers for better readability.
Definition ObjectRegister.h:33
SharedPointer< SchedulerTask > TaskPtr
Shared pointer type for scheduler tasks.
Definition TaskScheduler.h:190
static TaskPtr make(SchedulerTask::SchedulerTaskCallback callback)
Static factory method to create a task with a callback.
Definition TaskScheduler.h:212
std::function< void(LispStartReason)> LispStartHook
Called after the interpreter is built and before the script is evaluated.
Definition LispHelper.h:186
std::function< void(LispStopReason)> LispStopHook
Called before the interpreter is destroyed.
Definition LispHelper.h:192
constexpr const char * bclicked
Primitive for detecting button click events.
Definition DefaultPrimitives.h:80
UniotCore Uniot
Global Uniot platform instance.
Definition Uniot.cpp:20
@ WIFI_STATUS_LED
LED status indicators for network state.
Definition NetworkEvents.h:75
std::function< bool(const LispEvent &event)> LispEventInterceptor
Definition LispDevice.h:41