Files
giesCANne/scriptcontainer.h
T
Collin Kidder a3cd14e495 Additional implementation of the new connection scheme. It is now possible to send frames to CANConnection objects indirectly based on registered bus number.
This further abstracts the interface. Things are reasonably stable now for frame reception. Initial work has been done to support frame transmission as well. This is currently less stable but mostly working.
2016-03-27 22:37:02 -04:00

49 lines
1007 B
C++

#ifndef SCRIPTCONTAINER_H
#define SCRIPTCONTAINER_H
#include "can_structs.h"
#include "canfilter.h"
#include <QJSEngine>
#include <QTimer>
#include <qlistwidget.h>
class ScriptContainer : public QObject
{
Q_OBJECT
public:
ScriptContainer();
void gotFrame(const CANFrame &frame);
QString fileName;
QString filePath;
QString scriptText;
public slots:
void compileScript();
void setErrorWidget(QListWidget *list);
void setFilter(QJSValue id, QJSValue mask, QJSValue bus);
void setTickInterval(QJSValue interval);
void clearFilters();
void sendFrame(QJSValue bus, QJSValue id, QJSValue length, QJSValue data);
private slots:
void tick();
signals:
void sendCANFrame(const CANFrame *);
private:
QJSEngine scriptEngine;
QJSValue compiledScript;
QJSValue setupFunction;
QJSValue gotFrameFunction;
QJSValue tickFunction;
QTimer timer;
QListWidget *errorWidget;
QList<CANFilter> filters;
};
#endif // SCRIPTCONTAINER_H