Skip to content

Commit

Permalink
Merge pull request #2352 from OPCFoundation/master
Browse files Browse the repository at this point in the history
merge latest commits from master
  • Loading branch information
mregen authored Oct 27, 2023
2 parents b90f762 + 71ad9af commit 0015d11
Show file tree
Hide file tree
Showing 96 changed files with 9,741 additions and 1,335 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
TESTRESULTS: "TestResults-${{matrix.csproj}}-${{matrix.os}}-${{matrix.framework}}-${{matrix.configuration}}"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -57,13 +57,13 @@ jobs:

# https://github.com/docker/build-push-action
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand Down Expand Up @@ -93,18 +93,18 @@ jobs:
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_REPOSITORY }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
build-args: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public bool ShowDialog(UserNameIdentityToken token)

if (token.Password != null && token.Password.Length > 0)
{
PasswordTB.Text = new UTF8Encoding().GetString(token.Password);
PasswordTB.Text = Encoding.UTF8.GetString(token.Password);
}
}

Expand All @@ -86,7 +86,7 @@ public bool ShowDialog(UserNameIdentityToken token)

if (!String.IsNullOrEmpty(PasswordTB.Text))
{
token.Password = new UTF8Encoding().GetBytes(PasswordTB.Text);
token.Password = Encoding.UTF8.GetBytes(PasswordTB.Text);
}
else
{
Expand Down
39 changes: 21 additions & 18 deletions Applications/ConsoleReferenceClient/ClientSamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public void SubscribeToDataChanges(ISession session, uint minLifeTime)
/// <param name="addRootNode">Adds the root node to the result.</param>
/// <param name="filterUATypes">Filters nodes from namespace 0 from the result.</param>
/// <returns>The list of nodes on the server.</returns>
public IList<INode> FetchAllNodesNodeCache(
public async Task<IList<INode>> FetchAllNodesNodeCacheAsync(
IUAClient uaClient,
NodeId startingNode,
bool fetchTree = false,
Expand All @@ -398,13 +398,13 @@ public IList<INode> FetchAllNodesNodeCache(
{
// clear NodeCache to fetch all nodes from server
uaClient.Session.NodeCache.Clear();
FetchReferenceIdTypes(uaClient.Session);
await FetchReferenceIdTypesAsync(uaClient.Session).ConfigureAwait(false);
}

// add root node
if (addRootNode)
{
var rootNode = uaClient.Session.NodeCache.Find(startingNode);
var rootNode = await uaClient.Session.NodeCache.FindAsync(startingNode).ConfigureAwait(false);
nodeDictionary[rootNode.NodeId] = rootNode;
}

Expand All @@ -419,11 +419,11 @@ public IList<INode> FetchAllNodesNodeCache(

searchDepth++;
Utils.LogInfo("{0}: Find {1} references after {2}ms", searchDepth, nodesToBrowse.Count, stopwatch.ElapsedMilliseconds);
IList<INode> response = uaClient.Session.NodeCache.FindReferences(
IList<INode> response = await uaClient.Session.NodeCache.FindReferencesAsync(
nodesToBrowse,
references,
false,
true);
true).ConfigureAwait(false);

var nextNodesToBrowse = new ExpandedNodeIdCollection();
int duplicates = 0;
Expand Down Expand Up @@ -466,7 +466,7 @@ public IList<INode> FetchAllNodesNodeCache(
}
else
{
nodeDictionary[node.NodeId] = node; ;
nodeDictionary[node.NodeId] = node;
}
}
else
Expand Down Expand Up @@ -511,10 +511,11 @@ public IList<INode> FetchAllNodesNodeCache(
/// <param name="uaClient">The UAClient with a session to use.</param>
/// <param name="startingNode">The node where the browse operation starts.</param>
/// <param name="browseDescription">An optional BrowseDescription to use.</param>
public ReferenceDescriptionCollection BrowseFullAddressSpace(
public async Task<ReferenceDescriptionCollection> BrowseFullAddressSpaceAsync(
IUAClient uaClient,
NodeId startingNode = null,
BrowseDescription browseDescription = null)
BrowseDescription browseDescription = null,
CancellationToken ct = default)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
Expand Down Expand Up @@ -563,9 +564,10 @@ public ReferenceDescriptionCollection BrowseFullAddressSpace(
repeatBrowse = false;
try
{
_ = uaClient.Session.Browse(null, null,
kMaxReferencesPerNode, browseCollection,
out browseResultCollection, out diagnosticsInfoCollection);
var browseResponse = await uaClient.Session.BrowseAsync(null, null,
kMaxReferencesPerNode, browseCollection, ct).ConfigureAwait(false);
browseResultCollection = browseResponse.Results;
diagnosticsInfoCollection = browseResponse.DiagnosticInfos;
ClientBase.ValidateResponse(browseResultCollection, browseCollection);
ClientBase.ValidateDiagnosticInfos(diagnosticsInfoCollection, browseCollection);

Expand Down Expand Up @@ -629,8 +631,9 @@ public ReferenceDescriptionCollection BrowseFullAddressSpace(
}

Utils.LogInfo("BrowseNext {0} continuation points.", continuationPoints.Count);
_ = uaClient.Session.BrowseNext(null, false, continuationPoints,
out var browseNextResultCollection, out diagnosticsInfoCollection);
var browseNextResult = await uaClient.Session.BrowseNextAsync(null, false, continuationPoints, ct).ConfigureAwait(false);
var browseNextResultCollection = browseNextResult.Results;
diagnosticsInfoCollection = browseNextResult.DiagnosticInfos;
ClientBase.ValidateResponse(browseNextResultCollection, continuationPoints);
ClientBase.ValidateDiagnosticInfos(diagnosticsInfoCollection, continuationPoints);
allBrowseResults.AddRange(browseNextResultCollection);
Expand Down Expand Up @@ -696,7 +699,7 @@ public ReferenceDescriptionCollection BrowseFullAddressSpace(
/// Outputs elapsed time information for perf testing and lists all
/// types that were successfully added to the session encodeable type factory.
/// </remarks>
public async Task LoadTypeSystem(ISession session)
public async Task LoadTypeSystemAsync(ISession session)
{
m_output.WriteLine("Load the server type system.");

Expand Down Expand Up @@ -742,15 +745,15 @@ public async Task LoadTypeSystem(ISession session)
/// The NodeCache needs this information to function properly with subtypes of hierarchical calls.
/// </remarks>
/// <param name="session">The session to use</param>
void FetchReferenceIdTypes(ISession session)
Task FetchReferenceIdTypesAsync(ISession session)
{
// fetch the reference types first, otherwise browse for e.g. hierarchical references with subtypes won't work
var bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
var namespaceUris = session.NamespaceUris;
var referenceTypes = typeof(ReferenceTypeIds)
.GetFields(bindingFlags)
.Select(field => NodeId.ToExpandedNodeId((NodeId)field.GetValue(null), namespaceUris));
session.FetchTypeTree(new ExpandedNodeIdCollection(referenceTypes));
return session.FetchTypeTreeAsync(new ExpandedNodeIdCollection(referenceTypes));
}
#endregion

Expand Down Expand Up @@ -897,7 +900,7 @@ public async Task SubscribeAllValuesAsync(
StartNodeId = item.NodeId,
AttributeId = Attributes.Value,
SamplingInterval = samplingInterval,
DisplayName = item.DisplayName.Text ?? item.BrowseName.Name,
DisplayName = item.DisplayName?.Text ?? item.BrowseName.Name,
QueueSize = queueSize,
DiscardOldest = true,
MonitoringMode = MonitoringMode.Reporting,
Expand All @@ -907,7 +910,7 @@ public async Task SubscribeAllValuesAsync(
}

// Create the monitored items on Server side
subscription.ApplyChanges();
await subscription.ApplyChangesAsync().ConfigureAwait(false);
m_output.WriteLine("MonitoredItems {0} created for SubscriptionId = {1}.", subscription.MonitoredItemCount, subscription.Id);
}
catch (Exception ex)
Expand Down
12 changes: 5 additions & 7 deletions Applications/ConsoleReferenceClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ public static async Task Main(string[] args)
// Define the UA Client application
ApplicationInstance.MessageDlg = new ApplicationMessageDlg(output);
CertificatePasswordProvider PasswordProvider = new CertificatePasswordProvider(password);
ApplicationInstance application = new ApplicationInstance
{
ApplicationInstance application = new ApplicationInstance {
ApplicationName = applicationName,
ApplicationType = ApplicationType.Client,
ConfigSectionName = configSectionName,
Expand Down Expand Up @@ -220,7 +219,7 @@ public static async Task Main(string[] args)
var samples = new ClientSamples(output, ClientBase.ValidateResponse, quitEvent, verbose);
if (loadTypes)
{
await samples.LoadTypeSystem(uaClient.Session).ConfigureAwait(false);
await samples.LoadTypeSystemAsync(uaClient.Session).ConfigureAwait(false);
}

if (browseall || fetchall || jsonvalues)
Expand All @@ -230,7 +229,7 @@ public static async Task Main(string[] args)
if (browseall)
{
referenceDescriptions =
samples.BrowseFullAddressSpace(uaClient, Objects.RootFolder);
await samples.BrowseFullAddressSpaceAsync(uaClient, Objects.RootFolder).ConfigureAwait(false);
variableIds = new NodeIdCollection(referenceDescriptions
.Where(r => r.NodeClass == NodeClass.Variable && r.TypeDefinition.NamespaceIndex != 0)
.Select(r => ExpandedNodeId.ToNodeId(r.NodeId, uaClient.Session.NamespaceUris)));
Expand All @@ -239,16 +238,15 @@ public static async Task Main(string[] args)
IList<INode> allNodes = null;
if (fetchall)
{
allNodes = samples.FetchAllNodesNodeCache(
uaClient, Objects.RootFolder, true, true, false);
allNodes = await samples.FetchAllNodesNodeCacheAsync(uaClient, Objects.RootFolder, true, true, false).ConfigureAwait(false);
variableIds = new NodeIdCollection(allNodes
.Where(r => r.NodeClass == NodeClass.Variable && r is VariableNode && ((VariableNode)r).DataType.NamespaceIndex != 0)
.Select(r => ExpandedNodeId.ToNodeId(r.NodeId, uaClient.Session.NamespaceUris)));
}

if (jsonvalues && variableIds != null)
{
await samples.ReadAllValuesAsync(uaClient, variableIds).ConfigureAwait(false);
var (allValues, results) = await samples.ReadAllValuesAsync(uaClient, variableIds).ConfigureAwait(false);
}

if (subscribe && (browseall || fetchall))
Expand Down
4 changes: 2 additions & 2 deletions Applications/Quickstarts.Servers/Boiler/Boiler.NodeSet2.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" LastModified="2023-02-23T10:07:27.7772148Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" LastModified="2023-10-06T12:57:31.2741539Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<NamespaceUris>
<Uri>http://opcfoundation.org/UA/Boiler/</Uri>
</NamespaceUris>
<Models>
<Model ModelUri="http://opcfoundation.org/UA/Boiler/" Version="1.0.0" PublicationDate="2023-02-23T10:07:27.7772148Z">
<Model ModelUri="http://opcfoundation.org/UA/Boiler/" Version="1.0.0" PublicationDate="2023-10-06T12:57:31.2741539Z">
<RequiredModel ModelUri="http://opcfoundation.org/UA/" XmlSchemaUri="http://opcfoundation.org/UA/2008/02/Types.xsd" />
</Model>
</Models>
Expand Down
2 changes: 1 addition & 1 deletion Applications/Quickstarts.Servers/Boiler/Boiler.Types.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
>
<xs:annotation>
<xs:appinfo>
<ua:Model ModelUri="http://opcfoundation.org/UA/Boiler/" Version="1.0.0" PublicationDate="2023-02-23T10:07:27.7772148Z" />
<ua:Model ModelUri="http://opcfoundation.org/UA/Boiler/" Version="1.0.0" PublicationDate="2023-10-06T12:57:31.2741539Z" />
</xs:appinfo>
</xs:annotation>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" LastModified="2023-02-23T10:07:27.7824728Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" LastModified="2023-10-06T12:57:31.2901182Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<NamespaceUris>
<Uri>http://samples.org/UA/MemoryBuffer</Uri>
</NamespaceUris>
<Models>
<Model ModelUri="http://samples.org/UA/MemoryBuffer" Version="1.0.0" PublicationDate="2023-02-23T10:07:27.7824728Z">
<Model ModelUri="http://samples.org/UA/MemoryBuffer" Version="1.0.0" PublicationDate="2023-10-06T12:57:31.2901182Z">
<RequiredModel ModelUri="http://opcfoundation.org/UA/" XmlSchemaUri="http://opcfoundation.org/UA/2008/02/Types.xsd" />
</Model>
</Models>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
>
<xs:annotation>
<xs:appinfo>
<ua:Model ModelUri="http://samples.org/UA/MemoryBuffer" Version="1.0.0" PublicationDate="2023-02-23T10:07:27.7824728Z" />
<ua:Model ModelUri="http://samples.org/UA/MemoryBuffer" Version="1.0.0" PublicationDate="2023-10-06T12:57:31.2901182Z" />
</xs:appinfo>
</xs:annotation>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ protected override void OnAfterCreate(ISystemContext context, NodeState node)
InitializeVariable(context, IntegerValue, TestData.Variables.ArrayValueObjectType_IntegerValue);
InitializeVariable(context, UIntegerValue, TestData.Variables.ArrayValueObjectType_UIntegerValue);
InitializeVariable(context, VectorValue, TestData.Variables.ArrayValueObjectType_VectorValue);
InitializeVariable(context, VectorUnionValue, TestData.Variables.ArrayValueObjectType_VectorUnionValue);
InitializeVariable(context, VectorWithOptionalFieldsValue, TestData.Variables.ArrayValueObjectType_VectorWithOptionalFieldsValue);
InitializeVariable(context, MultipleVectorsValue, TestData.Variables.ArrayValueObjectType_MultipleVectorsValue);
}
#endregion

Expand Down Expand Up @@ -123,6 +126,9 @@ protected override ServiceResult OnGenerateValues(
GenerateValue(system, IntegerValue);
GenerateValue(system, UIntegerValue);
GenerateValue(system, VectorValue);
GenerateValue(system, VectorUnionValue);
GenerateValue(system, VectorWithOptionalFieldsValue);
GenerateValue(system, MultipleVectorsValue);

return base.OnGenerateValues(context, method, objectId, count);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ protected override void OnAfterCreate(ISystemContext context, NodeState node)
InitializeVariable(context, IntegerValue, TestData.Variables.ScalarValueObjectType_IntegerValue);
InitializeVariable(context, UIntegerValue, TestData.Variables.ScalarValueObjectType_UIntegerValue);
InitializeVariable(context, VectorValue, TestData.Variables.ScalarValueObjectType_VectorValue);
InitializeVariable(context, VectorUnionValue, TestData.Variables.ScalarValueObjectType_VectorUnionValue);
InitializeVariable(context, VectorWithOptionalFieldsValue, TestData.Variables.ScalarValueObjectType_VectorWithOptionalFieldsValue);
InitializeVariable(context, MultipleVectorsValue, TestData.Variables.ScalarValueObjectType_MultipleVectorsValue);
}
#endregion

Expand Down Expand Up @@ -123,6 +126,9 @@ protected override ServiceResult OnGenerateValues(
GenerateValue(system, IntegerValue);
GenerateValue(system, UIntegerValue);
GenerateValue(system, VectorValue);
GenerateValue(system, VectorUnionValue);
GenerateValue(system, VectorWithOptionalFieldsValue);
GenerateValue(system, MultipleVectorsValue);

return base.OnGenerateValues(context, method, objectId, count);
}
Expand Down
Loading

0 comments on commit 0015d11

Please sign in to comment.