Xml To Message

1 viestiä / 0 new
Uusin kirjoitus
Paul
Xml To Message

Hi,

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);

byte[] pdu = translator.GetPdu(input);
string pduxml = translator.PduToXml(pdu);
//-> change pdu text here
byte[] pduEncoded = translator.XmlToPdu(pduxml);
string hexPdu = translator.XmlToHexPdu(pduxml);

//need to set message pdu equal to new pdu
//need to encode xml back to binary

Any suggestions, or already-available approaches please?