コード例 #1
0
            /// <summary>
            /// Register a publisher
            /// </summary>
            /// <param name="caller_id"></param>
            /// <param name="topic"></param>
            /// <param name="topic_type"></param>
            /// <param name="caller_api"></param>
            /// <returns></returns>
            public ReturnStruct registerPublisher(String caller_id, String topic, String topic_type, String caller_api)
            {
                reg_manager.register_publisher(topic, caller_id, caller_api);
                if (!topic_types.ContainsValue(topic_type))
                {
                    topic_types.Add(topic, topic_type);
                }
                List <String> puburis  = publishers.get_apis(topic);
                List <String> sub_uris = subscribers.get_apis(topic);

                _notify_topic_subscribers(topic, puburis, sub_uris);

                ReturnStruct rtn = new ReturnStruct();

                rtn.statusMessage = String.Format("Registered [{0}] as publisher of [{1}]", caller_id, topic);
                rtn.statusCode    = 1;
                rtn.value         = new XmlRpcValue();
                rtn.value.Set(0, new XmlRpcValue());
                for (int i = 0; i < sub_uris.Count(); i++)
                {
                    XmlRpcValue tmp = new XmlRpcValue(sub_uris[0]);
                    rtn.value.Set(i, tmp);
                }
                return(rtn);
            }
コード例 #2
0
ファイル: Master.cs プロジェクト: wiwing/ROS.NET
        /// <summary>
        /// Register a new subscriber
        /// </summary>
        /// <param name="parms"></param>
        /// <param name="result"></param>
        public XmlRpcValue registerSubscriber(String caller_id, String topic, String type, String caller_api)
        {
            XmlRpcValue  res = new XmlRpcValue();
            ReturnStruct st  = handler.registerSubscriber(caller_id, topic, type, caller_api);

            res.Set(0, st.statusCode);
            res.Set(1, st.statusMessage);
            res.Set(2, st.value);
            return(res);
        }
コード例 #3
0
ファイル: Master.cs プロジェクト: wiwing/ROS.NET
        public XmlRpcValue unregisterService(String caller_id, String service, String service_api)
        {
            XmlRpcValue  res = new XmlRpcValue();
            ReturnStruct r   = handler.unregisterService(caller_id, service, service_api);

            res.Set(0, r.statusCode);
            res.Set(1, r.statusMessage);
            res.Set(2, r.value);
            return(res);
        }
コード例 #4
0
ファイル: Master.cs プロジェクト: wiwing/ROS.NET
        /// <summary>
        /// Register a new publisher to a topic
        /// </summary>
        /// <param name="parms"></param>
        /// <param name="result"></param>
        public XmlRpcValue registerPublisher(String caller_id, String topic, String type, String caller_api)
        {
            XmlRpcValue res = new XmlRpcValue();

            Console.WriteLine("PUBLISHING: " + caller_id + " : " + caller_api + " : " + topic);

            ReturnStruct st = handler.registerPublisher(caller_id, topic, type, caller_api);

            res.Set(0, st.statusCode);
            res.Set(1, st.statusMessage);
            res.Set(2, st.value);
            return(res);
        }
コード例 #5
0
ファイル: Master.cs プロジェクト: wiwing/ROS.NET
        public XmlRpcValue lookupService(String caller_id, String service)
        {
            XmlRpcValue  res = new XmlRpcValue();
            ReturnStruct r   = handler.lookupService(caller_id, service);

            res.Set(0, r.statusCode);
            res.Set(1, r.statusMessage);
            if (r.value != null)
            {
                res.Set(2, r.value);
            }
            return(res);
        }
コード例 #6
0
        public ReturnStruct _unregister(Registrations r, String key, String caller_id, String caller_api, String service_api = null)
        {
            ReturnStruct ret;

            if (nodes.ContainsKey(caller_id))
            {
                NodeRef node_ref = nodes[caller_id];
                ret = r.unregister(key, caller_id, caller_api, service_api);
                if (ret.statusCode == 1)
                {
                    node_ref.remove(r.type, key);
                }
                if (node_ref.is_empty())
                {
                    nodes.Remove(caller_id);
                }
            }
            else
            {
                ret = new ReturnStruct(0, String.Format("[{0}] is not a registered node", caller_id), new XmlRpc_Wrapper.XmlRpcValue(1));
            }
            return(ret); // new ReturnStruct(code, msg, new XmlRpc_Wrapper.XmlRpcValue(ret));
        }
