Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new data reader.
        /// </summary>
        /// <returns>The newly created DataReader</returns>
        /// <param name="topic">The topic that will be read by the DataReader</param>
        /// <param name="qos">Possibly empty list of QoS policies for the DataReader.</param>
        public async Task <DataReader <T> > CreateDataReader <T>(Topic topic, List <QosPolicy> qos)
        {
            if (IsConnected)
            {
                var qosJson = (qos != null) ? JsonConvert.SerializeObject(qos) : "";
                var ws      = await _ctrl.CreateReaderAsync(Domain, topic.Name, qosJson);

                var dr = new DataReaderImpl <T> (ws);
                OnNewDataReader(new OnNewDataReaderEventArgs(dr));
                return(dr);
            }
            else
            {
                throw new VortexAPIException("Can not create a data reader when not connected to Vortex.");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new data reader.
        /// </summary>
        /// <returns>The newly created DataReader</returns>
        /// <param name="topic">The topic that will be read by the DataReader</param>
        /// <param name="qos">A non-empty list of QoS policies for the DataReader.</param>
        public async Task <DataReader <T> > CreateDataReader <T>(Topic topic, List <QosPolicy> qos)
        {
            if (IsConnected)
            {
                var vqos = (qos == null) || (qos.Count == 0) ? DefaultReaderQos : qos;
                var ws   = await _ctrl.CreateReaderAsync(Domain, topic.Name, vqos);

                var dr = new DataReaderImpl <T> (ws);
                OnNewDataReader(new OnNewDataReaderEventArgs(dr));
                return(dr);
            }
            else
            {
                throw new VortexAPIException("Can not create a data reader when not connected to Vortex.");
            }
        }
Ejemplo n.º 3
0
 public Task <WebSocket> CreateReaderAsync(int did, string tname, string qos)
 {
     return(ctrlLink.CreateReaderAsync(did, tname, qos));
 }