Beispiel #1
0
 public List<GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>> Refresh(GXDLMSProfileGeneric item, GXDLMSCommunicator comm)
 {
     if (item.LogicalName.CompareTo("0.0.99.1.2.255") == 0) // LoadProfile1EndOfRecordingData
     {
         List<GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>> items = new List<GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>>();
         //Read profile generic columns.
         object value = comm.GetProfileGenericColumns(item.Name);
         byte[] data = comm.Read("0.0.99.128.1.255", ObjectType.ProfileGeneric, 2);
         byte[] allData = comm.ReadDataBlock(data, "Get profile generic columns...", 1);
         object[] values = (object[])comm.m_Cosem.GetValue(allData);
         Array info = values[0] as Array;
         GXDLMSObject obj = new GXDLMSData();
         obj.Description = "DateTime";
         obj.SetUIDataType(1, DataType.DateTime);
         items.Add(new GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(1, 0)));
         obj = new GXDLMSData();
         obj.Description = "Status";
         items.Add(new GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(2, 0)));
         //Two last items contains Start and end date.
         int cnt = 4;
         for (int pos = 0; pos < info.Length - 2; pos += 2)
         {
             obj = new GXDLMSData();
             obj.LogicalName = GXHelpers.ConvertFromDLMS(info.GetValue(pos), DataType.OctetString, DataType.OctetString, false).ToString();
             object scalerUnit = info.GetValue(pos + 1);
             obj.Description = "";
             items.Add(new GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(++cnt, 0)));
         }
         LastDateTime = ((GXDateTime) GXDLMS.Common.GXHelpers.ConvertFromDLMS(info.GetValue(info.Length - 1), DataType.OctetString, DataType.DateTime, true)).Value;
         return items;
     }
     return null;
 }
Beispiel #2
0
 public List<GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>> Refresh(GXDLMSProfileGeneric item, GXDLMSCommunicator comm)
 {
     GXReplyData reply = new GXReplyData();
     if (item.LogicalName.CompareTo("0.0.99.1.2.255") == 0) // LoadProfile1EndOfRecordingData
     {
         List<GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>> items = new List<GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>>();
         //Read profile generic columns.
         comm.GetProfileGenericColumns(item);
         byte[] data = comm.Read(item, 2);
         comm.ReadDataBlock(data, "Get profile generic columns...", 1, reply);
         object[] values = (object[])reply.Value;
         Array info = values[0] as Array;
         GXDLMSObject obj = new GXDLMSData();
         obj.Description = "DateTime";
         obj.SetUIDataType(1, DataType.DateTime);
         items.Add(new GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(1, 0)));
         obj = new GXDLMSData();
         obj.Description = "Status";
         items.Add(new GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(2, 0)));
         //Two last items contains Start and end date.
         int cnt = 4;
         for (int pos = 0; pos < info.Length - 2; pos += 2)
         {
             obj = new GXDLMSData();
             obj.LogicalName = Convert.ToString(GXDLMSClient.ChangeType((byte[])info.GetValue(pos), DataType.OctetString));
             object scalerUnit = info.GetValue(pos + 1);
             obj.Description = "";
             items.Add(new GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(++cnt, 0)));
         }
         LastDateTime = (GXDateTime)GXDLMSClient.ChangeType((byte[]) info.GetValue(info.Length - 1), DataType.DateTime);
         return items;
     }
     return null;
 }