public object[] GetData()
 {
     //if(ap.Index > 20)
     //    Console.WriteLine("Hi");
     return(new object[]
     {
         Index,
         Graph,
         /*null,*/            //The signal indicator Image
         MacAddress.ToString(),
         Ssid,
         Spark,
         IsN&& NSettings != null && NSettings.Is40Mhz
                        ? NSettings.SecondaryChannelLower
                              ? Channel + " + " + (Channel - 4)
                              : Channel + " + " + (Channel + 4)
                        : Channel.ToString(),
         Vendor,
         Security,
         MaxRate,
         NetworkType,
         FirstSeenTimestamp.ToLongTimeString(),
         LastSeenTimestamp.ToLongTimeString(),
         GpsData.Latitude.ToString("F6"),
         GpsData.Longitude.ToString("F6")
     });
 }
Exemple #2
0
        public int CompareTo(object obj)
        {
            MacAddress compareObject = obj as MacAddress;

            if (null == obj)
            {
                return(-1);
            }

            if (compareObject != null)
            {
                for (int i = 0; i < compareObject.Length; ++i)
                {
                    if (this[i] > compareObject[i])
                    {
                        return(1);
                    }
                    if (this[i] < compareObject[i])
                    {
                        return(-1);
                    }
                }
            }
            return(0);
        }
 public string GetVendor(MacAddress mac)
 {
     // format the key name
     string key = mac[0].ToString("X2") + "-" +
                  mac[1].ToString("X2") + "-" +
                  mac[2].ToString("X2");
     try
     {
         return _vendors[key];
     }
     catch (KeyNotFoundException)
     {
         return String.Empty;
     }
 }
Exemple #4
0
        public NetworkData(DateTime timestamp, byte[] macAddress, string privacy, string ssid, uint channel, int rssi, uint signalQuality, string supportedRates, string networkType)
        {
            Rates = new List<double>();
            MyTimestamp = timestamp;
            MyMacAddress = new MacAddress(macAddress);

            Privacy = privacy;
            Ssid = ssid;
            Channel = channel;
            Rssi = rssi;
            SignalQuality = signalQuality;
            Rates = supportedRates.Split(new char[] { '/' }).ToList<string>().ConvertAll<double>(Convert.ToDouble);
            NetworkType = networkType;
            Age = 0;
        }
Exemple #5
0
        public string GetVendor(MacAddress mac)
        {
            // format the key name
            string key = mac[0].ToString("X2") + "-" +
                         mac[1].ToString("X2") + "-" +
                         mac[2].ToString("X2");

            try
            {
                return(_vendors[key]);
            }
            catch (KeyNotFoundException)
            {
                return(String.Empty);
            }
        }
        public NetworkData(DateTime timestamp, byte[] macAddress, string privacy, string ssid, uint channel, int rssi, uint signalQuality, string supportedRates, string networkType)
        {
            Rates = new List<double>();
            MyTimestamp = timestamp;
            MyMacAddress = new MacAddress(macAddress);

            Privacy = privacy;
            Ssid = ssid;
            Channel = channel;
            Rssi = rssi;
            SignalQuality = signalQuality;
            try
            {
                Rates = supportedRates.Split(new char[] { '/' }).ToList<string>().ConvertAll<double>(d =>
                    {
                        try
                        {
                            return Convert.ToDouble(d);
                        }
                        catch (FormatException)
                        {
                            // Something went wrong, most likely an invalid rate string
                            return 0;
                        }
                    });
            }
            catch (FormatException)
            {
                // Something went wrong
                Rates.Add(-1.0);
            }
            catch(OutOfMemoryException)
            {
                // Something went wrong
                Rates.Add(-1.0);
            }
            NetworkType = networkType;
            Age = 0;
        }
        public NetworkData(DateTime timestamp, byte[] macAddress, string security, string ssid, uint channel, int rssi, uint signalQuality, string supportedRates, string networkType)
        {
            Rates        = new List <double>();
            MyTimestamp  = timestamp;
            MyMacAddress = new MacAddress(macAddress);

            Security      = security;
            Ssid          = ssid;
            Channel       = channel;
            Rssi          = rssi;
            SignalQuality = signalQuality;
            try
            {
                Rates = supportedRates.Split(new[] { '/' }).ToList().ConvertAll(d => Convert.ToDouble(d, CultureInfo.InvariantCulture));
            }
            catch (FormatException)
            {
                //Something went wrong
                Rates.Add(-1.0);
            }
            NetworkType = networkType;
            Age         = 0;
        }
Exemple #8
0
 public NetworkData(byte[] macAddress)
     : this()
 {
     MyMacAddress = new MacAddress(macAddress);
 }
        public NetworkData(DateTime timestamp, byte[] macAddress, string security, string ssid, uint channel, int rssi, uint signalQuality, string supportedRates, string networkType)
        {
            Rates = new List<double>();
            MyTimestamp = timestamp;
            MyMacAddress = new MacAddress(macAddress);

            Security = security;
            Ssid = ssid;
            Channel = channel;
            Rssi = rssi;
            SignalQuality = signalQuality;
            try
            {
                Rates = supportedRates.Split(new[] { '/' }).ToList().ConvertAll(d => Convert.ToDouble(d, CultureInfo.InvariantCulture));
            }
            catch (FormatException)
            {
                //Something went wrong
                Rates.Add(-1.0);
            }
            NetworkType = networkType;
            Age = 0;
        }
 /// <summary>
 /// Gets an AP by its MAC address
 /// </summary>
 /// <param name="mac">The MAC address of the AP to look for</param>
 /// <returns></returns>
 private AccessPoint GetAccessPointByMacAddress(MacAddress mac)
 {
     lock (_cache)
     {
         return _cache.Values.FirstOrDefault(ap => ap.MacAddress.Equals(mac));
     }
 }
 public NetworkData(byte[] macAddress)
     : this()
 {
     MyMacAddress = new MacAddress(macAddress);
 }
Exemple #12
0
        /// <summary>
        /// Determines if this object is equal to another
        /// MacAddress object.
        /// </summary>
        /// <param name="obj">a MacAddress object to compare with the current object</param>
        /// <returns>true if the two objects are equal, false otherwise.</returns>
        public override bool Equals(object obj)
        {
            MacAddress ma = obj as MacAddress;

            return(null != ma && ma.MyValue == MyValue);
        }