1 | /**
|
---|
2 | *
|
---|
3 | * Distributed under the UTC Heudiascy Pacpus License, Version 1.0.
|
---|
4 | * Copyright (c) UTC Heudiasyc 2010 - 2013. All rights reserved.
|
---|
5 | *
|
---|
6 | * See the LICENSE file for more information or a copy at:
|
---|
7 | * http://www.hds.utc.fr/~kurdejma/LICENSE_1_0.txt
|
---|
8 | *
|
---|
9 | */
|
---|
10 |
|
---|
11 | #include <QApplication>
|
---|
12 |
|
---|
13 | #include "ui/pacpusmainwindow.h"
|
---|
14 | #include <Pacpus/kernel/ComponentManager.h>
|
---|
15 | #include <Pacpus/kernel/Log.h>
|
---|
16 |
|
---|
17 | #ifdef WIN32
|
---|
18 | # include <windows.h>
|
---|
19 | # include <mmsystem.h>
|
---|
20 | #endif
|
---|
21 |
|
---|
22 | using namespace pacpus;
|
---|
23 | using namespace std;
|
---|
24 |
|
---|
25 | DECLARE_STATIC_LOGGER("pacpus.core.Sensor");
|
---|
26 |
|
---|
27 | static const string kDefaultXmlConfigFilePath = "PACPUS.xml";
|
---|
28 |
|
---|
29 | int main(int argc, char * argv[])
|
---|
30 | {
|
---|
31 | QApplication app(argc, argv);
|
---|
32 |
|
---|
33 | // faire une boucle pour charger tous les plugins
|
---|
34 | // il faudrait faire une classe supplementaire integree a PacpusLib /home/gdherbom/dev/pacpus/pacpusbase/pacpusbin/trunk/
|
---|
35 | /* QPluginLoader loader("libVelodyneHDL64S2.so");
|
---|
36 | qDebug() << loader.errorString();
|
---|
37 | qDebug() << loader.load();
|
---|
38 | qDebug() << loader.errorString();
|
---|
39 | QObject * plugin = loader.instance();
|
---|
40 |
|
---|
41 | qDebug() << "Loading plugin:" << qobject_cast<PacpusPluginInterface*>(plugin)->name() << "associated to file:" << loader.fileName();
|
---|
42 | qDebug() << loader.errorString();
|
---|
43 | */
|
---|
44 | ComponentManager * mgr = ComponentManager::getInstance();
|
---|
45 | LOG_DEBUG("main : " << mgr);
|
---|
46 |
|
---|
47 | #ifdef WIN32
|
---|
48 | timeBeginPeriod(1);
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | string configFilePath;
|
---|
52 | if (argc > 1) {
|
---|
53 | configFilePath = argv[1];
|
---|
54 | } else {
|
---|
55 | configFilePath = kDefaultXmlConfigFilePath;
|
---|
56 | LOG_WARN("no XML config file specified. Using default: " << configFilePath.c_str());
|
---|
57 | }
|
---|
58 | LOG_INFO("loading file '" << configFilePath.c_str() << "'");
|
---|
59 | mgr->loadComponents(configFilePath.c_str());
|
---|
60 |
|
---|
61 | PacpusMainWindow window;
|
---|
62 | window.show();
|
---|
63 |
|
---|
64 | // save application exit status
|
---|
65 | int exitStatus = app.exec();
|
---|
66 | // stop all components before exiting app
|
---|
67 | mgr->stop();
|
---|
68 |
|
---|
69 | mgr->destroy();
|
---|
70 |
|
---|
71 | #ifdef WIN32
|
---|
72 | timeEndPeriod(1);
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | // return application exit status
|
---|
76 | return exitStatus;
|
---|
77 | }
|
---|