Wiki » Historie » Version 17
Maximilian Seesslen, 20.08.2024 14:37
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 | 16 | Maximilian Seesslen | |
57 | h3. Terminal Output |
||
58 | |||
59 | 1 | Maximilian Seesslen | The server prints a dynamic list with the connections and traffic statistics. |
60 | 16 | Maximilian Seesslen | * ID/Type |
61 | * Connection uptime |
||
62 | * Disconnections |
||
63 | 1 | Maximilian Seesslen | * in/out messag count |
64 | * in msg/s |
||
65 | |||
66 | Example: |
||
67 | |||
68 | 3 | Maximilian Seesslen | <pre> |
69 | 7 | Maximilian Seesslen | Id Target Uptime In Out In/s |
70 | 3 | Maximilian Seesslen | ----------------------------------------- |
71 | 7 | Maximilian Seesslen | 0: CAN 0:10s 12 55 0 |
72 | 1: Server 0:10s 3 51 0 |
||
73 | 3 | Maximilian Seesslen | 2: Client 0:05s 43 52 0 |
74 | 3: Client 0:01s 1 57 0 |
||
75 | 1 | Maximilian Seesslen | </pre> |
76 | 15 | Maximilian Seesslen | |
77 | 1 | Maximilian Seesslen | h2. Loop detection |
78 | 15 | Maximilian Seesslen | |
79 | Two servers can be connected (e.g. for connecting multiple CAN-segments). But for each connection there must |
||
80 | only be a single connection line with a pair of connectors. Otherwise messages would bounce forever. |
||
81 | 8 | Maximilian Seesslen | Such loops should be detected: |
82 | 1 | Maximilian Seesslen | The TCP-Server generates an periodical Heartbeat which is send/routed to every tcp connection. |
83 | When server sends heartbeat, it must not receive it back. Otherwise there is a loop. How to generate uuid? |
||
84 | 15 | Maximilian Seesslen | |
85 | <pre> |
||
86 | Server TCP Server |
||
87 | List List |
||
88 | { { |
||
89 | connectionCan connectionCan |
||
90 | 17 | Maximilian Seesslen | connectionTcpServer ┌───────────> connectionTcpClient |
91 | connectionTcpServer <─────┘ ┌─────> connectionTcpServer <----Doubled connection |
||
92 | connectionTcpClinet <───────────┘ |
||
93 | 15 | Maximilian Seesslen | } } |
94 | </pre> |
||
95 | |||
96 | 4 | Maximilian Seesslen | h2. Ansi |
97 | |||
98 | box(x1,y1,x2,y2) |
||
99 | hLine(x1,y1,x2) |
||
100 | vLine(x1,y1,y2) |
||
101 | 6 | Maximilian Seesslen | |
102 | 5 | Maximilian Seesslen | <pre> |
103 | ┬ |
||
104 | │ |
||
105 | ┴ |
||
106 | ├──┤ |
||
107 | ┌─┐ |
||
108 | │ │ |
||
109 | 6 | Maximilian Seesslen | └─┘ |
110 | 5 | Maximilian Seesslen | </pre> |
111 | |||
112 | QLoggingCategory::setFilterRules("*.debug=false"); |
||
113 | qSetMessagePattern("[%{time process}] %{function}: %{message}"); |
||
114 | qDebug("Happy debugging"); |
||
115 | 3 | Maximilian Seesslen | |
116 | 2 | Maximilian Seesslen | h1. Links |
117 | |||
118 | 1 | Maximilian Seesslen | https://www.sciencebuddies.org/science-fair-projects/references/ascii-table |