1 #ifndef COMPONENTBASE_H
2 #define COMPONENTBASE_H
11 #include <QElapsedTimer>
12 #include "Protocol/onbobject.h"
13 #include "Protocol/ONBPacket.h"
14 #include "tronostools_global.h"
106 ComponentBase(QString name,
unsigned long classId, QString description = QString(), QObject *parent =
nullptr);
114 unsigned short id()
const {
return m_id;}
120 unsigned long timestamp()
const;
123 QJsonObject getJsonConfig()
const;
129 void objectChanged(QString name);
135 unsigned long classID = 0;
139 unsigned long serialNumber = 0;
149 unsigned long burnCount = 0;
154 void setIcon(QImage icon);
159 void setIcon(QString filename);
220 ObjectInfo *obj = m_objectMap.value(name,
nullptr);
223 if (obj->rebind(var))
236 bool renameObject(QString oldName, QString newName);
242 bool deleteObject(QString name);
247 void sendObject(QString name);
255 void touchOutput(QString name,
bool notifyAnyway =
false);
289 void log(QString message);
293 unsigned short m_id = 0;
295 QList<ObjectInfo*> m_objects;
297 QMap<QString, ObjectInfo*> m_objectMap;
299 QList<ObjectInfo*> m_svcObjects;
301 unsigned char m_objectCount;
304 QMap<unsigned char, QTimer*> m_autoSendTimers;
309 void parseServiceMessage(
unsigned char oid,
const QByteArray &data);
310 void parseGlobalServiceMessage(
unsigned char aid);
311 void parseMessage(
unsigned char oid,
const QByteArray &data);
312 void sendServiceMessage(
unsigned char oid,
const QByteArray &data = QByteArray());
313 void sendMessage(
unsigned char oid,
const QByteArray &data);
315 void sendSvcObject(
unsigned char oid);
316 void sendObjectInfo(
unsigned char oid);
319 void setId(
unsigned short id) {m_id = id;}
321 bool m_created =
false;
322 QString m_instanceName =
"";
323 unsigned short m_version = 0;
324 unsigned char m_busType = 0;
325 QByteArray m_iconData;
329 QElapsedTimer *m_timestampTimer =
nullptr;
332 void receiveData(
const ONBPacket &packet);
336 void newData(
const ONBPacket &packet);
341 #endif // COMPONENTBASE_H
Output is volatile.
Definition: ObjectInfo.h:37
ONBObject< T > & createInput(QString name, T &var)
Create an input of the component.
Definition: ComponentBase.h:168
bool rebindObject(QString name, T &var)
Rebind the existing object to another variable.
Definition: ComponentBase.h:218
virtual void objectRequestEvent(QString name)
Event of object request.
Definition: ComponentBase.h:273
The base for the ONB component.
Definition: ComponentBase.h:97
ONBObject< T > & createSetting(QString name, T &var)
Create a setting of the component.
Definition: ComponentBase.h:196
const ObjectDescription & description() const
Get description of the object.
Definition: ObjectInfo.h:299
QString releaseInfo
This field can be filled with arbitrary information about component release (e.g. build date and time...
Definition: ComponentBase.h:145
ONBObject< T > & createOutput(QString name, T &var)
Create an ouput of the component.
Definition: ComponentBase.h:182
virtual void onCreate()
Component creation event.
Definition: ComponentBase.h:260
Component-side ONB Object.
Definition: ObjectInfo.h:9
unsigned char & versionMinor
Minor version of the component.
Definition: ComponentBase.h:143
The base class for XORDE module.
Definition: ModuleBaseONB.h:59
virtual void objectChangeEvent(QString name)
Event of object change.
Definition: ComponentBase.h:286
Object with read-write access, its value stored in NVM.
Definition: ObjectInfo.h:39
ONB Object base interface.
Definition: ObjectInfo.h:16
virtual void objectReceiveEvent(QString name)
Event of object receive.
Definition: ComponentBase.h:280
QString componentName
The name of the component. Used to name the type, must be unique.
Definition: ComponentBase.h:133
QString hardwareInfo
This field commonly used in devices. Can contain CPU description or something else about hardware...
Definition: ComponentBase.h:147
unsigned short id() const
Get componentID of the component.
Definition: ComponentBase.h:114
Input is volatile object that can oly be written.
Definition: ObjectInfo.h:36
QString description
Human-readable description for the help.
Definition: ComponentBase.h:137
virtual void onDestroy()
Component deletion event.
Definition: ComponentBase.h:265
unsigned char & version
Major version of the component.
Definition: ComponentBase.h:141