apply dynamic path to other Find methods. add dbus plugin documents. change default...
authorKevron Rees <tripzero.kev@gmail.com>
Fri, 10 Jan 2014 00:19:16 +0000 (16:19 -0800)
committerKevron Rees <tripzero.kev@gmail.com>
Fri, 10 Jan 2014 00:19:16 +0000 (16:19 -0800)
examples/websocketsink2
examples/websocketsource2
plugins/dbus/README [new file with mode: 0644]
plugins/dbus/automotivemanager.cpp
plugins/dbus/dbusplugin.cpp

index 2f95e47..2ecebd4 100644 (file)
@@ -13,7 +13,7 @@
                        "interface" : "lo",
                        "ssl" : "false",
                        "port" : "23000",
-                       "binaryProtocol" : "true"
+                       "binaryProtocol" : "false"
                } 
        ]
 }
index 25a8088..0c45aaa 100644 (file)
@@ -2,11 +2,11 @@
        "sources" : [ 
                {
                        "name" : "WebsocketSource",
-                       "path" : "/usr/lib/automotive-message-broker/websocketsourceplugin.so",
+                       "path" : "/usr/lib/automotive-message-broker/websocketsource.so",
                        "port" : "23000",
                        "ssl" : "false",
                        "ip" : "127.0.0.1",
-                       "binaryProtocol" : "true"
+                       "binaryProtocol" : "false"
                }
        ],
        "sinks": [
diff --git a/plugins/dbus/README b/plugins/dbus/README
new file mode 100644 (file)
index 0000000..b8d3b03
--- /dev/null
@@ -0,0 +1,25 @@
+DBus plugin
+
+This plugin provides a nice DBus API to application who want access to AMB data.
+
+To use the DBus plugin, add the following to the "sinks" array in /etc/ambd/config:
+
+{
+       "name" : "dbussink",
+       "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so",
+       "frequency" : "60"
+}
+
+Configuration Key Definitions:
+
+"name"
+name of plugin.  This key is not used by the plugin at this moment.
+
+"path"
+path to plugin on the filesystem.
+
+"frequency"
+Frequency in Hz which AMB will fire dbus signals.  AMB will fire the most recent values at this rate.
+
+Default: 60
+
index a435d70..b5fb149 100644 (file)
@@ -141,8 +141,20 @@ static void handleMethodCall(GDBusConnection       *connection,
                for(auto itr = interfaces.begin(); itr != interfaces.end(); itr++)
                {
                        AbstractDBusInterface* t = *itr;
+
                        if(t->zone() == (Zone::Type)zone)
                        {
+                               if(!t->isRegistered())
+                                       t->registerObject();
+
+                               std::list<std::string> processes = manager->subscribedProcesses[t];
+
+                               if(!contains(processes,sender))
+                               {
+                                       DebugOut()<<"Referencing "<<t->objectPath()<<" with sender: "<<sender<<endl;
+                                       manager->subscribedProcesses[t].push_back(sender);
+                               }
+
                                g_dbus_method_invocation_return_value(invocation,g_variant_new("(o)", t->objectPath().c_str()));
                                return;
                        }
@@ -283,6 +295,17 @@ static void handleMethodCall(GDBusConnection       *connection,
                        boost::algorithm::erase_all(targetSource, "-");
                        if(t->zone() == (Zone::Type)zone && source == targetSource)
                        {
+                               if(!t->isRegistered())
+                                       t->registerObject();
+
+                               std::list<std::string> processes = manager->subscribedProcesses[t];
+
+                               if(!contains(processes,sender))
+                               {
+                                       DebugOut()<<"Referencing "<<t->objectPath()<<" with sender: "<<sender<<endl;
+                                       manager->subscribedProcesses[t].push_back(sender);
+                               }
+
                                g_dbus_method_invocation_return_value(invocation,g_variant_new("(o)", t->objectPath().c_str()));
                                return;
                        }
index 9547072..7fa31c1 100644 (file)
@@ -35,7 +35,7 @@ DBusSink::DBusSink(string propertyName, AbstractRoutingEngine* engine, GDBusConn
 {
        AbstractDBusInterface::re = engine;
 
-       int timeout = 50;
+       int timeout = 60;
 
        if(config.find("frequency") != config.end())
        {