Example #1
0
        /// <summary>
        /// Sends the data described by a data set collection to remote destination.
        /// </summary>
        /// <param name="producerBinding">Encapsulates functionality used by the <see cref="IMessageWriter" /> to collect all the data (data set items) required to prepare new message and send it over the network.</param>
        /// <param name="length">Number of items to be send used to calculate the length of the message.</param>
        /// <param name="contentMask">The content mask represented as unsigned number <see cref="UInt64" />. The order of the bits starting from the least significant
        /// bit matches the order of the data items within the data set.</param>
        /// <param name="encoding">The encoding.</param>
        /// <param name="dataSelector">The data selector.</param>
        /// <param name="messageSequenceNumber">The message sequence number. A monotonically increasing sequence number assigned by the publisher to each message sent.</param>
        /// <param name="timeStamp">The time stamp - the time the Data was collected.</param>
        /// <param name="configurationVersion">The configuration version.</param>
        /// <exception cref="System.ArgumentOutOfRangeException">Impossible to convert null value
        /// or</exception>
        void IMessageWriter.Send(Func<int, IProducerBinding> producerBinding, ushort length, ulong contentMask, FieldEncodingEnum encoding, DataSelector dataSelector,
            ushort messageSequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
        {
            lock (this)
              {
            if (State.State != HandlerState.Operational)
              return;
            ContentMask = contentMask;

            CreateMessage(encoding, dataSelector.PublisherId, dataSelector.DataSetWriterId, length, messageSequenceNumber, timeStamp, configurationVersion);
            //UInt64 _mask = 0x1;
            for (int i = 0; i < length; i++)
            {
              //TODO: Implement ContentMask https://github.com/mpostol/OPC-UA-OOI/issues/89
              //if ((ContentMask & _mask) > 0)
              //{
              IProducerBinding _pb = producerBinding(i);
              switch (encoding)
              {
            case FieldEncodingEnum.VariantFieldEncoding:
              WriteValueVariant(_pb);
              break;
            case FieldEncodingEnum.CompressedFieldEncoding:
              WriteValue(_pb);
              break;
            case FieldEncodingEnum.DataValueFieldEncoding:
              WriteDataValue(_pb);
              break;
              }
              //}
              //_mask = _mask << 1;
            }
            SendMessage();
              }
        }
Example #2
0
        protected internal override void AddMessageHandler(IMessageHandler messageHandler, AssociationConfiguration configuration)
        {
            base.AddMessageHandler(messageHandler, configuration);
            ProducerAssociationConfiguration _configuration = (ProducerAssociationConfiguration)configuration;

            m_Encoding = _configuration.FieldEncoding;
            AddMessageWriter(messageHandler as IMessageWriter);
        }
Example #3
0
 public ProducerMessageHeader(IBinaryHeaderEncoder writer, FieldEncodingEnum encoding, MessageLengthFieldTypeEnum lengthFieldType, MessageTypeEnum messageType, ConfigurationVersionDataType configurationVersion)
 {
     m_MessageType         = messageType;
     m_Encoding            = encoding;
     m_lengthFieldType     = lengthFieldType;
     m_HeaderWriter        = new HeaderWriter(writer, PackageHeaderLength());
     MessageSequenceNumber = 0;
     ConfigurationVersion  = configurationVersion;
 }
 /// <summary>
 /// Creates the message.
 /// </summary>
 /// <param name="encoding">The selected encoding for the message.</param>
 /// <param name="prodicerId">The prodicer identifier.</param>
 /// <param name="dataSetWriterId">The data set writer identifier.</param>
 /// <param name="fieldCount">The field count.</param>
 /// <param name="sequenceNumber">The sequence number.</param>
 /// <param name="timeStamp">The time stamp.</param>
 /// <param name="configurationVersion">The configuration version.</param>
 protected internal override void CreateMessage(FieldEncodingEnum encoding, Guid prodicerId, ushort dataSetWriterId, ushort fieldCount, ushort sequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
 {
     OnMessageAdding(prodicerId, dataSetWriterId);
       MessageHeader = MessageHeader.GetProducerMessageHeader(this, encoding, m_lengthFieldType, MessageTypeEnum.DataKeyFrame, configurationVersion);
       //Create message header and placeholder for further header content.
       MessageHeader.FieldCount = fieldCount;
       MessageHeader.MessageSequenceNumber = sequenceNumber;
       MessageHeader.TimeStamp = timeStamp;
 }
Example #5
0
 /// <summary>
 /// Creates the message.
 /// </summary>
 /// <param name="encoding">The selected encoding for the message.</param>
 /// <param name="prodicerId">The producer identifier.</param>
 /// <param name="dataSetWriterId">The data set writer identifier.</param>
 /// <param name="fieldCount">The field count.</param>
 /// <param name="sequenceNumber">The sequence number.</param>
 /// <param name="timeStamp">The time stamp.</param>
 /// <param name="configurationVersion">The configuration version.</param>
 protected internal override void CreateMessage
     (FieldEncodingEnum encoding, Guid prodicerId, ushort dataSetWriterId, ushort fieldCount, ushort sequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
 {
     OnMessageAdding(prodicerId, dataSetWriterId);
     MessageHeader = MessageHeader.GetProducerMessageHeader(this, encoding, m_lengthFieldType, MessageTypeEnum.DataKeyFrame, configurationVersion);
     //Create message header and placeholder for further header content.
     MessageHeader.FieldCount            = fieldCount;
     MessageHeader.MessageSequenceNumber = sequenceNumber;
     MessageHeader.TimeStamp             = timeStamp;
 }
 /// <summary>
 /// Sends the data described by a data set collection to remote destination.
 /// </summary>
 /// <param name="producerBinding">Encapsulates functionality used by the <see cref="T:UAOOI.Networking.SemanticData.MessageHandling.IMessageWriter" /> to collect all the data (data set items) required to prepare new message and send it over the network.</param>
 /// <param name="length">Number of items to be send used to calculate the length of the message.</param>
 /// <param name="contentMask">The content mask represented as unsigned number <see cref="T:System.UInt64" />. The order of the bits starting from the least significant
 /// bit matches the order of the data items within the data set.</param>
 /// <param name="encoding">The encoding.</param>
 /// <param name="dataSelector">The data selector.</param>
 /// <param name="messageSequenceNumber">The message sequence number. A monotonically increasing sequence number assigned by the publisher to each message sent.</param>
 /// <param name="timeStamp">The time stamp - the time the Data was collected.</param>
 /// <param name="configurationVersion">The configuration version.</param>
 /// <exception cref="ArgumentOutOfRangeException">length</exception>
 public void Send(Func<int, IProducerBinding> producerBinding, ushort length, ulong contentMask, FieldEncodingEnum encoding, DataSelector 
     dataSelector, ushort messageSequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
 {
     if (length > 2)
     throw new ArgumentOutOfRangeException("length");
       m_Buffer = new Object[length];
       for (int i = 0; i < 2; i++)
     m_Buffer[i] = producerBinding(i);
       m_HaveSendData = true;
 }
 /// <summary>
 /// Sends the data described by a data set collection to remote destination.
 /// </summary>
 /// <param name="producerBinding">Encapsulates functionality used by the <see cref="T:UAOOI.Networking.SemanticData.MessageHandling.IMessageWriter" /> to collect all the data (data set items) required to prepare new message and send it over the network.</param>
 /// <param name="length">Number of items to be send used to calculate the length of the message.</param>
 /// <param name="contentMask">The content mask represented as unsigned number <see cref="T:System.UInt64" />. The order of the bits starting from the least significant
 /// bit matches the order of the data items within the data set.</param>
 /// <param name="encoding">The encoding.</param>
 /// <param name="dataSelector">The data selector.</param>
 /// <param name="messageSequenceNumber">The message sequence number. A monotonically increasing sequence number assigned by the publisher to each message sent.</param>
 /// <param name="timeStamp">The time stamp - the time the Data was collected.</param>
 /// <param name="configurationVersion">The configuration version.</param>
 /// <exception cref="ArgumentOutOfRangeException">length</exception>
 public void Send
     (Func <int, IProducerBinding> producerBinding, ushort length, ulong contentMask, FieldEncodingEnum encoding, DataSelector
     dataSelector, ushort messageSequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
 {
     if (length > 2)
     {
         throw new ArgumentOutOfRangeException("length");
     }
     m_Buffer = new Object[length];
     for (int i = 0; i < 2; i++)
     {
         m_Buffer[i] = producerBinding(i);
     }
     m_HaveSendData = true;
 }
Example #8
0
 /// <summary>
 /// Gets the producer message header.
 /// </summary>
 /// <param name="writer">The writer <see cref="IBinaryHeaderEncoder" /> to populate the payload with the header information.</param>
 /// <param name="encoding">The encoding.</param>
 /// <param name="lengthFieldType">Type of the length field in the the message header.</param>
 /// <param name="messageType">Type of the message.</param>
 /// <param name="configurationVersion">The configuration version.</param>
 /// <returns>MessageHeader.</returns>
 internal static MessageHeader GetProducerMessageHeader(IBinaryHeaderEncoder writer, FieldEncodingEnum encoding, MessageLengthFieldTypeEnum lengthFieldType, MessageTypeEnum messageType, ConfigurationVersionDataType configurationVersion)
 {
     return(new ProducerMessageHeader(writer, encoding, lengthFieldType, messageType, configurationVersion));
 }
Example #9
0
 public ProducerMessageHeader(IBinaryHeaderEncoder writer, FieldEncodingEnum encoding, MessageLengthFieldTypeEnum lengthFieldType, MessageTypeEnum messageType, ConfigurationVersionDataType configurationVersion)
 {
     m_MessageType = messageType;
     m_Encoding = encoding;
     m_lengthFieldType = lengthFieldType;
     m_HeaderWriter = new HeaderWriter(writer, PackageHeaderLength());
     MessageSequenceNumber = 0;
     ConfigurationVersion = configurationVersion;
 }
Example #10
0
 /// <summary>
 /// Gets the producer message header.
 /// </summary>
 /// <param name="writer">The writer <see cref="IBinaryHeaderEncoder" /> to populate the payload with the header information.</param>
 /// <param name="encoding">The encoding.</param>
 /// <param name="lengthFieldType">Type of the length field in the the message header.</param>
 /// <param name="messageType">Type of the message.</param>
 /// <param name="configurationVersion">The configuration version.</param>
 /// <returns>MessageHeader.</returns>
 internal static MessageHeader GetProducerMessageHeader(IBinaryHeaderEncoder writer, FieldEncodingEnum encoding, MessageLengthFieldTypeEnum lengthFieldType, MessageTypeEnum messageType, ConfigurationVersionDataType configurationVersion)
 {
     return new ProducerMessageHeader(writer, encoding, lengthFieldType, messageType, configurationVersion);
 }
 protected internal override void AddMessageHandler(IMessageHandler messageHandler, AssociationConfiguration configuration)
 {
     base.AddMessageHandler(messageHandler, configuration);
       ProducerAssociationConfiguration _configuration = (ProducerAssociationConfiguration)configuration;
       m_Encoding = _configuration.FieldEncoding;
       AddMessageWriter(messageHandler as IMessageWriter);
 }
Example #12
0
 public void Send
     (Func <int, IProducerBinding> producerBinding, ushort length, ulong contentMask, FieldEncodingEnum encoding, DataSelector dataSelector,
     ushort messageSequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
 {
     IsOk++;
     Assert.AreEqual <int>(3, length);
 }
Example #13
0
 //methods
 /// <summary>
 /// Creates the message.
 /// </summary>
 /// <param name="encoding">The selected encoding for the message.</param>
 /// <param name="prodicerId">The prodicer identifier.</param>
 /// <param name="dataSetWriterId">The data set writer identifier.</param>
 /// <param name="fieldCount">The field count.</param>
 /// <param name="sequenceNumber">The sequence number.</param>
 /// <param name="timeStamp">The time stamp.</param>
 /// <param name="configurationVersion">The configuration version.</param>
 protected internal abstract void CreateMessage(FieldEncodingEnum encoding, Guid prodicerId, UInt16 dataSetWriterId, ushort fieldCount, ushort sequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion);
Example #14
0
 protected internal override void CreateMessage
     (FieldEncodingEnum encoding, Guid prodicerId, ushort dataSetWriterId, ushort fieldCount, ushort sequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
 {
     MassageCreated = true;
 }
 public void Send(Func<int, IProducerBinding> producerBinding, ushort length, ulong contentMask, FieldEncodingEnum encoding, DataSelector dataSelector, 
     ushort messageSequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
 {
     IsOk++;
     Assert.AreEqual<int>(3, length);
 }
Example #16
0
 //methods
 /// <summary>
 /// Creates the message.
 /// </summary>
 /// <param name="encoding">The selected encoding for the message.</param>
 /// <param name="producerId">The producer identifier.</param>
 /// <param name="dataSetWriterId">The data set writer identifier.</param>
 /// <param name="fieldCount">The field count.</param>
 /// <param name="sequenceNumber">The sequence number.</param>
 /// <param name="timeStamp">The time stamp.</param>
 /// <param name="configurationVersion">The configuration version.</param>
 protected internal abstract void CreateMessage
     (FieldEncodingEnum encoding, Guid producerId, ushort dataSetWriterId, ushort fieldCount, ushort sequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion);
Example #17
0
        /// <summary>
        /// Sends the data described by a data set collection to remote destination.
        /// </summary>
        /// <param name="producerBinding">Encapsulates functionality used by the <see cref="IMessageWriter" /> to collect all the data (data set items) required to prepare new message and send it over the network.</param>
        /// <param name="length">Number of items to be send used to calculate the length of the message.</param>
        /// <param name="contentMask">The content mask represented as unsigned number <see cref="ulong" />. The order of the bits starting from the least significant
        /// bit matches the order of the data items within the data set.</param>
        /// <param name="encoding">The encoding.</param>
        /// <param name="dataSelector">The data selector.</param>
        /// <param name="messageSequenceNumber">The message sequence number. A monotonically increasing sequence number assigned by the publisher to each message sent.</param>
        /// <param name="timeStamp">The time stamp - the time the Data was collected.</param>
        /// <param name="configurationVersion">The configuration version.</param>
        /// <exception cref="System.ArgumentOutOfRangeException">Impossible to convert null value
        /// or</exception>
        void IMessageWriter.Send
            (Func <int, IProducerBinding> producerBinding, ushort length, ulong contentMask, FieldEncodingEnum encoding, DataSelector dataSelector,
            ushort messageSequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
        {
            lock (this)
            {
                if (State.State != HandlerState.Operational)
                {
                    return;
                }
                ContentMask = contentMask;
                CreateMessage(encoding, dataSelector.PublisherId, dataSelector.DataSetWriterId, length, messageSequenceNumber, timeStamp, configurationVersion);
                //UInt64 _mask = 0x1;
                for (int i = 0; i < length; i++)
                {
                    //TODO: Implement ContentMask https://github.com/mpostol/OPC-UA-OOI/issues/89
                    //if ((ContentMask & _mask) > 0)
                    //{
                    IProducerBinding _pb = producerBinding(i);
                    switch (encoding)
                    {
                    case FieldEncodingEnum.VariantFieldEncoding:
                        WriteValueVariant(_pb);
                        break;

                    case FieldEncodingEnum.CompressedFieldEncoding:
                        WriteValue(_pb);
                        break;

                    case FieldEncodingEnum.DataValueFieldEncoding:
                        WriteDataValue(_pb);
                        break;
                    }
                    //}
                    //_mask = _mask << 1;
                }
                SendMessage();
            }
        }
 protected internal override void CreateMessage(FieldEncodingEnum encoding, Guid prodicerId, ushort dataSetWriterId, ushort fieldCount, ushort sequenceNumber, DateTime timeStamp, ConfigurationVersionDataType configurationVersion)
 {
     MassageCreated = true;
 }