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

Set DefaultEncodingId in DataTypeDefinition, was always null NodeId #1523

Merged
merged 5 commits into from
Sep 24, 2021

Conversation

mregen
Copy link
Contributor

@mregen mregen commented Sep 23, 2021

  • DefaultEncodingId is always set to binary encoding id
  • the default encoding id is derived for the encodeable factory, since the typetree does not contain sufficent information to find the proper binary encoding id
  • add a few helper functions in core for an upcoming PR that was used for testing with custom types, will simplify to add more nodemanagers to servers with custom types

@mregen mregen marked this pull request as draft September 23, 2021 15:39
@mregen mregen linked an issue Sep 23, 2021 that may be closed by this pull request
@@ -75,6 +72,12 @@ public interface IEncodeableFactory
/// <param name="assembly">The assembly containing the types to add to the factory</param>
void AddEncodeableTypes(Assembly assembly);

/// <summary>
/// Adds an enumerable of extension types to the factory.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enumeration

@mregen mregen marked this pull request as ready for review September 23, 2021 15:50
@codecov
Copy link

codecov bot commented Sep 23, 2021

Codecov Report

Merging #1523 (9e6454c) into master (0d34b7d) will increase coverage by 0.05%.
The diff coverage is 43.90%.

❗ Current head 9e6454c differs from pull request most recent head 857bf74. Consider uploading reports for the commit 857bf74 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1523      +/-   ##
==========================================
+ Coverage   52.96%   53.01%   +0.05%     
==========================================
  Files         307      307              
  Lines       58376    58387      +11     
==========================================
+ Hits        30919    30956      +37     
+ Misses      27457    27431      -26     
Impacted Files Coverage Δ
.../Opc.Ua.Core/Stack/State/ModelCompilerExtension.cs 0.00% <ø> (ø)
...ck/Opc.Ua.Core/Types/Encoders/EncodeableFactory.cs 70.52% <0.00%> (-3.92%) ⬇️
...ibraries/Opc.Ua.Server/NodeManager/INodeManager.cs 68.29% <33.33%> (ø)
Stack/Opc.Ua.Core/Stack/State/DataTypeState.cs 42.85% <55.00%> (+6.85%) ⬆️
Stack/Opc.Ua.Core/Stack/Nodes/TypeTable.cs 44.71% <75.00%> (ø)
Libraries/Opc.Ua.Client/Subscription.cs 70.31% <0.00%> (+0.72%) ⬆️
Libraries/Opc.Ua.Client/Session.cs 63.01% <0.00%> (+1.29%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d34b7d...857bf74. Read the comment docs.

@lgtm-com
Copy link

lgtm-com bot commented Sep 23, 2021

This pull request introduces 2 alerts when merging 9e6454c into 0d34b7d - view on LGTM.com

new alerts:

  • 2 for Dereferenced variable may be null

if (ServiceResult.IsGood(result))
{
if (dataTypeDefinition?.Body is StructureDefinition structureType &&
structureType.DefaultEncodingId.IsNullNodeId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this piece of code covering enum datatypes as well? or they don't need special handling?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, EnumDefinition does not have a DefaultEncodingId as a member, I wonder why it is only needed for struct... I believe enum are encoded as int anyway, so it may not even matter

Copy link
Contributor

@mrsuciu mrsuciu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@mregen
Copy link
Contributor Author

mregen commented Sep 24, 2021

sorry, I found a better way to add the setter code to the StructureDefinition, so it could be used for other means like metadataframe

@lgtm-com
Copy link

lgtm-com bot commented Sep 24, 2021

This pull request introduces 3 alerts when merging 2ed6867 into 0d34b7d - view on LGTM.com

new alerts:

  • 3 for Dereferenced variable may be null

@lgtm-com
Copy link

lgtm-com bot commented Sep 24, 2021

This pull request introduces 2 alerts when merging 857bf74 into 0d34b7d - view on LGTM.com

new alerts:

  • 2 for Dereferenced variable may be null

@mregen mregen merged commit 33ae8bb into master Sep 24, 2021
@mregen mregen deleted the defaultEncodingId branch September 24, 2021 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DefaultEncodingId in DataTypeDefinition should not be Null
3 participants