reworked xml stuff

This commit is contained in:
paul-loedige 2020-12-14 20:25:42 +01:00
parent ed1f10efe1
commit 7402015920
2 changed files with 26 additions and 52 deletions

View File

@ -2,23 +2,22 @@
<DeviceList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="config.xsd">
<Device name="example">
<Value type="boolean"/>
<Protocol type="DI">
<Port>
<Pin>GPIO_2</Pin>
</Port>
</Protocol>
<ValueInfo type="boolean"/>
<Port protocol="DI">
<Pin>GPIO_2</Pin>
</Port>
</Device>
<Device name="example2">
<Value type="int" unit="°C">
<Conversion type="Offset" value="1.2" />
<Conversion type="Factor" value="2.5" />
</Value>
<Protocol type="AI">
<Port>
<Pin>GPIO_3</Pin>
</Port>
</Protocol>
<Device name="sensorarray">
<ValueInfo type="int" unit="°C">
<Offset>1.2</Offset>
<Factor>2.5</Factor>
</ValueInfo>
<Port protocol="DI">
<Pin>GPIO_3</Pin>
<Pin>GPIO_4</Pin>
<Pin>GPIO_5</Pin>
<Pin>GPIO_6</Pin>
</Port>
</Device>
</DeviceList>

View File

@ -20,13 +20,6 @@
</xs:restriction>
</xs:simpleType>
<!-- available conversion types -->
<xs:simpleType name="ConversionType">
<xs:restriction base="xs:string">
<xs:enumeration value="Factor"/>
<xs:enumeration value="Offset"/>
</xs:restriction>
</xs:simpleType>
<!-- available Pins -->
<xs:simpleType name="Pin">
@ -81,10 +74,10 @@
<xs:element name="Device">
<xs:complexType>
<xs:sequence>
<xs:element ref="Value"
<xs:element ref="ValueInfo"
minOccurs="1"
maxOccurs="1"/>
<xs:element ref="Protocol"
<xs:element ref="Port"
minOccurs="1"
maxOccurs="1"/>
</xs:sequence>
@ -94,25 +87,17 @@
</xs:complexType>
</xs:element>
<xs:element name="Protocol">
<xs:element name="ValueInfo">
<xs:complexType>
<xs:sequence>
<xs:element ref="Port"
minOccurs="1"
maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="type"
type="ProtocolType"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Value">
<xs:complexType>
<xs:sequence>
<xs:element ref="Conversion"
<xs:element name="Offset"
type="xs:float"
minOccurs="0"
maxOccurs="unbounded"/>
maxOccurs="1"/>
<xs:element name="Factor"
type="xs:float"
minOccurs="0"
maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="type"
type="ValueType"
@ -123,17 +108,6 @@
</xs:complexType>
</xs:element>
<xs:element name="Conversion">
<xs:complexType>
<xs:attribute name="type"
type="ConversionType"
use="required"/>
<xs:attribute name="value"
type="xs:float"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Port">
<xs:complexType>
<xs:sequence>
@ -142,6 +116,7 @@
minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="protocol" type="ProtocolType" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>