Skip to content

Commit

Permalink
Hardening of extracting AAS IDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
barnstee committed Jan 23, 2025
1 parent 76e00d4 commit 6f37fdb
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions I4AASNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class I4AASNodeManager : CustomNodeManager2
{
private long _lastUsedId = 0;

private string _namespaceURI = "http://opcfoundation.org/UA/" + Program.g_AASEnv?.AssetAdministrationShells[0].IdShort + "/";
private string _namespaceURI = "http://opcfoundation.org/UA/AAS2Nodeset/";

public FolderState? _rootAssetAdminShells = null;
public FolderState? _rootSubmodels = null;
Expand All @@ -24,11 +24,23 @@ public I4AASNodeManager(IServerInternal server, ApplicationConfiguration configu
{
SystemContext.NodeIdFactory = this;

List<string> namespaceUris = new()
{
_namespaceURI
};
List<string> namespaceUris = new();

if (!string.IsNullOrEmpty(Program.g_AASEnv?.AssetAdministrationShells[0].IdShort))
{
_namespaceURI = "http://opcfoundation.org/UA/" + Program.g_AASEnv?.AssetAdministrationShells[0].IdShort.Replace("/", "_").Replace(":", "_") + "/";
}
else if (!string.IsNullOrEmpty(Program.g_AASEnv?.AssetAdministrationShells[0].Id))
{
_namespaceURI = "http://opcfoundation.org/UA/" + Program.g_AASEnv?.AssetAdministrationShells[0].Id.Replace("/", "_").Replace(":", "_") + "/";
}
else if (!string.IsNullOrEmpty(Program.g_AASEnv?.AssetAdministrationShells[0].Identification?.Id))
{
_namespaceURI = "http://opcfoundation.org/UA/" + Program.g_AASEnv?.AssetAdministrationShells[0].Identification.Id.Replace("/", "_").Replace(":", "_") + "/";
}

namespaceUris.Add(_namespaceURI);

NamespaceUris = namespaceUris;
}

Expand Down

0 comments on commit 6f37fdb

Please sign in to comment.