Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Additional Custom Types #173

Open
awcullen opened this issue Oct 31, 2020 · 0 comments
Open

Additional Custom Types #173

awcullen opened this issue Oct 31, 2020 · 0 comments

Comments

@awcullen
Copy link
Contributor

In v3.0, we ask that you mark the assembly containing your custom structures with TypeLibrary attribute.


using System;
using Workstation.ServiceModel.Ua;

[assembly: TypeLibrary()]
namespace CustomTypeLibrary
{
    [DataTypeId("nsu=http://www.unifiedautomation.com/DemoServer/;i=3002")]
    [BinaryEncodingId("nsu=http://www.unifiedautomation.com/DemoServer/;i=5054")]
    public class CustomVector : Structure
    {
        public double X { get; set; }
        public double Y { get; set; }
        public double Z { get; set; }
        public override void Encode(IEncoder encoder)
        {
            encoder.WriteDouble("X", X);
            encoder.WriteDouble("Y", Y);
            encoder.WriteDouble("Z", Z);
        }
        public override void Decode(IDecoder decoder)
        {
            X = decoder.ReadDouble("X");
            Y = decoder.ReadDouble("Y");
            Z = decoder.ReadDouble("Z");
        }
    }
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant