2 Copyright (C) 2012 Intel Corporation
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.
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.
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
20 #ifndef BluemonkeySink_H
21 #define BluemonkeySink_H
23 #include "abstractsink.h"
26 #include <QJsonDocument>
27 #include "uuidhelper.h"
29 #include "authenticate.h"
31 class IrcCommunication;
34 class Property: public QObject, public AbstractSink
37 Q_PROPERTY(QString type READ type)
38 Q_PROPERTY(QVariant value READ value WRITE setValue)
41 Property(VehicleProperty::Property, QString srcFilter, AbstractRoutingEngine* re, QObject *parent = 0);
44 void setType(QString t);
46 virtual PropertyList subscriptions() { return PropertyList(); }
47 virtual void supportedChanged(PropertyList ){ }
49 virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid);
51 virtual std::string uuid() { return amb::createUuid(); }
54 void setValue(QVariant v);
58 void changed(QVariant val);
61 AbstractPropertyType* mValue;
65 class BluemonkeySink : public QObject, public AbstractSink
69 BluemonkeySink(AbstractRoutingEngine* e, map<string, string> config);
70 virtual PropertyList subscriptions();
71 virtual void supportedChanged(PropertyList supportedProperties);
72 virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid);
73 virtual std::string uuid();
77 QObject* subscribeTo(QString str);
78 QObject* subscribeTo(QString str, QString srcFilter);
80 QStringList sourcesForProperty(QString property);
82 bool authenticate(QString pass);
84 void loadConfig(QString str);
88 void writeProgram(QString program);
90 void log(QString str);
92 private Q_SLOTS: /// methods:
94 void loadConfigPriv();
97 QStringList configsToLoad;
98 IrcCommunication* irc;
99 QScriptEngine* engine;
103 class BluemonkeySinkManager: public AbstractSinkManager
106 BluemonkeySinkManager(AbstractRoutingEngine* engine, map<string, string> config)
107 :AbstractSinkManager(engine, config)
109 new BluemonkeySink(routingEngine, config);
113 #endif // BluemonkeySink_H