public KCBFloorForm()
        {
            InitializeComponent();
            autoDetectCheck.Checked = true;

            /*
             * //Test Results
             * 4th Floor  0022B048DB98   99% Detection if we use both MAC    0022B04986C8(F1,S),0022B0498830 (F,S2),0022B048DB98 (F3,S),0022B048DB90(F,S3)
             *                         L4(0022B048DB98,0022B04986C8)
             * 3rd Floor  0022B04984B0   99% Detection if we use both MAC    0022B04984B0(F2,S2),0022B0498358(F1,S2)
             *                         L3(0022B04984B0,0022B0498358)
             * 2nd Floor  0022B048DBB0   99% Detection Very Good             0022B048DBB8(F,S3),0022B048DBB0(F3,S0)
             *                         L2(0022B048DBB0,0022B048DBB8)
             * 1st Floor  0022B04990B8   50%  Detection                          0022B0498B58(F1,S), 0022B0498D98(F,S1),0022B04990B8(F2,S),
             *                         //Can give good result if used with     0022B04986C8(F,S1), 0022B0498838(F1,S),0022B0498808(F,S1),
             *                         L1(0022B04990B8,0022B0498838)             0022B0498458(F,S1)
             *
             * Ground     0022B0498B58   50% Deection                        0022B0498B58(F2,S2),0022B0498B50(F1,S3)
             *                         LG(0022B0498B58,0022B0498B50)
             * Basement   0022B0498C38   99% Accuracy if we use both MAC     0022B0498C38(F5,S),0022B0498C30(F2,S2),
             *                         LB(0022B0498C38,0022B0498C30)       0022B0498B58(F,S2),0022B0498808(F,S1)
             *
             *
             * L4(0022B048DB98,0022B04986C8)
             * L3(0022B04984B0,0022B0498358)
             * L2(0022B048DBB0)
             * L1(0022B04990B8,0022B0498838)
             * LG(0022B0498B58,0022B0498B50)
             * LB(0022B0498C38,0022B0498C30)
             */

            //first attempt to detect floor using 1WIFI MAC Address
            //Floor 1 to 5
            rF[5] = new routerInfo("Neglected", -9000);
            rF[4] = new routerInfo("0022B048DB98", -9000);
            rF[3] = new routerInfo("0022B04984B0", -9000);
            rF[2] = new routerInfo("0022B048DBB0", -9000);
            rF[1] = new routerInfo("0022B04990B8", -9000);
            //Ground Floor
            rF[7] = new routerInfo("0022B0498B58 ", -9000);
            //Basement
            rF[6] = new routerInfo("0022B0498C38", -9000);
            //New WIFI MAC Address and RSSI
            allRouterInfo[0]  = new  routerInfo("Neglect it", -9000);
            allRouterInfo[1]  = new  routerInfo("0022B048DB98", -9000);
            allRouterInfo[2]  = new  routerInfo("0022B04986C8", -9000);
            allRouterInfo[3]  = new  routerInfo("0022B0498358", -9000);
            allRouterInfo[4]  = new  routerInfo("0022B04984B0", -9000);
            allRouterInfo[5]  = new  routerInfo("0022B048DBB0", -9000);
            allRouterInfo[6]  = new  routerInfo("0022B04990B8", -9000);
            allRouterInfo[7]  = new  routerInfo("0022B0498838", -9000);
            allRouterInfo[8]  = new  routerInfo("0022B0498B58", -9000);
            allRouterInfo[9]  = new  routerInfo("0022B0498B50", -9000);
            allRouterInfo[10] = new routerInfo("0022B0498C38", -9000);
            allRouterInfo[11] = new routerInfo("0022B0498C30", -9000);
            allRouterInfo[12] = new routerInfo("0022B048DBB8", -9000);
            setDefaultDBM();
        }
        //Method to scan the
        public bool scanSorroundingFloor()
        {
            WlanClient client = new WlanClient();
            string     SSID   = "";
            string     RoMAC  = "";
            //uint SignalStrength = 0;
            bool foundKCBWIFI = false;

            try
            {
                foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
                {
                    Wlan.WlanBssEntry[] wlanBssEntries = wlanIface.GetNetworkBssList();
                    foreach (Wlan.WlanBssEntry network in wlanBssEntries)
                    {
                        SSID = SSIDName(network.dot11Ssid);
                        //SignalStrength = network.linkQuality;
                        int    SignalStrengths = network.rssi;
                        byte[] macAddress      = network.dot11Bssid;

                        RoMAC = "";
                        //Get Mac Address of the SSID
                        for (int i = 0; i < macAddress.Length; i++)
                        {
                            RoMAC += macAddress[i].ToString("x2").PadLeft(2, '0').ToUpper();
                        }
                        //This detection doesn't work properly however in abscence of 2 router RSSI it works.
                        for (int i = 1; i <= 7; i++)
                        {
                            if (RoMAC.Equals(rF[i].MACAddress))
                            {
                                rF[i]        = new routerInfo(rF[i].MACAddress, SignalStrengths);
                                foundKCBWIFI = true;
                            }
                        }
                        //New code to set MAC Addresses
                        for (int j = 1; j <= 12; j++)
                        {
                            if (RoMAC.Equals(allRouterInfo[j].MACAddress))
                            {
                                allRouterInfo[j] = new routerInfo(allRouterInfo[j].MACAddress, SignalStrengths);
                                foundKCBWIFI     = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(foundKCBWIFI);
        }
示例#3
0
        //Method to scan the
        public bool scanSorroundingFloor()
        {
            WlanClient client = new WlanClient();
            string     SSID   = "";
            string     RoMAC  = "";
            //uint SignalStrength = 0;
            bool foundKCBWIFI = false;

            try
            {
                foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
                {
                    Wlan.WlanBssEntry[] wlanBssEntries = wlanIface.GetNetworkBssList();
                    foreach (Wlan.WlanBssEntry network in wlanBssEntries)
                    {
                        SSID = SSIDName(network.dot11Ssid);
                        //SignalStrength = network.linkQuality;
                        int    SignalStrengths = network.rssi;
                        byte[] macAddress      = network.dot11Bssid;

                        RoMAC = "";
                        //Get Mac Address of the SSID
                        for (int i = 0; i < macAddress.Length; i++)
                        {
                            RoMAC += macAddress[i].ToString("x2").PadLeft(2, '0').ToUpper();
                        }
                        for (int i = 1; i <= 7; i++)
                        {
                            if (RoMAC.Equals(rF[i].MACAddress))
                            {
                                rF[i]        = new routerInfo(rF[i].MACAddress, SignalStrengths);
                                foundKCBWIFI = true;
                                //Console.WriteLine("SSID :{0} \nSignal Strength :{1}%", SSID, SignalStrength);
                                //Console.WriteLine("Mac: {0}", RoMAC);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(foundKCBWIFI);
        }