Hi
I have a python TCP server which waits and receives a data packet (e.g., "DEVICE1" string) from a socket (e.g. on port 3333) and then it writes back the "text1." string to the socket.
I developed a serial over TCP xml protocol driver in dataminer and seems the driver is working.
I can see the protocol driver can send "DEVICE1" string packet to my python TCP server and I can see the protocol driver can receive "text1." data from the python server (from the element Stream Viewer).
=============================================
<< 05:35:27 - getTCPdata
000000 4445564943 4531 DEVICE1
>> 05:35:29 - getTCPdata
000000 7465787431 2E text1.
==============================================
I have a parameter (parameter 7) in the xml protocol trying to show the content of the received data ("text1.").
But looks like the parameter could not decode the data ("text1.") sent from the python server. The parameter content in the element page is empty.
Therefore, how to decode the data ("text1.") in dataminer xml protocol side?
Following is my python code which sends string 'text1.' which is encoded to utf-8:
connection.sendall("text1.".encode('utf-8'))
Following is the parameter 7 xml tags:
<Param id="7" trending="false">
<Name>Returned Str</Name>
<Description>Returned Str</Description>
<Information>
<Includes>
<Include>range</Include>
<Include>units</Include>
<Include>steps</Include>
<Include>time</Include>
</Includes>
</Information>
<Type>read</Type>
<Interprete>
<RawType>other</RawType>
<LengthType>next param</LengthType>
<Type>string</Type>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>General</Page>
<Column>0</Column>
<Row>2</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type>string</Type>
</Measurement>
</Param>
</Params>
Thanks
I don't immediately see a mistake in parameter 7. Could you please also show how the response XML itself looks like?
Also don't forget to implement the "read response" action that is triggered "before response" as described here: https://docs.dataminer.services/develop/devguide/Connector/ConnectionsSerialCreatingCommandsAndResponses.html#responses-with-variable-length-parameters
please see the new answer i posted below. thanks
please see the below new answer i posted. I could not paste xml tags in the comment. I don’t know why.
the response XML is simple, which just has one param 7 in it:
<Responses>
<Response id="1">
<Name>getDeviceStateRSP</Name>
<Description>Get Device State RsP</Description>
<Content>
<Param>7</Param>
</Content>
</Response>
</Responses>
I have a Pair (consisted by cmd1 and response1) in a group which is in a 10s timer. Response 1 has param 7 in it.
<Pairs>
<Pair id="1" ping="true">
<Name>getDeviceState</Name>
<Description>Get Device State</Description>
<Content>
<Command>1</Command>
<Response>1</Response>
</Content>
</Pair>
</Pairs>
Thanks
Hi, do you also have a “read response” action that is being triggered “before response” as described here? https://docs.dataminer.services/develop/devguide/Connector/ConnectionsSerialCreatingCommandsAndResponses.html#responses-with-variable-length-parameters
I see that this question has been inactive for some time. Have you found a solution for this yet? If yes, could you provide some information about this for reference for other users? If not, feel free to contact techsupport@skyline.be for assistance.