Exemplo n.º 1
0
 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")
     });
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
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;
     }
 }
Exemplo n.º 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;
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 6
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;
            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;
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
0
 public NetworkData(byte[] macAddress)
     : this()
 {
     MyMacAddress = new MacAddress(macAddress);
 }
Exemplo n.º 9
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;
        }
Exemplo n.º 10
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));
     }
 }
Exemplo n.º 11
0
 public NetworkData(byte[] macAddress)
     : this()
 {
     MyMacAddress = new MacAddress(macAddress);
 }
Exemplo n.º 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);
        }