forked from digitaldex/piMeter_hardware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
29 lines (25 loc) · 820 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <QtCore/QCoreApplication>
#include <QtCore/QCommandLineParser>
#include <QtCore/QCommandLineOption>
#include <QJsonObject>
#include <QThread>
#include <iostream>
#include <bcm2835.h>
#include "spiworker.h"
#include "ringbuffer.h"
#include "WebSocketServer.h"
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
RingBuffer spiDataBuffer;
qint16 port = 8888;
WebSocketServer *server = new WebSocketServer(port, &spiDataBuffer);
QObject::connect(server, &WebSocketServer::closed, &a, &QCoreApplication::quit);
QThread *Thread = new QThread;
spiWorker *worker = new spiWorker(&spiDataBuffer);
worker->moveToThread(Thread);
QObject::connect(Thread, SIGNAL (started()), worker, SLOT (process()));
Thread->start();
return a.exec();
}