{
"name" : "Database",
"path" : "/usr/lib/automotive-message-broker/databasesinkplugin.so",
- "properties" : "{ 'properties' : ['VehicleSpeed'] }"
+ "properties" : "{ 'properties' : ['VehicleSpeed'] }",
+ "startOnLoad" : "true"
},
{
"name" : "Example Sink",
propertyType(valueType val) : baseClass(property, val) {} \
};
+#define PROPERTYTYPE1(property, propertyType, baseClass, valueType) \
+ class propertyType : public baseClass { \
+ public: propertyType(): baseClass(#property) {} \
+ propertyType(valueType val) : baseClass(#property, val) {} \
+ };
+
#define PROPERTYTYPEBASIC(property, valueType) \
class property ## Type : public BasicPropertyType<valueType> { \
public: property ## Type(): BasicPropertyType(property) {} \
property ## Type(valueType val) : BasicPropertyType(property, val) {} \
};
+#define PROPERTYTYPEBASIC1(property, valueType) \
+ class property ## Type : public BasicPropertyType<valueType> { \
+ public: property ## Type(): BasicPropertyType("property") {} \
+ property ## Type(valueType val) : BasicPropertyType("property", val) {} \
+ };
+
#define PROPERTYTYPENOVAL(property, propertyType, baseClass) \
class propertyType : public baseClass { \
public: propertyType(): baseClass(property) {} \
mSupported.push_back(DatabaseLoggingProperty);
mSupported.push_back(DatabasePlaybackProperty);
+ /// get supported:
initDb();
- /// get supported:
-
vector<vector<string> > supportedStr = shared->db->select("SELECT DISTINCT key FROM "+tablename);
for(int i=0; i < supportedStr.size(); i++)
mSupported.push_back(supportedStr[i][0]);
}
+ delete shared;
+ shared = NULL;
+
routingEngine->setSupported(supported(), this);
if(config.find("startOnLoad")!= config.end())
if(reply->property == DatabaseFileProperty)
{
- StringPropertyType temp(databaseName);
+ DatabaseFilePropertyType temp(databaseName);
reply->value = &temp;
reply->success = true;
uint playbackMultiplier;
};
+PROPERTYTYPEBASIC1(DatabaseLogging, bool)
+PROPERTYTYPEBASIC1(DatabasePlayback, bool)
+PROPERTYTYPE1(DatabaseFile, DatabaseFilePropertyType, StringPropertyType, std::string)
+
+
class DatabaseSinkManager: public AbstractSinkManager
{
public:
:AbstractSinkManager(engine, config)
{
new DatabaseSink(routingEngine, config);
- VehicleProperty::registerProperty(DatabaseLoggingProperty, [](){return new BasicPropertyType<bool>(false);});
- VehicleProperty::registerProperty(DatabasePlaybackProperty, [](){return new BasicPropertyType<bool>(false);});
-VehicleProperty::registerProperty(DatabaseFileProperty, [](){return new StringPropertyType("out.ogg");});
+ VehicleProperty::registerProperty(DatabaseLoggingProperty, [](){return new DatabaseLoggingType(false);});
+ VehicleProperty::registerProperty(DatabasePlaybackProperty, [](){return new DatabasePlaybackType(false);});
+ VehicleProperty::registerProperty(DatabaseFileProperty, [](){return new DatabaseFilePropertyType("storage");});
}
};
OBD2Source::OBD2Source(AbstractRoutingEngine *re, map<string, string> config)
: AbstractSource(re, config)
{
- bool success = VehicleProperty::registerProperty(Obd2Connected,[](){ return new Obd2ConnectType(false); });
+ bool success = VehicleProperty::registerProperty(Obd2Connected,[](){ return new Obd2ConnectType(Obd2Connected,false); });
if(!success)
{