registerSubscriber() public method

public registerSubscriber ( String caller_id, String topic, String topic_type, String caller_api ) : rosmaster.ReturnStruct
caller_id String
topic String
topic_type String
caller_api String
return rosmaster.ReturnStruct
示例#1
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);
        }
示例#2
0
        /// <summary>
        /// Register a new subscriber
        /// </summary>
        /// <param name="parms"></param>
        /// <param name="result"></param>
        public void registerSubscriber([In][Out] IntPtr parms, [In][Out] IntPtr result)
        {
            XmlRpcValue res = XmlRpcValue.Create(ref result), parm = XmlRpcValue.Create(ref parms);

            String caller_id  = parm[0].GetString();
            String topic      = parm[1].GetString();
            String type       = parm[2].GetString();
            String caller_api = parm[3].GetString(); //hostname

            handler.registerSubscriber(caller_id, topic, type, caller_api);
            res.Set(0, 1);
            res.Set(1, "GOOD JOB!");
            res.Set(2, new XmlRpcValue(""));

            //string uri = XmlRpcManager.Instance.uri;

            //XmlRpcValue args = new XmlRpcValue(this_node.Name, s.name, datatype, uri);
            //XmlRpcValue result = new XmlRpcValue();
            //XmlRpcValue payload = new XmlRpcValue();
            //if (!master.execute("registerSubscriber", args, ref result, ref payload, true))
            //    return false;
            //List<string> pub_uris = new List<string>();
            //for (int i = 0; i < payload.Size; i++)
            //{
            //    XmlRpcValue asshole = payload[i];
            //    string pubed = asshole.Get<string>();
            //    if (pubed != uri && !pub_uris.Contains(pubed))
            //    {
            //        pub_uris.Add(pubed);
            //    }
            //}
            //bool self_subscribed = false;
            //Publication pub = null;
            //string sub_md5sum = s.md5sum;
            //lock (advertised_topics_mutex)
            //{
            //    foreach (Publication p in advertised_topics)
            //    {
            //        pub = p;
            //        string pub_md5sum = pub.Md5sum;
            //        if (pub.Name == s.name && md5sumsMatch(pub_md5sum, sub_md5sum) && !pub.Dropped)
            //        {
            //            self_subscribed = true;
            //            break;
            //        }
            //    }
            //}

            //s.pubUpdate(pub_uris);
            //if (self_subscribed)
            //    s.addLocalConnection(pub);
            //return true;
        }