Beckhoff / TF6000_ADS_DOTNET_V5_Samples

Sample code for the Version 6.X series of the TwinCAT ADS .NET Packages
https://infosys.beckhoff.com/content/1033/tc3_ads.net/9407515403.html?id=6770980177009971601
BSD Zero Clause License
37 stars 15 forks source link

Add Rpc Method to Server Samples #9

Closed mark-lazarides closed 2 years ago

mark-lazarides commented 2 years ago

Hi,

Is it possible to add an Rpc Method to the Ads Symbolic Server samples? I have had a quick look through the docs but can't see how to do that. If you can suggest a way to me, I will try and then add as a PR.

Thanks, Mark

RalfHeitmann commented 2 years ago

This feature is already on the TODO list and will be implemented in one of the next versions. The main issue is that we not only have to extend the sample, this feature also needs extensions in the Beckhoff.TwinCAT.Ads package.

mark-lazarides commented 2 years ago

thanks for the response, @RalfHeitmann.

Can you guide me on what is necessary? I could put something together to help move it along?

RalfHeitmann commented 2 years ago

Just be patient ;-) The plan is to support code like this:


PrimitiveType dtInt = new PrimitiveType("INT", typeof(short));

RpcMethod rpc1 = new RpcMethod("Method1",
                new RpcMethodParameterCollection()
                    .AddParameter("i1", dtInt, MethodParamFlags.In)
                    .AddParameter("i2", dtInt, MethodParamFlags.In)
                , dtInt); // Return Type

RpcMethod rpc2 = new RpcMethod("Method2",
                new RpcMethodParameterCollection()
                    .AddParameter("in1", dtInt, MethodParamFlags.In)
                    .AddParameter("out1", dtInt, MethodParamFlags.Out)
                , null); // Return Type

RpcMethodCollection rpcMethods = new RpcMethodCollection()
                .AddMethod(rpc1)
                .AddMethod(rpc2);

RpcStructType dtStructRpc = new RpcStructType("MYRPCSTRUCT", null, members,rpcMethods);
RalfHeitmann commented 2 years ago

@mark-lazarides , please have a look into the refactored sample

mark-lazarides commented 2 years ago

@RalfHeitmann, great, thank you! I will have a play with it this weekend.