Esempio n. 1
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]);
        }
Esempio n. 2
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);
        }