Example #1
0
MsgBufferModel::MsgBufferModel(QObject *parent)
	:QAbstractTableModel(parent)
{
	/* Object Variables. */
	lastValue = 0;



	/* GUI Refresh. */
	timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), this, SLOT(timerHit()));
	timer->start(1000);

	/* Monitor Threads. */
	QThread *threadx = new QThread;
	Monitor *monitor = new Monitor;

	connect(monitor, SIGNAL(messageInBuffer(canMessage*)), this, SLOT(newMsg(canMessage*)));
	connect(this, SIGNAL(start()), monitor, SLOT(start()));
	connect(this, SIGNAL(stop()), monitor, SLOT(stop()));
	monitor->moveToThread(threadx);
	threadx->start();

	emit start();
}