File: Z21DataTypes.h

package info (click to toggle)
railcontrol 24%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,960 kB
  • sloc: cpp: 39,964; javascript: 2,454; makefile: 103; php: 97; sh: 25
file content (146 lines) | stat: -rw-r--r-- 4,411 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
RailControl - Model Railway Control Software

Copyright (c) 2017-2025 by Teddy / Dominik Mahrer - www.railcontrol.org

RailControl is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.

RailControl is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with RailControl; see the file LICENCE. If not see
<http://www.gnu.org/licenses/>.
*/

#pragma once

// protocol specification at https://www.z21.eu/media/Kwc_Basic_DownloadTag_Component/47-1652-959-downloadTag/default/69bad87e/1558674980/z21-lan-protokoll.pdf

namespace Hardware
{
	namespace Protocols
	{
		namespace Z21Enums
		{
			enum BroadCastFlags : uint32_t
			{
				BroadCastFlagNone            = 0x00000000,
				BroadCastFlagBasic           = 0x00000001,
				BroadCastFlagRBus            = 0x00000002,
				BroadCastFlagRailCom         = 0x00000004,
				BroadCastFlagSystemState     = 0x00000100,
				BroadCastFlagAllLoco         = 0x00010000,
				BroadCastFlagRailComData     = 0x00040000,
				BroadCastFlagCanDetector     = 0x00080000,
				BroadCastFlagLocoNetBasic    = 0x01000000,
				BroadCastFlagLocoNetLoco     = 0x02000000,
				BroadCastFlagLocoNetSwitch   = 0x04000000,
				BroadCastFlagLocoNetDetector = 0x08000000
			};

			enum Command : uint8_t
			{
				CommandSetLocoMode        = 0x61,
				CommandSetTurnoutMode     = 0x70
			};

			enum ProtocolMode : uint8_t
			{
				ProtocolModeDCC           = 0,
				ProtocolModeMM            = 1
			};

			enum FeatureSet : uint8_t
			{
				FeaturesNotRestricted     = 0x00,
				FeaturesStartLocked       = 0x01,
				FeaturesStartUnlocked     = 0x02
			};

			enum Header : uint16_t
			{
				HeaderSerialNumber        = 0x10,
				HeaderGetCode             = 0x18,
				HeaderGetHardwareInfo     = 0x1A,
				HeaderLogOff              = 0x30,
				HeaderSeeXHeader          = 0x40,
				HeaderSetBroadcastFlags   = 0x50,
				HeaderGetBroadcastFlags   = 0x51,
				HeaderGetLocoMode         = 0x60,
				HeaderSetLocoMode         = 0x61,
				HeaderGetTurnoutMode      = 0x70,
				HeaderSetTurnoutMode      = 0x71,
				HeaderRmBusData           = 0x80,
				HeaderSystemData          = 0x84,
				HeaderGetSystemState      = 0x85,
				HeaderRailComtData        = 0x88,
				HeaderLocoNetRx           = 0xA0,
				HeaderLocoNetTx           = 0xA1,
				HeaderLocoNetLan          = 0xA2,
				HeaderLocoNetDispatch     = 0xA3,
				HeaderLocoNetDetector     = 0xA4,
				HeaderDetector            = 0xC4
			};

			enum XHeader : uint8_t
			{
				XHeaderSeeDB0_1           = 0x21,
				XHeaderTurnoutInfo        = 0x43,
				XHeaderGetTurnoutInfo     = 0x43,
				XHeaderSetTurnout         = 0x53,
				XHeaderSeeDB0_2           = 0x61,
				XHeaderStatusChanged      = 0x62,
				XHeaderVersion            = 0x63,
				XHeaderCvResult           = 0x64,
				XHeaderSetStop            = 0x80,
				XHeaderBcStopped          = 0x81,
				XHeaderGetLocoInfo        = 0xE3,
				XHeaderLocoDrive          = 0xE4,
				XHeaderSetLocoBinaryState = 0xE5,
				XHeaderLocoInfo           = 0xEF,
				XHeaderGetFirmwareVersion = 0xF1,
				XHeaderFirmwareVersion    = 0xF3
			};

			enum DB0 : uint8_t
			{
				DB0PowerOff               = 0x00,
				DB0PowerOn                = 0x01,
				DB0ProgrammingMode        = 0x02,
				DB0ShortCircuit           = 0x08,
				DB0FirmwareVersion        = 0x0A,
				DB0SetLocoDrive14         = 0x10,
				DB0SetLocoDrive28         = 0x12,
				DB0CvShortCircuit         = 0x12,
				DB0SetLocoDrive128        = 0x13,
				DB0CvNack                 = 0x13,
				DB0Version                = 0x21,
				DB0StatusChanged          = 0x22,
				DB0Status                 = 0x24,
				DB0SetPowerOff            = 0x80,
				DB0SetPowerOn             = 0x81,
				DB0UnknownCommand         = 0x82,
				DB0LocoFunction           = 0xF8
			};

			enum PomDB0 : uint8_t
			{
				PomLoco                   = 0x30,
				PomAccessory              = 0x31
			};

			enum PomOption : uint16_t
			{
				PomWriteByte              = 0xEC00,
				PomWriteBit               = 0xE800,
				PomReadByte               = 0xE400
			};
		}
	}
}