core must keep sink subscriptions even if there are no sources. when sources come...
authorKevron Rees <tripzero.kev@gmail.com>
Thu, 30 Jan 2014 21:36:30 +0000 (13:36 -0800)
committerKevron Rees <tripzero.kev@gmail.com>
Thu, 30 Jan 2014 21:39:12 +0000 (13:39 -0800)
CMakeLists.txt
ambd/core.cpp
examples/websocketsink2
examples/websocketsource2
plugins/websocket/websocketsource.cpp
plugins/websocketsink/CMakeLists.txt

index f7e20cd..725513d 100644 (file)
@@ -22,7 +22,7 @@ set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PROJECT_NAME}
 
 option(qtmainloop "Use QCoreApplication mainloop " OFF)
 option(websocket_plugin "websocket source and sink plugins" OFF)
-option(websocketsink_plugin "old websocket sink plugin" OFF)
+option(websocketold_plugin "old websocket sink plugin" OFF)
 option(tpms_plugin "TPMS plugin " OFF)
 option(obd2_plugin "OBD-II plugin" OFF)
 option(database_plugin "Database plugins" OFF)
index 077c1f8..6175458 100644 (file)
@@ -244,7 +244,8 @@ bool Core::subscribeToProperty(VehicleProperty::Property property, AbstractSink*
        auto itr = mMasterPropertyList.begin();
        while(itr != mMasterPropertyList.end())
        {
-               if(itr->second == property) {
+               VehicleProperty::Property prop = itr->second;
+               if(prop == property) {
                        AbstractSource* src = itr->first;
                        src->subscribeToPropertyChanges(property);
                        // Move to next source. It will skip all the remaining properties in this source.
@@ -256,8 +257,8 @@ bool Core::subscribeToProperty(VehicleProperty::Property property, AbstractSink*
                }
        }
 
-       if(subscribed)
-               propertySinkMap[property].emplace(sink, std::string(""));
+       //if(subscribed)
+       propertySinkMap[property].emplace(sink, std::string(""));
 
        return subscribed;
 }
@@ -368,7 +369,7 @@ void Core::handleAddSupported(const PropertyList& added, AbstractSource* source)
                // Subscribe to property in a new source if such property was subscribed. This catches newly supported properties in the process.
                //
                // TODO: is this sufficient to:
-               /// Iterate through subscribed properties and resubscribe.  This catches newly supported properties in the process.
+               // Iterate through subscribed properties and resubscribe.  This catches newly supported properties in the process.
                // which was originally located at the end of the setSupported and updateSupported functions? I think it is sufficient.
                if( propertySinkMap.find(property) != propertySinkMap.end()){
                        source->subscribeToPropertyChanges(property);
index 2ecebd4..bff577d 100644 (file)
@@ -3,14 +3,14 @@
                {
                        "name" : "ExampleSouce",
                        "path" : "/usr/lib/automotive-message-broker/examplesourceplugin.so",
-                       "delay" : "6"
+                       "delay" : "1000"
                }
        ],
        "sinks": [
                {
                        "name" : "WebSocketSink",
-                       "path" : "/usr/lib/automotive-message-broker/websocketsinkplugin.so",
-                       "interface" : "lo",
+                       "path" : "/usr/lib/automotive-message-broker/websocketsink.so",
+                       "interface" : "eth1",
                        "ssl" : "false",
                        "port" : "23000",
                        "binaryProtocol" : "false"
index 0c45aaa..cad1a44 100644 (file)
@@ -5,7 +5,7 @@
                        "path" : "/usr/lib/automotive-message-broker/websocketsource.so",
                        "port" : "23000",
                        "ssl" : "false",
-                       "ip" : "127.0.0.1",
+                       "ip" : "192.168.1.40",
                        "binaryProtocol" : "false"
                }
        ],
index 5ac26d3..615af3c 100644 (file)
@@ -463,7 +463,7 @@ static int callback_http_only(libwebsocket_context *context,struct libwebsocket
 }
 void WebSocketSource::setSupported(PropertyList list)
 {
-       DebugOut() <<__SMALLFILE__ << ":" << __LINE__ <<"SET SUPPORTED"<<endl;
+       DebugOut() <<__SMALLFILE__ << ":" << __LINE__ <<" "<< __FUNCTION__ <<endl;
        m_supportedProperties = list;
        m_re->updateSupported(list,PropertyList(),this);
 }
index 998340c..f911069 100644 (file)
@@ -1,4 +1,4 @@
-if(websocketsink_plugin)
+if(websocketold_plugin)
 
 include(CheckIncludeFiles)
 include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs})
@@ -13,4 +13,4 @@ target_link_libraries(websocketsinkplugin amb ${websockets_LIBRARIES} -L${CMAKE_
 
 install(TARGETS websocketsinkplugin LIBRARY DESTINATION lib${LIB_SUFFIX}/automotive-message-broker)
 
-endif(websocketsink_plugin)
+endif(websocketold_plugin)