Name change for tcpsink to be websocketsink
authorMichael Carpenter <malcom2073@gmail.com>
Wed, 22 Aug 2012 00:59:10 +0000 (20:59 -0400)
committerMichael Carpenter <malcom2073@gmail.com>
Wed, 22 Aug 2012 00:59:10 +0000 (20:59 -0400)
14 files changed:
config
plugins/CMakeLists.txt
plugins/tcpsink/CMakeLists.txt [deleted file]
plugins/tcpsink/tcpsinkmanager.h [deleted file]
plugins/tcpsink/tcpsinkplugin.cpp [deleted file]
plugins/tcpsink/tcpsinkplugin.h [deleted file]
plugins/websocketsink/CMakeLists.txt [new file with mode: 0644]
plugins/websocketsink/test/api.js [moved from plugins/tcpsink/test/api.js with 100% similarity]
plugins/websocketsink/test/index.html [moved from plugins/tcpsink/test/index.html with 100% similarity]
plugins/websocketsink/test/style.css [moved from plugins/tcpsink/test/style.css with 100% similarity]
plugins/websocketsink/websocketsink.cpp [new file with mode: 0644]
plugins/websocketsink/websocketsink.h [new file with mode: 0644]
plugins/websocketsink/websocketsinkmanager.cpp [moved from plugins/tcpsink/tcpsinkmanager.cpp with 86% similarity]
plugins/websocketsink/websocketsinkmanager.h [new file with mode: 0644]

diff --git a/config b/config
index 461861d..44830c7 100644 (file)
--- a/config
+++ b/config
@@ -1,5 +1,5 @@
 {
        "sources" : [ "../plugins/examplesourceplugin.so" ],
-       "sinks": [ "../plugins/examplesinkplugin.so", "../plugins/dbus/dbussinkplugin.so" ,"../plugins/tcpsink/tcpsinkplugin.so" ]
+       "sinks": [ "../plugins/examplesinkplugin.so", "../plugins/dbus/dbussinkplugin.so" ,"../plugins/tcpsink/websocketsinkplugin.so" ]
 }
 
