<?xml version = "1.0" encoding = "UTF-8"?>

<Schema name = "FDTModbusDeviceTypeIdentSchema"
	 xmlns = "urn:schemas-microsoft-com:xml-data"
	 xmlns:dt = "urn:schemas-microsoft-com:datatypes"
	 xmlns:modbusident = "x-schema:FDTModbusIdentSchema.xml"
	 xmlns:fdt = "x-schema:FDTDataTypesSchema.xml">


	<!-- FDT DeviceTypeIdent schema V1.0 for Modbus protocol -->
	<!-- The  FDT DeviceTypeIdent schema defines the mapping of the Modbus identification objects -->
	<!-- to standard FDT identification elements -->
	<!-- The Modbus identification objects can be read with the standard Modbus service ReadDeviceIdentification -->

	<!-- The mapping of Modbus identification objects to FDT identification elements is divided into two categories: -->

	<!-- - Basic category: -->
	<!--   Mapping of mandatory Modbus identification objects to required (mandatory) FDT identification elements -->


	<!-- - Regular category: -->
	<!--   Mapping of optional Modbus identification objects to the optional FDT identification element IdValue-->

		
	<!-- Definition of general FDT attributes-->
	<AttributeType name = "schemaVersion" dt:type = "number" default = "1.0"/>


	<!-- Definition of general FDT elements which contain the information about the applied protocol -->
	<!-- and the version of the protocol -->
      
	<ElementType name = "IdBusProtocol" content = "empty"  model = "closed"> 
		<attribute type = "modbusident:protocolName" required="yes"/>
	</ElementType>



	<!-- Basic category: -->
	<!-- Mapping of Modbus identification elements required by the FDT DTMDeviceTypeIdent schema-->
	<!-- These elements represent all mandatory objects for Modbus device identification (basic category) -->

	<!--Modbus identification object VendorName is mapped to FDT element IdManufacturer -->
	<ElementType name = "IdManufacturer" content = "eltOnly"  model = "closed">
		<attribute type = "modbusident:vendorName" required="yes"/>
		<element type = "modbusident:RegExpr" minOccurs = "0" maxOccurs = "*"/>
	</ElementType>

	<!--Modbus identification object ProductCode is mapped to FDT element IdTypeID -->
	<ElementType name = "IdTypeID" content = "eltOnly"  model = "closed">
		<attribute type = "modbusident:productCode" required="yes"/>
		<element type = "modbusident:RegExpr" minOccurs = "0" maxOccurs = "*"/>
	</ElementType>

	<!--Modbus identification object MajorMinorRevision is mapped to FDT element IdSoftwareRevision -->
	<ElementType name = "IdSoftwareRevision" content = "eltOnly"  model = "closed">
		<attribute type = "modbusident:majorMinorRevision" required="yes"/>
		<element type = "modbusident:RegExpr" minOccurs = "0" maxOccurs = "*"/>
	</ElementType>
	

	<!-- Regular category: -->
	<!-- Mapping of Modbus identification elements not required by the FDT DTMDeviceTypeIdent schema-->
	<!-- The information provided by each optional Modbus identification object (regular category) is mapped  -->
	<!-- to the standard FDT identification element IdValues, which may occur several times -->


	<!-- The following optional Modbus identification objects are supported: -->

	<!-- VendorUrl                       Attribute name/Protocol specific name:"vendorUrl"                      -->
	<!-- ProductName                  Attribute name/Protocol specific name:"productName"                -->
	<!-- ModelName                     Attribute name/Protocol specific name:"modelName"                   -->
	<!-- UserApplicationName     Attribute name/Protocol specific name:"userApplicationName"    -->   
	

	<ElementType name="IdValue" content="eltOnly" model="closed">
		<attribute type="modbusident:name" required="yes"/>
		<attribute type="modbusident:value" required="no"/>
		<attribute type="modbusident:protocolSpecificName" required="yes"/>
		<element type="modbusident:RegExpr" minOccurs="0" maxOccurs="*"/>
	</ElementType>


	<ElementType name="IdValues" content="eltOnly" model="closed">
		<element type="IdValue" minOccurs="0" maxOccurs="*"/>
	</ElementType>


	<!--FDT DeviceIdentification element -->

	<ElementType name = "DeviceIdentification" content = "eltOnly" model = "closed">
		<attribute type = "modbusident:idDTMSupportLevel" required="yes"/>
		<element type = "IdBusProtocol" minOccurs="1" maxOccurs="1"/>
		<element type = "IdManufacturer" minOccurs="1" maxOccurs="1"/>
		<element type = "IdTypeID" minOccurs="1" maxOccurs="1"/>
		<element type = "IdSoftwareRevision" minOccurs="1" maxOccurs="1"/>
		<element type = "IdValues" minOccurs = "0" maxOccurs = "1"/>
	</ElementType>

	<ElementType name = "DeviceIdentifications" content = "eltOnly" model = "closed">
		<element type = "DeviceIdentification" minOccurs = "1" maxOccurs = "*"/>
	</ElementType>

	<ElementType name = "FDT" content = "eltOnly" model = "closed">
		<element type = "DeviceIdentifications"/>
	</ElementType>

</Schema>
