/// <summary>
        /// Return the information from all smart cards that are present.
        /// </summary>
        /// <returns>All of the installed cylinders.</returns>
        static private void ReadChangedCylinders(bool[] changedSmartCards, IList <GasEndPoint> changedGasEndPoints, PortRestrictions port1Restrictions)
        {
            const string funcName = "ReadChangedCylinders: ";

            Log.Assert(changedSmartCards != null, funcName + "changedSmartCards should not be null.");

            DockingStation dockingStation = Controller.GetDockingStation(); // SGF  8-Nov-2012  INS-2686

            changedGasEndPoints.Clear();

            for (int i = 0; i < changedSmartCards.Length; i++)
            {
                int position = i + 1;

                Log.Debug(funcName + "POSITION " + position);

                if (changedSmartCards[position - 1] == false)     // No detection of a card insertion, nor a removal?
                {
                    Log.Debug(string.Format("{0}Position {1} Smart card SKIPPED; No insertion change detected.", funcName, position));

                    if (position == Controller.FRESH_AIR_GAS_PORT)
                    {
                        GasEndPoint persistedPort1GasEndPoint = new GasEndPointDataAccess().FindByPosition(Controller.FRESH_AIR_GAS_PORT);

                        // If there's nothing known to be installed on port 1, then create a fresh air
                        // cylinder for the port.
                        // This could happen if, while nothing was installed on the port, a SettingsUpdate
                        // just occurred previously where the port setting was changed to allow fresh air.
                        // In that situation, we have to then make the fresh air cylinder.
                        if (persistedPort1GasEndPoint == null)
                        {
                            Log.Debug(string.Format("{0}Position {1}, No persisted cylinder; assuming Fresh Air.", funcName, position));
                            GasEndPoint freshAirCylinder = GasEndPoint.CreateFreshAir(position);
                            freshAirCylinder.GasChangeType = GasEndPoint.ChangeType.Installed;
                            changedGasEndPoints.Add(freshAirCylinder);
                        }
                    }

                    // SGF  8-Nov-2012  INS-2686 -- begin
                    // Soon, we will check to see if a pressure switch is present, and if so, read the pressure level.
                    // Before we do that, we must check for two scenarios in which it is not necessary or appropriate
                    // to read a pressure switch.
                    //     1. If there is no cylinder attached to the port, there is no reason to check for a pressure switch.
                    //     2. If this is the first port, and we know that the port is drawing fresh air, there is no reason
                    //        to check for a pressure switch.  This case cannot be handled by case #1, as we define a "logical"
                    //        cylinder to represent fresh air.
                    // If we find either scenario for the current port, we skip further processing on this port, and proceed to
                    // the next one.
                    GasEndPoint currentInstalledCylinder = dockingStation.GasEndPoints.Find(ic => ic.Position == position);
                    if (currentInstalledCylinder == null)
                    {
                        Log.Debug(string.Format("{0}Position {1} No cylinder present; do not check for pressure switch.", funcName, position));
                        continue;
                    }
                    else
                    {
                        bool isFreshAir = currentInstalledCylinder.Cylinder.IsFreshAir;
                        if (isFreshAir)
                        {
                            Log.Debug(string.Format("{0}Position {1} Fresh air; do not check for pressure switch.", funcName, position));
                            continue;
                        }
                    }
                    // SGF  8-Nov-2012  INS-2686 -- end

                    // SMARTCARD NOT CHANGED (NO INSERT OR REMOVAL DETECTED).
                    // WE NEED TO AT LEAST ALWAYS READ THE PRESSURE SWITCH THEN.
                    if (SmartCardManager.IsPressureSwitchPresent(position))
                    {
                        GasEndPoint pressureCylinder = new GasEndPoint();
                        pressureCylinder.Position          = position;
                        pressureCylinder.Cylinder.Pressure = ReadPressureLevel(position);
                        pressureCylinder.GasChangeType     = GasEndPoint.ChangeType.PressureChanged;

                        Log.Debug(string.Format("{0}Position {1} Pressure Switch reports {2}.", funcName, position, pressureCylinder.Cylinder.Pressure));

                        changedGasEndPoints.Add(pressureCylinder);
                    }
                    else
                    {
                        Log.Debug(string.Format("{0}Position {1} Pressure Switch not present.", funcName, position));
                    }

                    continue;
                }

                // IF WE MAKE IT TO HERE, THE CARD HAS BEEN EITHER INSERTED OR REMOVED.

                if (!SmartCardManager.IsCardPresent(position))      // CARD REMOVED?
                {
                    Log.Debug(string.Format("{0}Position {1} SmartCard not present, Returning CardRemoved", funcName, position));

                    // Server needs to know specifically that cylinder is missing.
                    // Indicate this with an InstalledCylinder containing an empty Cylinder object.
                    GasEndPoint missingCylinder = new GasEndPoint();
                    missingCylinder.Position      = position;
                    missingCylinder.GasChangeType = GasEndPoint.ChangeType.Uninstalled;
                    changedGasEndPoints.Add(missingCylinder);

                    // If a cylinder is not installed on the fresh air port, then assume fresh air
                    // for the port
                    if (position == Controller.FRESH_AIR_GAS_PORT)
                    {
                        Log.Debug(string.Format("{0}Position {1} is assumed to be Fresh Air.", funcName, position));
                        GasEndPoint freshAirCylinder = GasEndPoint.CreateFreshAir(position);
                        freshAirCylinder.GasChangeType = GasEndPoint.ChangeType.Installed;
                        changedGasEndPoints.Add(freshAirCylinder);
                    }

                    continue;
                }

                // IF WE MAKE IT TO HERE, THE CARD HAS BEEN INSERTED.

                Cylinder cylinder = SmartCardManager.ReadCard(position);
                if (cylinder == null)    // Couldn't read valid cylinder?  Driver error or corrupt card.
                {
                    Log.Debug(string.Format("{0}Position {1}, ReadCard returned null. SKIPPING cylinder.", funcName, position));
                    continue;
                }

                // Dates read from card will be in 'local' time, but everything we deal with is in UTC.
                cylinder.ExpirationDate = Configuration.ToUniversalTime(cylinder.ExpirationDate);
                cylinder.RefillDate     = Configuration.ToUniversalTime(cylinder.RefillDate);

                Thread.Sleep(1000);

                cylinder.Pressure = ReadPressureLevel(position);

                GasEndPoint gasEndPoint = new GasEndPoint(cylinder, position, GasEndPoint.Type.iGas);
                gasEndPoint.GasChangeType = GasEndPoint.ChangeType.Installed;
                Log.Debug(string.Format("{0}Position {1}, Returning CardInserted. Pressure={2}", funcName, position, cylinder.Pressure));

                changedGasEndPoints.Add((GasEndPoint)gasEndPoint.Clone());
            }  // end-for

            return;
        }