-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
46 lines (46 loc) · 1.46 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "Face.h"
#include "Logger.h"
#include "WebsocketServer.h"
#include <QApplication>
#include <QSqlDatabase>
#include <QCommandLineParser>
#include <QCommandLineOption>
#if _WIN32
void wiringPiSetup(){}
#else
#include <wiringPi.h>
#endif
//#include <Beeper.h>
int main(int argc, char *argv[]){
QApplication app(argc, argv);
app.setApplicationDisplayName("RPi-BigFace");
app.setApplicationName("RPi-BigFace");
app.setApplicationVersion("v2.0");
//Parse command line parameters and prepare the parameters
QCommandLineParser cmdParser;
cmdParser.addVersionOption();
cmdParser.addHelpOption();
QCommandLineOption verbose("verbose","Set if show all logs.");
cmdParser.addOption(verbose);
QCommandLineOption dbpath("dbpath","Set temporary database path.","dbpath",qApp->applicationDirPath()+"/Face.db");
cmdParser.addOption(dbpath);
cmdParser.process(app);
//Prepare SQLite Database
QSqlDatabase defaultDatabase=QSqlDatabase::addDatabase("QSQLITE");
defaultDatabase.setDatabaseName(cmdParser.value(dbpath));
defaultDatabase.open();
//Install the Message Handler
Logger::verbose=cmdParser.isSet(verbose);
qInstallMessageHandler(Logger::messageHandler);
qInfo()<<"程序启动正常";
//WiringPi
wiringPiSetup();
//Instance EventServer
EventServer::instance();
//Instance WebSocket Server
WebsocketServer::instance();
//Instance Face
Face w;
w.show();
return app.exec();
}