Example #1
0
        /// <summary>
        /// Read list of attributes.
        /// </summary>
        public void ReadList(List <KeyValuePair <GXDLMSObject, int> > list)
        {
            byte[][]      data   = Client.ReadList(list);
            GXReplyData   reply  = new GXReplyData();
            List <object> values = new List <object>();

            foreach (byte[] it in data)
            {
                ReadDataBlock(it, reply);
                if (reply.Value is object[])
                {
                    values.AddRange((object[])reply.Value);
                }
                else if (reply.Value != null)
                {
                    //Value is null if data is send multiple frames.
                    values.Add(reply.Value);
                }
                reply.Clear();
            }
            if (values.Count != list.Count)
            {
                throw new Exception("Invalid reply. Read items count do not match.");
            }
            Client.UpdateValues(list, values);
        }