forked from xiaozhi/xiaozhi-esp32
add iot framework
This commit is contained in:
41
main/iot/thing_manager.h
Normal file
41
main/iot/thing_manager.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef THING_MANAGER_H
|
||||
#define THING_MANAGER_H
|
||||
|
||||
|
||||
#include "thing.h"
|
||||
|
||||
#include <cJSON.h>
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
|
||||
namespace iot {
|
||||
|
||||
class ThingManager {
|
||||
public:
|
||||
static ThingManager& GetInstance() {
|
||||
static ThingManager instance;
|
||||
return instance;
|
||||
}
|
||||
ThingManager(const ThingManager&) = delete;
|
||||
ThingManager& operator=(const ThingManager&) = delete;
|
||||
|
||||
void AddThing(Thing* thing);
|
||||
|
||||
std::string GetDescriptorsJson();
|
||||
std::string GetStatesJson();
|
||||
void Invoke(const cJSON* command);
|
||||
|
||||
private:
|
||||
ThingManager() = default;
|
||||
~ThingManager() = default;
|
||||
|
||||
std::vector<Thing*> things_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace iot
|
||||
|
||||
#endif // THING_MANAGER_H
|
||||
Reference in New Issue
Block a user