datastreamserver.h
Go to the documentation of this file.
1 /*DataStreamServer PlotJuggler Plugin license(Faircode)
2 
3 Copyright(C) 2018 Philippe Gauthier - ISIR - UPMC
4 Permission is hereby granted to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies("Use") of the Software, and to permit persons to whom the Software is furnished to do so.
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7 */
8 #ifndef DATASTREAMSERVER_H
9 #define DATASTREAMSERVER_H
10 
11 #include <QWebSocketServer>
12 #include <QWebSocket>
13 #include <QList>
14 
15 #include <QtPlugin>
16 #include <thread>
18 
19 
21 {
22  Q_OBJECT
23  Q_PLUGIN_METADATA(IID "fr.upmc.isir.stech.plotjugglerplugins.DataStreamerServer")
24  Q_INTERFACES(DataStreamer)
25 
26 public:
27 
29 
30  virtual bool start(QStringList*) override;
31 
32  virtual void shutdown() override;
33 
34  virtual bool isRunning() const override { return _running; }
35 
36  virtual ~DataStreamServer();
37 
38  virtual const char* name() const override { return "WebSocket Server"; }
39 
40  virtual bool isDebugPlugin() override { return false; }
41 
42 private:
43  quint16 _port;
44  QList<QWebSocket *> _clients;
45  QWebSocketServer _server;
46 
47  bool _running;
48 
49 private slots:
50  void onNewConnection();
51  void processMessage(QString message);
52  void socketDisconnected();
53 };
54 
55 #endif // DATASTREAMSERVER_H
QWebSocketServer _server
virtual void shutdown() override
void processMessage(QString message)
virtual bool isRunning() const override
virtual bool isDebugPlugin() override
virtual ~DataStreamServer()
QList< QWebSocket * > _clients
virtual const char * name() const override
The DataStreamer base class to create your own plugin.
virtual bool start(QStringList *) override


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17