mirror of
https://github.com/EyeTrackVR/OpenIris.git
synced 2025-11-04 15:39:42 +08:00
Move OTA and Observer to libs
This commit is contained in:
parent
1f823a96ab
commit
2af63b9d7c
47
ESP/lib/Observer/Observer.h
Normal file
47
ESP/lib/Observer/Observer.h
Normal file
@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
#include <set>
|
||||
|
||||
namespace ObserverEvent
|
||||
{
|
||||
enum Event
|
||||
{
|
||||
configLoaded = 1,
|
||||
deviceConfigUpdated = 2,
|
||||
cameraConfigUpdated = 3,
|
||||
networksConfigUpdated = 4,
|
||||
};
|
||||
}
|
||||
|
||||
class IObserver
|
||||
{
|
||||
public:
|
||||
void update(ObserverEvent::Event event){};
|
||||
};
|
||||
|
||||
class ISubject
|
||||
{
|
||||
private:
|
||||
std::set<IObserver *> observers;
|
||||
|
||||
public:
|
||||
void attach(IObserver *observer)
|
||||
{
|
||||
this->observers.insert(observer);
|
||||
}
|
||||
|
||||
void detach(IObserver *observer)
|
||||
{
|
||||
this->observers.erase(observer);
|
||||
}
|
||||
|
||||
void notify(ObserverEvent::Event event)
|
||||
{
|
||||
std::set<IObserver *>::iterator iterator = observers.begin();
|
||||
|
||||
while (iterator != observers.end())
|
||||
{
|
||||
(*iterator)->update(event);
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -27,7 +27,7 @@ build_flags =
|
||||
; -include "file_name.hpp" ; this has been added for future movement to a proper library structure
|
||||
build_unflags = -Os
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_ldf_mode = deep
|
||||
lib_ldf_mode = deep+
|
||||
upload_speed = 921600
|
||||
release_version = 0.0.1 ; increase this value every release build
|
||||
lib_deps =
|
||||
|
||||
Loading…
Reference in New Issue
Block a user