/// <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;
        }
Example #2
0
        /// <summary>
        /// devname device name
        /// </summary>
        /// <param name="DevName"></param>
        public void DownLoadInformationFrmDevice(string DevName, int wdDeviceType)
        {
            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 = new byte[0];
            DeviceName = bytSubID.ToString() + "-" + bytDevID.ToString() + "\\" + HDLSysPF.ReadDeviceMainRemark(bytSubID, bytDevID);
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(5, null);
            }

            int MaxValue = DeviceTypeList.GetMaxValueFromPublicModeGroup(wdDeviceType);

            ArayTmp  = new byte[1];
            Curtains = new List <BasicCurtain>();
            // read curtain paramters
            #region
            if (CurtainDeviceType.NormalCurtainG1DeviceType.Contains(wdDeviceType) || CurtainDeviceType.CurtainG2DeviceType.Contains(wdDeviceType))
            {
                for (byte bytI = 1; bytI <= MaxValue * 2; bytI++)
                {
                    ArayTmp[0] = bytI;
                    BasicCurtain oTmp = new BasicCurtain();
                    oTmp.ReadCurtainSetupInformation(bytSubID, bytDevID, bytI, wdDeviceType);
                    Curtains.Add(oTmp);
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(bytI * 45 / MaxValue, null);
                    }
                }
            }
            #endregion
            // read joggle time
            if (CurtainDeviceType.CurtainG2DeviceType.Contains(wdDeviceType))
            {
                bytCurType = 1;
            }
            else if (CurtainDeviceType.RollerCurtainDeviceType.Contains(wdDeviceType))
            {
                bytCurType = 2;
            }
            else if (CurtainDeviceType.NormalMotorCurtainDeviceType.Contains(wdDeviceType))
            {
                bytCurType = 2;
            }

            if (bytCurType == 1)
            {
                for (byte bytI = 1; bytI <= 4; bytI++)
                {
                    ArayTmp[0] = bytI;
                    BasicCurtain oTmp = new BasicCurtain();
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1C76, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == true)
                    {
                        switch (bytI)
                        {
                        case 1: intJogTime = CsConst.myRevBuf[26] * 256 + CsConst.myRevBuf[27]; break;

                        case 2: intJogTime1 = CsConst.myRevBuf[26] * 256 + CsConst.myRevBuf[27]; break;

                        case 3: intJogTime2 = CsConst.myRevBuf[26] * 256 + CsConst.myRevBuf[27]; break;

                        case 4: intJogTime3 = CsConst.myRevBuf[26] * 256 + CsConst.myRevBuf[27]; break;
                        }
                        CsConst.myRevBuf = new byte[1200];
                    }
                    else
                    {
                        return;
                    }
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(80 + bytI, null);
                    }
                }
            }
            else if (bytCurType == 2)
            {
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1F02, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == true)
                {
                    bytInvert      = CsConst.myRevBuf[25]; // forward and backwork   or Backward forward
                    bytAutoMeasure = CsConst.myRevBuf[26]; // 上电自动测速
                    bytDragMode    = CsConst.myRevBuf[27]; // 0 : no action, 1 long drag ; 2 short drag
                    intDragLong    = (CsConst.myRevBuf[28] * 256 + CsConst.myRevBuf[29]) / 100;
                    intDragShort   = (CsConst.myRevBuf[30] * 256 + CsConst.myRevBuf[31]) / 100;
                    intDragSafe    = (CsConst.myRevBuf[32] * 256 + CsConst.myRevBuf[33]) / 100;
                }
                else
                {
                    return;
                }
                CsConst.myRevBuf = new byte[1200];
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(95, null);
                }
            }
            MyRead2UpFlags[0] = true;
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100, null);
            }
        }