public bool Get_OUT_Bit(int iBitNr)
 {
     if (this.Get_RelaisBox_für_Ausgang(iBitNr) == 1)
     {
         return(BitFld_ARM_Box1.AnyOn(HELPER_BIT_FIELD.DecimalToFlag(iBitNr)));
     }
     if (this.Get_RelaisBox_für_Ausgang(iBitNr) == 2)
     {
         // d
         iBitNr = iBitNr - 6;
         return(BitFld_ARM_Box2.AnyOn(HELPER_BIT_FIELD.DecimalToFlag(iBitNr)));
     }
     else
     {
         return(false);
     }
 }
        public void Set_OUT_Bit(int iBitNr, bool bISOn)
        {
            byte bValue     = 0;
            int  iRelaisBox = 0;

            iRelaisBox = this.Get_RelaisBox_für_Ausgang(iBitNr);

            if (iRelaisBox == 1)
            {
                HELPER_BIT_FIELD.Flag currFlag = HELPER_BIT_FIELD.DecimalToFlag(iBitNr);

                if (bISOn)
                {
                    this.BitFld_ARM_Box1.SetOn(currFlag);
                }
                else
                {
                    this.BitFld_ARM_Box1.SetOff(currFlag);
                }

                bValue = (byte)this.BitFld_ARM_Box1.Mask;
            }
            else if (iRelaisBox == 2)
            {
                iBitNr = iBitNr - 6;
                HELPER_BIT_FIELD.Flag currFlag = HELPER_BIT_FIELD.DecimalToFlag(iBitNr);

                if (bISOn)
                {
                    this.BitFld_ARM_Box2.SetOn(currFlag);
                }
                else
                {
                    this.BitFld_ARM_Box2.SetOff(currFlag);
                }

                bValue = (byte)this.BitFld_ARM_Box2.Mask;
            }
            else
            {
                Debug.Assert(false);
                return;
            }

            this.WriteDIO(bValue, /*Relaisbox*/ iRelaisBox);
        }
        private bool ReadDIO(int iBitNr)
        {
            string s       = "x";
            bool   bRet    = false;
            int    iReturn = 0;

            int RelaisBox = this.Get_RelaisBox_für_Eingang(iBitNr);

            try
            {
                if (RelaisBox == 1)
                {
                    try
                    {
                        s = cGlobalScale.objCIND890APIClient_DigitalIO.DiscreteIO.ReadDIOInput(/*ist immer 3 für X3*/ port, /*ist immer 1*/ slave_ARM_Box1);
                    }
                    catch (Exception ex)
                    {
                        SiAuto.LogException("ReadDIO(a)", ex);

                        cGlobalHandling.MessageBox(
                            "ARM100 Lesen Box1: Das Scaleinterface meldet an Port X3, unter der Slave Adresse " + slave_ARM_Box1.ToString() +
                            " keine Verbindung", "ARM 100 Lesefunktion (Read DIO)");
                        return(false);
                    }


                    iReturn = Convert.ToInt32(s);
                    this.BitFld_ARM_Box1_Eingänge.Mask = (byte)iReturn;
                }
                else if (RelaisBox == 2)
                {
                    try
                    {
                        s = cGlobalScale.objCIND890APIClient_DigitalIO.DiscreteIO.ReadDIOInput(/*ist immer 3 für X3*/ port, /*ist immer 1*/ slave_ARM_Box2);
                    }
                    catch (Exception ex)
                    {
                        SiAuto.LogException("ReadDIO(b)", ex);

                        cGlobalHandling.MessageBox(
                            "ARM100 Lesen Box2: Das Scaleinterface meldet an Port X3, unter der Slave Adresse " + slave_ARM_Box2.ToString() +
                            " keine Verbindung", "ARM 100 Lesefunktion (Read DIO)");
                        return(false);
                    }



                    iReturn = Convert.ToInt32(s);
                    this.BitFld_ARM_Box2_Eingänge.Mask = (byte)iReturn;
                }
                else
                {
                }

                if (RelaisBox == 1)
                {
                    bRet = this.BitFld_ARM_Box1_Eingänge.AnyOn(HELPER_BIT_FIELD.DecimalToFlag(iBitNr));
                }
                else if (RelaisBox == 2)
                {
                    iBitNr = iBitNr - 4;
                    bRet   = this.BitFld_ARM_Box2_Eingänge.AnyOn(HELPER_BIT_FIELD.DecimalToFlag(iBitNr));
                }
                else
                {
                    bRet = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Read DIO IO Fehler \r\n" + ex.Message);
                throw;
            }

            return(bRet);
        }