Exemple #1
0
 /// <summary>
 /// Handle <see cref="UaPubSubApplication.MetaDataReceived"/> event.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Application_MetaDataReceived(object sender, SubscribedDataEventArgs e)
 {
     if (m_udpDiscoverySubscriber != null && e.NetworkMessage.DataSetWriterId != null)
     {
         m_udpDiscoverySubscriber.RemoveWriterIdForDataSetMetadata(e.NetworkMessage.DataSetWriterId.Value);
     }
 }
Exemple #2
0
        /// <summary>
        /// Handler for <see cref="UaPubSubApplication.MetaDataDataReceived" /> event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void UaPubSubApplication_MetaDataDataReceived(object sender, SubscribedDataEventArgs e)
        {
            lock (m_lock)
            {
                Console.WriteLine("MetaDataDataReceived event:");
                if (e.NetworkMessage is JsonNetworkMessage)
                {
                    Console.WriteLine("JSON Network MetaData Message: Source={0}, PublisherId={1}, DataSetWriterId={2} Fields count={3}\n",
                                      e.Source,
                                      ((JsonNetworkMessage)e.NetworkMessage).PublisherId,
                                      ((JsonNetworkMessage)e.NetworkMessage).DataSetWriterId,
                                      e.NetworkMessage.DataSetMetaData.Fields.Count);
                }
                if (e.NetworkMessage is UadpNetworkMessage)
                {
                    Console.WriteLine("UADP Network MetaData Message: Source={0}, PublisherId={1}, DataSetWriterId={2} Fields count={3}\n",
                                      e.Source,
                                      ((UadpNetworkMessage)e.NetworkMessage).PublisherId,
                                      ((UadpNetworkMessage)e.NetworkMessage).DataSetWriterId,
                                      e.NetworkMessage.DataSetMetaData.Fields.Count);
                }

                Console.WriteLine("\tMetaData.Name={0}, MajorVersion={1} MinorVersion={2}",
                                  e.NetworkMessage.DataSetMetaData.Name,
                                  e.NetworkMessage.DataSetMetaData.ConfigurationVersion.MajorVersion,
                                  e.NetworkMessage.DataSetMetaData.ConfigurationVersion.MinorVersion);

                foreach (FieldMetaData metaDataField in e.NetworkMessage.DataSetMetaData.Fields)
                {
                    Console.WriteLine("\t\t{0, -20} DataType:{1, 10}, ValueRank:{2, 5}", metaDataField.Name, metaDataField.DataType, metaDataField.ValueRank);
                }
                Console.WriteLine(kDisplaySeparator);
            }
        }
Exemple #3
0
        /// <summary>
        /// Handler for <see cref="UaPubSubApplication.DataReceived" /> event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void UaPubSubApplication_DataReceived(object sender, SubscribedDataEventArgs e)
        {
            lock (m_lock)
            {
                Console.WriteLine("DataReceived event:");

                if (e.NetworkMessage is UadpNetworkMessage)
                {
                    Console.WriteLine("UADP Network DataSetMessage ({0} DataSets): Source={1}, SequenceNumber={2}",
                                      e.NetworkMessage.DataSetMessages.Count, e.Source, ((UadpNetworkMessage)e.NetworkMessage).SequenceNumber);
                }
                else if (e.NetworkMessage is JsonNetworkMessage)
                {
                    Console.WriteLine("JSON Network DataSetMessage ({0} DataSets): Source={1}, MessageId={2}",
                                      e.NetworkMessage.DataSetMessages.Count, e.Source, ((JsonNetworkMessage)e.NetworkMessage).MessageId);
                }

                foreach (UaDataSetMessage dataSetMessage in e.NetworkMessage.DataSetMessages)
                {
                    DataSet dataSet = dataSetMessage.DataSet;
                    Console.WriteLine("\tDataSet.Name={0}, DataSetWriterId={1}, SequenceNumber={2}", dataSet.Name, dataSet.DataSetWriterId, dataSetMessage.SequenceNumber);

                    for (int i = 0; i < dataSet.Fields.Length; i++)
                    {
                        Console.WriteLine("\t\tTargetNodeId:{0}, Attribute:{1}, Value:{2}",
                                          dataSet.Fields[i].TargetNodeId, dataSet.Fields[i].TargetAttribute, dataSetMessage.DataSet.Fields[i].Value);
                    }
                }
                Console.WriteLine(kDisplaySeparator);
            }
        }
        /// <summary>
        /// Handler for <see cref="UaPubSubApplication.MetaDataDataReceived" /> event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void UaPubSubApplication_MetaDataDataReceived(object sender, SubscribedDataEventArgs e)
        {
            lock (m_lock)
            {
                if (e.NetworkMessage is JsonNetworkMessage)
                {
                    Console.WriteLine("JSON Network metadata message was received from Source={0}, PublisherId={1}, DataSetWriterId={2} Fields count={3}",
                                      e.Source,
                                      ((JsonNetworkMessage)e.NetworkMessage).PublisherId,
                                      ((JsonNetworkMessage)e.NetworkMessage).DataSetWriterId,
                                      e.NetworkMessage.DataSetMetaData.Fields.Count);
                }

                Console.WriteLine("\tMetaData.Name={0}, MajorVersion={1} MinorVersion={2}",
                                  e.NetworkMessage.DataSetMetaData.Name,
                                  e.NetworkMessage.DataSetMetaData.ConfigurationVersion.MajorVersion,
                                  e.NetworkMessage.DataSetMetaData.ConfigurationVersion.MinorVersion);

                foreach (FieldMetaData metaDataField in e.NetworkMessage.DataSetMetaData.Fields)
                {
                    Console.WriteLine("\t\tName:{0}", metaDataField.Name);
                }
                Console.WriteLine("------------------------------------------------");
            }
        }
Exemple #5
0
        private static void UaPubSubApplication_DataReceived(object sender, SubscribedDataEventArgs e)
        {
            lock (m_lock)
            {
                Console.WriteLine("Data Received from Source={0}, SequenceNumber={1}, DataSet count={2}",
                                  e.SourceEndPoint, e.NetworkMessageSequenceNumber, e.DataSets.Count);

                foreach (DataSet dataSet in e.DataSets)
                {
                    Console.WriteLine("\tDataSet.Name={0}, DataSetWriterId={1}", dataSet.Name, dataSet.DataSetWriterId);

                    for (int i = 0; i < dataSet.Fields.Length; i++)
                    {
                        Console.WriteLine("\t\tTargetNodeId:{0}, Attribute:{1}, Value:{2}",
                                          dataSet.Fields[i].TargetNodeId, dataSet.Fields[i].TargetAttribute, dataSet.Fields[i].Value);
                    }
                }
                Console.WriteLine("------------------------------------------------");
            }
        }
 /// <summary>
 /// MetaData received handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UaPubSubApplication_MetaDataReceived(object sender, SubscribedDataEventArgs e)
 {
     m_uaMetaDataShutdownEvent.Set();
 }