コード例 #7
0
            public ReturnStruct registerSubscriber(String caller_id, String topic, String topic_type, String caller_api)
            {
                reg_manager.register_subscriber(topic, caller_id, caller_api);

                if (!topic_types.ContainsValue(topic_type))
                {
                    topic_types.Add(topic, topic_type);
                }
                List <String> puburis = publishers.get_apis(topic);

                ReturnStruct rtn = new ReturnStruct();

                rtn.statusMessage = String.Format("Subscribed to [{0}] ", topic);
                rtn.statusCode    = 1;
                rtn.value         = new XmlRpcValue();
                rtn.value.Set(0, new XmlRpcValue());
                for (int i = 0; i < puburis.Count(); i++)
                {
                    XmlRpcValue tmp = new XmlRpcValue(puburis[i]);
                    rtn.value.Set(i, tmp);
                }
                return(rtn);
            }
コード例 #8
0
ファイル: Master_API.cs プロジェクト: uml-robotics/ROS.NET
            /// <summary>
            /// Register a publisher
            /// </summary>
            /// <param name="caller_id"></param>
            /// <param name="topic"></param>
            /// <param name="topic_type"></param>
            /// <param name="caller_api"></param>
            /// <returns></returns>
            public ReturnStruct registerPublisher(String caller_id, String topic, String topic_type, String caller_api) 
            {
                reg_manager.register_publisher(topic, caller_id, caller_api);
                if (!topic_types.ContainsValue(topic_type))
                    topic_types.Add(topic, topic_type);
                List<String> puburis = publishers.get_apis(topic);
                List<String> sub_uris = subscribers.get_apis(topic);
                _notify_topic_subscribers(topic, puburis, sub_uris);

                ReturnStruct rtn = new ReturnStruct();
                rtn.statusMessage = String.Format("Registered [{0}] as publisher of [{1}]", caller_id, topic);
                rtn.statusCode = 1;
                rtn.value = new XmlRpcValue();
                rtn.value.Set(0, new XmlRpcValue());
                for (int i = 0; i < sub_uris.Count(); i++)
                {
                    XmlRpcValue tmp = new XmlRpcValue(sub_uris[0]);
                    rtn.value.Set(i, tmp);
                }
                return rtn;
            }
コード例 #9
0
ファイル: Master_API.cs プロジェクト: uml-robotics/ROS.NET
            public ReturnStruct registerSubscriber(String caller_id, String topic, String topic_type, String caller_api) 
            {
                reg_manager.register_subscriber(topic, caller_id, caller_api);

                if (!topic_types.ContainsValue(topic_type))
                    topic_types.Add(topic, topic_type);
                List<String> puburis = publishers.get_apis(topic);

                ReturnStruct rtn = new ReturnStruct();
                rtn.statusMessage = String.Format("Subscribed to [{0}] ", topic);
                rtn.statusCode = 1;
                rtn.value = new XmlRpcValue();
                rtn.value.Set(0, new XmlRpcValue());
                for (int i = 0; i < puburis.Count(); i++)
                {
                    XmlRpcValue tmp = new XmlRpcValue(puburis[i]);
                    rtn.value.Set(i, tmp);
                }
                return rtn;
            }
コード例 #10
0
ファイル: Registrations.cs プロジェクト: rvlietstra/ROS.NET
 public ReturnStruct _unregister(Registrations r, String key, String caller_id, String caller_api, String service_api = null)
 {
     ReturnStruct ret;
     if (nodes.ContainsKey(caller_id))
     {
         NodeRef node_ref = nodes[caller_id];
         ret = r.unregister(key, caller_id, caller_api, service_api);
         if (ret.statusCode == 1)
         {
             node_ref.remove(r.type, key);
         }
         if (node_ref.is_empty())
         {
             nodes.Remove(caller_id);
         }
     }
     else
     {
         ret = new ReturnStruct(0, String.Format("[{0}] is not a registered node",caller_id), new XmlRpc_Wrapper.XmlRpcValue(1));
     }
     return ret; // new ReturnStruct(code, msg, new XmlRpc_Wrapper.XmlRpcValue(ret));
 }