Skip to content

Commit

Permalink
Trace improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
gurux01 committed Nov 21, 2017
1 parent 6a5d2e3 commit 97d90e8
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Development/GXDLMSCommunicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//
//
// Version: $Revision: 9716 $,
// $Date: 2017-11-21 09:19:16 +0200 (ti, 21 marras 2017) $
// Version: $Revision: 9718 $,
// $Date: 2017-11-21 10:23:05 +0200 (ti, 21 marras 2017) $
// $Author: gurux01 $
//
// Copyright (c) Gurux Ltd
Expand Down Expand Up @@ -190,11 +190,7 @@ public void ReadDLMSPacket(byte[] data, int tryCount, GXReplyData reply)
if (client.InterfaceType == InterfaceType.WRAPPER && media is GXNet && !parent.UseRemoteSerial)
{
eop = null;
}
if (parent.OnTrace != null)
{
parent.OnTrace(parent, "<- " + DateTime.Now.ToLongTimeString(), data);
}
}
int pos = 0;
bool succeeded = false;
ReceiveParameters<byte[]> p = new ReceiveParameters<byte[]>()
Expand Down Expand Up @@ -258,14 +254,15 @@ public void ReadDLMSPacket(byte[] data, int tryCount, GXReplyData reply)
}
catch (Exception ex)
{
GXLogWriter.WriteLog("Received data", p.Reply);
GXLogWriter.WriteLog("Received data:", p.Reply);
throw ex;
}
}
if (parent.OnTrace != null)
{
parent.OnTrace(parent, "-> " + DateTime.Now.ToLongTimeString(), p.Reply);
}
GXLogWriter.WriteLog("Received data", p.Reply);
if (reply.Error != 0)
{
if (reply.Error == (int)ErrorCode.Rejected)
Expand Down Expand Up @@ -694,7 +691,7 @@ public void InitializeConnection()
data = SNRMRequest();
if (data != null)
{
GXLogWriter.WriteLog("Send SNRM request.");
GXLogWriter.WriteLog("Send SNRM request.", data);
ReadDLMSPacket(data, 1, reply);
GXLogWriter.WriteLog("Parsing UA reply succeeded.");
//Has server accepted client.
Expand All @@ -704,8 +701,7 @@ public void InitializeConnection()
//Split requests to multiple packets if needed.
//If password is used all data might not fit to one packet.
reply.Clear();
GXLogWriter.WriteLog("Send AARQ request.");
ReadDataBlock(AARQRequest(), "", reply);
ReadDataBlock(AARQRequest(), "Send AARQ request.", reply);
try
{
//Parse reply.
Expand Down Expand Up @@ -811,6 +807,7 @@ internal void ReadDataBlock(byte[][] data, string text, int multiplier, GXReplyD
/// <returns>Received data.</returns>
internal void ReadDataBlock(byte[] data, string text, int multiplier, GXReplyData reply)
{
GXLogWriter.WriteLog(text, data);
ReadDLMSPacket(data, reply);
if (OnDataReceived != null)
{
Expand Down

0 comments on commit 97d90e8

Please sign in to comment.