Exemplo n.º 1
0
        public override void OnScanResult(ScanCallbackType callbackType, ScanResult res)
        {
            base.OnScanResult(callbackType, res);
            BES.beacon      dad = new BES.beacon();
            BluetoothDevice btd = res.Device;
            ScanRecord      rec = res.ScanRecord;

            string mac = btd.Address;
            string nom = btd.Name;
            string cla = btd.BluetoothClass.ToString();
            string bon = btd.BondState.ToString();
            int    rss = res.Rssi;
            string uui = "";
            int    tax = 3;

            IDictionary <ParcelUuid, byte[]> sda;

            if (nom == "OnyxBeacon")
            {
                sda = rec.ServiceData;
                uui = Retorna_UUID(sda).ToString();
            }
            tax           = rec.TxPowerLevel;
            dad.distancia = Calcula_Dist(rss, tax);
            dad.btd       = btd;
            dad.nome      = nom;
            dad.mac       = mac;
            dad.rssi      = rss;
            dad.taxa      = tax.ToString();
            dad.uuid      = uui;
            dad.classe    = cla;
            dad.bond      = bon;
            bec[mac]      = dad;
        }
Exemplo n.º 2
0
        public BES.Localiza Verifica_Mapa(XmlNodeList Lnodos, BES.beacon bicon)
        {
            BES.Localiza Posicion = new BES.Localiza();
            Posicion.Mac   = "--";
            Posicion.Bloco = "--";
            Posicion.Andar = "--";
            Posicion.X     = "--";
            Posicion.Y     = "--";
            Posicion.Noco  = "--";
            Posicion.Nuco  = "--";
            Posicion.Pd    = "--";
            Posicion.Area  = "--";
            Posicion.Midi  = "M_00.mid";
            Posicion.Foto  = "F_00.png";

            foreach (XmlNode nod in Lnodos)
            {
                XmlAttributeCollection atts = nod.Attributes;
                if (atts["MAC"].Value == bicon.mac)
                {
                    Posicion.Mac   = atts["MAC"].Value;
                    Posicion.Bloco = atts["Bloco"].Value;
                    Posicion.Andar = atts["Andar"].Value;
                    Posicion.X     = atts["X"].Value.Substring(0, 3);
                    Posicion.Y     = atts["Y"].Value.Substring(0, 3);
                    Posicion.Noco  = atts["Noco"].Value;
                    Posicion.Nuco  = atts["Nuco"].Value;
                    Posicion.Pd    = atts["Pd"].Value.Substring(0, 4);
                    Posicion.Area  = atts["Area"].Value.Substring(0, 6);
                    Posicion.Midi  = atts["Midi"].Value;
                    Posicion.Foto  = atts["Foto"].Value;
                    break;
                }
            }
            return(Posicion);
        }