Esempio n. 1
0
        /// <summary>
        ///下载设置
        /// </summary>
        public bool DownloadSensorInfosToDevice(string DevName, int DeviceType, int intActivePage, int num1, int num2)
        {
            string strMainRemark = DevName.Split('\\')[1].Trim();

            DevName = DevName.Split('\\')[0].Trim();

            //保存basic informations网络信息
            byte bytSubID = byte.Parse(DevName.Split('-')[0].ToString());
            byte bytDevID = byte.Parse(DevName.Split('-')[1].ToString());

            byte[] ArayTmp = null;
            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x000E, bytSubID, bytDevID, false, true, true, false) == false)
            {
                return(false);
            }
            else
            {
                byte[] arayRemark = new byte[20];
                for (int intI = 0; intI < 20; intI++)
                {
                    arayRemark[intI] = CsConst.myRevBuf[25 + intI];
                }
                Devname = bytSubID.ToString() + "-" + bytDevID.ToString() + "\\" + HDLPF.Byte2String(arayRemark);

                HDLUDP.TimeBetwnNext(1);
            }
            ///红外发射
            if (intActivePage == 0 || intActivePage == 1)
            {
                #region
                ArayTmp = new byte[2];
                IRCodes = new List <UVCMD.IRCode>();
                //读取红外有效性
                for (int i = num1; i <= num2; i++)
                {
                    UVCMD.IRCode temp = new UVCMD.IRCode();
                    temp.IRLength  = 0;
                    temp.IRLoation = 0;
                    temp.KeyID     = i;
                    temp.Codes     = "";
                    temp.Remark1   = "";
                    temp.Enable    = 0;
                    IRCodes.Add(temp);
                }
                ArayTmp = new byte[0];
                int  intTmp        = 0;
                byte ValidCount    = 0;
                byte FirstKey      = 0;
                byte LastSendCount = 0;
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x168A, bytSubID, bytDevID, false, true, true, false) == true)
                {
                    ValidCount = CsConst.myRevBuf[26];
                    FirstKey   = CsConst.myRevBuf[27];

                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return(false);
                }
                if (ValidCount > 11)
                {
                    intTmp = ValidCount / 11;
                    if (ValidCount % 11 != 0)
                    {
                        intTmp        = intTmp + 1;
                        LastSendCount = Convert.ToByte(ValidCount % 11);
                    }
                }
                else if (ValidCount != 0 && ValidCount <= 11)
                {
                    intTmp = 1;
                }
                List <byte> listTmp = new List <byte>();
                for (int i = 0; i < intTmp; i++)
                {
                    ArayTmp    = new byte[2];
                    ArayTmp[0] = FirstKey;
                    ArayTmp[1] = 11;
                    if (i == intTmp - 1 && LastSendCount != 0)
                    {
                        ArayTmp[1] = LastSendCount;
                    }
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x168C, bytSubID, bytDevID, false, true, true, false) == true)
                    {
                        FirstKey = CsConst.myRevBuf[40];
                        for (int j = 0; j < ArayTmp[1]; j++)
                        {
                            if (!listTmp.Contains(CsConst.myRevBuf[29 + j]))
                            {
                                listTmp.Add(CsConst.myRevBuf[29 + j]);
                            }
                        }

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return(false);
                    }
                }
                for (int i = 0; i < IRCodes.Count; i++)
                {
                    for (int j = 0; j < listTmp.Count; j++)
                    {
                        if ((IRCodes[i].KeyID - 1) == Convert.ToInt32(listTmp[j]))
                        {
                            IRCodes[i].Enable = 1;
                            break;
                        }
                    }
                }
                for (int i = 0; i < IRCodes.Count; i++)
                {
                    if (IRCodes[i].Enable == 1)
                    {
                        ArayTmp    = new byte[2];
                        ArayTmp[0] = Convert.ToByte(IRCodes[i].KeyID - 1);
                        ArayTmp[1] = 0;
                        byte[] arayRemark = new byte[20];
                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x168E, bytSubID, bytDevID, false, true, true, false) == true)
                        {
                            Array.Copy(CsConst.myRevBuf, 29, arayRemark, 0, 10);

                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return(false);
                        }
                        ArayTmp    = new byte[2];
                        ArayTmp[0] = Convert.ToByte(IRCodes[i].KeyID - 1);
                        ArayTmp[1] = 1;
                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x168E, bytSubID, bytDevID, false, true, true, false) == true)
                        {
                            Array.Copy(CsConst.myRevBuf, 29, arayRemark, 10, 10);

                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return(false);
                        }
                        IRCodes[i].Remark1 = HDLPF.Byte2String(arayRemark);
                    }
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(10 * (i + 1) / IRCodes.Count);
                    }
                }
                #endregion
                MyRead2UpFlags[0] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(10);
            }
            // 红外接收
            if (intActivePage == 0 || intActivePage == 2)
            {
                #region
                IrReceiver = new List <IRReceive>();
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1672, bytSubID, bytDevID, false, true, true, false) == true)
                {
                    ArayTmpMode = new byte[40];
                    Array.Copy(CsConst.myRevBuf, 26, ArayTmpMode, 0, 40);

                    HDLUDP.TimeBetwnNext(1);
                    for (int intI = num1; intI <= num2; intI++)
                    {
                        IRReceive oTmp = new IRReceive();
                        oTmp.BtnNum     = intI;
                        oTmp.IRBtnModel = ArayTmpMode[intI - 1];
                        oTmp.TargetInfo = new List <UVCMD.ControlTargets>();
                        //读取按键备注
                        #region
                        ArayTmp = new byte[1];

                        ArayTmp[0] = Convert.ToByte(intI);
                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x167A, bytSubID, bytDevID, false, true, true, false) == true)
                        {
                            byte[] arayRemark = new byte[20];
                            for (int intJ = 0; intJ < 20; intJ++)
                            {
                                arayRemark[intJ] = CsConst.myRevBuf[27 + intJ];
                            }
                            oTmp.IRBtnRemark = HDLPF.Byte2String(arayRemark);

                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return(false);
                        }
                        #endregion
                        //按键目标
                        #region
                        oTmp.TargetInfo = new List <UVCMD.ControlTargets>();
                        if (CsConst.isRestore)
                        {
                            byte bytTotalCMD = 1;
                            switch (oTmp.IRBtnModel)
                            {
                            case 0: bytTotalCMD = 1; break;

                            case 1:
                            case 2:
                            case 3:
                            case 6:
                            case 10: bytTotalCMD = 1; break;

                            case 4:
                            case 5:
                            case 7:
                            case 13: bytTotalCMD = 99; break;

                            case 11: bytTotalCMD = 98; break;

                            case 16:
                            case 17: bytTotalCMD = 49; break;
                            }
                            for (byte bytJ = 0; bytJ < bytTotalCMD; bytJ++)
                            {
                                ArayTmp    = new byte[2];
                                ArayTmp[0] = (byte)(intI);
                                ArayTmp[1] = (byte)(bytJ + 1);
                                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1676, bytSubID, bytDevID, false, true, true, false) == true)
                                {
                                    UVCMD.ControlTargets oCMD = new UVCMD.ControlTargets();
                                    oCMD.ID       = CsConst.myRevBuf[27];
                                    oCMD.Type     = CsConst.myRevBuf[28]; //转换为正确的类型
                                    oCMD.SubnetID = CsConst.myRevBuf[29];
                                    oCMD.DeviceID = CsConst.myRevBuf[30];
                                    oCMD.Param1   = CsConst.myRevBuf[31];
                                    oCMD.Param2   = CsConst.myRevBuf[32];
                                    oCMD.Param3   = CsConst.myRevBuf[33];
                                    oCMD.Param4   = CsConst.myRevBuf[34];

                                    oTmp.TargetInfo.Add(oCMD);

                                    HDLUDP.TimeBetwnNext(1);
                                }
                                else
                                {
                                    return(false);
                                }
                            }
                        }
                        #endregion
                        IrReceiver.Add(oTmp);
                        if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                        {
                            CsConst.calculationWorker.ReportProgress(2 + intI / 2);
                        }
                    }
                }
                else
                {
                    return(false);
                }
                #endregion
                MyRead2UpFlags[1] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(20);
            }
            //传感器设置
            if (intActivePage == 0 || intActivePage == 3 || intActivePage == 4)
            {
                #region
                if (intActivePage == 0 || intActivePage == 3)
                {
                    // read led灯使能位
                    #region
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0xDB3E, bytSubID, bytDevID, false, true, true, false) == true)
                    {
                        Array.Copy(CsConst.myRevBuf, 27, ONLEDs, 0, CsConst.myRevBuf[26]);

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return(false);
                    }
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(21);
                    }
                    #endregion
                }
                if (intActivePage == 0 || intActivePage == 3 || intActivePage == 4)
                {
                    //读取使能位
                    #region
                    ArayTmp = null;
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x165E, bytSubID, bytDevID, false, true, true, false) == true)
                    {
                        Array.Copy(CsConst.myRevBuf, 26, EnableSensors, 0, 7);

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return(false);
                    }
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(23);
                    }
                    #endregion
                }
                if (intActivePage == 0 || intActivePage == 3)
                {
                    //读取温度补偿值
                    #region
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1641, bytSubID, bytDevID, false, true, true, false) == true)
                    {
                        Array.Copy(CsConst.myRevBuf, 26, ParamSensors, 0, 1);

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return(false);
                    }
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(24);
                    }
                    #endregion
                    //读取灵敏度
                    #region
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x166E, bytSubID, bytDevID, false, true, true, false) == true)
                    {
                        Array.Copy(CsConst.myRevBuf, 26, ParamSensors, 1, 1);

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return(false);
                    }
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(25);
                    }
                    #endregion
                    //恒照度读取
                    if (DeviceType == 329)
                    {
                        #region
                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x16A9, bytSubID, bytDevID, false, true, true, false) == true)
                        {
                            Array.Copy(CsConst.myRevBuf, 26, EnableBroads, 0, 9);

                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return(false);
                        }
                        if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                        {
                            CsConst.calculationWorker.ReportProgress(26);
                        }
                        #endregion
                    }
                }
                #endregion
                MyRead2UpFlags[2] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(30);
            }
            //逻辑块功能设置
            if (intActivePage == 0 || intActivePage == 4)
            {
                #region
                // 读取24个逻辑的使能位
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x165A, bytSubID, bytDevID, false, true, true, false) == true)
                {
                    logic = new List <SensorLogic>();
                    byte[] ArayTmpMode = new byte[24];
                    Array.Copy(CsConst.myRevBuf, 26, ArayTmpMode, 0, Eightin1DeviceTypeList.TotalLogic);

                    HDLUDP.TimeBetwnNext(1);
                    for (int intI = 1; intI <= Eightin1DeviceTypeList.TotalLogic; intI++)
                    {
                        SensorLogic oTmp = new SensorLogic();
                        oTmp.ID            = (byte)intI;
                        oTmp.EnableSensors = new byte[15];
                        oTmp.Paramters     = new byte[20];
                        oTmp.Enabled       = ArayTmpMode[intI - 1];
                        //无效则不读取
                        if (oTmp.Enabled != 1)
                        {
                            logic.Add(oTmp);
                            continue;
                        }
                        //读取备注
                        #region
                        ArayTmp    = new byte[1];
                        ArayTmp[0] = Convert.ToByte(intI);
                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1648, bytSubID, bytDevID, false, true, true, false) == true)
                        {
                            byte[] arayRemark = new byte[20];
                            for (int intJ = 0; intJ < 20; intJ++)
                            {
                                arayRemark[intJ] = CsConst.myRevBuf[27 + intJ];
                            }
                            oTmp.Remarklogic = HDLPF.Byte2String(arayRemark);

                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return(false);
                        }
                        #endregion
                        //读取设置
                        #region
                        if (CsConst.isRestore)
                        {
                            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1650, bytSubID, bytDevID, false, true, true, false) == true)
                            {
                                oTmp.bytRelation   = CsConst.myRevBuf[27];
                                oTmp.EnableSensors = new byte[15];
                                int intTmp = CsConst.myRevBuf[28];
                                if (intTmp == 255)
                                {
                                    intTmp = 0;
                                }
                                //oTmp.EnableSensors
                                for (byte bytI = 0; bytI <= 6; bytI++)
                                {
                                    oTmp.EnableSensors[bytI] = Convert.ToByte((intTmp & (1 << bytI)) == (1 << bytI));
                                }
                                oTmp.DelayTimeT = CsConst.myRevBuf[29] * 256 + CsConst.myRevBuf[30];
                                Array.Copy(CsConst.myRevBuf, 31, oTmp.Paramters, 0, 7);
                                oTmp.UV1           = new UniversalSwitchSet();
                                oTmp.UV1.id        = Convert.ToByte(HDLPF.IsNumStringMode(CsConst.myRevBuf[38].ToString(), 201, 248));
                                oTmp.UV1.condition = CsConst.myRevBuf[39];

                                oTmp.UV2    = new UniversalSwitchSet();
                                oTmp.UV2.id = Convert.ToByte(HDLPF.IsNumStringMode(CsConst.myRevBuf[40].ToString(), 201, 248));
                                if (oTmp.UV2.id == oTmp.UV1.id)
                                {
                                    oTmp.UV2.id = Convert.ToByte(oTmp.UV1.id + 1);
                                }
                                oTmp.UV2.condition = CsConst.myRevBuf[41];

                                oTmp.DelayTimeF = CsConst.myRevBuf[42] * 256 + CsConst.myRevBuf[43];
                                if (oTmp.DelayTimeT == 65535)
                                {
                                    oTmp.DelayTimeT = 0;
                                }
                                if (oTmp.DelayTimeF == 65535)
                                {
                                    oTmp.DelayTimeF = 0;
                                }

                                HDLUDP.TimeBetwnNext(1);

                                ArayTmp    = new byte[1];
                                ArayTmp[0] = oTmp.UV1.id;
                                if ((CsConst.mySends.AddBufToSndList(ArayTmp, 0x164C, bytSubID, bytDevID, false, false, true, false) == true))
                                {
                                    byte[] arayRemark = new byte[20];
                                    Array.Copy(CsConst.myRevBuf, 27, arayRemark, 0, arayRemark.Length);
                                    oTmp.UV1.remark    = HDLPF.Byte2String(arayRemark);
                                    oTmp.UV1.isAutoOff = (CsConst.myRevBuf[47] == 1);
                                    if (CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49] > 3600)
                                    {
                                        oTmp.UV1.autoOffDelay = 1;
                                    }
                                    else
                                    {
                                        oTmp.UV1.autoOffDelay = CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49];
                                    }

                                    HDLUDP.TimeBetwnNext(1);
                                }

                                ArayTmp[0] = oTmp.UV2.id;
                                if ((CsConst.mySends.AddBufToSndList(ArayTmp, 0x164C, bytSubID, bytDevID, false, false, true, false) == true))
                                {
                                    byte[] arayRemark = new byte[20];
                                    Array.Copy(CsConst.myRevBuf, 27, arayRemark, 0, arayRemark.Length);
                                    oTmp.UV2.remark    = HDLPF.Byte2String(arayRemark);
                                    oTmp.UV2.isAutoOff = (CsConst.myRevBuf[47] == 1);
                                    if (CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49] > 3600)
                                    {
                                        oTmp.UV2.autoOffDelay = 1;
                                    }
                                    else
                                    {
                                        oTmp.UV2.autoOffDelay = CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49];
                                    }

                                    HDLUDP.TimeBetwnNext(1);
                                }
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        #endregion

                        //成立的触发目标
                        oTmp.DownloadLogicTrueCommandsFromDevice(bytSubID, bytDevID, DeviceType, 0, 0);
                        //不成立的触发目标
                        oTmp.DownloadLogicFalseCommandsFromDevice(bytSubID, bytDevID, DeviceType, 0, 0);
                        logic.Add(oTmp);
                        if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                        {
                            CsConst.calculationWorker.ReportProgress(24 + intI * 2);
                        }
                    }
                }
                else
                {
                    return(false);
                }
                #endregion
                MyRead2UpFlags[3] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(40);
            }
            if (intActivePage == 0 || intActivePage == 5)
            {
                //安防设置
                #region
                fireset = new List <UVCMD.SecurityInfo>();
                ArayTmp = new byte[1];
                for (byte intI = 1; intI <= 3; intI++)
                {
                    ArayTmp[0] = intI;
                    //读取备注
                    #region
                    UVCMD.SecurityInfo oTmp = new UVCMD.SecurityInfo();
                    oTmp.bytSeuID = intI;

                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1666, bytSubID, bytDevID, false, true, true, false) == true)
                    {
                        byte[] arayRemark = new byte[20];
                        for (int intJ = 0; intJ < 20; intJ++)
                        {
                            arayRemark[intJ] = CsConst.myRevBuf[27 + intJ];
                        }
                        oTmp.strRemark = HDLPF.Byte2String(arayRemark);

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return(false);
                    }

                    #endregion
                    //读取设置
                    #region
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x166A, bytSubID, bytDevID, false, true, true, false) == true)
                    {
                        oTmp.bytTerms = CsConst.myRevBuf[27];
                        oTmp.bytSubID = CsConst.myRevBuf[28];
                        oTmp.bytDevID = CsConst.myRevBuf[29];
                        oTmp.bytArea  = CsConst.myRevBuf[30];

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return(false);
                    }
                    fireset.Add(oTmp);
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(40 + (10 * intI / 4));
                    }
                    #endregion
                }
                #endregion
                MyRead2UpFlags[4] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(50);
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100);
            }
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        ///下载设置
        /// </summary>
        public void DownloadMSPUInfoToDevice(string DevName, int DeviceType, int intActivePage)
        {
            string strMainRemark = DevName.Split('\\')[1].Trim();

            DevName = DevName.Split('\\')[0].Trim();

            byte bytSubID   = byte.Parse(DevName.Split('-')[0].ToString());
            byte bytDevID   = byte.Parse(DevName.Split('-')[1].ToString());
            int  wdMaxValue = DeviceTypeList.GetMaxValueFromPublicModeGroup(DeviceType);

            byte[] ArayTmp = new byte[0];
            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x000E, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
            {
                byte[] arayRemark = new byte[20];
                for (int intI = 0; intI < 20; intI++)
                {
                    arayRemark[intI] = CsConst.myRevBuf[25 + intI];
                }
                Devname = bytSubID.ToString() + "-" + bytDevID.ToString() + "\\" + HDLPF.Byte2String(arayRemark);

                HDLUDP.TimeBetwnNext(1);
            }
            else
            {
                return;
            }

            if (intActivePage == 0 || intActivePage == 1)
            {
                #region
                ONLEDs = new byte[5];
                //读取LED状态
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0xDB3E, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    ONLEDs    = new byte[5];
                    ONLEDs[0] = CsConst.myRevBuf[27];

                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return;
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(1, null);
                }
                //读取传感器使能
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x161C, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    EnableSensors    = new byte[15];
                    EnableSensors[0] = CsConst.myRevBuf[26];
                    EnableSensors[1] = CsConst.myRevBuf[27];
                    EnableSensors[2] = CsConst.myRevBuf[31];
                    EnableSensors[3] = CsConst.myRevBuf[37];
                    EnableSensors[4] = CsConst.myRevBuf[32];
                    EnableSensors[5] = CsConst.myRevBuf[34];
                    EnableSensors[6] = CsConst.myRevBuf[35];
                    EnableSensors[7] = CsConst.myRevBuf[36];

                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return;
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(2, null);
                }
                //读取补偿值
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1600, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    ParamSensors    = new byte[15];
                    ParamSensors[0] = CsConst.myRevBuf[26];
                    ParamSensors[1] = CsConst.myRevBuf[27];
                    ParamSensors[2] = CsConst.myRevBuf[38];
                    ParamSensors[3] = CsConst.myRevBuf[39];

                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return;
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(3);
                }
                //恒照度读取
                if (DeviceType == 326)
                {
                    EnableBroads = new byte[15];
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x16A9, bytSubID, bytDevID, false, true, true, false) == true)
                    {
                        Array.Copy(CsConst.myRevBuf, 26, EnableBroads, 0, 9);

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return;
                    }
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(4);
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(5, null);
                }
                #endregion
                MyRead2UpFlags[0] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(10);
            }
            if (intActivePage == 0 || intActivePage == 2)
            {
                //逻辑块功能设置
                #region
                // 读取24个逻辑的使能位
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1618, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    logic = new List <SensorLogic>();
                    byte[] ArayTmpMode = new byte[24];
                    Array.Copy(CsConst.myRevBuf, 26, ArayTmpMode, 0, 24);

                    HDLUDP.TimeBetwnNext(1);
                    for (int intI = 1; intI <= 24; intI++)
                    {
                        SensorLogic oTmp = new SensorLogic();
                        oTmp.ID      = (byte)intI;
                        oTmp.Enabled = ArayTmpMode[intI - 1];
                        oTmp.SetUp   = new List <UVCMD.ControlTargets>();
                        oTmp.NoSetUp = new List <UVCMD.ControlTargets>();
                        if (oTmp.Enabled != 1)
                        {
                            logic.Add(oTmp);
                            continue;
                        }
                        #region

                        //读取备注
                        ArayTmp    = new byte[1];
                        ArayTmp[0] = Convert.ToByte(intI);

                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1606, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                        {
                            byte[] arayRemark = new byte[20];
                            for (int intJ = 0; intJ < 20; intJ++)
                            {
                                arayRemark[intJ] = CsConst.myRevBuf[27 + intJ];
                            }
                            oTmp.Remarklogic = HDLPF.Byte2String(arayRemark);

                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return;
                        }
                        if (CsConst.isRestore)
                        {
                            //读取设置
                            #region
                            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x160E, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                            {
                                oTmp.bytRelation   = CsConst.myRevBuf[27];
                                oTmp.EnableSensors = new byte[15];
                                int intTmp = CsConst.myRevBuf[28] * 256 + CsConst.myRevBuf[29];
                                if (intTmp == 65535)
                                {
                                    intTmp = 0;
                                }
                                for (byte i = 0; i < 12; i++)
                                {
                                    if ((intTmp & (1 << i)) == (1 << i))
                                    {
                                        switch (i)
                                        {
                                        case 0: oTmp.EnableSensors[0] = 1; break;

                                        case 1: oTmp.EnableSensors[1] = 1; break;

                                        case 5: oTmp.EnableSensors[2] = 1; break;

                                        case 6: oTmp.EnableSensors[4] = 1; break;

                                        case 8: oTmp.EnableSensors[5] = 1; break;

                                        case 9: oTmp.EnableSensors[6] = 1; break;

                                        case 10: oTmp.EnableSensors[7] = 1; break;

                                        case 11: oTmp.EnableSensors[3] = 1; break;
                                        }
                                    }
                                }

                                oTmp.DelayTimeT = CsConst.myRevBuf[30] * 256 + CsConst.myRevBuf[31];
                                oTmp.DelayTimeF = CsConst.myRevBuf[32] * 256 + CsConst.myRevBuf[33];
                                if (oTmp.DelayTimeT == 65535)
                                {
                                    oTmp.DelayTimeT = 0;
                                }
                                if (oTmp.DelayTimeF == 65535)
                                {
                                    oTmp.DelayTimeF = 0;
                                }
                                Array.Copy(CsConst.myRevBuf, 34, oTmp.Paramters, 0, 6);
                                oTmp.Paramters[6] = CsConst.myRevBuf[46];
                                oTmp.Paramters[7] = CsConst.myRevBuf[55];
                                oTmp.Paramters[8] = CsConst.myRevBuf[47];
                                oTmp.UV1          = new UniversalSwitchSet();
                                if (201 <= CsConst.myRevBuf[49] && CsConst.myRevBuf[49] <= 248)
                                {
                                    oTmp.UV1.id = CsConst.myRevBuf[49];
                                }
                                else
                                {
                                    oTmp.UV1.id = 201;
                                }
                                if (CsConst.myRevBuf[50] <= 1)
                                {
                                    oTmp.UV1.condition = CsConst.myRevBuf[50];
                                }
                                oTmp.UV2 = new UniversalSwitchSet();
                                if (201 <= CsConst.myRevBuf[51] && CsConst.myRevBuf[51] <= 248)
                                {
                                    oTmp.UV2.id = CsConst.myRevBuf[51];
                                }
                                else
                                {
                                    oTmp.UV2.id = 201;
                                    if (oTmp.UV1.id == 201)
                                    {
                                        oTmp.UV2.id = 202;
                                    }
                                }
                                if (CsConst.myRevBuf[52] <= 1)
                                {
                                    oTmp.UV2.condition = CsConst.myRevBuf[52];
                                }
                                oTmp.Paramters[9]  = CsConst.myRevBuf[53];
                                oTmp.Paramters[10] = CsConst.myRevBuf[54];

                                HDLUDP.TimeBetwnNext(1);
                            }
                            else
                            {
                                return;
                            }
                            #endregion
                            //读取通用开关信息
                            #region
                            ArayTmp[0] = oTmp.UV1.id;
                            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x160A, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                            {
                                byte[] arayRemark = new byte[20];
                                for (int i = 0; i < 20; i++)
                                {
                                    arayRemark[i] = CsConst.myRevBuf[27 + i];
                                }
                                oTmp.UV1.remark = HDLPF.Byte2String(arayRemark);
                                if (CsConst.myRevBuf[47] == 1)
                                {
                                    oTmp.UV1.isAutoOff = true;
                                }
                                if (CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49] > 3600)
                                {
                                    oTmp.UV1.autoOffDelay = 1;
                                }
                                else
                                {
                                    oTmp.UV1.autoOffDelay = CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49];
                                }

                                HDLUDP.TimeBetwnNext(1);
                            }
                            else
                            {
                                return;
                            }
                            if ((CsConst.mySends.AddBufToSndList(ArayTmp, 0xE018, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true))
                            {
                                oTmp.UV1.state = CsConst.myRevBuf[26];

                                HDLUDP.TimeBetwnNext(1);
                            }
                            else
                            {
                                return;
                            }
                            ArayTmp[0] = oTmp.UV2.id;
                            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x160A, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                            {
                                byte[] arayRemark = new byte[20];
                                for (int i = 0; i < 20; i++)
                                {
                                    arayRemark[i] = CsConst.myRevBuf[27 + i];
                                }
                                oTmp.UV2.remark = HDLPF.Byte2String(arayRemark);
                                if (CsConst.myRevBuf[47] == 1)
                                {
                                    oTmp.UV2.isAutoOff = true;
                                }
                                if (CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49] > 3600)
                                {
                                    oTmp.UV2.autoOffDelay = 1;
                                }
                                else
                                {
                                    oTmp.UV2.autoOffDelay = CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49];
                                }

                                HDLUDP.TimeBetwnNext(1);
                            }
                            else
                            {
                                return;
                            }
                            if ((CsConst.mySends.AddBufToSndList(ArayTmp, 0xE018, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true))
                            {
                                oTmp.UV2.state = CsConst.myRevBuf[26];
                            }
                            else
                            {
                                return;
                            }
                            #endregion
                            //成立的触发目标
                            #region
                            for (byte bytJ = 0; bytJ < 20; bytJ++)
                            {
                                ArayTmp    = new byte[2];
                                ArayTmp[0] = (byte)(intI);
                                ArayTmp[1] = (byte)(bytJ + 1);
                                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1612, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                                {
                                    UVCMD.ControlTargets oCMD = new UVCMD.ControlTargets();
                                    oCMD.ID   = CsConst.myRevBuf[27];
                                    oCMD.Type = CsConst.myRevBuf[28];  //转换为正确的类型

                                    if (oCMD.Type != 3)
                                    {
                                        oCMD.SubnetID = CsConst.myRevBuf[29];
                                        oCMD.DeviceID = CsConst.myRevBuf[30];
                                        oCMD.Param1   = CsConst.myRevBuf[31];
                                        oCMD.Param2   = CsConst.myRevBuf[32];
                                        oCMD.Param3   = CsConst.myRevBuf[33];
                                        oCMD.Param4   = CsConst.myRevBuf[34];

                                        oTmp.SetUp.Add(oCMD);
                                    }

                                    HDLUDP.TimeBetwnNext(1);
                                }
                                else
                                {
                                    return;
                                }
                            }
                            #endregion
                            //不成立的触发目标
                            #region
                            for (byte bytJ = 0; bytJ < 20; bytJ++)
                            {
                                ArayTmp    = new byte[2];
                                ArayTmp[0] = (byte)(intI + 24);
                                ArayTmp[1] = (byte)(bytJ + 1);

                                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1612, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                                {
                                    UVCMD.ControlTargets oCMD = new UVCMD.ControlTargets();
                                    oCMD.ID   = CsConst.myRevBuf[27];
                                    oCMD.Type = CsConst.myRevBuf[28];  //转换为正确的类型

                                    if (oCMD.Type != 3)
                                    {
                                        oCMD.SubnetID = CsConst.myRevBuf[29];
                                        oCMD.DeviceID = CsConst.myRevBuf[30];
                                        oCMD.Param1   = CsConst.myRevBuf[31];
                                        oCMD.Param2   = CsConst.myRevBuf[32];
                                        oCMD.Param3   = CsConst.myRevBuf[33];
                                        oCMD.Param4   = CsConst.myRevBuf[34];

                                        oTmp.NoSetUp.Add(oCMD);
                                    }

                                    HDLUDP.TimeBetwnNext(1);
                                }
                                else
                                {
                                    return;
                                }
                            }
                            #endregion
                        }
                        logic.Add(oTmp);
                        #endregion
                        if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                        {
                            CsConst.calculationWorker.ReportProgress(10 + intI);
                        }
                    }
                }
                else
                {
                    return;
                }
                #endregion
                MyRead2UpFlags[1] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(20);
            }
            if (intActivePage == 0 || intActivePage == 3)
            {
                fireset = new List <UVCMD.SecurityInfo>();
                ArayTmp = new byte[1];
                #region
                for (byte intI = 1; intI <= 1; intI++)
                {
                    ArayTmp[0] = intI;
                    //读取备注
                    UVCMD.SecurityInfo oTmp = new UVCMD.SecurityInfo();
                    oTmp.bytSeuID = intI;
                    switch (intI)
                    {
                    default:
                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1624, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                        {
                            byte[] arayRemark = new byte[20];
                            for (int intJ = 0; intJ < 20; intJ++)
                            {
                                arayRemark[intJ] = CsConst.myRevBuf[27 + intJ];
                            }
                            oTmp.strRemark = HDLPF.Byte2String(arayRemark);

                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return;
                        }
                        break;
                    }
                    //读取设置
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1628, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                    {
                        oTmp.bytTerms = CsConst.myRevBuf[27];
                        oTmp.bytSubID = CsConst.myRevBuf[28];
                        oTmp.bytDevID = CsConst.myRevBuf[29];
                        oTmp.bytArea  = CsConst.myRevBuf[30];

                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return;
                    }
                    fireset.Add(oTmp);
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(35 + intI);
                    }
                }
                #endregion
                MyRead2UpFlags[2] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(30);
            }
            if (intActivePage == 0 || intActivePage == 4)
            {
                #region
                //读取模拟测试
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1620, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    SimulateEnable    = new byte[15];
                    SimulateEnable[0] = CsConst.myRevBuf[26];
                    SimulateEnable[1] = CsConst.myRevBuf[27];
                    SimulateEnable[2] = CsConst.myRevBuf[28];
                    SimulateEnable[3] = CsConst.myRevBuf[32];
                    SimulateEnable[4] = CsConst.myRevBuf[40];
                    ParamSimulate     = new byte[15];
                    ParamSimulate[0]  = CsConst.myRevBuf[33];
                    ParamSimulate[1]  = CsConst.myRevBuf[34];
                    ParamSimulate[2]  = CsConst.myRevBuf[35];
                    ParamSimulate[3]  = CsConst.myRevBuf[39];
                    ParamSimulate[4]  = CsConst.myRevBuf[41];

                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return;
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(31, null);
                }
                #endregion
                MyRead2UpFlags[3] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(40);
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100);
            }
        }
