public ReaderConnection()
        {
            scanThread    = new Thread(Run);
            controlThread = new Thread(PrintTags);
            standThread   = new Thread(PrintLocation);
            laserThread   = new Thread(laserDistance);
            tags          = new List <TagInfo>();
            stands        = new List <Stand>();
            state         = new LocationAlgorithm();
            serial1       = new Serial();

            Stand a1 = new Stand("100000000000000000000103", "100000000000000000000112", "100000000000000000000126", "100000000000000000000127", "A", 1.30, 0.00, 1);
            Stand a2 = new Stand("100000000000000000000112", "100000000000000000000103", "100000000000000000000118", "100000000000000000000123", "A", 1.00, 1.35, 2);
            Stand a3 = new Stand("100000000000000000000123", "100000000000000000000118", "100000000000000000000113", "100000000000000000000102", "A", 1.00, 2.35, 3);
            Stand a4 = new Stand("100000000000000000000102", "100000000000000000000113", "100000000000000000000130", "100000000000000000000130", "A", 1.00, 3.35, 4);

            Stand b1 = new Stand("100000000000000000000106", "100000000000000000000115", "100000000000000000000128", "100000000000000000000129", "B", 1.30, 0.00, 1);
            Stand b2 = new Stand("100000000000000000000106", "100000000000000000000115", "100000000000000000000116", "100000000000000000000121", "B", 1.00, 1.35, 2);
            Stand b3 = new Stand("100000000000000000000109", "100000000000000000000116", "100000000000000000000121", "100000000000000000000114", "B", 1.00, 2.35, 3);
            Stand b4 = new Stand("100000000000000000000109", "100000000000000000000114", "100000000000000000000130", "100000000000000000000130", "B", 1.00, 3.35, 4);

            Stand c1 = new Stand("100000000000000000000110", "100000000000000000000130", "100000000000000000000130", "100000000000000000000130", "C", 1.30, 0.00, 1);
            Stand c2 = new Stand("100000000000000000000110", "100000000000000000000117", "100000000000000000000130", "100000000000000000000130", "C", 1.00, 1.35, 2);
            Stand c3 = new Stand("100000000000000000000117", "100000000000000000000107", "100000000000000000000130", "100000000000000000000130", "C", 1.00, 2.35, 3);
            Stand c4 = new Stand("100000000000000000000107", "100000000000000000000130", "100000000000000000000130", "100000000000000000000130", "C", 1.00, 3.35, 4);

            stands.Add(a1);
            stands.Add(a2);
            stands.Add(a3);
            stands.Add(a4);
            stands.Add(b1);
            stands.Add(b2);
            stands.Add(b3);
            stands.Add(b4);
            stands.Add(c1);
            stands.Add(c2);
            stands.Add(c3);
            stands.Add(c4);

            disconnected = false;
        }
        public String getLocationAlternative()
        {
            strongestTags = ReaderConnection.tags.OrderByDescending(t => t.signalStrength).ToList();
            if (strongestTags.Count > 5)
            {
                strongestTags.RemoveRange(5, strongestTags.Count - 5);
            }
            int   maxCount  = 0;
            int   maxCount2 = 0;
            Stand maxStand  = null;

            int   highestSignalStrength = -65535;
            Stand averageStand          = null;

            string location = "";

            foreach (Stand s in ReaderConnection.stands)
            {
                foreach (String tag in s.tags)
                {
                    // FIND HIGHEST OCCURRENCE AMONGST ALL STANDS
                    int standOccurrence = ReaderConnection.tags.FindAll(t => t.itemCode.Contains(tag)).Count();
                    if (standOccurrence > maxCount)
                    {
                        maxCount = standOccurrence;
                        maxStand = s;
                    }
                    else if (standOccurrence == maxCount)
                    {
                        maxCount2 = standOccurrence;
                    }

                    //CALCULATE WHAT TAG HAS THE HIGHEST SIGNAL STRENGTH

                    if (standOccurrence > 0)
                    {
                        int signalStrength = ReaderConnection.tags.FindAll(t => t.itemCode.Contains(tag)).Sum(t => t.signalStrength);
                        if (signalStrength > highestSignalStrength)
                        {
                            highestSignalStrength = signalStrength;
                            averageStand          = s;
                        }
                    }
                }
                if (ReaderConnection.laserHeight >= s.baseHeight && ReaderConnection.laserHeight <= (s.baseHeight + s.height))
                {
                    finalHeight = s.row;
                    goodReading = true;
                }
            }

            if (goodReading)
            {
                if (maxCount != maxCount2)
                {
                    finalLocation = maxStand;
                }
                else
                {
                    finalLocation = averageStand;
                }

                if (finalLocation != null)
                {
                    location = finalLocation.locationDescription + finalHeight;
                }
                goodReading = false;
                return(location);
            }
            else
            {
                return("not valid");
            }
        }