Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.05.04 final release fixes #2893

Open
wants to merge 35 commits into
base: develop/main374
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
abb4170
Add missing constants for JSON encoding.
randy-armstrong Oct 14, 2024
b8b299f
Update generated files to 1.05.04.
randy-armstrong Oct 14, 2024
df035b4
Update NuGets
randy-armstrong Oct 14, 2024
ac1d2bc
Fix compile errors due to abstract types.
randy-armstrong Oct 18, 2024
d374d8e
Update nodesets.
randy-armstrong Oct 26, 2024
b752247
Update JSON Encoder/Decoder.
randy-armstrong Oct 31, 2024
dfb20ca
Update with JSON encoder.
randy-armstrong Nov 2, 2024
4405e37
Change prefix char.
randy-armstrong Nov 2, 2024
73682ed
Change prefix to uppercase.
randy-armstrong Nov 2, 2024
5fc7c00
Fix JsonEncoder
randy-armstrong Nov 3, 2024
f5ef1b4
Fix null pointer.
randy-armstrong Nov 5, 2024
58198ff
Update encoders to suppress artifacts.
randy-armstrong Nov 6, 2024
b5e9f75
JSON encoding fixes.
randy-armstrong Nov 10, 2024
affd2ee
Fix JSON RawEncoding
randy-armstrong Nov 16, 2024
a67f322
Update JSON encoders.
randy-armstrong Nov 17, 2024
9d46580
Revert changes for Matrix in Variant.
randy-armstrong Nov 25, 2024
cfd3b37
Update NodeSet.
randy-armstrong Nov 27, 2024
1c624ae
Resolve name conflict with new Opc.Ua types.
randy-armstrong Nov 27, 2024
673fab0
Fix failing Tests
randy-armstrong Nov 27, 2024
e8cb17f
Fix unit tests after change to Verbose/Compact encoding.
randy-armstrong Nov 28, 2024
2545ebf
Add final 1.05.04 generated classes and unit test fixes.
randy-armstrong Nov 29, 2024
1f90858
Fix more unit tests.
randy-armstrong Dec 1, 2024
a511586
Update NodeSet to released version.
randy-armstrong Dec 2, 2024
fa1b869
Remove unintended changes to UANodeSet.xsd
randy-armstrong Dec 3, 2024
f710e44
Update Schema/UANodeSet.xsd
randy-armstrong Dec 9, 2024
e5a680a
Merge remote-tracking branch 'origin/develop/main374' into 1.05.04-fi…
randy-armstrong Dec 9, 2024
b4c72b6
Merge breaking changes to JsonEncoder.cs from develop/main374
randy-armstrong Dec 9, 2024
220f458
Allow JObject in ExtensionObjects.
randy-armstrong Dec 20, 2024
311f610
fix version json
mregen Jan 5, 2025
58ef0df
Update generated files to UA-1.05.04-2025-01-08
randy-armstrong Jan 8, 2025
d9ea078
Merge remote-tracking branch 'origin/develop/main374' into 1.05.04-fi…
mregen Jan 8, 2025
12c6504
Merge branch 'develop/main374' into 1.05.04-final-release-fixes
mregen Jan 16, 2025
658fa77
Some cleanup of the new APIs and Union implementation. (#2927)
mregen Jan 17, 2025
8dc2b83
update common comments
mregen Jan 20, 2025
cbca77d
merge latest develop branch
mregen Jan 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions Applications/ConsoleReferenceSubscriber/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
using Opc.Ua;
using Opc.Ua.PubSub;
using Opc.Ua.PubSub.Configuration;
using Opc.Ua.PubSub.Encoding;
using Encoding = Opc.Ua.PubSub.Encoding;
using Opc.Ua.PubSub.PublishedData;
using Opc.Ua.PubSub.Transport;

Expand Down Expand Up @@ -212,15 +212,15 @@ private static void UaPubSubApplication_DataReceived(object sender, SubscribedDa
{
Console.WriteLine("DataReceived event:");

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

foreach (UaDataSetMessage dataSetMessage in e.NetworkMessage.DataSetMessages)
Expand Down Expand Up @@ -248,20 +248,20 @@ private static void UaPubSubApplication_MetaDataDataReceived(object sender, Subs
lock (m_lock)
{
Console.WriteLine("MetaDataDataReceived event:");
if (e.NetworkMessage is JsonNetworkMessage)
if (e.NetworkMessage is Encoding.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,
((Encoding.JsonNetworkMessage)e.NetworkMessage).PublisherId,
((Encoding.JsonNetworkMessage)e.NetworkMessage).DataSetWriterId,
e.NetworkMessage.DataSetMetaData.Fields.Count);
}
if (e.NetworkMessage is UadpNetworkMessage)
if (e.NetworkMessage is Encoding.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,
((Encoding.UadpNetworkMessage)e.NetworkMessage).PublisherId,
((Encoding.UadpNetworkMessage)e.NetworkMessage).DataSetWriterId,
e.NetworkMessage.DataSetMetaData.Fields.Count);
}

Expand Down Expand Up @@ -326,8 +326,6 @@ private static PubSubConfigurationDataType CreateSubscriberConfiguration_UdpUadp
readerGroup1.Name = "ReaderGroup 1";
readerGroup1.Enabled = true;
readerGroup1.MaxNetworkMessageSize = 1500;
readerGroup1.MessageSettings = new ExtensionObject(new ReaderGroupMessageDataType());
readerGroup1.TransportSettings = new ExtensionObject(new ReaderGroupTransportDataType());

#region Define DataSetReader 'Simple' for PublisherId = (UInt16)1, DataSetWriterId = 1
DataSetReaderDataType dataSetReaderSimple = new DataSetReaderDataType();
Expand All @@ -338,7 +336,6 @@ private static PubSubConfigurationDataType CreateSubscriberConfiguration_UdpUadp
dataSetReaderSimple.Enabled = true;
dataSetReaderSimple.DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData;
dataSetReaderSimple.KeyFrameCount = 1;
dataSetReaderSimple.TransportSettings = new ExtensionObject(new DataSetReaderTransportDataType());

UadpDataSetReaderMessageDataType uadpDataSetReaderMessage = new UadpDataSetReaderMessageDataType() {
GroupVersion = 0,
Expand Down Expand Up @@ -385,7 +382,6 @@ private static PubSubConfigurationDataType CreateSubscriberConfiguration_UdpUadp
dataSetReaderAllTypes.Enabled = true;
dataSetReaderAllTypes.DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData;
dataSetReaderAllTypes.KeyFrameCount = 1;
dataSetReaderAllTypes.TransportSettings = new ExtensionObject(new DataSetReaderTransportDataType());

uadpDataSetReaderMessage = new UadpDataSetReaderMessageDataType() {
GroupVersion = 0,
Expand Down Expand Up @@ -468,8 +464,6 @@ private static PubSubConfigurationDataType CreateSubscriberConfiguration_MqttJso
readerGroup1.Name = "ReaderGroup 1";
readerGroup1.Enabled = true;
readerGroup1.MaxNetworkMessageSize = 1500;
readerGroup1.MessageSettings = new ExtensionObject(new ReaderGroupMessageDataType());
readerGroup1.TransportSettings = new ExtensionObject(new ReaderGroupTransportDataType());

#region Define DataSetReader1 'Simple' for PublisherId = (UInt16)2, DataSetWriterId = 1

Expand Down Expand Up @@ -625,8 +619,6 @@ private static PubSubConfigurationDataType CreateSubscriberConfiguration_MqttUad
readerGroup1.Name = "ReaderGroup 1";
readerGroup1.Enabled = true;
readerGroup1.MaxNetworkMessageSize = 1500;
readerGroup1.MessageSettings = new ExtensionObject(new ReaderGroupMessageDataType());
readerGroup1.TransportSettings = new ExtensionObject(new ReaderGroupTransportDataType());

#region Define DataSetReader 'Simple' for PublisherId = (UInt16)1, DataSetWriterId = 1
DataSetReaderDataType dataSetReaderSimple = new DataSetReaderDataType();
Expand Down
3 changes: 2 additions & 1 deletion Applications/Quickstarts.Servers/Alarms/AlarmNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using Opc.Ua;
using Opc.Ua.Server;
Expand Down Expand Up @@ -143,7 +144,7 @@ public override void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> e

Type alarmControllerType = Type.GetType("Alarms.AlarmController");
int interval = 1000;
string intervalString = interval.ToString();
string intervalString = interval.ToString(CultureInfo.InvariantCulture);

int conditionTypeIndex = 0;
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ public override void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> e
string referenceString = "Has3ForwardReferences";
if (i > 1)
{
referenceString += i.ToString();
referenceString += i.ToString(CultureInfo.InvariantCulture);
}
BaseDataVariableState has3ForwardReferences = CreateMeshVariable(referencesFolder, referencesPrefix + referenceString, referenceString);
has3ForwardReferences.AddReference(ReferenceTypes.HasCause, false, variables[0].NodeId);
Expand Down
2 changes: 1 addition & 1 deletion Fuzzing/Encoders/Fuzz.Tools/Encoders.Fuzz.Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SharpFuzz" Version="2.1.1" />
<PackageReference Include="SharpFuzz" Version="2.2.0" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Serilog" Version="4.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion Fuzzing/Encoders/Fuzz/Encoders.Fuzz.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SharpFuzz" Version="2.1.1" />
<PackageReference Include="SharpFuzz" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Opc.Ua.Client.ComplexTypes/ComplexTypeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ private async Task<NodeId> GetBuiltInSuperTypeAsync(NodeId dataType, bool allowS
{
// enumerations of namespace 0 in a structure
// which are not in the type system are encoded as UInt32
return new NodeId((uint)BuiltInType.UInt32);
return DataTypeIds.UInt32;
}
if (superType == DataTypeIds.Enumeration)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ public override void Encode(IEncoder encoder)
{
encoder.PushNamespace(XmlNamespace);

if (encoder.UseReversibleEncoding)
{
encoder.WriteUInt32("EncodingMask", m_encodingMask);
}
encoder.WriteEncodingMask(m_encodingMask);

foreach (var property in GetPropertyEnumerator())
{
Expand All @@ -118,7 +115,22 @@ public override void Decode(IDecoder decoder)
{
decoder.PushNamespace(XmlNamespace);

m_encodingMask = decoder.ReadUInt32("EncodingMask");
m_encodingMask = decoder.ReadEncodingMask(null);

// try again if the mask is implicitly defined by the JSON keys
if (m_encodingMask == 0 && decoder is IJsonDecoder)
{
var masks = new StringCollection();
foreach (var property in GetPropertyEnumerator())
{
if (property.IsOptional)
{
masks.Add(property.Name);
}
}

m_encodingMask = decoder.ReadEncodingMask(masks);
}

foreach (var property in GetPropertyEnumerator())
{
Expand All @@ -132,6 +144,7 @@ public override void Decode(IDecoder decoder)

DecodeProperty(decoder, property);
}

decoder.PopNamespace();
}

Expand Down
54 changes: 44 additions & 10 deletions Libraries/Opc.Ua.Client.ComplexTypes/Types/UnionComplexType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,9 @@ public override void Encode(IEncoder encoder)
{
encoder.PushNamespace(XmlNamespace);

string fieldName = null;
if (encoder.UseReversibleEncoding)
{
encoder.WriteUInt32("SwitchField", m_switchField);
fieldName = "Value";
}
// the encoder may return an override for the field name
// e.g. to support reversible JSON encoding
encoder.WriteSwitchField(m_switchField, out string fieldName);

if (m_switchField != 0)
{
Expand All @@ -114,11 +111,17 @@ public override void Encode(IEncoder encoder)
}
unionSelector++;
}

if (encoder.UseReversibleEncoding)
{
fieldName = fieldName ?? unionProperty.Name;
}

EncodeProperty(encoder, fieldName, unionProperty);
}
else if (!encoder.UseReversibleEncoding)
{
encoder.WriteString(null, "null");
encoder.WriteString(null, null);
}

encoder.PopNamespace();
Expand All @@ -129,20 +132,51 @@ public override void Decode(IDecoder decoder)
{
decoder.PushNamespace(XmlNamespace);

m_switchField = decoder.ReadUInt32("SwitchField");
string fieldName = "Value";
UInt32 unionSelector = 0;

unionSelector = decoder.ReadSwitchField(null);

// maybe the switch field is implicitly defined by the JSON keys
bool isJsonDecoder = decoder.EncodingType == EncodingType.Json;
if (unionSelector == 0 && isJsonDecoder)
{
var fields = new StringCollection();
foreach (var property in GetPropertyEnumerator())
{
if (property.IsOptional)
{
fields.Add(property.Name);
}
}

unionSelector = decoder.ReadSwitchField(fields);
}

UInt32 unionSelector = m_switchField;
m_switchField = unionSelector;
if (unionSelector > 0)
{
foreach (var property in GetPropertyEnumerator())
{
if (--unionSelector == 0)
{
DecodeProperty(decoder, "Value", property);
fieldName = property.Name;

if (isJsonDecoder &&
decoder is IJsonDecoder jsonDecoder &&
jsonDecoder.ReadField("Value", out _))
{
DecodeProperty(jsonDecoder, "Value", property);
}
else
{
DecodeProperty(decoder, fieldName, property);
}
break;
}
}
}

decoder.PopNamespace();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ ApplicationRecordDataType application
}
}

NodeId nodeId = new NodeId();
NodeId nodeId = NodeId.Null;
if (!NodeId.IsNull(application.ApplicationId))
{
// verify node integrity
Expand Down
Loading
Loading