Esempio n. 3
0
        /// <summary>
        ///下载设置
        /// </summary>
        public void DownloadMSPUInfoToDevice(string DevName, int DeviceType, int intActivePage)
        {
            string strMainRemark = DevName.Split('\\')[1].Trim();

            DevName = DevName.Split('\\')[0].Trim();

            byte bytSubID   = byte.Parse(DevName.Split('-')[0].ToString());
            byte bytDevID   = byte.Parse(DevName.Split('-')[1].ToString());
            int  wdMaxValue = DeviceTypeList.GetMaxValueFromPublicModeGroup(DeviceType);

            byte[] ArayTmp = new byte[0];

            String Remark = HDLSysPF.ReadDeviceMainRemark(bytSubID, bytDevID);

            Devname = bytSubID.ToString() + "-" + bytDevID.ToString() + "\\" + Remark;

            if (intActivePage == 0 || intActivePage == 1)
            {
                #region
                //读取LED状态
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0xDB3E, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    ONLEDs           = new byte[5];
                    ONLEDs[0]        = CsConst.myRevBuf[27];
                    ONLEDs[1]        = CsConst.myRevBuf[28];
                    CsConst.myRevBuf = new byte[1200];
                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return;
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(1, null);
                }
                //读取传感器使能
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x161C, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    EnableSensors    = new byte[15];
                    EnableSensors[0] = CsConst.myRevBuf[26];
                    EnableSensors[1] = CsConst.myRevBuf[27];
                    EnableSensors[2] = CsConst.myRevBuf[31];
                    EnableSensors[3] = CsConst.myRevBuf[37];
                    EnableSensors[4] = CsConst.myRevBuf[32];
                    EnableSensors[5] = CsConst.myRevBuf[34];
                    EnableSensors[6] = CsConst.myRevBuf[35];
                    EnableSensors[7] = CsConst.myRevBuf[36];
                    CsConst.myRevBuf = new byte[1200];
                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return;
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(2, null);
                }
                //读取补偿值
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1600, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    ParamSensors     = new byte[15];
                    ParamSensors[0]  = CsConst.myRevBuf[26];
                    ParamSensors[1]  = CsConst.myRevBuf[27];
                    ParamSensors[2]  = CsConst.myRevBuf[38];
                    ParamSensors[3]  = CsConst.myRevBuf[39];
                    CsConst.myRevBuf = new byte[1200];
                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return;
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(3, null);
                }
                #endregion
                MyRead2UpFlags[1] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(10);
            }
            if (intActivePage == 0 || intActivePage == 2)
            {
                //逻辑块功能设置
                #region
                // 读取24个逻辑的使能位
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1618, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    logic = new List <SensorLogic>();
                    byte[] ArayTmpMode = new byte[24];
                    Array.Copy(CsConst.myRevBuf, 26, ArayTmpMode, 0, 24);
                    CsConst.myRevBuf = new byte[1200];
                    HDLUDP.TimeBetwnNext(1);
                    for (int intI = 1; intI <= 24; intI++)
                    {
                        SensorLogic oTmp = new SensorLogic();
                        oTmp.ID      = (byte)intI;
                        oTmp.Enabled = ArayTmpMode[intI - 1];
                        oTmp.SetUp   = new List <UVCMD.ControlTargets>();
                        oTmp.NoSetUp = new List <UVCMD.ControlTargets>();
                        #region

                        //读取备注
                        ArayTmp    = new byte[1];
                        ArayTmp[0] = Convert.ToByte(intI);

                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1606, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                        {
                            byte[] arayRemark = new byte[20];
                            for (int intJ = 0; intJ < 20; intJ++)
                            {
                                arayRemark[intJ] = CsConst.myRevBuf[27 + intJ];
                            }
                            oTmp.Remarklogic = HDLPF.Byte2String(arayRemark);
                            CsConst.myRevBuf = new byte[1200];
                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return;
                        }
                        if (oTmp.Enabled == 1) // 有效才读取信息
                        {
                            if (CsConst.isRestore)
                            {
                                //读取设置
                                oTmp.DownloadOnlyLogicSettingFromDevice(bytSubID, bytDevID, DeviceType);
                                //读取通用开关信息
                                #region
                                ArayTmp[0] = oTmp.UV1.id;
                                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x160A, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                                {
                                    byte[] arayRemark = new byte[20];
                                    for (int i = 0; i < 20; i++)
                                    {
                                        arayRemark[i] = CsConst.myRevBuf[27 + i];
                                    }
                                    oTmp.UV1.remark = HDLPF.Byte2String(arayRemark);
                                    if (CsConst.myRevBuf[47] == 1)
                                    {
                                        oTmp.UV1.isAutoOff = true;
                                    }
                                    if (CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49] > 3600)
                                    {
                                        oTmp.UV1.autoOffDelay = 1;
                                    }
                                    else
                                    {
                                        oTmp.UV1.autoOffDelay = CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49];
                                    }
                                    CsConst.myRevBuf = new byte[1200];
                                    HDLUDP.TimeBetwnNext(1);
                                }
                                else
                                {
                                    return;
                                }
                                if ((CsConst.mySends.AddBufToSndList(ArayTmp, 0xE018, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true))
                                {
                                    oTmp.UV1.state   = CsConst.myRevBuf[26];
                                    CsConst.myRevBuf = new byte[1200];
                                    HDLUDP.TimeBetwnNext(1);
                                }
                                else
                                {
                                    return;
                                }
                                ArayTmp[0] = oTmp.UV2.id;
                                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x160A, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                                {
                                    byte[] arayRemark = new byte[20];
                                    for (int i = 0; i < 20; i++)
                                    {
                                        arayRemark[i] = CsConst.myRevBuf[27 + i];
                                    }
                                    oTmp.UV2.remark = HDLPF.Byte2String(arayRemark);
                                    if (CsConst.myRevBuf[47] == 1)
                                    {
                                        oTmp.UV2.isAutoOff = true;
                                    }
                                    if (CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49] > 3600)
                                    {
                                        oTmp.UV2.autoOffDelay = 1;
                                    }
                                    else
                                    {
                                        oTmp.UV2.autoOffDelay = CsConst.myRevBuf[48] * 256 + CsConst.myRevBuf[49];
                                    }
                                    CsConst.myRevBuf = new byte[1200];
                                    HDLUDP.TimeBetwnNext(1);
                                }
                                else
                                {
                                    return;
                                }
                                if ((CsConst.mySends.AddBufToSndList(ArayTmp, 0xE018, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true))
                                {
                                    oTmp.UV2.state   = CsConst.myRevBuf[26];
                                    CsConst.myRevBuf = new byte[1200];
                                    HDLUDP.TimeBetwnNext(1);
                                }
                                else
                                {
                                    return;
                                }
                                #endregion
                                oTmp.DownloadLogicTrueCommandsFromDevice(bytSubID, bytDevID, DeviceType, 0, 0);
                                //不成立的触发目标
                                oTmp.DownloadLogicFalseCommandsFromDevice(bytSubID, bytDevID, DeviceType, 0, 0);
                            }
                        }
                        logic.Add(oTmp);
                        #endregion
                        if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                        {
                            CsConst.calculationWorker.ReportProgress(10 + intI);
                        }
                    }
                }
                else
                {
                    return;
                }
                #endregion
                MyRead2UpFlags[2] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(20);
            }
            if (intActivePage == 0 || intActivePage == 3)
            {
                fireset = new List <UVCMD.SecurityInfo>();
                ArayTmp = new byte[1];
                #region
                for (byte intI = 3; intI <= 4; intI++)
                {
                    ArayTmp[0] = intI;
                    //读取备注
                    UVCMD.SecurityInfo oTmp = new UVCMD.SecurityInfo();
                    oTmp.bytSeuID = intI;
                    switch (intI)
                    {
                    default:
                        if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1624, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                        {
                            byte[] arayRemark = new byte[20];
                            for (int intJ = 0; intJ < 20; intJ++)
                            {
                                arayRemark[intJ] = CsConst.myRevBuf[27 + intJ];
                            }
                            oTmp.strRemark   = HDLPF.Byte2String(arayRemark);
                            CsConst.myRevBuf = new byte[1200];
                            HDLUDP.TimeBetwnNext(1);
                        }
                        else
                        {
                            return;
                        }
                        break;
                    }
                    //读取设置
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1628, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                    {
                        oTmp.bytTerms    = CsConst.myRevBuf[27];
                        oTmp.bytSubID    = CsConst.myRevBuf[28];
                        oTmp.bytDevID    = CsConst.myRevBuf[29];
                        oTmp.bytArea     = CsConst.myRevBuf[30];
                        CsConst.myRevBuf = new byte[1200];
                        HDLUDP.TimeBetwnNext(1);
                    }
                    else
                    {
                        return;
                    }
                    fireset.Add(oTmp);
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(35 + intI);
                    }
                }
                #endregion
                MyRead2UpFlags[3] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(30);
            }
            if (intActivePage == 0 || intActivePage == 4)
            {
                #region
                //读取模拟测试
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1620, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(DeviceType)) == true)
                {
                    SimulateEnable    = new byte[15];
                    SimulateEnable[0] = CsConst.myRevBuf[26];
                    SimulateEnable[1] = CsConst.myRevBuf[27];
                    SimulateEnable[2] = CsConst.myRevBuf[28];
                    SimulateEnable[3] = CsConst.myRevBuf[32];
                    SimulateEnable[4] = CsConst.myRevBuf[40];
                    ParamSimulate     = new byte[15];
                    ParamSimulate[0]  = CsConst.myRevBuf[33];
                    ParamSimulate[1]  = CsConst.myRevBuf[34];
                    ParamSimulate[2]  = CsConst.myRevBuf[35];
                    ParamSimulate[3]  = CsConst.myRevBuf[39];
                    ParamSimulate[4]  = CsConst.myRevBuf[41];
                    CsConst.myRevBuf  = new byte[1200];
                    HDLUDP.TimeBetwnNext(1);
                }
                else
                {
                    return;
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(31, null);
                }
                #endregion
                MyRead2UpFlags[4] = true;
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(40);
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100);
            }
        }