示例#1
0
        public void SetGet()
        {
            var server = new ParameterServer(new Uri("http://localhost"));

            server.HasParam("test", "test_param")[2].Is(false);

            server.SetParam("test", "test_param", 1234);

            server.HasParam("test", "test_param")[2].Is(true);

            server.GetParam("test", "test_param")[2].Is(1234);
        }
示例#2
0
        public MasterServer(int portNumber)
        {
            _channel = new HttpServerChannel("master", portNumber, new XmlRpcServerFormatterSinkProvider());

            var tmp = new Uri(_channel.GetChannelUri());

            MasterUri = new Uri("http://" + Ros.HostName + ":" + tmp.Port);

            ChannelServices.RegisterChannel(_channel, false);
            RemotingServices.Marshal(this, "/");

            _parameterServer = new ParameterServer(MasterUri);

            _logger.Info(m => m("MasterServer launched {0}", MasterUri.ToString()));
        }
示例#3
0
        public void SubscribeBeforeSetParam()
        {
            var server = new ParameterServer(new Uri("http://localhost"));

            var slave = new SlaveServer("test", 0, new TopicContainer());
            var observer = new ReplaySubject<KeyValuePair<string, object>>();

            slave.ParameterUpdated += (key, value) => observer.OnNext(new KeyValuePair<string, object>(key, value));

            server.SubscribeParam("test", slave.SlaveUri.ToString(), "test_param");

            server.SetParam("test", "test_param", 5678);

            observer.First().Key.Is("test_param");
            observer.First().Value.Is(5678);
        }