Esempio n. 1
0
 void ClientServiceAdded (object sender, ServiceArgs e)
 {
     lock (mutex) {
         Assert.AreEqual (ServiceOperation.Added, e.Operation);
         Assert.AreEqual ("upnp:test", e.Service.ServiceType);
         Assert.AreEqual ("uuid:mono-upnp-tests:test", e.Usn);
         Monitor.Pulse (mutex);
     }
 }
Esempio n. 2
0
 public JsonResult GetUserById(ServiceArgs<string> data)
 {
     try
     {
         var result = users.FirstOrDefault(u => u.Equals(data.Args));
         return JsonResponse(result, data.RequestId);
     }
     catch (Exception e)
     {
         return JsonError(e, null, Request.Url.AbsoluteUri);
     }
 }
Esempio n. 3
0
 public void Execute(WoodCore core, ServiceArgs args)
 {
     var methodName = args.Method;
     var callback = args.CallbackName;
     if (_actions.ContainsKey(methodName))
     {
         var method = _actions[methodName] as Action<WoodCore, ServiceArgs>;
         if (method == null)
         {
             throw new Exception("service " + args.Service + " has no method named " + args.Method);
         }
         method(core, args);
     }
     throw new Exception("service " + args.Service + " has no method named " + args.Method);
 }
Esempio n. 4
0
 public object ExecuteHasReturn(WoodCore core, ServiceArgs args)
 {
     var methodName = args.Method;
     var callback = args.CallbackName;
     if (_actions.ContainsKey(methodName))
     {
         var method = _actions[methodName] as Func<WoodCore, ServiceArgs, object>;
         if (method == null)
         {
             throw new Exception("service " + args.Service + " has no method  named " + args.Method + " with return value");
         }
         return method(core, args);
     }
     throw new Exception("service " + args.Service + " has no method  named " + args.Method + " with return value");
 }
Esempio n. 5
0
        private static void OnServiceFound(object o, ServiceArgs args)
        {
            if (args.Service.Name == server.Name)
                return;

            Console.WriteLine ("Found: " + args.Service.Name);
            if (args.Service.IsProtected) {
                Console.WriteLine ("Password is required, skipping");
                return;
            }

            Client client = new Client (args.Service);
            client.Login ();
            client.Updated += OnClientUpdated;

            foreach (Database db in client.Databases) {
                server.AddDatabase (db);
                Console.WriteLine ("Added database: " + db.Name);
            }

            server.Commit ();
            clients.Add (client);
        }
