예제 #1
0
        /// <summary>
        /// Creates a new data writer.
        /// </summary>
        /// <returns>The newly created DataWriter</returns>
        /// <param name="topic">The topic that will be written by the DataWriter</param>
        /// <param name="qos">Possibly empty list of QoS policies for the DataWriter</param>
        public async Task <DataWriter <T> > CreateDataWriter <T>(Topic topic, List <QosPolicy> qos)
        {
            if (IsConnected)
            {
                var qosJson = (qos != null) ? JsonConvert.SerializeObject(qos) : "";
                var ws      = await _ctrl.CreateWriterAsync(Domain, topic.Name, qosJson);

                var dw = new DataWriterImpl <T> (ws);
                OnNewDataWriter(new OnNewDataWriterEventArgs(dw));
                return(dw);
            }
            else
            {
                throw new VortexAPIException("Can not create a data writer when not connected to Vortex.");
            }
        }
예제 #2
0
        /// <summary>
        /// Creates a new data writer.
        /// </summary>
        /// <returns>The newly created DataWriter</returns>
        /// <param name="topic">The topic that will be written by the DataWriter</param>
        /// <param name="qos">A non empty list of QoS policies for the DataWriter</param>
        public async Task <DataWriter <T> > CreateDataWriter <T>(Topic topic, List <QosPolicy> qos)
        {
            if (IsConnected)
            {
                List <QosPolicy> vqos = (qos == null) || (qos.Count == 0) ? DefaultWriterQos : qos;
                var ws = await _ctrl.CreateWriterAsync(Domain, topic.Name, vqos);

                var dw = new DataWriterImpl <T> (ws);
                OnNewDataWriter(new OnNewDataWriterEventArgs(dw));
                return(dw);
            }
            else
            {
                throw new VortexAPIException("Can not create a data writer when not connected to Vortex.");
            }
        }
예제 #3
0
 public Task <WebSocket> CreateWriterAsync(int did, string tname, string qos)
 {
     return(ctrlLink.CreateWriterAsync(did, tname, qos));
 }