<Schema name="FDTSERCOSCommunicationSchema" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:fdt="x-schema:FDTDataTypesSchema.xml">
	<AttributeType name="schemaVersion" dt:type="number" default="1.00"/>	
	<!-- communication reference used in 'negotiation' -->
	<AttributeType name="communicationReference" dt:type="uuid"/>
    <!--                          EIDN                              -->
	<AttributeType name="idn" dt:type="ui4"/>
	<!--  data block element of the IDN, range: 1 - 7 -->
    <AttributeType name="dbElement" dt:type="ui1"/>
    
  
  <AttributeType name="sercosAddress" dt:type="ui2"/>
  <AttributeType name="systemTag" dt:type="string"/>
  <AttributeType name="CP" dt:type="enumeration" dt:values="NRT CP0 CP1 CP2 CP3 CP4"/>
    
	<AttributeType name="fileName" dt:type="string"/>
	<AttributeType name="password" dt:type="ui4"/>
	<AttributeType name="maxDataLength" dt:type="ui4"/>
	
	<AttributeType name="sequenceTime" dt:type="ui4"/>
	<AttributeType name="delayTime" dt:type="ui4"/>

	<AttributeType name="sercosProtocol" dt:type="enumeration" dt:values="svc sip tftp"/>
	
	<AttributeType name="errorCode" dt:type="bin.hex"/>
	<AttributeType name="errorInfo" dt:type="string"/>
	<AttributeType name="errorType" dt:type="enumeration" dt:values="not_handled sercos_type_a sercos_type_b"/>

	<!--                                                                               -->
	<!--                             error description                           -->
	<!--                                                                               -->
	
	<ElementType name="sercosError" content="empty" model="closed">
		<attribute type="errorType" required="yes"/>
		<attribute type="errorCode" required="no"/>
		<attribute type="errorInfo" required="no"/>
	</ElementType>

	<!--                                                                               -->
	<!--                     connect, disconnect, abort                   -->
	<!--                                                                               -->

	<ElementType name="ConnectRequest" content="empty" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
	<!--  sercos address is not required as these addresses are managed by
           the master dtm for all slaves and the master is in possession of  the 
           system tag of the requesting slave DTM for mapping     -->
	<!--  if sercos protocol isn't specified, Service Channel should be used   -->
		<attribute type="sercosAddress" required="yes"/>
		<attribute type="CP" required="yes"/>
		<attribute type="systemTag" required="yes"/>
	</ElementType>
	

	<ElementType name="ConnectResponse" content="mixed" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		
		<!-- Success: CR of the established connection. Failure: not relevant. -->
		<attribute type="communicationReference" required="yes"/> 
		<element type="sercosError" minOccurs="0" maxOccurs="1"/>
		
	</ElementType>

	<ElementType name="DisconnectRequest" content="empty" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<attribute type="communicationReference" required="yes"/> <!-- connect response communication reference. -->
	</ElementType>

	<ElementType name="DisconnectResponse" content="empty" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<attribute type="communicationReference" required="yes"/> <!-- connect response communication reference. -->
	</ElementType>

	<ElementType name="Abort" content="empty" model="closed">
		<attribute type="communicationReference" required="yes"/>
	</ElementType>

	<ElementType name="CancelTransaction" content="empty" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<attribute type="communicationReference" required="yes"/>
	</ElementType>

	<ElementType name="SequenceBegin" content="empty" model="closed">
		<attribute type="sequenceTime" required="no"/>
		<attribute type="delayTime" required="no"/>
		<attribute type="communicationReference" required="yes"/>
	</ElementType>
	<ElementType name="SequenceEnd" content="empty" model="closed">
		<attribute type="communicationReference" required="yes"/>
	</ElementType>
	<ElementType name="SequenceStart" content="empty" model="closed">
		<attribute type="communicationReference" required="yes"/>
	</ElementType>	
	
	<!--                                                                               -->
	<!--                             TFTP service                               -->
	<!--                       file upload, download                          -->
	<!--                                                                               -->

	<ElementType name="FileUploadRequest" content="empty" model="closed">
		<!-- password to be verified by the slave. -->
		<attribute type="password" required="no"/>
		<!-- file name of the upload data.              -->
		<attribute type="fileName" required="yes"/>
		<attribute type="maxDataLength" required="no"/>
	</ElementType>

	<ElementType name="FileUploadResponse" content="eltOnly" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<attribute type="communicationReference" required="yes"/>
		<!-- file name of the download data. Must be same as in request. -->
		<attribute type="fileName" required="yes"/>
		<group order="one">
			<element type="sercosError"/>
			<element type="fdt:CommunicationData"/>
		</group>
	</ElementType>
	
	<ElementType name="FileDownloadRequest" content="mixed" model="closed">
		<!-- password to be verified by the slave. -->
		<attribute type="password" required="no"/>
		<!-- file name of the download data.          -->
		<attribute type="fileName" required="yes"/>
		<element type="fdt:CommunicationData" minOccurs="1" maxOccurs="1"/>
	</ElementType>

	<ElementType name="FileDownloadResponse" content="mixed" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<attribute type="communicationReference" required="yes"/>
		<!-- file name of the download data. Must be same as in request. -->
		<attribute type="fileName" required="yes"/>
		<element type="sercosError" minOccurs="0" maxOccurs="1"/>
	</ElementType>	
		
	<!--                                                                               -->
	<!--                    Watchdog Trigger Service                      -->
	<!--                                                                               -->
  <!--  
	<ElementType name="WatchdogTriggerRequest" content="empty" model="closed"/>
	  <attribute type="fdt:nodeId" required="yes"/>
	</ElementType>
	 -->  
	 
	<ElementType name="WatchdogTriggerResponse" content="eltOnly" model="closed">
		<group order="one">
			<element type="sercosError"/>
			<!--   watchdog expiration period in ms, uint32   -->
			<element type="fdt:CommunicationData"/>
		</group>
	</ElementType>	
	
	<!--                                                                               -->
	<!--                       parameter read, write                         -->
	<!--                                                                               -->

	<ElementType name="ReadElementRequest" content="empty" model="closed">
		<attribute type="dbElement" required="yes"/>
	</ElementType>
	
	<ElementType name="ReadElementResponse" content="eltOnly" model="closed">
    <attribute type="dbElement" required="yes"/>
		<group order="one">
			<element type="sercosError"/>
			<element type="fdt:CommunicationData"/>
		</group>
	</ElementType>	
			
	<ElementType name="ParameterReadRequest" content="mixed" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<!-- CR from connect response. -->
		<attribute type="communicationReference" required="yes"/>
		<!-- extended IDN. For standard IDN, SI, SE parts are zeros! -->
		<attribute type="idn" required="yes"/>
		<!-- data block element of the IDN. If this element isn't present, all 7 data blocks upload is requested. -->
		<element type="ReadElementRequest" minOccurs="0" maxOccurs="*"/>
	</ElementType>
			
	<ElementType name="ParameterReadResponse" content="mixed" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<!-- CR from connect response. -->
		<attribute type="communicationReference" required="yes"/>
		<!-- extended IDN, must be same as in request. For standard IDN, SI, SE parts are zeros! -->
		<attribute type="idn" required="yes"/>
	
		<element type="ReadElementResponse" minOccurs="1" maxOccurs="*"/>
	</ElementType>
	
	<ElementType name="ParameterWriteRequest" content="eltOnly" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<!-- CR from connect response. -->
		<attribute type="communicationReference" required="yes"/>  
		<!-- extended IDN. For standard IDN, SI, SE parts are zeros! -->
		<attribute type="idn" required="yes"/>
		<!-- data block element of the IDN. If this element isn't present, all 7 data blocks upload is requested. -->
		<attribute type="dbElement" required="yes"/>
		<element type="fdt:CommunicationData" minOccurs="1" maxOccurs="1"/>
	</ElementType>		
	
	<ElementType name="ParameterWriteResponse" content="mixed" model="closed">
		<attribute type="fdt:nodeId" required="no"/>
		<!-- CR from connect response. -->
		<attribute type="communicationReference" required="yes"/>
		<!-- extended IDN, must be same as in request. -->
		<attribute type="idn" required="yes"/>
		<!-- data block element of the IDN. , must be same as in request. -->
		<attribute type="dbElement" required="yes"/>
		<element type="sercosError" minOccurs="0" maxOccurs="1"/>
	</ElementType>			
	
	
	<!--                                                                               -->
	<!--                                schema root                             -->
	<!--                                                                               -->

	<ElementType name="FDT" content="eltOnly" model="closed">
		<attribute type="schemaVersion" required="no"/>
		<attribute type="fdt:nodeId" required="no"/>
		<group order="one">
			<element type="ConnectRequest"/>
			<element type="ConnectResponse"/>
			<element type="DisconnectRequest"/>
			<element type="DisconnectResponse"/>
			<element type="Abort"/>
			
			<element type="CancelTransaction"/>
			<element type="SequenceBegin"/>
			<element type="SequenceEnd"/>
			<element type="SequenceStart"/>
			
			<element type="WatchdogTriggerRequest"/>
			<element type="WatchdogTriggerResponse"/>
			
			<element type="ParameterReadRequest"/>
			<element type="ParameterReadResponse"/>
			<element type="ParameterWriteRequest"/>
			<element type="ParameterWriteResponse"/>
			
			<element type="FileUploadRequest"/>
			<element type="FileUploadResponse"/>
			<element type="FileDownloadRequest"/>
			<element type="FileDownloadResponse"/>
			
			<element type="fdt:CommunicationError"/>
		</group>
	</ElementType>
</Schema>
