Exemple #1
0
 /// <summary>
 /// Read Profile Generic Columns by entry.
 /// </summary>
 public object[] ReadRowsByEntry(GXDLMSObject it, int index, int count, GXDLMSObjectCollection columns)
 {
     byte[]   reply = ReadDataBlock(m_Parser.Read(m_Parser.ReadRowsByEntry(it.Name, index, count), 1, 1, ObjectType.None, 0));
     object[] rows  = (object[])m_Parser.GetValue(reply);
     if (columns != null && rows.Length != 0 && m_Parser.ObisCodes.Count != 0)
     {
         Array row = (Array)rows[0];
         if (columns.Count != row.Length)
         {
             throw new Exception("Columns count do not mach.");
         }
         for (int pos = 0; pos != columns.Count; ++pos)
         {
             if (row.GetValue(pos) is byte[])
             {
                 DataType type = DataType.None;
                 //Find Column type
                 GXObisCode code = m_Parser.ObisCodes.FindByLN(columns[pos].ObjectType, columns[pos].LogicalName, null);
                 if (code != null)
                 {
                     GXAttribute att = code.Attributes.Find(columns[pos].AttributeIndex);
                     if (att != null)
                     {
                         type = att.UIType;
                     }
                 }
                 foreach (object[] cell in rows)
                 {
                     cell[pos] = GXDLMS.ChangeType((byte[])cell[pos], type);
                 }
             }
         }
     }
     return(rows);
 }