/// <summary>
        /// Initializes the communication interface.
        /// This object can then be passed to the Command objects like MeBasicCmd.
        /// </summary>
        /// <param name="phyCom">Physical connection.</param>
        public MeComQuerySet(IMeComPhy phyCom)
        {
            this.phyCom = phyCom;
            meFrame     = new MeComFrame(phyCom, statistics);

            Random rand = new Random();

            sequenceNr = Convert.ToUInt16(rand.Next(65535));

            threadIdOfCreator = Thread.CurrentThread.ManagedThreadId;
        }
        /// <summary>
        /// Changes the physical connection interface for this communication object.
        /// </summary>
        /// <param name="phyCom"></param>
        /// <exception cref="NotSupportedException">when a different thread then the creator of this object
        /// tries to change the physical interface.</exception>
        public void ChangePhyCom(IMeComPhy phyCom)
        {
            lock (lockObj)
            {
                if (Thread.CurrentThread.ManagedThreadId != threadIdOfCreator)
                {
                    throw new NotSupportedException("Only the creator thread can change the physical interface!");
                }

                this.phyCom = phyCom;
                meFrame     = new MeComFrame(this.phyCom, statistics);
            }
        }