[bluemonkey] - new libbm, ble module
[profile/ivi/automotive-message-broker.git] / plugins / bluemonkey / bluemonkey.h
1 /*
2         Copyright (C) 2012  Intel Corporation
3
4         This library is free software; you can redistribute it and/or
5         modify it under the terms of the GNU Lesser General Public
6         License as published by the Free Software Foundation; either
7         version 2.1 of the License, or (at your option) any later version.
8
9         This library is distributed in the hope that it will be useful,
10         but WITHOUT ANY WARRANTY; without even the implied warranty of
11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12         Lesser General Public License for more details.
13
14         You should have received a copy of the GNU Lesser General Public
15         License along with this library; if not, write to the Free Software
16         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19
20 #ifndef Bluemonkey_H
21 #define Bluemonkey_H
22
23 #include <map>
24
25 #include <QObject>
26 #include <QVariant>
27 #include <QJsonDocument>
28 #include <QDateTime>
29 #include <QJSValue>
30
31 #include "authenticate.h"
32
33 class QJSEngine;
34
35 class Bluemonkey : public QObject
36 {
37         Q_OBJECT
38 public:
39         Bluemonkey(std::map<std::string, std::string> config = std::map<std::string, std::string>(), QObject* parent = nullptr);
40         ~Bluemonkey();
41
42         bool loadModule(const QString &name, QObject* module);
43
44 public Q_SLOTS:
45         void assertIsTrue(bool isTrue, const QString &msg="");
46
47         void loadConfig(QString str);
48
49         bool loadModule(QString path);
50
51         void reloadEngine();
52
53         void writeProgram(QString program);
54
55         void log(QString str);
56
57         QObject* createTimer();
58         QObject* createQObject();
59
60 Q_SIGNALS:
61
62         void ready();
63
64 private:
65         QList<void*> modules;
66         QJSEngine* engine;
67         QStringList configsToLoad;
68         std::map<std::string, std::string> configuration;
69 };
70
71 #endif // Bluemonkey_H