1 #ifndef MODULEBASEONB_H
2 #define MODULEBASEONB_H
4 #include "tronostools_global.h"
5 #include "ComponentBase.h"
9 #include <QElapsedTimer>
80 m_classInfo[comp->
classID] = comp;
81 m_creators[comp->
classID] = [=](QString name)
85 c->m_instanceName = name;
93 void setIcon(QImage icon);
98 void setIcon(QString filename);
106 void log(QString message);
109 QList<QJsonObject> getClassesInfo()
const;
111 QJsonArray getComponentsConfigList()
const;
113 virtual bool start() = 0;
114 virtual bool isActive() = 0;
115 virtual bool work() = 0;
121 virtual QJsonObject getJsonConfig()
const;
124 QList<ComponentBase*> m_components;
125 QMap<unsigned short, ComponentBase*> m_componentsMap;
126 QList<unsigned long> m_classes;
127 QHash<unsigned long, ComponentBase*> m_classInfo;
128 QHash<unsigned long, std::function<ComponentBase*(QString)> > m_creators;
130 QByteArray m_iconData;
131 QElapsedTimer m_timestampTimer;
133 bool isComponentExists(QString name);
135 void parsePacket(
const ONBPacket &packet);
138 void sendFail(
const ONBPacket &packet);
139 void sendKillComponent(
unsigned short compID);
140 void sendClassList();
143 bool newComponent(
unsigned long classID, QString name);
144 bool deleteComponent(
unsigned short compID);
148 void componentInitialized(QJsonObject config);
152 void componentCreated(
unsigned short id);
155 void sendClassInfoPacket(
const ONBPacket &packet);
159 virtual void sendPacket(
const ONBPacket &packet) = 0;
164 void receivePacket(
const ONBPacket &packet);
167 #endif // MODULEBASE_H
ComponentBase * component(unsigned short id)
Get the component by id.
Definition: ModuleBaseONB.h:103
void declareComponent(T *component)
Declare the ONB component.
Definition: ModuleBaseONB.h:76
The base for the ONB component.
Definition: ComponentBase.h:97
unsigned long classID
ClassID of the component. Class identifier, must be unique. There is classification table (must be so...
Definition: ComponentBase.h:135
The base class for XORDE module.
Definition: ModuleBaseONB.h:59