Esempio n. 6
0
        private static void OnServiceRemoved(object o, ServiceArgs args)
        {
            Console.WriteLine ("Removed: " + args.Service.Name);

            foreach (Client client in clients) {
                if (client.Name == args.Service.Name) {
                    foreach (Database db in client.Databases) {
                        server.RemoveDatabase (db);
                    }

                    clients.Remove (client);
                    break;
                }
            }
        }
 public IGridPageDto <ITechnicianCoverageDto> GetAllByGridPage(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
 public IEnumerable <KeyValuePair <string, string> > GetDisplayList(ServiceArgs args = null)
 {
     return(AvailableStates?.OrderBy(s => s.CountryId).ThenBy(s => s.Name).ToList().Select(s => new KeyValuePair <string, string>(s.Abbreviation, s.Name)).ToList()
            ?? new List <KeyValuePair <string, string> >());
 }
Esempio n. 9
0
        private static void OnServiceRemoved(object o, ServiceArgs args)
        {
            Console.WriteLine ("Removed: " + args.Service.Name);

            foreach (Client client in clients) {
                if (client.Name == args.Service.Name) {
                    clients.Remove (client);
                    break;
                }
            }
        }
Esempio n. 10
0
 public ServiceInstallEventArgs()
 {
     Install = new InstallArgs();
     Service = new ServiceArgs();
 }
Esempio n. 11
0
 public IEnumerable <KeyValuePair <string, string> > GetDisplayList(ServiceArgs args = null)
 {
     return(GetAll()?.OrderBy(p => p.InsuranceCompanyName).Where(x => !x.DisabledInd).Select(p => new KeyValuePair <string, string>(p.InsuranceCompanyId.ToString(), p.InsuranceCompanyName)).ToList());
 }
Esempio n. 12
0
 public Task <IEnumerable <IWorkTypeDto> > GetAllAsync(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 13
0
 public Task <IEnumerable <IDiagnosticResultDto> > GetAllAsync(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
        private void OnMessage(string message)
        {
            if ((message != null) && !message.Equals(string.Empty))
            {
                Topper topper = new Topper(message);

                string op = topper.op;

                if ("publish".Equals(op))                  // Topic
                {
                    string topic     = topper.topic;
                    string msgParams = string.Empty;

                    // if we have message parameters, parse them
                    Match      match = Regex.Match(message, @"""msg""\s*:\s*({.*}),");
                    RosMessage msg   = null;

                    if (match.Success)
                    {
                        msgParams = match.Groups[1].Value;
                    }

                    foreach (var sub in this.subscribers)
                    {
                        // only consider subscribers with a matching topic
                        if (topic != sub.Key.Topic)
                        {
                            continue;
                        }

                        msg = sub.Key.ParseMessage(msgParams);
                        MessageTask newTask = new MessageTask(sub.Key, msg);

                        lock (this.lockMsgQueue)
                        {
                            this.msgQueue[topic].Enqueue(newTask);
                        }
                    }
                }
                else if (Regex.IsMatch(message, @"""op""\s*:\s*""call_service"""))                 // Service
                {
                    ServiceHeader header = new ServiceHeader(message);

                    foreach (var srv in this.serviceProviders)
                    {
                        if (srv.Key.Name == header.service)
                        {
                            ServiceArgs args = null;
//							ServiceResponse response = null;

                            // if we have args, parse them (args are optional on services, though)
                            Match match = Regex.Match(message, @"""args""\s*:\s*({.*}),");
                            if (match.Success)
                            {
                                args = srv.Key.ParseRequest(match.Groups[1].Value);
                            }

                            // add service request to queue, to be processed later in Render()
                            lock (this.lockMsgQueue)
                            {
                                this.svcQueue[srv.Key.Name].Enqueue(new ServiceTask(srv.Key, args, header.id));
                            }

                            break;                             // there should only be one server for each service
                        }
                    }
                }
                else
                {
                    Debug.LogWarning("Unhandled message:\n" + message);
                }
            }
            else
            {
                Debug.Log("Got an empty message from the web socket");
            }
        }
 public IEnumerable <ITechnicianCoverageDto> GetAll(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 16
0
 public IGridPageDto <IUserShopDto> GetAllByGridPage(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 17
0
 public IEnumerable <IUserShopDto> GetAll(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 18
0
 public Task <IGridPageDto <IDiagnosticResultDto> > GetAllByGridPageAsync(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 19
0
 public IEnumerable <IWorkTypeDto> GetAll(ServiceArgs args = null)
 {
     return(Conn.Query <WorkTypeDto>("Scan.usp_GetWorkTypeSearch", commandType: CommandType.StoredProcedure).Distinct().ToList());
 }
 public Task <IEnumerable <ITechnicianProfileDto> > GetAllAsync(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 21
0
 public Task <IGridPageDto <IWorkTypeDto> > GetAllByGridPageAsync(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
 public Task <IGridPageDto <ITechnicianProfileDto> > GetAllByGridPageAsync(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 23
0
 private void OnServiceFound(object o, ServiceArgs args)
 {
     AddDaapServer(args.Service);
 }
 public IGridPageDto <IEstimatePlanDto> GetAllByGridPage(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 25
0
 public ActionResult GetUserById(ServiceArgs<string> data)
 {
     return View();
 }
 public IEnumerable <KeyValuePair <string, string> > GetDisplayList(ServiceArgs args = null)
 {
     return(Db.EstimatePlans.OrderBy(e => e.Name).ToList()
            .Select(e => new KeyValuePair <string, string>(e.EstimatePlanId.ToString(), e.Name)).ToList());
 }
Esempio n. 27
0
 public Task <IEnumerable <KeyValuePair <string, string> > > GetDisplayListAsync(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
 public IEnumerable <IEstimatePlanDto> GetAll(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }
Esempio n. 29
0
        private static void OnServiceFound(object o, ServiceArgs args)
        {
            Console.WriteLine ("Found: " + args.Service.Name);

            Client client = new Client (args.Service);
            client.Login ();

            AddClient (client);
        }
 public ServiceTask(RosBridgeServiceProvider service, ServiceArgs serviceArgs, string id)
 {
     this.service     = service;
     this.serviceArgs = serviceArgs;
     this.id          = id;
 }
        private void OnMessage <Tmsg>(string message) where Tmsg : RosMessage
        {
//			Debug.LogWarning("OnMessage="+message);

            if ((message != null) && !message.Equals(string.Empty))
            {
                Topper topper = new Topper(message);

                if ("publish".Equals(topper.op))                  // Topic
                {
                    RosbridgeJson <Tmsg> rosbridgeJson = null;

                    foreach (var sub in this.subscribers)
                    {
                        // only consider subscribers with a matching topic
                        if (topper.topic != sub.Key.Topic)
                        {
                            continue;
                        }

                        if (rosbridgeJson == null)
                        {
                            rosbridgeJson = new RosbridgeJson <Tmsg>(message);
                        }

                        MessageTask newTask = new MessageTask(sub.Key, rosbridgeJson.msg);

                        lock (this.lockMsgQueue)
                        {
                            this.msgQueue[rosbridgeJson.topic].Enqueue(newTask);
                        }
                    }
                }
                else if ("call_service".Equals(topper.op))                 // Service
                {
                    RosbridgeJson <Tmsg> rosbridgeJson = new RosbridgeJson <Tmsg>(message);

                    foreach (var srv in this.serviceProviders)
                    {
                        if (srv.Key.Name == rosbridgeJson.service)
                        {
                            ServiceArgs args = null;
//							ServiceResponse response = null;

                            // if we have args, parse them (args are optional on services, though)
                            Match match = Regex.Match(message, @"""args""\s*:\s*({.*}),");
                            if (match.Success)
                            {
                                args = srv.Key.ParseRequest(match.Groups[1].Value);
                            }

                            // add service request to queue, to be processed later in Render()
                            lock (this.lockMsgQueue)
                            {
                                this.svcQueue[srv.Key.Name].Enqueue(new ServiceTask(srv.Key, args, rosbridgeJson.id));
                            }

                            break;                             // there should only be one server for each service
                        }
                    }
                }
                else
                {
                    Debug.LogWarning("Unhandled message:\n" + message);
                }
            }
            else
            {
                Debug.Log("Got an empty message from the web socket");
            }
        }
Esempio n. 32
0
 private void SsdpClientOnServiceUpdated(object sender, ServiceArgs serviceArgs)
 {
     FalichsLogger.Instance.log(FalichsLogger.Severity.INFO, "SSDP Service updated:" + serviceArgs.Service.Locations.First());
 }
Esempio n. 33
0
        void InvokeService(HttpListenerContext context, ServiceArgs args)
        {
            try
            {
                var service = ServiceManager.GetService(args.Service);
                if (args.RequireReturn)
                {
                    var result = service.ExecuteHasReturn(this, args);
                    ReturnContentToClient(context, result);
                }
                else
                {
                    service.Execute(this, args);
                    ReturnContentToClient(context);
                }

            }
            catch (Exception exp)
            {
                ReturnErrorToClient(context, exp.Message);
            }
        }
Esempio n. 34
0
 public IEnumerable <KeyValuePair <string, string> > GetDisplayList(ServiceArgs args = null)
 {
     return(Conn.Query("Scan.usp_GetWorkTypeDisplayList", commandType: CommandType.StoredProcedure).Select(t =>
                                                                                                           new KeyValuePair <string, string>(t.WorkTypeId.ToString(), t.WorkTypeName)).ToList());
 }
Esempio n. 35
0
			public LocationManager(WoodCore core,ServiceArgs args){
				this.core=core;
				this.args=args;
				Id=Guid.NewGuid();
				mgr=new CLLocationManager();
				if(UIDevice.CurrentDevice.CheckSystemVersion(8,0)){
					mgr.RequestAlwaysAuthorization();
				}
				if(CLLocationManager.LocationServicesEnabled){
					mgr.DesiredAccuracy=1;
					//StartUpdatingLocation();
					mgr.LocationsUpdated+=delegate(object sender,CLLocationsUpdatedEventArgs e) {
						LocationUpdated(this,new LocationUpdatedEventArgs(e.Locations[e.Locations.Length-1]));	
					};
				}
			}
Esempio n. 36
0
 public IGridPageDto <IDiagnosticQueueDto> GetAllByGridPage(ServiceArgs args = null)
 {
     throw new NotImplementedException();
 }