Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
Enumerator
a
b
c
d
f
g
h
i
l
m
n
o
p
r
s
t
u
v
x
y
Classes
Class List
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
w
x
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Properties
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
i
m
o
q
r
s
v
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
b
c
d
e
f
h
k
l
o
p
r
s
t
u
x
z
Enumerator
b
c
d
f
h
i
k
l
n
o
p
r
s
t
u
v
w
x
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
plotjuggler_plugins
DataStreamWebsocket
websocket_server.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
5
associated documentation files(the "Software"), to deal in the Software without
6
restriction, including without limitation the rights to use, copy, modify, merge, publish,
7
distribute, sublicense, and / or sell copies("Use") of the Software, and to permit persons
8
to whom the Software is furnished to do so. The above copyright notice and this permission
9
notice shall be included in all copies or substantial portions of the Software. THE
10
SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
11
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
12
NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
13
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
14
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
15
THE SOFTWARE.
16
*/
17
#pragma once
18
19
#include <QWebSocketServer>
20
#include <QWebSocket>
21
#include <QList>
22
23
#include <QtPlugin>
24
#include <thread>
25
#include "
PlotJuggler/datastreamer_base.h
"
26
#include "
PlotJuggler/messageparser_base.h
"
27
28
using namespace
PJ
;
29
30
class
WebsocketServer
:
public
PJ::DataStreamer
31
{
32
Q_OBJECT
33
Q_PLUGIN_METADATA(IID
"facontidavide.PlotJuggler3.DataStreamer"
)
34
Q_INTERFACES(
PJ::DataStreamer
)
35
36
public
:
37
WebsocketServer
();
38
39
virtual
bool
start
(QStringList*)
override
;
40
41
virtual
void
shutdown
()
override
;
42
43
virtual
bool
isRunning
()
const override
44
{
45
return
_running;
46
}
47
48
virtual
~
WebsocketServer
()
override
;
49
50
virtual
const
char
*
name
()
const override
51
{
52
return
"WebSocket Server"
;
53
}
54
55
virtual
bool
isDebugPlugin
()
override
56
{
57
return
false
;
58
}
59
60
private
:
61
bool
_running
;
62
QList<QWebSocket*>
_clients
;
63
QWebSocketServer
_server
;
64
PJ::MessageParserPtr
_parser
;
65
66
private
slots:
67
void
onNewConnection();
68
void
processMessage(QString message);
69
void
socketDisconnected();
70
};
PJ::MessageParserPtr
std::shared_ptr< MessageParser > MessageParserPtr
Definition:
messageparser_base.h:136
WebsocketServer::isDebugPlugin
virtual bool isDebugPlugin() override
Definition:
websocket_server.h:55
WebsocketServer
Definition:
websocket_server.h:30
WebsocketServer::_parser
PJ::MessageParserPtr _parser
Definition:
websocket_server.h:64
QList< QWebSocket * >
PJ::DataStreamer
The DataStreamer base classm used to read streaming of data.
Definition:
datastreamer_base.h:25
shutdown
ROSCONSOLE_DECL void shutdown()
WebsocketServer::name
virtual const char * name() const override
Name of the plugin type, NOT the particular instance.
Definition:
websocket_server.h:50
WebsocketServer::isRunning
virtual bool isRunning() const override
isRunning
Definition:
websocket_server.h:43
WebsocketServer::_clients
QList< QWebSocket * > _clients
Definition:
websocket_server.h:62
start
ROSCPP_DECL void start()
WebsocketServer::_server
QWebSocketServer _server
Definition:
websocket_server.h:63
PJ
Definition:
dataloader_base.h:16
WebsocketServer::_running
bool _running
Definition:
websocket_server.h:61
datastreamer_base.h
messageparser_base.h
plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Jan 26 2025 03:23:27