Ejemplo n.º 1
0
        /// <summary>
        /// strDevName device subnet id and device id
        /// </summary>
        /// <param name="strDevName"></param>
        public override void DownLoadInformationFrmDevice(string strDevName, int intDeviceType, int intActivePage, int num1, int num2)// 0 mean all, else that tab only
        {
            Boolean BlnIsSuccess = false;

            if (strDevName == null)
            {
                return;
            }
            string strMainRemark = strDevName.Split('\\')[1].Trim();

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

            byte bytSubID = byte.Parse(DeviceName.Split('-')[0].ToString());
            byte bytDevID = byte.Parse(DeviceName.Split('-')[1].ToString());

            byte[] ArayTmp = null;

            base.DownLoadInformationFrmDevice(strDevName, intDeviceType, intActivePage, 0, 0);

            // 读取回路信息
            Chans = new BasicCurtain();
            Chans.ReadCurtainSetupInformation(bytSubID, bytDevID, 1, intDeviceType);
            MyRead2UpFlags[0] = true;
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100, null);
            }
            BlnIsSuccess = true;
            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// strDevName device subnet id and device id
        /// </summary>
        /// <param name="strDevName"></param>
        public override void DownLoadInformationFrmDevice(string strDevName, int intDeviceType, int intActivePage, int num1, int num2)// 0 mean all, else that tab only
        {
            Boolean BlnIsSuccess = false;

            if (strDevName == null)
            {
                return;
            }
            string strMainRemark = strDevName.Split('\\')[1].Trim();

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

            byte bytSubID = byte.Parse(DeviceName.Split('-')[0].ToString());
            byte bytDevID = byte.Parse(DeviceName.Split('-')[1].ToString());

            byte[] ArayTmp = new Byte[1];

            base.DownLoadInformationFrmDevice(strDevName, intDeviceType, intActivePage, 0, 0);

            // 读取回路信息
            Chans = new List <RelayChannel>();
            #region
            int wdMaxValue = 1;
            for (int i = 0; i < wdMaxValue; i++)
            {
                RelayChannel Ch = new RelayChannel();
                Ch.LoadType     = 0;
                Ch.OnDelay      = 0;
                Ch.ProtectDelay = 0;

                ArayTmp[0] = (byte)(i + 1);
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x331A, bytSubID, bytDevID, false, false, true, false) == true)
                {
                    if (CsConst.myRevBuf != null)
                    {
                        byte[] arayRemark = new byte[20];
                        HDLSysPF.CopyRemarkBufferFrmMyRevBuffer(CsConst.myRevBuf, arayRemark, 26);
                        Ch.Remark = HDLPF.Byte2String(arayRemark);
                    }
                    CsConst.myRevBuf = new byte[1200];
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(i * (50 / wdMaxValue), null);
                }
                Chans.Add(Ch);
            }
            ArayTmp = null;
            // read off delay
            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0xF084, bytSubID, bytDevID, false, false, true, true) == true)
            {
                for (int intI = 0; intI < wdMaxValue; intI++)
                {
                    Chans[intI].OFFDelay = CsConst.myRevBuf[25 + intI];
                    if (Chans[intI].LoadType == 255 || Chans[intI].LoadType > CsConst.LoadType.Length - 1)
                    {
                        Chans[intI].LoadType = 0;
                    }
                }
                CsConst.myRevBuf = new byte[1200];
            }

            // read on delay
            ArayTmp = null;
            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0xF04D, bytSubID, bytDevID, false, false, true, true) == true)
            {
                for (int intI = 0; intI < wdMaxValue; intI++)
                {
                    Chans[intI].OnDelay = CsConst.myRevBuf[25 + intI];
                }
                CsConst.myRevBuf = new byte[1200];
            }

            // read protoct delay
            if (CsConst.mySends.AddBufToSndList(ArayTmp, 0xF03F, bytSubID, bytDevID, false, false, true, false) == true)
            {
                for (int intI = 0; intI < wdMaxValue; intI++)
                {
                    Chans[intI].ProtectDelay = CsConst.myRevBuf[25 + intI];
                }
                CsConst.myRevBuf = new byte[1200];
            }

            #endregion
            MyRead2UpFlags[0] = true;
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100, null);
            }
            BlnIsSuccess = true;
            return;
        }