Projekt

Allgemein

Profil

Wiki » Historie » Version 15

Maximilian Seesslen, 20.08.2024 14:30

1 9 Maximilian Seesslen
h1. CANHub
2 15 Maximilian Seesslen
3 3 Maximilian Seesslen
h2. Intro
4
5
CANServer is an Server-Client library that provides multiple applications access to an CAN-Bus via TCP/IP.
6
Every message received via CAN gets send to all clients. When an client sends an message, it is send 
7
via CAN-Bus and also to the other clients.
8
The physical CAN-Bus is optional.
9
10 8 Maximilian Seesslen
h3. Usecases
11 3 Maximilian Seesslen
12 8 Maximilian Seesslen
* CAN over ethernet
13
* Graphical user interface for home automatisation
14
  An laptop/tablet can be connected to an server via WLAN
15
* Recording/Replay
16
  An PC-Application could record CAN messages and replay them.
17
* Debugging
18
  Show CAN traffic while interacting with the bus with other devices.
19
* WLAN CAN-Bridge
20
  Two CAN segments can be connected via WLAN
21 3 Maximilian Seesslen
22 8 Maximilian Seesslen
h3. Architecture
23 1 Maximilian Seesslen
24
<pre>
25 9 Maximilian Seesslen
        Server                      TCP       Client
26 12 Maximilian Seesslen
        List
27
        {                             /-----> connectionTcpClient
28 9 Maximilian Seesslen
            connectionCan             |
29
            connectionTcpServer       |
30 1 Maximilian Seesslen
            connectionTcpServer <-----/
31 9 Maximilian Seesslen
            connectionTcpServer
32 12 Maximilian Seesslen
        }
33 9 Maximilian Seesslen
</pre>
34
35
<pre>
36
      class CConnector {
37
         signal dataIn(SMsg);
38
         slot dataOut(SMsg);
39
      }
40 7 Maximilian Seesslen
</pre>
41
42 10 Maximilian Seesslen
<pre>
43 1 Maximilian Seesslen
        Server                      
44 10 Maximilian Seesslen
        List
45 12 Maximilian Seesslen
        {
46 10 Maximilian Seesslen
            connectionCan       <-----\
47 1 Maximilian Seesslen
      /---- connectionTcpServer <-----|
48 10 Maximilian Seesslen
      |     connectionTcpServer <-----|
49
      |     connectionTcpServer <-----|
50 12 Maximilian Seesslen
      | }                             |
51 13 Maximilian Seesslen
      |                               |
52 11 Maximilian Seesslen
      \--> serverDataInSlot-----------/
53 10 Maximilian Seesslen
</pre>
54
55 3 Maximilian Seesslen
Each connection has an id which is an ongoing number handled by the server.
56
## Terminal Output
57
The server prints a dynamic list with the connections and traffic statistics.
58 1 Maximilian Seesslen
- ID/Type
59
- Connection uptime
60 3 Maximilian Seesslen
* in/out messag count
61 1 Maximilian Seesslen
* in msg/s
62
63
Example:
64
65
<pre>
66 3 Maximilian Seesslen
Id Target        Uptime   In   Out   In/s
67 7 Maximilian Seesslen
-----------------------------------------
68 3 Maximilian Seesslen
0: CAN           0:10s    12   55    0
69 7 Maximilian Seesslen
1: Server        0:10s    3    51    0
70
2: Client        0:05s    43   52    0
71 3 Maximilian Seesslen
3: Client        0:01s    1    57    0
72
</pre>
73 1 Maximilian Seesslen
74 15 Maximilian Seesslen
h2. Loop detection
75 1 Maximilian Seesslen
76 15 Maximilian Seesslen
Two servers can be connected (e.g. for connecting multiple CAN-segments). But for each connection there must 
77
only be a single connection line with a pair of connectors. Otherwise messages would bounce forever.
78
Such loops should be detected:
79 8 Maximilian Seesslen
The TCP-Server generates an periodical Heartbeat which is send/routed to every tcp connection.
80 1 Maximilian Seesslen
When server sends heartbeat, it must not receive it back. Otherwise there is a loop. How to generate uuid?
81
82 15 Maximilian Seesslen
<pre>
83
        Server                      TCP       Server
84
        List                                  List
85
        {                                     {
86
            connectionCan                           connectionCan
87
            connectionTcpServer        /----------> connectionTcpClient
88
            connectionTcpServer <-----/      /----> connectionTcpServer     <----Doubled connection
89
            connectionTcpClinet <-----------/
90
        }                                     }
91
</pre>
92
93
h2. Ansi
94 4 Maximilian Seesslen
95
box(x1,y1,x2,y2)
96
hLine(x1,y1,x2)
97
vLine(x1,y1,y2)
98
99 6 Maximilian Seesslen
<pre>
100 5 Maximilian Seesslen
101
102
103
├──┤
104
┌─┐
105
│ │
106
└─┘
107 6 Maximilian Seesslen
</pre>
108 5 Maximilian Seesslen
109
   QLoggingCategory::setFilterRules("*.debug=false");
110
   qSetMessagePattern("[%{time process}] %{function}: %{message}");
111
   qDebug("Happy debugging");
112
113 3 Maximilian Seesslen
h1. Links
114 2 Maximilian Seesslen
115
https://www.sciencebuddies.org/science-fair-projects/references/ascii-table