示例#1
0
        /// <summary>
        /// Create a new Topic
        /// </summary>
        /// <returns>The newly created Topic.</returns>
        /// <param name="name">The name of the new topic.</param>
        /// <param name="type">The type to be used by the server for creating the topic.</param>
        /// <param name="typeRegistrationType">The type to register the topic with Vortex.</param>
        /// <param name="qos">Possibly empty list of Qos policies for the Topic.</param>
        public async Task <Topic> CreateTopic <T>(string name, string type, string typeRegistrationType, List <QosPolicy> qos)
        {
            if (IsConnected)
            {
                var qosJson = (qos != null) ? JsonConvert.SerializeObject(qos) : "";
                await _ctrl.CreateTopicAsync(Domain, name, type, typeRegistrationType, qosJson);

                var topic = new TopicImpl(Domain, name, type, qos.ToArray());
                OnNewTopic(new OnNewTopicEventArgs(topic));
                return(topic);
            }
            else
            {
                throw new VortexAPIException("Can not create a topic when not connected to Vortex.");
            }
        }
示例#2
0
        /// <summary>
        /// Create a new Topic
        /// </summary>
        /// <returns>The newly created Topic.</returns>
        /// <param name="name">The name of the new topic.</param>
        /// <param name="type">The type to be used by the server for creating the topic.</param>
        /// <param name="typeRegistrationType">The type to register the topic with Vortex.</param>
        /// <param name="qos">Possibly empty list of Qos policies for the Topic.</param>
        public async Task <Topic> CreateTopic <T>(string name, string tt, string trt, List <QosPolicy> qos)
        {
            if (IsConnected)
            {
                var rqos = (qos == null) || (qos.Count == 0) ? DefaultTopicQos : qos;
                await _ctrl.CreateTopicAsync(Domain, name, tt, trt, rqos);

                var topic = new TopicImpl(Domain, name, tt, qos);
                OnNewTopic(new OnNewTopicEventArgs(topic));
                return(topic);
            }
            else
            {
                throw new VortexAPIException("Can not create a topic when not connected to Vortex.");
            }
        }
示例#3
0
 public Task  CreateTopicAsync(int did, string tname, string ttype, string tregtype, string qos)
 {
     return(ctrlLink.CreateTopicAsync(did, tname, ttype, tregtype, qos));
 }