+++ /dev/null
-auth.pin = "000"
"sinks": [
{
"name" : "Bluemonkey Sink",
- "path" : "/usr/lib/automotive-message-broker/bluemonkeyplugin.so"
+ "path" : "/usr/lib/automotive-message-broker/bluemonkeyplugin.so",
+ "authSettings" : "/etc/ambd/authSettings.js",
+ "ircSettings" : "/etc/ambd/ircSettings.js",
+ "config" : "/etc/ambd/config.js",
+ "customPrograms" : "/etc/ambd/customPrograms.js"
+
}
]
}
+++ /dev/null
-var speedProperty = bluemonkey.subscribeTo("VehicleSpeed");
-
-bluemonkey.loadConfig("customPrograms.js");
-
-
+++ /dev/null
-var address = "chat.freenode.com"
-var port = 8001
-var proxy = ""
-var username = ""
-var nick = ""
-var pass = ""
-
-
-function ircConnecting() {
- print("connecting to irc");
-}
-
-function ircConnected() {
- print("connected");
- for(var i=0;i<irc.channels.length;i++)
- {
- irc.join(irc.channels[i]);
- }
-}
-
-
-irc.channels = ["#bluemonkey","#linuxice"]
-irc.connected.connect(ircConnected);
-irc.connecting.connect(ircConnecting);
-
-irc.connect(address,port,proxy,username,nick,pass);
set_target_properties(bluemonkeyplugin PROPERTIES PREFIX "")
target_link_libraries(bluemonkeyplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${QT_LIBRARIES} ${communi_LIBRARIES})
-install(TARGETS bluemonkeyplugin LIBRARY DESTINATION lib/automotive-message-broker)
+set(config_files ${CMAKE_CURRENT_SOURCE_DIR}/ircSettings.js
+ ${CMAKE_CURRENT_SOURCE_DIR}/authSettings.js
+ ${CMAKE_CURRENT_SOURCE_DIR}/config.js)
+install(TARGETS bluemonkeyplugin LIBRARY DESTINATION lib/automotive-message-broker)
+install (FILES ${config_files} DESTINATION /etc/ambd)
endif(bluemonkey_plugin)
#include <QSettings>
#include <QtScript>
-Authenticate::Authenticate(QObject *parent) :
+Authenticate::Authenticate(std::map<std::string, std::string> config, QObject *parent) :
QObject(parent)
{
QSettings settings;
QScriptValue eventEngineValue = engine.newQObject(this);
engine.globalObject().setProperty("auth", eventEngineValue);
- QString str = "authSettings.js";
+ QString str = config["authSettings"].c_str();
QFile file(str);
if(!file.open(QIODevice::ReadOnly))
#include <QObject>
#include <QStringList>
+#include <map>
+#include <string>
class Authenticate : public QObject
{
Q_OBJECT
Q_PROPERTY(QString pin READ pin WRITE setPin)
public:
- explicit Authenticate(QObject *parent = 0);
+ explicit Authenticate(std::map<std::string, std::string> config, QObject *parent = 0);
void setPin(QString p) { mPin = p; }
QString pin() { return mPin; }
BluemonkeySink::BluemonkeySink(AbstractRoutingEngine* e, map<string, string> config): QObject(0), AbstractSink(e, config), engine(nullptr)
{
- irc = new IrcCommunication(this);
+ irc = new IrcCommunication(config, this);
reloadEngine();
- auth = new Authenticate(this);
+ auth = new Authenticate(config, this);
connect(irc, &IrcCommunication::message, [&](QString sender, QString prefix, QString codes ) {
QScriptValue value = engine->newQObject(this);
engine->globalObject().setProperty("bluemonkey", value);
- loadConfig("config.js");
+
+
+ loadConfig(configuration["config"].c_str());
}
void BluemonkeySink::writeProgram(QString program)
{
- QFile file("customPrograms.js");
+ QFile file(configuration["customPrograms"].c_str());
file.open(QIODevice::ReadWrite | QIODevice::Append);
#define foreach Q_FOREACH
-IrcCommunication::IrcCommunication(QObject* parent)
+IrcCommunication::IrcCommunication(std::map<std::string, std::string> config, QObject* parent)
:QObject(parent)
{
+
session = new IrcSession(this);
mSsl=false;
QScriptValue eventEngineValue = engine->newQObject(this);
engine->globalObject().setProperty("irc", eventEngineValue);
- QString str = "ircSettings.js";
+ QString str = config["ircSettings"].c_str();
QFile file(str);
if(!file.open(QIODevice::ReadOnly))
{
- qDebug()<<"failed to open config file: "<<str;
+ qDebug()<<"failed to open irc config file: "<<str;
return;
}
#include <QObject>
#include <QVariant>
#include <QStringList>
+#include <map>
#include <IrcSession>
#include <IrcMessage>
Q_PROPERTY(QStringList channels READ channels WRITE setChannels)
Q_PROPERTY(bool ssl WRITE setSsl)
public:
- IrcCommunication(QObject* parent=0);
+ IrcCommunication(std::map<std::string, std::string> config, QObject* parent=0);
QStringList channels() { return mChannels; }
void setChannels(QStringList c) { mChannels = c; }