install(TARGETS bluemonkeyDbModule LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
endif()
+find_package(Qt5DBus)
+
+if(Qt5DBus_FOUND)
+ message(STATUS "enabling dbus bluemonkey module")
+ add_library(bluemonkeyDBusModule MODULE bmdbus.cpp)
+ set_target_properties(bluemonkeyDBusModule PROPERTIES PREFIX "")
+ target_link_libraries(bluemonkeyDBusModule ${link_libraries} amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${QT_LIBRARIES} ${Qt5DBus_LIBRARIES})
+ set(QT_INCLUDE_DIRS ${QT_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
+ install(TARGETS bluemonkeyDBusModule LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
+endif()
+
include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${communi_INCLUDE_DIRS} ${QT_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/plugins/common)
set(bluemonkeyplugin_headers bluemonkey.h authenticate.h)
set_target_properties(bluemonkeyplugin PROPERTIES PREFIX "")
target_link_libraries(bluemonkeyplugin dl amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${QT_LIBRARIES} ${communi_LIBRARIES} amb-plugins-common -L${CMAKE_CURRENT_BINARY_DIR}/plugins/common)
-set(config_files ${CMAKE_CURRENT_SOURCE_DIR}/config.js)
+set(config_files ${CMAKE_CURRENT_BINARY_DIR}/config.js)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.js ${CMAKE_CURRENT_BINARY_DIR}/config.js @ONLY)
install(TARGETS bluemonkeyplugin LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
{
dlclose(module);
}
+
+ engine->deleteLater();
}
file.close();
- DebugOut()<<"evaluating script: "<<script.toStdString()<<endl;
+ DebugOut(7)<<"evaluating script: "<<script.toStdString()<<endl;
QJSValue val = engine->evaluate(script);
if(engine)
engine->deleteLater();
- engine = new QJSEngine(this);
+ engine = new QJSEngine();
QJSValue value = engine->newQObject(this);
engine->globalObject().setProperty("bluemonkey", value);
#ifndef BluemonkeySink_H
#define BluemonkeySink_H
-#include "abstractsource.h"
-#include "ambpluginimpl.h"
+#include <abstractsource.h>
+#include <ambpluginimpl.h>
+#include <uuidhelper.h>
#include <map>
#include <QJsonDocument>
#include <QDateTime>
#include <QJSValue>
-#include "uuidhelper.h"
+#include <QThread>
#include "authenticate.h"
class QJSEngine;
-class ModuleInterface
-{
-public:
- virtual std::map<std::string, QObject*> objects(std::map<string, string> config) = 0;
-};
-
-Q_DECLARE_INTERFACE(ModuleInterface, "org.automotive.bluemonkey.moduleinterface")
-
class Property: public QObject, public AbstractSink
{
Q_OBJECT
Q_PROPERTY(int zone READ zone)
public:
- Property(VehicleProperty::Property, QString srcFilter, AbstractRoutingEngine* re, Zone::Type zone = Zone::None, QObject *parent = 0);
+ Property(VehicleProperty::Property, QString srcFilter, AbstractRoutingEngine * re, Zone::Type zone = Zone::None, QObject * parent = 0);
QString name();
void setType(QString t);
--- /dev/null
+/*
+ Copyright (C) 2012 Intel Corporation
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "bmdbus.h"
+
+#include <QDBusInterface>
+#include <QDBusConnection>
+
+extern "C" std::map<std::string, QObject*> create(std::map<std::string, std::string> config, QObject* parent)
+{
+ std::map<std::string, QObject*> moduleInstances;
+ moduleInstances["dbus"] = new BMDBus(parent);
+ return moduleInstances;
+}
+
+BMDBus::BMDBus(QObject *parent)
+ :QObject(parent)
+{
+
+}
+
+QObject *BMDBus::createInterface(const QString &service, const QString &path, const QString &interface, BMDBus::Connection bus)
+{
+ return new QDBusInterface(service, path, interface, bus == Session ? QDBusConnection::sessionBus() : QDBusConnection::systemBus(), this);
+}
--- /dev/null
+/*
+ Copyright (C) 2012 Intel Corporation
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef BM_DBUS_H_
+#define BM_DBUS_H_
+
+#include <QObject>
+
+class BMDBus : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(Connection)
+
+public:
+
+ enum Connection{
+ System,
+ Session
+ };
+
+ BMDBus(QObject * parent = nullptr);
+
+public Q_SLOTS:
+
+ QObject* createInterface(const QString & service, const QString & path, const QString & interface, Connection bus);
+
+private: ///methods:
+
+
+};
+
+
+#endif
{'AnswerToTheUniverse' : 'AnswerToTheUniverse'}]);
});
+bluemonkey.loadModule("@PLUGIN_INSTALL_PATH@/bluemonkeyDBusModule.so");
+
+if(dbus)
+{
+ var dbusIface = dbus.createInterface("org.freedesktop.DBus", "/", "org.freedesktop.DBus", dbus.Session);
+
+ var reply = dbusIface.GetId();
+
+ bluemonkey.log("org.freedesktop.DBus.GetId() response: " + reply);
+}
+
bluemonkey.createCustomProperty("VehicleSpeed", 10);
bluemonkey.createCustomProperty("EngineSpeed", 5000);
bluemonkey.createCustomProperty("PowertrainTorque", 324);
+/*
+ Copyright (C) 2012 Intel Corporation
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "db.h"
#include <debugout.h>
+/*
+ Copyright (C) 2012 Intel Corporation
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include <QObject>
#include <QSqlDatabase>
#include <QSqlQuery>
+/*
+ Copyright (C) 2012 Intel Corporation
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#include "irccoms.h"
#include <QtDebug>
#include <IrcCommand>
+/*
+ Copyright (C) 2012 Intel Corporation
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
#ifndef COMMUNICATION_H
#define COMMUNICATION_H
#include <QObject>