index 8a19304..484e6ad 100644 (file)
@@ -18,4 +18,4 @@ target_link_libraries(examplesinkplugin -lamb -L${CMAKE_CURRENT_BINARY_DIR}/lib
 
 add_subdirectory(wheel)
 add_subdirectory(dbus)
-add_subdirectory(tcpsink)
\ No newline at end of file
+add_subdirectory(websocketsink)
diff --git a/plugins/tcpsink/CMakeLists.txt b/plugins/tcpsink/CMakeLists.txt
deleted file mode 100644 (file)
index d26ef66..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-
-include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs})
-
-set(tcpsinkplugin_headers tcpsinkplugin.h)
-set(tcpsinkplugin_sources tcpsinkmanager.cpp tcpsinkplugin.cpp)
-add_library(tcpsinkplugin MODULE ${tcpsinkplugin_sources})
-set_target_properties(tcpsinkplugin PROPERTIES PREFIX "")
-target_link_libraries(tcpsinkplugin -lamb -lwebsockets  -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries})
\ No newline at end of file
diff --git a/plugins/tcpsink/tcpsinkmanager.h b/plugins/tcpsink/tcpsinkmanager.h
deleted file mode 100644 (file)
index 8e31de4..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-    <one line to give the library's name and an idea of what it does.>
-    Copyright (C) 2012  Michael Carpenter <email>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-
-#ifndef TCPSINKMANAGER_H
-#define TCPSINKMANAGER_H
-
-#include <abstractroutingengine.h>
-#include <abstractsink.h>
-#include <gio/gio.h>
-#include <libwebsockets.h>
-
-class TcpSinkManager: public AbstractSinkManager
-{
-public:
-       TcpSinkManager(AbstractRoutingEngine* engine);
-       void addSink(libwebsocket *socket,VehicleProperty::Property property);
-private:
-  AbstractRoutingEngine *m_engine;
-       struct libwebsocket_protocols protocollist[2];
-};
-
-#endif // TCPSINKMANAGER_H
diff --git a/plugins/tcpsink/tcpsinkplugin.cpp b/plugins/tcpsink/tcpsinkplugin.cpp
deleted file mode 100644 (file)
index 11bd8db..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-    <one line to give the library's name and an idea of what it does.>
-    Copyright (C) 2012  Michael Carpenter <email>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-
-#include "tcpsinkplugin.h"
-#include <glib.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-
-
-
-TcpSinkPlugin::TcpSinkPlugin(AbstractRoutingEngine* re) : AbstractSink(re)
-{
-
-}
-string TcpSinkPlugin::uuid()
-{
-       return "e43f6cad-60e3-4454-9638-01ffa9ab8c8f";
-}
-void TcpSinkPlugin::propertyChanged(VehicleProperty::Property property, boost::any value, string  uuid)
-{
-}
-void TcpSinkPlugin::supportedChanged(PropertyList supportedProperties)
-{
-}
-PropertyList TcpSinkPlugin::subscriptions()
-{
-       return PropertyList();
-} 
-
diff --git a/plugins/tcpsink/tcpsinkplugin.h b/plugins/tcpsink/tcpsinkplugin.h
deleted file mode 100644 (file)
index d53a514..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-    <one line to give the library's name and an idea of what it does.>
-    Copyright (C) 2012  Michael Carpenter <email>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-
-#ifndef TCPSINKPLUGIN_H
-#define TCPSINKPLUGIN_H
-#include <glib.h>
-#include <abstractroutingengine.h>
-#include "abstractsink.h"
-class TcpSinkPlugin : public AbstractSink
-{
-
-public:
-       TcpSinkPlugin(AbstractRoutingEngine* re);
-       string uuid() ;
-       void propertyChanged(VehicleProperty::Property property, boost::any value, string  uuid);
-       void supportedChanged(PropertyList supportedProperties);
-       PropertyList subscriptions();
-
-};
-
-#endif // TCPSINKPLUGIN_H
diff --git a/plugins/websocketsink/CMakeLists.txt b/plugins/websocketsink/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2aac74c
--- /dev/null
@@ -0,0 +1,8 @@
+
+include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs})
+
+set(websocketsinkplugin_headers websocketsink.h websocketmanager.h)
+set(websocketsinkplugin_sources websocketsinkmanager.cpp websocketsink.cpp)
+add_library(websocketsinkplugin MODULE ${websocketsinkplugin_sources})
+set_target_properties(websocketsinkplugin PROPERTIES PREFIX "")
+target_link_libraries(websocketsinkplugin -lamb -lwebsockets  -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries})
diff --git a/plugins/websocketsink/websocketsink.cpp b/plugins/websocketsink/websocketsink.cpp
new file mode 100644 (file)
index 0000000..587392a
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+       Copyright (C) 2012  Intel Corporation
+
+       This library is free software; you can redistribute it and/or
+       modify it under the terms of the GNU Lesser General Public
+       License as published by the Free Software Foundation; either
+       version 2.1 of the License, or (at your option) any later version.
+
+       This library is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+       Lesser General Public License for more details.
+
+       You should have received a copy of the GNU Lesser General Public
+       License along with this library; if not, write to the Free Software
+       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+
+#include "websocketsink.h"
+#include <glib.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+
+
+WebSocketSink::WebSocketSink(AbstractRoutingEngine* re) : AbstractSink(re)
+{
+
+}
+string WebSocketSink::uuid()
+{
+       return "e43f6cad-60e3-4454-9638-01ffa9ab8c8f";
+}
+void WebSocketSink::propertyChanged(VehicleProperty::Property property, boost::any value, string  uuid)
+{
+}
+void WebSocketSink::supportedChanged(PropertyList supportedProperties)
+{
+}
+PropertyList WebSocketSink::subscriptions()
+{
+       return PropertyList();
+} 
+
diff --git a/plugins/websocketsink/websocketsink.h b/plugins/websocketsink/websocketsink.h
new file mode 100644 (file)
index 0000000..6fb2cdc
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+       Copyright (C) 2012  Intel Corporation
+
+       This library is free software; you can redistribute it and/or
+       modify it under the terms of the GNU Lesser General Public
+       License as published by the Free Software Foundation; either
+       version 2.1 of the License, or (at your option) any later version.
+
+       This library is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+       Lesser General Public License for more details.
+
+       You should have received a copy of the GNU Lesser General Public
+       License along with this library; if not, write to the Free Software
+       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+
+#ifndef WEBSOCKETSINK_H
+#define WEBSOCKETSINK_H
+#include <glib.h>
+#include <abstractroutingengine.h>
+#include "abstractsink.h"
+class WebSocketSink : public AbstractSink
+{
+
+public:
+       WebSocketSink(AbstractRoutingEngine* re);
+       string uuid() ;
+       void propertyChanged(VehicleProperty::Property property, boost::any value, string  uuid);
+       void supportedChanged(PropertyList supportedProperties);
+       PropertyList subscriptions();
+
+};
+
+#endif // WEBSOCKETSINK_H
similarity index 86%
rename from plugins/tcpsink/tcpsinkmanager.cpp
rename to plugins/websocketsink/websocketsinkmanager.cpp
index 7d46764..0dc9912 100644 (file)
@@ -1,24 +1,23 @@
 /*
-    <one line to give the library's name and an idea of what it does.>
-    Copyright (C) 2012  Michael Carpenter <email>
+       Copyright (C) 2012  Intel Corporation
 
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
+       This library is free software; you can redistribute it and/or
+       modify it under the terms of the GNU Lesser General Public
+       License as published by the Free Software Foundation; either
+       version 2.1 of the License, or (at your option) any later version.
 
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
+       This library is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+       Lesser General Public License for more details.
 
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+       You should have received a copy of the GNU Lesser General Public
+       License along with this library; if not, write to the Free Software
+       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
 
-#include "tcpsinkmanager.h"
+#include "websocketsinkmanager.h"
 #include <sstream>
 #include <json-glib/json-glib.h>
 
 struct pollfd pollfds[100];
 int count_pollfds = 0;
 libwebsocket_context *context;
-TcpSinkManager *sinkManager;
+WebSocketSinkManager *sinkManager;
 static int websocket_callback(struct libwebsocket_context *context,struct libwebsocket *wsi,enum libwebsocket_callback_reasons reason, void *user,void *in, size_t len);
 bool gioPollingFunc(GIOChannel *source,GIOCondition condition,gpointer data);
 
 
 
-TcpSinkManager::TcpSinkManager(AbstractRoutingEngine* engine):AbstractSinkManager(engine)
+WebSocketSinkManager::WebSocketSinkManager(AbstractRoutingEngine* engine):AbstractSinkManager(engine)
 {
        m_engine = engine;
        
@@ -50,7 +49,7 @@ TcpSinkManager::TcpSinkManager(AbstractRoutingEngine* engine):AbstractSinkManage
        //Create a listening socket on port 23000 on localhost.
        context = libwebsocket_create_context(port, interface, protocollist,libwebsocket_internal_extensions,ssl_cert_path, ssl_key_path, -1, -1, options);
 }
-void TcpSinkManager::addSink(libwebsocket* socket, VehicleProperty::Property property)
+void WebSocketSinkManager::addSink(libwebsocket* socket, VehicleProperty::Property property)
 {
        AsyncPropertyRequest velocityRequest;
        velocityRequest.property = VehicleProperty::VehicleSpeed;
@@ -80,7 +79,7 @@ void TcpSinkManager::addSink(libwebsocket* socket, VehicleProperty::Property pro
 
 extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine)
 {
-       sinkManager = new TcpSinkManager(routingengine);
+       sinkManager = new WebSocketSinkManager(routingengine);
        return sinkManager;
 }
 static int websocket_callback(struct libwebsocket_context *context,struct libwebsocket *wsi,enum libwebsocket_callback_reasons reason, void *user,void *in, size_t len)
diff --git a/plugins/websocketsink/websocketsinkmanager.h b/plugins/websocketsink/websocketsinkmanager.h
new file mode 100644 (file)
index 0000000..ae5f9ef
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+       Copyright (C) 2012  Intel Corporation
+
+       This library is free software; you can redistribute it and/or
+       modify it under the terms of the GNU Lesser General Public
+       License as published by the Free Software Foundation; either
+       version 2.1 of the License, or (at your option) any later version.
+
+       This library is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+       Lesser General Public License for more details.
+
+       You should have received a copy of the GNU Lesser General Public
+       License along with this library; if not, write to the Free Software
+       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef WEBSOCKETSINKMANAGER_H
+#define WEBSOCKETSINKMANAGER_H
+
+#include <abstractroutingengine.h>
+#include <abstractsink.h>
+#include <gio/gio.h>
+#include <libwebsockets.h>
+
+class WebSocketSinkManager: public AbstractSinkManager
+{
+public:
+       WebSocketSinkManager(AbstractRoutingEngine* engine);
+       void addSink(libwebsocket *socket,VehicleProperty::Property property);
+private:
+  AbstractRoutingEngine *m_engine;
+       struct libwebsocket_protocols protocollist[2];
+};
+
+#endif // WEBSOCKETSINKMANAGER_H