mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-15 13:08:21 +01:00
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
#ifndef __SPROCKET_H__
|
|
#define __SPROCKET_H__
|
|
|
|
#define _TASK_SLEEP_ON_IDLE_RUN
|
|
#define _TASK_STD_FUNCTION
|
|
#define _TASK_PRIORITY
|
|
|
|
#include <TaskSchedulerDeclarations.h>
|
|
//#include <TaskScheduler.h>
|
|
#include <Arduino.h>
|
|
#include <vector>
|
|
#include "FS.h"
|
|
#ifdef ESP32
|
|
#include "SPIFFS.h"
|
|
#endif
|
|
#include "Network.h"
|
|
#include "SprocketConfig.h"
|
|
#include "Plugin.h"
|
|
|
|
using namespace std;
|
|
using namespace std::placeholders;
|
|
|
|
// FIXME move to some global fnc lib
|
|
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(array[0])
|
|
|
|
class Sprocket : public Mediator {
|
|
protected:
|
|
// TODO move scheduler out of Sprocket
|
|
// => see difference between standalone and mesh sprochet usage of scheduler
|
|
Scheduler* scheduler;
|
|
Network network;
|
|
private:
|
|
SprocketMessage currentMessage;
|
|
public:
|
|
SprocketConfig config;
|
|
std::vector<Plugin*> plugins;
|
|
Sprocket();
|
|
Sprocket(SprocketConfig);
|
|
Sprocket* init(SprocketConfig);
|
|
Sprocket* addTask(Task&);
|
|
virtual void loop();
|
|
virtual Sprocket* activate();
|
|
virtual Sprocket* activate(Scheduler*) { return this; };
|
|
virtual void dispatch( uint32_t from, String &msg );
|
|
|
|
void addPlugin(Plugin* p);
|
|
void activatePlugins(Scheduler* scheduler);
|
|
};
|
|
|
|
#endif |