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

Dynamic Ports: Struct metadata can be generated automatically #44

Open
martinboers opened this issue Aug 10, 2022 · 2 comments
Open

Dynamic Ports: Struct metadata can be generated automatically #44

martinboers opened this issue Aug 10, 2022 · 2 comments
Labels
feature-request New feature or request

Comments

@martinboers
Copy link
Member

martinboers commented Aug 10, 2022

The Dynamic Ports example lists the limitation that struct metadata is not generated automatically by the plcncli code generator.

It turns out that the //#typeinformation comment can be used to do just that.

The example should be updated to mention this.

@martinboers martinboers added the feature-request New feature or request label Aug 10, 2022
@ErikTempelaarVO
Copy link

Could you provide a little more detail?
I'm looking into creating dynamic ports from config file and I'd like to be able to use structs.

I am unable to find any documentation on this annotation.

@martinboers
Copy link
Member Author

You're right, there is no documentation on this feature. I know that it's on the developer's list of things to do, but I don't know if/when it will be done.

Without testing it, something like this should work:

// Define the struct that will be used to declare port variables.
// The typeinformation attribute means that the plcncli will generate GDS metadata for this struct.
//#typeinformation
struct SampleStruct
{
   float64 ElemA;
   uint32 ElemB;
   uint16 ElemC;
   boolean ElemD;
};

You should then be able to create dynamic ports of this type, in a similar way to ports of elementary data types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants