Hi :
I would like to write a raw tcp send and receive driver.
e.g.
- The element opens a tcp connection to a remote device via port 3333.
- Then the element sends text string "READ1" to the remote device.
- Then the element reads response (e.g. "RESULT1" or ERROR msg) from remote device.
I think it can be done via <pair>, <command> and <response>.
Are following xml tags the right way doing it?
Thanks
<Pair id="1" ping="true">
<Name>getDeviceState</Name>
<Description>Get Device State</Description>
<Content>
<Command>1</Command>
<Response>1</Response>
</Content>
</Pair>
<Command id="1">
<Name>getDeviceStateCMD</Name>
<Description>Get Device State CMD</Description>
<Content>
<Param>1</Param>
</Content>
</Command>
<Responses>
<Response id="1">
<Name>getDeviceStateRSP</Name>
<Description>Get Device State RsP</Description>
<Content>
<Param>2</Param>
</Content>
</Response>
<Param id="1">
<Name>dynamicCMDData</Name>
<Description>Command Data</Description>
<Information>
<Subtext></Subtext>
<Includes>
<Include>time</Include>
<Include>range</Include>
<Include>steps</Include>
<Include>units</Include>
</Includes>
</Information>
<Type>read</Type>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
<DefaultValue>READ1</DefaultValue>
</Interprete>
</Param>
<Param id="2">
<Name>dynamicRSPData</Name>
<Description>Dynamic Response Data</Description>
<Information>
<Subtext></Subtext>
<Includes>
<Include>time</Include>
<Include>range</Include>
<Include>steps</Include>
<Include>units</Include>
</Includes>
</Information>
<Type>read</Type>
<Interprete>
<RawType>other</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
</Interprete>
</Param>
Hi Peng Fei. Your code is in the right direction, but would change the following things:
Param 1 can be a fixed parameter:
<Param id="1">
<Name>dynamicCMDData</Name>
<Description>Command Data</Description>
<Type>fixed</Type>
<Interprete>
<RawType>other</RawType>
<LengthType>fixed</LengthType>
<Length>5</Length>
<Type>string</Type>
<Value>READ1</Value>
</Interprete>
</Param>
Next to that it would be better if a 'trailer' parameter could be added to the response (if possible, depending on the data format).
When the trailer is received, DataMiner knows it has received the whole message. If no trailer is defined DataMiner will wait until the configured timeout time in the element before starting to process the data, which slows down the communication a lot.
More detailed information and help can be found here:
https://docs.dataminer.services/develop/devguide/Connector/ConnectionsSerialCreatingCommandsAndResponses.html