/// <summary>
 /// Release.
 /// </summary>
 public void Release()
 {
     if (Media != null && Client != null)
     {
         try
         {
             if (Trace > TraceLevel.Info)
             {
                 Console.WriteLine("Release from the meter.");
             }
             GXReplyData reply = new GXReplyData();
             ReadDataBlock(Client.ReleaseRequest(), reply);
         }
         catch (Exception ex)
         {
             //All meters don't support Release.
             Console.WriteLine("Release failed. " + ex.Message);
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Release connection to the meter.
 /// </summary>
 public void Release()
 {
     if (Media != null && Client != null)
     {
         if (Trace > TraceLevel.Info)
         {
             Console.WriteLine("Release from the meter.");
         }
         GXReplyData reply = new GXReplyData();
         try
         {
             if (Client.InterfaceType == InterfaceType.WRAPPER ||
                 Client.Ciphering.Security != (byte)Security.None)
             {
                 ReadDataBlock(Client.ReleaseRequest(), reply);
             }
         }
         catch (Exception ex)
         {
             //All meters don't support Release.
             Console.WriteLine("Release failed. " + ex.Message);
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Close connection to the meter.
 /// </summary>
 public void Close()
 {
     if (Media != null && Client != null)
     {
         try
         {
             if (Trace > TraceLevel.Info)
             {
                 Console.WriteLine("Disconnecting from the meter.");
             }
             GXReplyData reply = new GXReplyData();
             try
             {
                 //Release is call only for secured connections.
                 //All meters are not supporting Release and it's causing problems.
                 if (Client.InterfaceType == InterfaceType.WRAPPER ||
                     (Client.InterfaceType == InterfaceType.HDLC && Client.Ciphering.Security != Security.None))
                 {
                     ReadDataBlock(Client.ReleaseRequest(), reply);
                 }
             }
             catch (Exception ex)
             {
                 //All meters don't support Release.
                 Console.WriteLine("Release failed. " + ex.Message);
             }
             reply.Clear();
             ReadDLMSPacket(Client.DisconnectRequest(), reply);
             Media.Close();
         }
         catch
         {
         }
         Media  = null;
         Client = null;
     }
 }
 byte[] ReleaseRequest()
 {
     byte[] data = client.ReleaseRequest()[0];
     GXLogWriter.WriteLog("Release request", data);
     return(data);
 }