changed XML structure
This commit is contained in:
parent
4e4e6bd73f
commit
6dde46c676
@ -7,8 +7,8 @@ import android.view.Menu;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.aped.communication.IIO;
|
||||
import com.example.aped.communication.IXML;
|
||||
import com.example.aped.communication.TestXML;
|
||||
import com.example.aped.utils.IXML;
|
||||
import com.example.aped.utils.TestXML;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example.aped.communication;
|
||||
package com.example.aped.utils;
|
||||
|
||||
import java.util.Dictionary;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package com.example.aped.communication;
|
||||
package com.example.aped.utils;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<DeviceList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="config.xsd">
|
||||
<Device name="example">
|
||||
<ValueInfo type="boolean"/>
|
||||
<Port protocol="DI">
|
||||
<Pin>GPIO_2</Pin>
|
||||
</Port>
|
||||
</Device>
|
||||
<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>
|
@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<!-- available protocols types -->
|
||||
<xs:simpleType name="ProtocolType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="DI"/>
|
||||
<xs:enumeration value="DO"/>
|
||||
<xs:enumeration value="AI"/>
|
||||
<xs:enumeration value="AO"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<!-- available value types -->
|
||||
<xs:simpleType name="ValueType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="int"/>
|
||||
<xs:enumeration value="float"/>
|
||||
<xs:enumeration value="boolean"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
|
||||
<!-- available Pins -->
|
||||
<xs:simpleType name="Pin">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="GPIO_2"/>
|
||||
<xs:enumeration value="GPIO_3"/>
|
||||
<xs:enumeration value="GPIO_4"/>
|
||||
<xs:enumeration value="GPIO_5"/>
|
||||
<xs:enumeration value="GPIO_6"/>
|
||||
<xs:enumeration value="GPIO_7"/>
|
||||
<xs:enumeration value="GPIO_8"/>
|
||||
<xs:enumeration value="GPIO_9"/>
|
||||
<xs:enumeration value="GPIO_10"/>
|
||||
<xs:enumeration value="GPIO_11"/>
|
||||
<xs:enumeration value="GPIO_12"/>
|
||||
<xs:enumeration value="GPIO_13"/>
|
||||
<xs:enumeration value="GPIO_14"/>
|
||||
<xs:enumeration value="GPIO_15"/>
|
||||
<xs:enumeration value="GPIO_16"/>
|
||||
<xs:enumeration value="GPIO_17"/>
|
||||
<xs:enumeration value="GPIO_18"/>
|
||||
<xs:enumeration value="GPIO_19"/>
|
||||
<xs:enumeration value="GPIO_20"/>
|
||||
<xs:enumeration value="GPIO_21"/>
|
||||
<xs:enumeration value="GPIO_22"/>
|
||||
<xs:enumeration value="GPIO_23"/>
|
||||
<xs:enumeration value="GPIO_24"/>
|
||||
<xs:enumeration value="GPIO_25"/>
|
||||
<xs:enumeration value="GPIO_26"/>
|
||||
<xs:enumeration value="GPIO_27"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:element name="DeviceList">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="Device"
|
||||
minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:unique name="UniqueDevice">
|
||||
<xs:selector xpath="Device"/>
|
||||
<xs:field xpath="@name"/>
|
||||
</xs:unique>
|
||||
<xs:unique name="UniquePin">
|
||||
<xs:selector xpath="Device"/>
|
||||
<xs:field xpath="Protocol/Port/Pin"/>
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="Device">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="ValueInfo"
|
||||
minOccurs="1"
|
||||
maxOccurs="1"/>
|
||||
<xs:element ref="Port"
|
||||
minOccurs="1"
|
||||
maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name"
|
||||
type="xs:string"
|
||||
use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="ValueInfo">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Offset"
|
||||
type="xs:float"
|
||||
minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="Factor"
|
||||
type="xs:float"
|
||||
minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="type"
|
||||
type="ValueType"
|
||||
use="required"/>
|
||||
<xs:attribute name="unit"
|
||||
type="xs:string"
|
||||
use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="Port">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Pin"
|
||||
type="Pin"
|
||||
minOccurs="1"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="protocol" type="ProtocolType" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* package for the storage of the XML files.
|
||||
* */
|
||||
package com.example.aped.utils.XML_files;
|
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* package for utilities.
|
||||
* */
|
||||
package com.example.aped.utils;
|
Loading…
x
Reference in New Issue
Block a user