Wiki » Historie » Version 11
Maximilian Seesslen, 15.08.2024 16:20
| 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 | List< /-----> connectionTcpClient |
||
| 26 | connectionCan | |
||
| 27 | connectionTcpServer | |
||
| 28 | connectionTcpServer <-----/ |
||
| 29 | connectionTcpServer |
||
| 30 | 7 | Maximilian Seesslen | > |
| 31 | 9 | Maximilian Seesslen | </pre> |
| 32 | |||
| 33 | <pre> |
||
| 34 | class CConnector { |
||
| 35 | signal dataIn(SMsg); |
||
| 36 | slot dataOut(SMsg); |
||
| 37 | } |
||
| 38 | 7 | Maximilian Seesslen | </pre> |
| 39 | |||
| 40 | 10 | Maximilian Seesslen | <pre> |
| 41 | Server |
||
| 42 | List |
||
| 43 | connectionCan <-----\ |
||
| 44 | /---- connectionTcpServer <-----| |
||
| 45 | | connectionTcpServer <-----| |
||
| 46 | | connectionTcpServer <-----| |
||
| 47 | | | |
||
| 48 | 11 | Maximilian Seesslen | \--> serverDataInSlot-----------/ |
| 49 | 10 | Maximilian Seesslen | </pre> |
| 50 | |||
| 51 | 3 | Maximilian Seesslen | Each connection has an id which is an ongoing number handled by the server. |
| 52 | ## Terminal Output |
||
| 53 | The server prints a dynamic list with the connections and traffic statistics. |
||
| 54 | 1 | Maximilian Seesslen | - ID/Type |
| 55 | - Connection uptime |
||
| 56 | 3 | Maximilian Seesslen | * in/out messag count |
| 57 | 1 | Maximilian Seesslen | * in msg/s |
| 58 | |||
| 59 | Example: |
||
| 60 | |||
| 61 | <pre> |
||
| 62 | 3 | Maximilian Seesslen | Id Target Uptime In Out In/s |
| 63 | 7 | Maximilian Seesslen | ----------------------------------------- |
| 64 | 3 | Maximilian Seesslen | 0: CAN 0:10s 12 55 0 |
| 65 | 7 | Maximilian Seesslen | 1: Server 0:10s 3 51 0 |
| 66 | 2: Client 0:05s 43 52 0 |
||
| 67 | 3 | Maximilian Seesslen | 3: Client 0:01s 1 57 0 |
| 68 | </pre> |
||
| 69 | 8 | Maximilian Seesslen | |
| 70 | h3. Loop detection |
||
| 71 | |||
| 72 | An Heartbeat is send/routed to every tcp connection. |
||
| 73 | When server sends heartbeat, it must not receive it back. Otherwise there is a loop. How to generate uuid? |
||
| 74 | |||
| 75 | 3 | Maximilian Seesslen | |
| 76 | 4 | Maximilian Seesslen | h1. Ansi |
| 77 | |||
| 78 | box(x1,y1,x2,y2) |
||
| 79 | hLine(x1,y1,x2) |
||
| 80 | vLine(x1,y1,y2) |
||
| 81 | |||
| 82 | 6 | Maximilian Seesslen | <pre> |
| 83 | 5 | Maximilian Seesslen | ┬ |
| 84 | │ |
||
| 85 | ┴ |
||
| 86 | ├──┤ |
||
| 87 | ┌─┐ |
||
| 88 | │ │ |
||
| 89 | └─┘ |
||
| 90 | 6 | Maximilian Seesslen | </pre> |
| 91 | 5 | Maximilian Seesslen | |
| 92 | QLoggingCategory::setFilterRules("*.debug=false"); |
||
| 93 | qSetMessagePattern("[%{time process}] %{function}: %{message}"); |
||
| 94 | qDebug("Happy debugging"); |
||
| 95 | |||
| 96 | 3 | Maximilian Seesslen | h1. Links |
| 97 | 2 | Maximilian Seesslen | |
| 98 | https://www.sciencebuddies.org/science-fair-projects/references/ascii-table |