示例#1
0
        private void monitorMyLocation()
        {
            try {
                while (true)
                {
                    if (discloseLocation)
                    {
                        Trace.WriteLine("DEBUG: Looking up location info..");
                        try {
                            MSE.login();
                            AesMobileStationLocation loc = MSE.queryMAC(myMac);
                            MSE.logout();

                            if (loc != null)
                            {
                                if ((prevLoc == null) || (prevLoc.x != loc.x) || (prevLoc.y != loc.y))
                                {
                                    TXTrecords.Add("locationID", "NOTIMPL" /* loc.x + " x " + loc.y */);
                                    publishService.setTXTRecordData(NetService.DataFromTXTRecordDictionary(TXTrecords));

                                    Trace.WriteLine(" Mac: " + loc.macAddress + " Loc: " + loc.x + "x" + loc.y + " lastHeard " + loc.minLastHeardSecs + " conf " + loc.confidenceFactor);
                                    prevLoc = loc;
                                }
                            }
                        } catch (Exception e) {
                            Trace.WriteLine("DEBUG: Disclose location: " + e.StackTrace);
                        }
                    }
                    Thread.Sleep(5000);
                }
            } catch (Exception e) {
                Trace.WriteLine("Oops - " + e.Message);
            }
        }
示例#2
0
        public AesMobileStationLocation[] query()
        {
            //ping();
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);

            LocationService LS = new LocationService("https://" + mseAddr + "/location/");

            try {
                GetChangesMethodArgs GCM = new GetChangesMethodArgs();
                GCM.AesBusinessSession    = new location.AesBusinessSession();
                GCM.AesBusinessSession.id = sessionId;
                AesGetChanges AGC = new AesGetChanges();
                AGC.classname = "AesMobileStationLocation";

                GCM.AesGetChanges = AGC;
                location.Response r = LS.GetChanges(GCM);

                if (r != null && r.Items != null)
                {
                    int count = 0;
                    foreach (location.AesObject aesObj in r.Items)
                    {
                        if (aesObj is AesMobileStationLocation)
                        {
                            count++;
                        }
                    }
                    AesMobileStationLocation[] locs = new AesMobileStationLocation[count];
                    int j = 0;
                    foreach (location.AesObject aesObj in r.Items)
                    {
                        if (aesObj is AesMobileStationLocation)
                        {
                            AesMobileStationLocation loc = (AesMobileStationLocation)aesObj;
                            locs[j++] = loc;
                        }
                    }
                    return(locs);
                }
                else
                {
                    Trace.WriteLine("GetChanges Failed");
                }
            } catch (Exception x) {
                Trace.WriteLine(x);
            }
            return(new location.AesMobileStationLocation[0]);
        }
示例#3
0
        private void locationChecked(object Sender, EventArgs e)
        {
            if (locationItem.Checked)
            {
                locationItem.Checked = false;

                prevLoc = null;
                TXTrecords.Remove("locationID");
                publishService.setTXTRecordData(NetService.DataFromTXTRecordDictionary(TXTrecords));
            }
            else
            {
                locationItem.Checked = true;
                discloseLocation     = true;
            }
            using (RegistryKey dcs = Registry.CurrentUser.CreateSubKey("Software").CreateSubKey("FXPAL").CreateSubKey("DisplayCast").CreateSubKey("Streamer")) {
                dcs.SetValue("discloseLocation", locationItem.Checked);
            }
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        public static void monitorMyLocation()
        {
            /* TextBox locationString = (TextBox)o;
             * if (locationString.GetType() != typeof(TextBox)) {
             *   Trace.WriteLine("Hmmm, not the right type");
             *   return;
             * }
             */
            while (true)
            {
                using (RegistryKey dcs = Registry.CurrentUser.CreateSubKey("Software").CreateSubKey("FXPAL").CreateSubKey("DisplayCast").CreateSubKey("Player")) {
                    discloseLocation = Convert.ToBoolean(dcs.GetValue("discloseLocation", false));
                }

                if (discloseLocation)
                {
                    // Trace.WriteLine("DEBUG: Looking up location info..");
                    try {
                        MSE.login();
                        AesMobileStationLocation loc = MSE.queryMAC(myMac);
                        MSE.logout();

                        if (loc != null)
                        {
                            if ((prevLoc == null) || (prevLoc.x != loc.x) || (prevLoc.y != loc.y))
                            {
                                TXTrecords.Add("locationID", "NOTIMPL" /* loc.x + " x " + loc.y */);
                                nsPublisher.TXTRecordData = NetService.DataFromTXTRecordDictionary(TXTrecords);

                                Trace.WriteLine(" Mac: " + loc.macAddress + " Loc: " + loc.x + "x" + loc.y + " lastHeard " + loc.minLastHeardSecs + " conf " + loc.confidenceFactor);
                                prevLoc = loc;
                            }
                        }
                    } catch (Exception e) {
                        Trace.WriteLine("DEBUG: Disclose location: " + e.StackTrace);
                    }
                }

                Thread.Sleep(5000);
            }
        }
示例#5
0
        public AesMobileStationLocation queryMAC(String mac)
        {
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);

            LocationService LS   = new LocationService("https://" + mseAddr + "/location/");
            String          lmac = mac.ToLower();

            try {
                AesGetChanges AGC = new AesGetChanges();
                AGC.classname = "AesMobileStationLocation";

                GetChangesMethodArgs GCM = new GetChangesMethodArgs();
                GCM.AesBusinessSession    = new location.AesBusinessSession();
                GCM.AesBusinessSession.id = sessionId;
                GCM.AesGetChanges         = AGC;

                location.Response r = LS.GetChanges(GCM);
                if ((r == null) || (r.Items == null))
                {
                    return(null);
                }

                foreach (location.AesObject aesObj in r.Items)
                {
                    if (aesObj is AesMobileStationLocation)
                    {
                        AesMobileStationLocation loc = (AesMobileStationLocation)aesObj;
                        // if (loc.macAddress.Equals(mac))
                        //    return (loc);
                        if (loc.macAddress.ToLower().Equals(lmac))
                        {
                            return(loc);
                        }
                    }
                }
            } catch (Exception x) {
                Trace.WriteLine(x);
            }
            return(null);
        }
