Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
* OPC UA Server (somehow) running
Browse files Browse the repository at this point in the history
* JSON.NEt to version 13.0.3
   (because of new OPC UA package)
* basic migration of plugin
   SmdExporter
  • Loading branch information
festo-i40 committed Jul 31, 2023
1 parent 233f945 commit 5835759
Show file tree
Hide file tree
Showing 70 changed files with 3,123 additions and 3,146 deletions.
4 changes: 2 additions & 2 deletions src/AasCore.Aas3_0/AasCore.Aas3_0.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
Expand All @@ -20,6 +20,6 @@
<PackageTags>aas;asset administration shell;iiot;industry internet of things;industrie 4.0;i4.0</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/AasxBammRdfImExport/AasxBammRdfImExport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="dotNetRDF" Version="2.7.5" />
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<None Update="test\Battery.ttl">
Expand Down
4 changes: 2 additions & 2 deletions src/AasxCsharpLibrary/AasxCsharpLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<DefineConstants>TRACE;UseAasxCompatibilityModels</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Using Include="AasCore.Aas3_0"/>
<Using Include="AasCore.Aas3_0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LICENSE.txt">
Expand All @@ -34,7 +34,7 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
<PackageReference Include="Namotion.Reflection" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NJsonSchema" Version="10.8.0" />
<PackageReference Include="System.ComponentModel.Composition" Version="6.0.0" />
<PackageReference Include="System.IO.Packaging" Version="6.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/AasxCsharpLibrary/Display/EnumerationPlacmentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
namespace AdminShellNS.Display
namespace AdminShellNS
{
public class EnumerationPlacmentBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
namespace AdminShellNS.Display
namespace AdminShellNS
{
public class EnumerationPlacmentOperationVariable : EnumerationPlacmentBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
namespace AdminShellNS.Display
namespace AdminShellNS
{
public enum OperationVariableDirection
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using AdminShellNS.Display;
using AdminShellNS;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -40,7 +40,10 @@ public static void Remove(this AnnotatedRelationshipElement annotatedRelationshi
}
}

public static object AddChild(this AnnotatedRelationshipElement annotatedRelationshipElement, ISubmodelElement childSubmodelElement, EnumerationPlacmentBase placement = null)
public static object AddChild(
this AnnotatedRelationshipElement annotatedRelationshipElement,
ISubmodelElement childSubmodelElement,
EnumerationPlacmentBase placement = null)
{
if (childSubmodelElement == null || childSubmodelElement is not IDataElement)
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace Extensions
// TODO (Jui, 2022-12-21): I do not know, if to put the List<> extension here or in a separate file
public static class ExtendListOfEmbeddedDataSpecification
{


public static IEmbeddedDataSpecification FindFirstIEC61360Spec(this List<IEmbeddedDataSpecification> list)
{
foreach (var eds in list)
Expand Down
2 changes: 1 addition & 1 deletion src/AasxCsharpLibrary/Extensions/ExtendEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using AdminShellNS.Display;
using AdminShellNS;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
1 change: 0 additions & 1 deletion src/AasxCsharpLibrary/Extensions/ExtendIReferable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using AdminShellNS;
using AdminShellNS.Display;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
1 change: 0 additions & 1 deletion src/AasxCsharpLibrary/Extensions/ExtendISubmodelElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ This source code may use other Open Source software components (see LICENSE.txt)
*/
using AasxCompatibilityModels;
using AdminShellNS;
using AdminShellNS.Display;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
113 changes: 69 additions & 44 deletions src/AasxCsharpLibrary/Extensions/ExtendKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public static bool MatchesSetOfTypes(this IKey key, IEnumerable<KeyTypes> set)
return false;
}


public static AasValidationAction Validate(this IKey key, AasValidationRecordList results, IReferable container)
{
// access
Expand Down Expand Up @@ -129,8 +128,6 @@ public static AasValidationAction Validate(this IKey key, AasValidationRecordLis
return res;
}



public static string ToStringExtended(this IKey key, int format = 1)
{
if (format == 2)
Expand Down Expand Up @@ -189,45 +186,73 @@ public static Key Parse(string cell, KeyTypes typeIfNotSet = KeyTypes.GlobalRefe
// no
return null;
}
// dead-csharp off
// -------------------------------------------------------------------------------------------------------------
#region Handling with enums for KeyTypes

// see: https://stackoverflow.com/questions/27372816/how-to-read-the-value-for-an-enummember-attribute
//public static string? GetEnumMemberValue<T>(this T value)
// where T : Enum
//{
// return typeof(T)
// .GetTypeInfo()
// .DeclaredMembers
// .SingleOrDefault(x => x.Name == value.ToString())
// ?.GetCustomAttribute<EnumMemberAttribute>(false)
// ?.Value;
//}

//public static KeyTypes? MapFrom(AasReferables input)
//{
// var st = input.GetEnumMemberValue();
// var res = Stringification.KeyTypesFromString(st);
// return res;
//}

//public static List<KeyTypes> MapFrom(IEnumerable<AasReferables> input)
//{
// List<KeyTypes> res = new();
// foreach (var i in input)
// {
// var x = MapFrom(i);
// if (x.HasValue)
// res.Add(x.Value);
// }
// return res;
//}

//public static List<KeyTypes> GetAllKeyTypesForAasReferables()
// => ExtendKey.MapFrom(Enum.GetValues(typeof(AasReferables)).OfType<AasReferables>());

#endregion
// dead-csharp on
}

#region Guess identification types

public enum IdType { Unknown = 0, IRI, IRDI };

public static IdType GuessIdType(string id)
{
// start
if (id == null)
return IdType.Unknown;
id = id.Trim().ToLower();

// IRDI?
if (Regex.IsMatch(id, @"(\d{3,4})\W+"))
return IdType.IRDI;

// IRI?
// TODO: check for escaping
if (Regex.IsMatch(id, @"(\w{3,5})://"))
return IdType.IRI;

// unsure
return IdType.Unknown;
}

#endregion

// dead-csharp off
// -------------------------------------------------------------------------------------------------------------
#region Handling with enums for KeyTypes

// see: https://stackoverflow.com/questions/27372816/how-to-read-the-value-for-an-enummember-attribute
//public static string? GetEnumMemberValue<T>(this T value)
// where T : Enum
//{
// return typeof(T)
// .GetTypeInfo()
// .DeclaredMembers
// .SingleOrDefault(x => x.Name == value.ToString())
// ?.GetCustomAttribute<EnumMemberAttribute>(false)
// ?.Value;
//}

//public static KeyTypes? MapFrom(AasReferables input)
//{
// var st = input.GetEnumMemberValue();
// var res = Stringification.KeyTypesFromString(st);
// return res;
//}

//public static List<KeyTypes> MapFrom(IEnumerable<AasReferables> input)
//{
// List<KeyTypes> res = new();
// foreach (var i in input)
// {
// var x = MapFrom(i);
// if (x.HasValue)
// res.Add(x.Value);
// }
// return res;
//}

//public static List<KeyTypes> GetAllKeyTypesForAasReferables()
// => ExtendKey.MapFrom(Enum.GetValues(typeof(AasReferables)).OfType<AasReferables>());

#endregion
// dead-csharp on

}
}
14 changes: 7 additions & 7 deletions src/AasxCsharpLibrary/Extensions/ExtendOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using AdminShellNS.Display;
using AdminShellNS;
using System.Collections.Generic;
using System.Linq;

Expand All @@ -16,7 +16,7 @@ public static class ExtendOperation
{
#region AasxPackageExplorer

public static object AddChild(this Operation operation, ISubmodelElement childSubmodelElement, EnumerationPlacmentBase placement = null)
public static object AddChild(this IOperation operation, ISubmodelElement childSubmodelElement, EnumerationPlacmentBase placement = null)
{
// not enough information to select list of children?
var pl = placement as EnumerationPlacmentOperationVariable;
Expand Down Expand Up @@ -50,7 +50,7 @@ public static object AddChild(this Operation operation, ISubmodelElement childSu
return ov;
}

public static EnumerationPlacmentBase GetChildrenPlacement(this Operation operation, ISubmodelElement child)
public static EnumerationPlacmentBase GetChildrenPlacement(this IOperation operation, ISubmodelElement child)
{
// trivial
if (child == null)
Expand Down Expand Up @@ -93,7 +93,7 @@ public static EnumerationPlacmentBase GetChildrenPlacement(this Operation operat
};
}

public static List<IOperationVariable> GetVars(this Operation op, OperationVariableDirection dir)
public static List<IOperationVariable> GetVars(this IOperation op, OperationVariableDirection dir)
{
if (dir == OperationVariableDirection.In)
return op.InputVariables;
Expand All @@ -103,7 +103,7 @@ public static List<IOperationVariable> GetVars(this Operation op, OperationVaria
}

public static List<IOperationVariable> SetVars(
this Operation op, OperationVariableDirection dir, List<IOperationVariable> value)
this IOperation op, OperationVariableDirection dir, List<IOperationVariable> value)
{
if (dir == OperationVariableDirection.In)
{
Expand All @@ -122,8 +122,8 @@ public static List<IOperationVariable> SetVars(

#endregion

public static Operation UpdateFrom(
this Operation elem, ISubmodelElement source)
public static IOperation UpdateFrom(
this IOperation elem, ISubmodelElement source)
{
if (source == null)
return elem;
Expand Down
5 changes: 3 additions & 2 deletions src/AasxCsharpLibrary/Extensions/ExtendSubmodel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using AdminShellNS;
using AdminShellNS.Display;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -52,7 +51,9 @@ public static void Remove(this Submodel submodel, ISubmodelElement submodelEleme
}
}

public static object AddChild(this ISubmodel submodel, ISubmodelElement childSubmodelElement, EnumerationPlacmentBase placement = null)
public static object AddChild(
this ISubmodel submodel, ISubmodelElement childSubmodelElement,
EnumerationPlacmentBase placement = null)
{
if (childSubmodelElement == null)
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using AdminShellNS.Display;
using AdminShellNS;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
6 changes: 4 additions & 2 deletions src/AasxCsharpLibrary/Extensions/ExtendSubmodelElementList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using AdminShellNS.Display;
using AdminShellNS;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -63,7 +63,9 @@ public static void Remove(this SubmodelElementList submodelElementList, ISubmode
}
}

public static object AddChild(this SubmodelElementList submodelElementList, ISubmodelElement childSubmodelElement, EnumerationPlacmentBase placement = null)
public static object AddChild(
this SubmodelElementList submodelElementList, ISubmodelElement childSubmodelElement,
EnumerationPlacmentBase placement = null)
{
if (childSubmodelElement == null)
return null;
Expand Down
13 changes: 7 additions & 6 deletions src/AasxDictionaryImport.Tests/Cdd/CddTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

using System.IO;
using AasxPackageLogic;
using Aas = AasCore.Aas3_0;
using AdminShellNS;
using NUnit.Framework;

Expand Down Expand Up @@ -78,15 +79,15 @@ protected static System.Collections.Generic.Dictionary<string, string> CreatePro
return dict;
}

protected static AdminShellV20.AdministrationShell CreateAdminShell(AdminShellV20.AdministrationShellEnv env)
protected static Aas.IAssetAdministrationShell CreateAdminShell(Aas.IEnvironment env)
{
var adminShell = new AdminShellV20.AdministrationShell()
var adminShell = new Aas.AssetAdministrationShell(
id: AdminShellUtil.GenerateIdAccordingTemplate(Options.Curr.TemplateIdAas),
assetInformation: new Aas.AssetInformation(Aas.AssetKind.Instance))
{
identification = new AdminShellV20.Identification(
AdminShellV20.Identification.IRI,
AdminShellUtil.GenerateIdAccordingTemplate(Options.Curr.TemplateIdAas)),
};
env.AdministrationShells.Add(adminShell);
if (env.AssetAdministrationShells != null)
env.AssetAdministrationShells.Add(adminShell);
return adminShell;
}
}
Expand Down
Loading

0 comments on commit 5835759

Please sign in to comment.