/// <summary> /// Returns Association View. /// </summary> /// <param name="table"></param> /// <returns></returns> byte[] GetData(List <object[]> table) { List <byte> data = new List <byte>(); data.Add((byte)DataType.Array); GXCommon.SetObjectCount(table.Count, data); foreach (object[] items in table) { data.Add((byte)DataType.Structure); GXCommon.SetObjectCount(items.Length, data); foreach (object value in items) { Gurux.DLMS.DataType tp = Gurux.DLMS.Internal.GXCommon.GetValueType(value); GXCommon.SetData(data, tp, value); } } return(data.ToArray()); }
/// <summary> /// Convert DLMS data type to .Net data type. /// </summary> /// <param name="type"></param> /// <returns></returns> static public Type GetDataType(Gurux.DLMS.DataType type) { switch (type) { case Gurux.DLMS.DataType.None: return(null); case Gurux.DLMS.DataType.Array: case Gurux.DLMS.DataType.CompactArray: case Gurux.DLMS.DataType.Structure: return(typeof(object[])); case Gurux.DLMS.DataType.BinaryCodedDesimal: return(typeof(string)); case Gurux.DLMS.DataType.BitString: return(typeof(string)); case Gurux.DLMS.DataType.Boolean: return(typeof(bool)); case Gurux.DLMS.DataType.Date: return(typeof(Date)); case Gurux.DLMS.DataType.DateTime: return(typeof(DateTime)); case Gurux.DLMS.DataType.Float32: return(typeof(float)); case Gurux.DLMS.DataType.Float64: return(typeof(double)); case Gurux.DLMS.DataType.Int16: return(typeof(Int16)); case Gurux.DLMS.DataType.Int32: return(typeof(Int32)); case Gurux.DLMS.DataType.Int64: return(typeof(Int64)); case Gurux.DLMS.DataType.Int8: return(typeof(sbyte)); case Gurux.DLMS.DataType.OctetString: return(typeof(byte[])); case Gurux.DLMS.DataType.String: return(typeof(string)); case Gurux.DLMS.DataType.Time: return(typeof(Time)); case Gurux.DLMS.DataType.UInt16: return(typeof(UInt16)); case Gurux.DLMS.DataType.UInt32: return(typeof(UInt32)); case Gurux.DLMS.DataType.UInt64: return(typeof(UInt64)); case Gurux.DLMS.DataType.UInt8: return(typeof(byte)); default: case Gurux.DLMS.DataType.Enum: break; } throw new Exception("Invalid DLMS data type."); }