Example #1
0
        /// <summary>
        /// Removes any radios that are no longer connected to the computer.
        /// </summary>
        /// <param name="NewRadios">The list of radios that are connected to the computer.</param>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  02/07/08 RCG 1.00           Created

        private void RemoveUnusedRadios(List <ZigBeeRadioToken> NewRadios)
        {
            List <ZigBeeRadioToken> AvailableRadios = new List <ZigBeeRadioToken>();
            List <ZigBeeRadioToken> InUseRadios     = new List <ZigBeeRadioToken>();

            // Check the available list
            foreach (ZigBeeRadioToken AvailableRadioToken in m_AvailableRadios)
            {
                bool bRadioFound = false;

                // Make sure that the radio is still in the list.
                foreach (ZigBeeRadioToken NewRadioToken in NewRadios)
                {
                    if (NewRadioToken.Equals(AvailableRadioToken) == true)
                    {
                        bRadioFound = true;
                        break;
                    }
                }

                if (bRadioFound == true)
                {
                    // We dont want to modify the list we are currently using so add it to
                    // a temporary list
                    AvailableRadios.Add(AvailableRadioToken);
                }
            }


            // Check the in use list
            foreach (ZigBeeRadioToken InUseRadioToken in m_RadiosInUse)
            {
                bool bRadioFound = false;

                // Make sure that the radio is still in the list.
                foreach (ZigBeeRadioToken NewRadioToken in NewRadios)
                {
                    if (NewRadioToken.Equals(InUseRadioToken) == true)
                    {
                        bRadioFound = true;
                        break;
                    }
                }

                if (bRadioFound == true)
                {
                    // We dont want to modify the list we are currently using so add it to
                    // a temporary list
                    InUseRadios.Add(InUseRadioToken);
                }
            }

            // Assign the new list of radios
            m_AvailableRadios = AvailableRadios;
            m_RadiosInUse     = InUseRadios;
        }
Example #2
0
        /// <summary>
        /// Adds radio tokens to the available list if they are new.
        /// </summary>
        /// <param name="NewRadios">The list of currently attached IA radios.</param>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  02/07/08 RCG 1.00           Created

        private void AddNewRadios(List <ZigBeeRadioToken> NewRadios)
        {
            foreach (ZigBeeRadioToken NewRadioToken in NewRadios)
            {
                bool bRadioFound = false;

                // Check the list of available radios
                foreach (ZigBeeRadioToken RadioToken in m_AvailableRadios)
                {
                    if (NewRadioToken.Equals(RadioToken) == true)
                    {
                        bRadioFound = true;
                        break;
                    }
                }

                // Check the list of radios in use
                if (bRadioFound == false)
                {
                    foreach (ZigBeeRadioToken RadioToken in m_RadiosInUse)
                    {
                        if (NewRadioToken.Equals(RadioToken) == true)
                        {
                            bRadioFound = true;
                            break;
                        }
                    }
                }

                if (bRadioFound == false)
                {
                    // We found a new radio so add it to the list
                    m_AvailableRadios.Add(NewRadioToken);
                }
            }
        }