2
2
* Copyright (c) 2005-2021 The OPC Foundation, Inc. All rights reserved.
3
3
*
4
4
* OPC Foundation MIT License 1.00
5
- *
5
+ *
6
6
* Permission is hereby granted, free of charge, to any person
7
7
* obtaining a copy of this software and associated documentation
8
8
* files (the "Software"), to deal in the Software without
11
11
* copies of the Software, and to permit persons to whom the
12
12
* Software is furnished to do so, subject to the following
13
13
* conditions:
14
- *
14
+ *
15
15
* The above copyright notice and this permission notice shall be
16
16
* included in all copies or substantial portions of the Software.
17
17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
@@ -65,7 +65,7 @@ public class UadpNetworkMessage : UaNetworkMessage
65
65
/// <summary>
66
66
/// Create new instance of UadpNetworkMessage
67
67
/// </summary>
68
- /// <param name="writerGroupConfiguration">The <see cref="WriterGroupDataType"/> conflagration object that produced this message.</param>
68
+ /// <param name="writerGroupConfiguration">The <see cref="WriterGroupDataType"/> conflagration object that produced this message.</param>
69
69
/// <param name="uadpDataSetMessages"><see cref="UadpDataSetMessage"/> list as input</param>
70
70
public UadpNetworkMessage ( WriterGroupDataType writerGroupConfiguration , List < UadpDataSetMessage > uadpDataSetMessages )
71
71
: base ( writerGroupConfiguration , uadpDataSetMessages ? . ConvertAll < UaDataSetMessage > ( x => ( UaDataSetMessage ) x ) ?? new List < UaDataSetMessage > ( ) )
@@ -114,7 +114,7 @@ public UadpNetworkMessage(UADPNetworkMessageDiscoveryType discoveryType)
114
114
#region Properties
115
115
116
116
/// <summary>
117
- /// NetworkMessageContentMask contains the mask that will be used to check NetworkMessage options selected for usage
117
+ /// NetworkMessageContentMask contains the mask that will be used to check NetworkMessage options selected for usage
118
118
/// </summary>
119
119
public UadpNetworkMessageContentMask NetworkMessageContentMask { get ; private set ; }
120
120
@@ -130,7 +130,7 @@ public UADPNetworkMessageType UADPNetworkMessageType
130
130
}
131
131
132
132
/// <summary>
133
- /// Get the UADP network message discovery type
133
+ /// Get the UADP network message discovery type
134
134
/// </summary>
135
135
public UADPNetworkMessageDiscoveryType UADPDiscoveryType
136
136
{
@@ -186,7 +186,7 @@ public object PublisherId
186
186
get { return m_publisherId ; }
187
187
set
188
188
{
189
- // Just in case value is a positive signed Integer
189
+ // Just in case value is a positive signed Integer
190
190
// Try to bring it to an accepted type (will overflow if value doesn't fit)
191
191
192
192
object adjustedValue = value ;
@@ -371,7 +371,7 @@ public override byte[] Encode(IServiceMessageContext messageContext)
371
371
/// <param name="stream">The stream to use.</param>
372
372
public override void Encode ( IServiceMessageContext messageContext , Stream stream )
373
373
{
374
- using ( BinaryEncoder encoder = new BinaryEncoder ( stream , messageContext ) )
374
+ using ( BinaryEncoder encoder = new BinaryEncoder ( stream , messageContext , false ) )
375
375
{
376
376
if ( m_uadpNetworkMessageType == UADPNetworkMessageType . DataSetMessage )
377
377
{
@@ -409,7 +409,7 @@ public override void Encode(IServiceMessageContext messageContext, Stream stream
409
409
}
410
410
411
411
/// <summary>
412
- /// Decodes the message
412
+ /// Decodes the message
413
413
/// </summary>
414
414
/// <param name="context"></param>
415
415
/// <param name="message"></param>
@@ -482,20 +482,20 @@ private void EncodeDataSetNetworkMessageType(BinaryEncoder binaryEncoder)
482
482
}
483
483
484
484
/// <summary>
485
- /// Encodes the NetworkMessage as a DiscoveryResponse of DataSetMetaData Type
485
+ /// Encodes the NetworkMessage as a DiscoveryResponse of DataSetMetaData Type
486
486
/// </summary>
487
487
/// <param name="binaryEncoder"></param>
488
488
private void EncodeDataSetMetaData ( BinaryEncoder binaryEncoder )
489
489
{
490
490
binaryEncoder . WriteUInt16 ( "DataSetWriterId" , DataSetWriterId ) ;
491
-
491
+
492
492
if ( m_metadata == null )
493
493
{
494
494
Utils . Trace ( "The UADP DiscoveryResponse DataSetMetaData message cannot be encoded: The MetaData property is missing. Value null will be used." ) ;
495
495
}
496
496
binaryEncoder . WriteEncodeable ( "MetaData" , m_metadata , typeof ( DataSetMetaDataType ) ) ;
497
497
498
- // temporary write StatusCode.Good
498
+ // temporary write StatusCode.Good
499
499
binaryEncoder . WriteStatusCode ( "StatusCode" , StatusCodes . Good ) ;
500
500
}
501
501
@@ -647,12 +647,12 @@ private void SetFlagsDiscoveryResponseMetaData()
647
647
ExtendedFlags1 = ExtendedFlags1EncodingMask . Security | ExtendedFlags1EncodingMask . ExtendedFlags2 ;
648
648
ExtendedFlags2 = ExtendedFlags2EncodingMask . NetworkMessageWithDiscoveryResponse ;
649
649
650
- // enable encoding of PublisherId in message header
650
+ // enable encoding of PublisherId in message header
651
651
NetworkMessageContentMask = UadpNetworkMessageContentMask . PublisherId ;
652
652
}
653
653
654
654
/// <summary>
655
- /// Set All flags before encode/decode for a NetworkMessage that contains A DiscoveryRequest
655
+ /// Set All flags before encode/decode for a NetworkMessage that contains A DiscoveryRequest
656
656
/// </summary>
657
657
private void SetFlagsDiscoveryRequest ( )
658
658
{
@@ -671,8 +671,8 @@ private void SetFlagsDiscoveryRequest()
671
671
672
672
673
673
/// <summary>
674
- /// Decode the stream from decoder parameter and produce a Dataset
675
- /// </summary>
674
+ /// Decode the stream from decoder parameter and produce a Dataset
675
+ /// </summary>
676
676
/// <param name="binaryDecoder"></param>
677
677
/// <param name="dataSetReaders"></param>
678
678
/// <returns></returns>
@@ -763,7 +763,7 @@ If the value is 0 (null), the parameter shall be ignored and all received DataSe
763
763
uadpDataSetMessages . Add ( new UadpDataSetMessage ( ) ) ;
764
764
}
765
765
766
- // 6.2 Decode payload into DataSets
766
+ // 6.2 Decode payload into DataSets
767
767
// Restore the encoded fields (into dataset for now) for each possible dataset reader
768
768
foreach ( UadpDataSetMessage uadpDataSetMessage in uadpDataSetMessages )
769
769
{
@@ -807,7 +807,7 @@ If the value is 0 (null), the parameter shall be ignored and all received DataSe
807
807
m_uaDataSetMessages . Clear ( ) ;
808
808
m_uaDataSetMessages . AddRange ( dataSetMessages ) ;
809
809
}
810
-
810
+
811
811
}
812
812
catch ( Exception ex )
813
813
{
@@ -825,7 +825,7 @@ private void DecodeMetaDataMessage(BinaryDecoder binaryDecoder)
825
825
DataSetWriterId = binaryDecoder . ReadUInt16 ( "DataSetWriterId" ) ;
826
826
m_metadata = binaryDecoder . ReadEncodeable ( "MetaData" , typeof ( DataSetMetaDataType ) ) as DataSetMetaDataType ;
827
827
828
- // temporary write StatusCode.Good
828
+ // temporary write StatusCode.Good
829
829
StatusCode statusCode = binaryDecoder . ReadStatusCode ( "StatusCode" ) ;
830
830
Utils . Trace ( "DecodeMetaDataMessage returned: " + statusCode . ToString ( ) ) ;
831
831
}
@@ -975,7 +975,7 @@ private void EncodePromotedFields(BinaryEncoder encoder)
975
975
}
976
976
977
977
/// <summary>
978
- /// Encode security header
978
+ /// Encode security header
979
979
/// </summary>
980
980
/// <param name="encoder"></param>
981
981
private void EncodeSecurityHeader ( BinaryEncoder encoder )
@@ -1006,7 +1006,7 @@ private void EncodePayload(BinaryEncoder encoder)
1006
1006
if ( DataSetMessages . Count > 1
1007
1007
&& ( NetworkMessageContentMask & UadpNetworkMessageContentMask . PayloadHeader ) != 0 )
1008
1008
{
1009
- //skip 2 * dataset count for each dataset payload size
1009
+ //skip 2 * dataset count for each dataset payload size
1010
1010
encoder . Position += 2 * DataSetMessages . Count ;
1011
1011
}
1012
1012
//encode dataset message payload
@@ -1050,7 +1050,7 @@ private void EncodeSignature(BinaryEncoder encoder)
1050
1050
1051
1051
#endregion
1052
1052
1053
- #region Private Methods - Decoding
1053
+ #region Private Methods - Decoding
1054
1054
1055
1055
/// <summary>
1056
1056
/// Encode Network Message Header
@@ -1237,7 +1237,7 @@ private void DecodePayloadSize(BinaryDecoder decoder)
1237
1237
if ( binaryDecoder != null )
1238
1238
{
1239
1239
int offset = 0 ;
1240
- // set start position of dataset message in binary stream
1240
+ // set start position of dataset message in binary stream
1241
1241
foreach ( UadpDataSetMessage uadpDataSetMessage in DataSetMessages )
1242
1242
{
1243
1243
uadpDataSetMessage . StartPositionInStream = binaryDecoder . Position + offset ;
@@ -1247,7 +1247,7 @@ private void DecodePayloadSize(BinaryDecoder decoder)
1247
1247
}
1248
1248
1249
1249
/// <summary>
1250
- /// Decode security header
1250
+ /// Decode security header
1251
1251
/// </summary>
1252
1252
/// <param name="decoder"></param>
1253
1253
private void DecodeSecurityHeader ( BinaryDecoder decoder )
0 commit comments