<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<xs:element name="common">
		<xs:complexType>
			<xs:attribute name="language" use="optional" default="0">
				<xs:simpleType>
					<xs:restriction base="xs:unsignedByte">
						<xs:minInclusive value="0"/>
						<xs:maxInclusive value="1"/>
					</xs:restriction>
				</xs:simpleType>
				<!--Use 0 for German, 1 for English-->
			</xs:attribute>
			<xs:attribute name="lcdlight" use="optional" default="0">
				<xs:simpleType>
					<xs:restriction base="xs:unsignedByte">
						<xs:minInclusive value="0"/>
						<xs:maxInclusive value="255"/>
					</xs:restriction>
				</xs:simpleType>
				<!--Unit is seconds. 0 means always off, 255 means always on-->
			</xs:attribute>
			<xs:attribute name="toggle" type="xs:boolean" use="optional" default="false">
				<!--False means direction toggling on pushing the encoder button. True means direction toggling if crossing the zero point.-->
			</xs:attribute>
			<xs:attribute name="autoip" type="xs:boolean" use="optional" default="true"/>
			<xs:attribute name="server" type="xs:anyURI" use="optional"/>
			<xs:attribute name="faststart" type="xs:boolean" use="optional" default="false">
				<!--Speed up start up and connecting to server.-->
			</xs:attribute>
			<xs:attribute name="turbo" type="xs:boolean" use="optional" default="false">
				<!-- Enable turbo encoder.-->
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="config">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="common" minOccurs="0"/>
				<xs:element ref="srcp" minOccurs="0"/>
				<xs:element ref="srcpproto" minOccurs="0" maxOccurs="15"/>
				<xs:element ref="srcpdb" minOccurs="0" maxOccurs="19"/>
			</xs:sequence>
			<xs:attribute name="version" type="xs:string" use="optional" default="1.1"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="data">
		<xs:complexType>
			<xs:attribute name="name" type="xs:string" use="required"/>
			<xs:attribute name="proto" type="xs:string" use="required">
				<!--Protocol string used for initializing at the SRCP server (i.e N 1).-->
			</xs:attribute>
			<xs:attribute name="bus" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:unsignedByte">
						<xs:minInclusive value="1"/>
					</xs:restriction>
				</xs:simpleType>
				<!--SRCP bus number.-->
			</xs:attribute>
			<xs:attribute name="add" type="xs:unsignedShort" use="optional">
				<!--Address of the device.-->
			</xs:attribute>
			<xs:attribute name="minadd" type="xs:unsignedShort">
				<!--Minimum possible address of the device.-->
			</xs:attribute>
			<xs:attribute name="maxadd" type="xs:unsignedShort">
				<!--Maximum possible address of the device.-->
			</xs:attribute>
			<xs:attribute name="steps" type="xs:unsignedByte">
				<!--Speed steps of a loco device.-->
			</xs:attribute>
			<xs:attribute name="maxspeed" type="xs:unsignedShort">
				<!--Maximum speed as a unit number (is calculated back to speed steps).-->
			</xs:attribute>
			<xs:attribute name="funcs" type="xs:unsignedByte">
				<!--Number of functions of a loco device.-->
			</xs:attribute>
			<xs:attribute name="togglemask" type="xs:unsignedLong">
				<!--Each bit in this field represents a loco function (Bit 0, F0, and so on). False means, that the function is used as a toggle switch. True means the function is used as a push button.-->
			</xs:attribute>
			<xs:attribute name="minport" type="xs:unsignedByte">
				<!--Minimum possible port for an accessory device.-->
			</xs:attribute>
			<xs:attribute name="maxport" type="xs:unsignedByte">
				<!--Maximum possible port for an accessory device.-->
			</xs:attribute>
			<xs:attribute name="delay">
				<xs:simpleType>
					<xs:restriction base="xs:long">
						<xs:minInclusive value="-1"/>
					</xs:restriction>
				</xs:simpleType>
				<!--Specific delay of an accessory device port before switching off (-1 means unlimited).-->
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="srcp">
		<xs:complexType>
			<xs:attribute name="locoprotorequest" type="xs:boolean" use="optional">
				<!--Request for loco protocol if true. False always uses the standard protocol.-->
			</xs:attribute>
			<xs:attribute name="locostandard" type="xs:unsignedByte" use="optional">
				<!--One of the IDs from the locos in the srcpproto list. -1 means database. -2 means Server Cache.-->
			</xs:attribute>
			<xs:attribute name="accprotorequest" type="xs:boolean" use="optional">
				<!--Request for accessory protocol if true. False always uses the standard protocol.-->
			</xs:attribute>
			<xs:attribute name="accstandard" type="xs:unsignedByte" use="optional">
				<!--One of the IDs from the accessories in the srcpproto list. -1 means database.-->
			</xs:attribute>
			<xs:attribute name="accdelay" use="optional">
				<xs:simpleType>
					<xs:restriction base="xs:long">
						<xs:minInclusive value="-1"/>
					</xs:restriction>
				</xs:simpleType>
				<!--Common delay of accessory device ports before switching off (-1 means unlimited).-->
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="srcpdb">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="data"/>
			</xs:sequence>
			<xs:attribute name="id" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:unsignedByte">
						<xs:minInclusive value="0"/>
						<xs:maxInclusive value="19"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="srcpproto">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="data"/>
			</xs:sequence>
			<xs:attribute name="id" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:unsignedByte">
						<xs:minInclusive value="0"/>
						<xs:maxInclusive value="15"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
</xs:schema>
