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 "abstractsource.h"
24 #include "ambpluginimpl.h"
30 #include <QJsonDocument>
33 #include "uuidhelper.h"
35 #include "authenticate.h"
42 virtual std::map<std::string, QObject*> objects(std::map<string, string> config) = 0;
45 Q_DECLARE_INTERFACE(ModuleInterface, "org.automotive.bluemonkey.moduleinterface")
47 class Property: public QObject, public AbstractSink
50 Q_PROPERTY(QString type READ type)
51 Q_PROPERTY(QVariant value READ value WRITE setValue)
54 Property(VehicleProperty::Property, QString srcFilter, AbstractRoutingEngine* re, QObject *parent = 0);
57 void setType(QString t);
59 virtual PropertyList subscriptions() { return PropertyList(); }
60 virtual void supportedChanged(const PropertyList &)
62 DebugOut()<<"Bluemonkey Property Supported Changed"<<endl;
65 virtual void propertyChanged(AbstractPropertyType* value);
67 virtual const std::string uuid() { return mUuid; }
70 void setValue(QVariant v);
72 void getHistory(QDateTime begin, QDateTime end, QJSValue cbFunction);
75 void changed(QVariant val);
78 AbstractPropertyType* mValue;
79 const std::string mUuid;
83 class BluemonkeySink : public QObject, public AmbPluginImpl
87 BluemonkeySink(AbstractRoutingEngine* e, map<string, string> config, AbstractSource& parent);
88 virtual PropertyList subscriptions();
89 virtual void supportedChanged(const PropertyList & supportedProperties);
90 virtual void propertyChanged(AbstractPropertyType* value);
91 virtual const std::string uuid() const;
95 virtual int supportedOperations();
97 private: //source privates
99 PropertyList mSupported;
100 std::list<AbstractPropertyType*> propertyValueCache;
105 QObject* subscribeTo(QString str);
106 QObject* subscribeToSource(QString str, QString srcFilter);
108 QStringList sourcesForProperty(QString property);
110 QStringList supportedProperties();
112 bool authenticate(QString pass);
114 void loadConfig(QString str);
116 bool loadModule(QString path);
120 void writeProgram(QString program);
122 void log(QString str);
124 QObject* createTimer();
126 void getHistory(QStringList properties, QDateTime begin, QDateTime end, QJSValue cbFunction);
128 void setSilentMode(bool m)
133 void createCustomProperty(QString name, QJSValue defaultValue);
136 QStringList configsToLoad;
143 #endif // BluemonkeySink_H