private static void HandleDataNotification(GXDLMSSettings settings, GXReplyData reply)
{
int start = reply.Data.Position - 1;
//Get invoke id.
UInt32 invokeId = reply.Data.GetUInt32();
reply.Time = DateTime.MinValue;
int len = reply.Data.GetUInt8();
byte[] tmp = null;
// If date time is given.
if (len != 0)
{
tmp = new byte[len];
reply.Data.Get(tmp);
if (reply.Xml != null)
{
reply.Xml.AppendLine(TranslatorTags.DateTime, "Value", GXCommon.ToHex(tmp, false));
}
reply.Time = (GXDateTime)GXDLMSClient.ChangeType(tmp, DataType.DateTime);
}
if (reply.Xml != null)
{
reply.Xml.AppendStartTag(Command.DataNotification);
reply.Xml.AppendLine(TranslatorTags.LongInvokeId, null,
reply.Xml.IntegerToHex(invokeId, 8));
reply.Xml.AppendLine(TranslatorTags.DateTime, null,
GXCommon.ToHex(tmp, false));
reply.Xml.AppendStartTag(TranslatorTags.NotificationBody);
reply.Xml.AppendStartTag(TranslatorTags.DataValue);
GXDataInfo di = new GXDataInfo();
di.xml = reply.Xml;
GXCommon.GetData(settings, reply.Data, di);
reply.Xml.AppendEndTag(TranslatorTags.DataValue);
reply.Xml.AppendEndTag(TranslatorTags.NotificationBody);
reply.Xml.AppendEndTag(Command.DataNotification);
}
else
{
GetDataFromBlock(reply.Data, start);
GetValueFromData(settings, reply);
}
}