Example #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);
            }
Example #2
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);
            }