/// <summary>
        /// Get module identification.
        /// </summary>
        /// <param name="addr">Address of the module.</param>
        /// <returns>A correctly typed Module instance.</returns>
        private IModule GetModuleIdent(byte addr)
        {
            IModule module = null;
            var     answer = new BICCPData();

            if (Biccp.RequestToModule(addr, answer, ICCConstants.BICCP_GRP_CONF, ICCConstants.BICCP_CMD_CONF_VERSION))
            {
                int iMajor = answer.Data[0];
                int iMinor = answer.Data[1];
                int iBuild = answer.Data[2];
                if (Biccp.RequestToModule(addr, answer, ICCConstants.BICCP_GRP_CONF, ICCConstants.BICCP_CMD_CONF_IDENT))
                {
                    module       = ModuleFactory.CreateInstance(answer.Data[1]);
                    module.Major = iMajor;
                    module.Minor = iMinor;
                    module.Build = iBuild;

                    module.Description = string.Empty;
                    for (int i = 0; i < ICCConstants.DESCSIZE; i++)
                    {
                        if (answer.Data[i + 2] != 0)
                        {
                            module.Description += (char)answer.Data[i + 2];
                        }
                    }
                }
            }

            Log.LogMessage((module != null), "Module identification", addr);

            return(module);
        }
        /// <summary>
        /// Scans the I2C bus.
        /// </summary>
        /// <returns>QUantity of modules scanned.</returns>
        public virtual int ScanBus()
        {
            RescanPending = true;

            ClearModules();

            byte[] moduleList = new byte[0x78];
            int    iNbModules = Biccp.BICCP_ScanBus(ref moduleList);

            int i = 0;

            for (byte l = 0; l < 0x78; l++)
            {
                if (moduleList[l] > 0)
                {
                    var ccMod = GetModuleIdent(l);
                    if (ccMod == null)
                    {
                        System.Threading.Thread.Sleep(10);
                        ccMod = GetModuleIdent(l);
                    }
                    if (ccMod != null)
                    {
                        ccMod.ID = l;
                        Modules.Add(l, ccMod);
                    }
                    else
                    {
                        ccMod    = ModuleFactory.CreateInstance(ICCConstants.BICCP_GRP_UNKNOWN);
                        ccMod.ID = l;
                        Modules.Add(l, ccMod);
                    }
                    i++;
                }
            }

            RaiseBusRescanned();

            RescanPending = false;

            return(i);
        }