Projekt

Allgemein

Profil

Wiki » Historie » Version 14

Maximilian Seesslen, 20.08.2024 14:22

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