I'm having some challenges in reading profile data from an unfamiliar meter type, where I'm able to read the configured profiles, but not values within a profile (Access Violated error), however values able to read and display GXDLMSDirector.
Trying to figure this out, I stumbled onto the GXDLMSTranslator class listened to the byte arrays between the meter and GXDLMSDirector and was able to decode the byte arrays (messages) to xml for the messages and pdus respectively.
My idea is to edit the xml respectively, and then to encode the xml back to a byte array and send the meter... therefore reading profile data by specified time frames in this manner. This now, is also where I'm stuck:
available functions:
DatatoXml <-> XmltoData
PduoXml <-> XmltoPdu
MessagetoXml <-> ?? (can't see available function?)
code so far:
var translator = new GXDLMSTranslator(Gurux.DLMS.Enums.TranslatorOutputType.SimpleXml);
var xml = translator.MessageToXml(input);
Thank you Mikko, this will certainly be very useful! (and thank you for the fast response)
Following the recommendations I tried an example to read a register value via a list of xml commands (1) SNRM, (2) AARQ, (3) value read (4) Disconnect. Using the msg translater, the xml decoding for snrm requests looks like:
Unfortunately, an exception is already thrown on this SNRM command with the msg "Invalid Command: targetaddress" (targetaddress tag value = 65285, and thus not found in switch statement under GXDLMSTranslator -> GetCommand)
Not sure if my xml commands are contructed correctly then? I tested the translator on both the Gurux website, as well as on GXDLMSDirecotor (screenshot attached)
Don't add SNRM or AARQ commands. They have added automatically when the connection is established. You can change AARQ parameters like a password with command line parameters.
Ok, noted, thanks. Removed them from list of commands so that only a value read command is present for execution. The exception however still persists, with output in console being:
XML client messages are a little bit different than in GXDLMSDirector.
Just convert your short name reference value to hex. Try with this.
1008 = 0x3F0
Hi,
Hi,
Check this:
https://github.com/Gurux/Gurux.DLMS.Net/tree/master/Gurux.DLMS.XmlClient
I believe it will do what you want to do.
BR,
Mikko
Thank you Mikko, this will
Thank you Mikko, this will certainly be very useful! (and thank you for the fast response)
Following the recommendations I tried an example to read a register value via a list of xml commands (1) SNRM, (2) AARQ, (3) value read (4) Disconnect. Using the msg translater, the xml decoding for snrm requests looks like:
cmd: 7E A0 07 03 21 93 0F 01 7E
xml:
<HDLC len="9" >
<TargetAddress Value="1" />
<SourceAddress Value="10" />
<!-- SNRM frame. -->
<FrameType Value="93" />
<Snrm>
</Snrm>
</HDLC>
Unfortunately, an exception is already thrown on this SNRM command with the msg "Invalid Command: targetaddress" (targetaddress tag value = 65285, and thus not found in switch statement under GXDLMSTranslator -> GetCommand)
Not sure if my xml commands are contructed correctly then? I tested the translator on both the Gurux website, as well as on GXDLMSDirecotor (screenshot attached)
Hi,
Hi,
Don't add SNRM or AARQ commands. They have added automatically when the connection is established. You can change AARQ parameters like a password with command line parameters.
BR,
Mikko
Ok, noted, thanks. Removed
Ok, noted, thanks. Removed them from list of commands so that only a value read command is present for execution. The exception however still persists, with output in console being:
------------------------------------------------------------
3ValRead
------------------------------------------------------------
Invalid Command: TargetAddress
The xml command representation is (as created by GXDLMSDirector):
<HDLC len="16" >
<TargetAddress Value="1" />
<SourceAddress Value="16" />
<!--I frame.-->
<FrameType Value="32" />
<PDU>
<ReadRequest Qty="1" >
<VariableName Value="1008" />
</ReadRequest>
</PDU>
</HDLC>
The input parameters I specify to the execution is: -r SN -S COM3:9600:8None1 -x xmlFiles
(with the xmlCommands stored in the specified directory)
Hi,
Hi,
XML client messages are a little bit different than in GXDLMSDirector.
Just convert your short name reference value to hex. Try with this.
1008 = 0x3F0
<?xml version="1.0" encoding="utf-8"?>
<Messages>
<ReadRequest Qty="01" >
<VariableName Value="3F0" />
</ReadRequest>
</Messages>
BR,
Mikko