private void FIllArchInterfer(ref int iPosData, byte[] btaRX, ref byte[] btaTX, int iQuantRow)
        {
            const uint uiDateInc     = 30 * 60;
            uint       uiBeginRec    = Global.ToUInt16rev(btaRX, (int)CArchVympel.ERequest.BeginRec);
            uint       uiDateArch    = uiDateArchBeg + uiDateInc * uiBeginRec;
            uint       uiDateNow     = Global.DateTimeAsInt(DateTime.Now);
            int        uiQuantRowOut = (int)((uiDateNow - uiDateArch) / uiDateInc);

            if (uiQuantRowOut >= iQuantRow)
            {
                uiQuantRowOut = iQuantRow;
            }
            else
            {
                uiQuantRowOut = (uiQuantRowOut % (iQuantRow + 1));
            }

            if (uiQuantRowOut < 0)
            {
                uiQuantRowOut = 0;
            }
            string asDTArch = "";

            for (int iRow = 0; iRow < uiQuantRowOut; iRow++)
            {
                if (uiDateArch >= uiDateNow)
                {
                    break;
                }
                // Дата и время
                //Global.LogWriteLine (Global.IntToDateTime (uiDateArch).ToString ());
                Global.AppendRev(BitConverter.GetBytes(uiDateArch), 0, btaTX, iPosData, 4);
                asDTArch   += Global.IntToDateTime(uiDateArch) + ";";
                uiDateArch += uiDateInc;
                iPosData   += 4;
                // Код вмешательства
                FillByVal(uiCodeInterfer, ref btaTX, ref iPosData);

                HeadsArchInterfer TheTypePar = GetTypeOfParam(uiCodeInterfer);
                if (TheTypePar == HeadsArchInterfer.Old_Value_Int)
                {
                    // Старое значение параметра
                    FillByVal((uint)++iVal, ref btaTX, ref iPosData);
                    // Новое значение параметра
                    FillByVal((uint)++iVal, ref btaTX, ref iPosData);
                }
                else
                {
                    // Старое значение параметра
                    FillByVal(++fVal, ref btaTX, ref iPosData);
                    // Новое значение параметра
                    FillByVal(++fVal, ref btaTX, ref iPosData);
                }
                if (++uiCodeInterfer == 0x112)
                {
                    uiCodeInterfer = 0x201;
                }
                else if (uiCodeInterfer == 0x20A)
                {
                    uiCodeInterfer = 0x301;
                }
                else if (uiCodeInterfer == 0x31C)
                {
                    uiCodeInterfer = 0x401;
                }
                else if (uiCodeInterfer == 0x422)
                {
                    uiCodeInterfer = 0x501;
                }
                else if (uiCodeInterfer == 0x504)
                {
                    uiCodeInterfer = 0x601;
                }
                else if (uiCodeInterfer == 0x608)
                {
                    uiCodeInterfer = 0x701;
                }
                else if (uiCodeInterfer == 0x702)
                {
                    uiCodeInterfer = 0x1000;
                }
                else if (uiCodeInterfer == 0x1001)
                {
                    uiCodeInterfer = 0xF001;
                }
                else if (uiCodeInterfer == 0xF002)
                {
                    uiCodeInterfer = 0x101;
                }
            }
            Parent.OutToWind(asDTArch);
            Global.AppendRev(BitConverter.GetBytes(uiQuantRowOut * CArchVympel.iaQuantRegByRow[(int)CArchVympel.EArchID.Alarm] * 2), 0, btaTX, (int)CArchVympel.ERequest.NumByteData, 1);
        }
Beispiel #2
0
        private void FIllArchInterfer(ref int iPosData, byte[] btaRX, ref byte[] btaTX, int iQuantRow)
        {
            const uint uiDateInc  = 30 * 60;
            uint       uiBeginRec = Global.ToUInt16rev(btaRX, (int)CArchVympel.ERequest.BeginRec);
            uint       uiDateArch = uiDateArchBeg + uiDateInc * uiBeginRec;

            //#if LOG_VYMPEL
            //			Global.LogWriteLine ("BeginRec " + uiBeginRec);
            //			#endif
            for (int iRow = 0; iRow < iQuantRow; iRow++)
            {
                // Дата и время
                Global.LogWriteLine(Global.IntToDateTime(uiDateArch).ToString());
                Global.AppendRev(BitConverter.GetBytes(uiDateArch), 0, btaTX, iPosData, 4);
                uiDateArch += uiDateInc;
                iPosData   += 4;
                // Код вмешательства
                FillByVal(uiCodeInterfer, ref btaTX, ref iPosData);

                HeadsArchInterfer TheTypePar = GetTypeOfParam(uiCodeInterfer);
                if (TheTypePar == HeadsArchInterfer.Old_Value_Int)
                {
                    // Старое значение параметра
                    FillByVal((uint)++iVal, ref btaTX, ref iPosData);
                    // Новое значение параметра
                    FillByVal((uint)++iVal, ref btaTX, ref iPosData);
                }
                else
                {
                    // Старое значение параметра
                    FillByVal(++fVal, ref btaTX, ref iPosData);
                    // Новое значение параметра
                    FillByVal(++fVal, ref btaTX, ref iPosData);
                }
                if (++uiCodeInterfer == 0x112)
                {
                    uiCodeInterfer = 0x201;
                }
                else if (uiCodeInterfer == 0x20A)
                {
                    uiCodeInterfer = 0x301;
                }
                else if (uiCodeInterfer == 0x31C)
                {
                    uiCodeInterfer = 0x401;
                }
                else if (uiCodeInterfer == 0x422)
                {
                    uiCodeInterfer = 0x501;
                }
                else if (uiCodeInterfer == 0x504)
                {
                    uiCodeInterfer = 0x601;
                }
                else if (uiCodeInterfer == 0x608)
                {
                    uiCodeInterfer = 0x701;
                }
                else if (uiCodeInterfer == 0x702)
                {
                    uiCodeInterfer = 0x1000;
                }
                else if (uiCodeInterfer == 0x1001)
                {
                    uiCodeInterfer = 0xF001;
                }
                else if (uiCodeInterfer == 0xF002)
                {
                    uiCodeInterfer = 0x101;
                }
            }
        }