示例#6
0
        public AesMobileStationLocation[] query()
        {
            //ping();
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);

            LocationService LS = new LocationService("https://" + mseAddr + "/location/");
            try {
                GetChangesMethodArgs GCM = new GetChangesMethodArgs();
                GCM.AesBusinessSession = new location.AesBusinessSession();
                GCM.AesBusinessSession.id = sessionId;
                AesGetChanges AGC = new AesGetChanges();
                AGC.classname = "AesMobileStationLocation";

                GCM.AesGetChanges = AGC;
                location.Response r = LS.GetChanges(GCM);

                if (r != null && r.Items != null) {
                    int count = 0;
                    foreach (location.AesObject aesObj in r.Items) {
                        if (aesObj is AesMobileStationLocation)
                            count++;
                    }
                    AesMobileStationLocation[] locs = new AesMobileStationLocation[count];
                    int j = 0;
                    foreach (location.AesObject aesObj in r.Items) {
                        if (aesObj is AesMobileStationLocation) {
                            AesMobileStationLocation loc = (AesMobileStationLocation)aesObj;
                            locs[j++] = loc;
                        }
                    }
                    return locs;
                } else {
                    Trace.WriteLine("GetChanges Failed");
                }
            } catch (Exception x) {
                Trace.WriteLine(x);
            }
            return new location.AesMobileStationLocation[0];
        }
示例#7
0
        /// <summary>
        /// 
        /// </summary>
        public static void monitorMyLocation() {
           /* TextBox locationString = (TextBox)o;
            if (locationString.GetType() != typeof(TextBox)) {
                Trace.WriteLine("Hmmm, not the right type");
                return;
            }
            */
            while (true) {
                using (RegistryKey dcs = Registry.CurrentUser.CreateSubKey("Software").CreateSubKey("FXPAL").CreateSubKey("DisplayCast").CreateSubKey("Player")) {

                    discloseLocation = Convert.ToBoolean(dcs.GetValue("discloseLocation", false));
                }

                if (discloseLocation) {
                    // Trace.WriteLine("DEBUG: Looking up location info..");
                    try {
                        MSE.login();
                        AesMobileStationLocation loc = MSE.queryMAC(myMac);
                        MSE.logout();

                        if (loc != null) {
                            if ((prevLoc == null) || (prevLoc.x != loc.x) || (prevLoc.y != loc.y)) {
                                TXTrecords.Add("locationID", "NOTIMPL" /* loc.x + " x " + loc.y */);
                                nsPublisher.TXTRecordData = NetService.DataFromTXTRecordDictionary(TXTrecords);

                                Trace.WriteLine(" Mac: " + loc.macAddress + " Loc: " + loc.x + "x" + loc.y + " lastHeard " + loc.minLastHeardSecs + " conf " + loc.confidenceFactor);
                                prevLoc = loc;
                            }
                        }
                    } catch (Exception e) {
                        Trace.WriteLine("DEBUG: Disclose location: " + e.StackTrace );
                    }
                }

                Thread.Sleep(5000);
            }
        }
示例#8
0
文件: Console.cs 项目: mobilipia/Win7
        private void locationChecked(object Sender, EventArgs e)
        {
            if (locationItem.Checked) {
                locationItem.Checked = false;

                prevLoc = null;
                TXTrecords.Remove("locationID");
                publishService.setTXTRecordData(NetService.DataFromTXTRecordDictionary(TXTrecords));
            } else {
                locationItem.Checked = true;
                discloseLocation = true;
            }
            using (RegistryKey dcs = Registry.CurrentUser.CreateSubKey("Software").CreateSubKey("FXPAL").CreateSubKey("DisplayCast").CreateSubKey("Streamer")) {
                dcs.SetValue("discloseLocation", locationItem.Checked);
            }
        }