Debian Codegraph @

Hardware/Protocols/Z21DataTypes.h

raw symbols SCIP
1 /*
2 RailControl - Model Railway Control Software
3
4 Copyright (c) 2017-2025 by Teddy / Dominik Mahrer - www.railcontrol.org
5
6 RailControl is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
9 later version.
10
11 RailControl is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with RailControl; see the file LICENCE. If not see
18 <http://www.gnu.org/licenses/>.
19 */
20
21 #pragma once
22
23 // protocol specification at https://www.z21.eu/media/Kwc_Basic_DownloadTag_Component/47-1652-959-downloadTag/default/69bad87e/1558674980/z21-lan-protokoll.pdf
24
25 namespace Hardware
26 {
27 namespace Protocols
28 {
29 namespace Z21Enums
30 {
31 enum BroadCastFlags : uint32_t
32 {
33 BroadCastFlagNone = 0x00000000,
34 BroadCastFlagBasic = 0x00000001,
35 BroadCastFlagRBus = 0x00000002,
36 BroadCastFlagRailCom = 0x00000004,
37 BroadCastFlagSystemState = 0x00000100,
38 BroadCastFlagAllLoco = 0x00010000,
39 BroadCastFlagRailComData = 0x00040000,
40 BroadCastFlagCanDetector = 0x00080000,
41 BroadCastFlagLocoNetBasic = 0x01000000,
42 BroadCastFlagLocoNetLoco = 0x02000000,
43 BroadCastFlagLocoNetSwitch = 0x04000000,
44 BroadCastFlagLocoNetDetector = 0x08000000
45 };
46
47 enum Command : uint8_t
48 {
49 CommandSetLocoMode = 0x61,
50 CommandSetTurnoutMode = 0x70
51 };
52
53 enum ProtocolMode : uint8_t
54 {
55 ProtocolModeDCC = 0,
56 ProtocolModeMM = 1
57 };
58
59 enum FeatureSet : uint8_t
60 {
61 FeaturesNotRestricted = 0x00,
62 FeaturesStartLocked = 0x01,
63 FeaturesStartUnlocked = 0x02
64 };
65
66 enum Header : uint16_t
67 {
68 HeaderSerialNumber = 0x10,
69 HeaderGetCode = 0x18,
70 HeaderGetHardwareInfo = 0x1A,
71 HeaderLogOff = 0x30,
72 HeaderSeeXHeader = 0x40,
73 HeaderSetBroadcastFlags = 0x50,
74 HeaderGetBroadcastFlags = 0x51,
75 HeaderGetLocoMode = 0x60,
76 HeaderSetLocoMode = 0x61,
77 HeaderGetTurnoutMode = 0x70,
78 HeaderSetTurnoutMode = 0x71,
79 HeaderRmBusData = 0x80,
80 HeaderSystemData = 0x84,
81 HeaderGetSystemState = 0x85,
82 HeaderRailComtData = 0x88,
83 HeaderLocoNetRx = 0xA0,
84 HeaderLocoNetTx = 0xA1,
85 HeaderLocoNetLan = 0xA2,
86 HeaderLocoNetDispatch = 0xA3,
87 HeaderLocoNetDetector = 0xA4,
88 HeaderDetector = 0xC4
89 };
90
91 enum XHeader : uint8_t
92 {
93 XHeaderSeeDB0_1 = 0x21,
94 XHeaderTurnoutInfo = 0x43,
95 XHeaderGetTurnoutInfo = 0x43,
96 XHeaderSetTurnout = 0x53,
97 XHeaderSeeDB0_2 = 0x61,
98 XHeaderStatusChanged = 0x62,
99 XHeaderVersion = 0x63,
100 XHeaderCvResult = 0x64,
101 XHeaderSetStop = 0x80,
102 XHeaderBcStopped = 0x81,
103 XHeaderGetLocoInfo = 0xE3,
104 XHeaderLocoDrive = 0xE4,
105 XHeaderSetLocoBinaryState = 0xE5,
106 XHeaderLocoInfo = 0xEF,
107 XHeaderGetFirmwareVersion = 0xF1,
108 XHeaderFirmwareVersion = 0xF3
109 };
110
111 enum DB0 : uint8_t
112 {
113 DB0PowerOff = 0x00,
114 DB0PowerOn = 0x01,
115 DB0ProgrammingMode = 0x02,
116 DB0ShortCircuit = 0x08,
117 DB0FirmwareVersion = 0x0A,
118 DB0SetLocoDrive14 = 0x10,
119 DB0SetLocoDrive28 = 0x12,
120 DB0CvShortCircuit = 0x12,
121 DB0SetLocoDrive128 = 0x13,
122 DB0CvNack = 0x13,
123 DB0Version = 0x21,
124 DB0StatusChanged = 0x22,
125 DB0Status = 0x24,
126 DB0SetPowerOff = 0x80,
127 DB0SetPowerOn = 0x81,
128 DB0UnknownCommand = 0x82,
129 DB0LocoFunction = 0xF8
130 };
131
132 enum PomDB0 : uint8_t
133 {
134 PomLoco = 0x30,
135 PomAccessory = 0x31
136 };
137
138 enum PomOption : uint16_t
139 {
140 PomWriteByte = 0xEC00,
141 PomWriteBit = 0xE800,
142 PomReadByte = 0xE400
143 };
144 }
145 }
146 }