CNC Companion Spec: Don't know how to use ExtensionObject

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
christoph_krekels
Jr. Member
Jr. Member
Posts: 3
Joined: 29 Nov 2018, 10:08

CNC Companion Spec: Don't know how to use ExtensionObject

Post by christoph_krekels »

Hello,

I generated among other things a Enumeration Datatype CncChannelProgStatus with the UaModeler, which includes 5 EnumValues:
EnumString SymbolicName Value
Stopped Stopped 0
Running Running 1
...

So first I uses the NodeHandletype internalPolled for variables to check how the value is displayed on the UaExpert Client -> Its displayed like: 1 (Running) and if i doppel click on the value the hole List (Stopped, Running...) will be shown as a dropdown menu.
I would like to have exactly the same with externalPolled NodeHandletype, but I cant figure out how to do that.

After the variable with the CncChannelProgStatus Datatype is polled, I get into my Interfacefunction, read the Data from my device and then i would like to return the Value with the specific CncChannelProgStatus Datatype like the internalPolled way.

This is the relevant part of the generated UaModeler code:
[DataContract(Namespace = UnifiedAutomation.UaCNC.Namespaces.UaCNC)]
public enum CncChannelProgStatus
{
/// <summary>
/// Channel program stopped
/// </summary>
[EnumMember(Value = "Stopped_0")]
Stopped = 0,
/// <summary>
/// Channel program running
/// </summary>
[EnumMember(Value = "Running_1")]
Running = 1,
/// <summary>
/// Channel program in waiting state
/// </summary>
[EnumMember(Value = "Waiting_2")]
Waiting = 2,
/// <summary>
/// Channel program interrupted
/// </summary>
[EnumMember(Value = "Interrupted_3")]
Interrupted = 3,
/// <summary>
/// Channel program canceled
/// </summary>
[EnumMember(Value = "Canceled_4")]
Canceled = 4,
}

#region CncChannelProgStatusCollection Class

I tried:
CncChannelProgStatus.Running -> returns only the intiger value 1
CncChannelProgStatus.Running.ToString() -> returns only the String value Running

What do I have to do, that the List will show Up on the UaExpert Client??

Thank you for your help.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: CNC Companion Spec: Don't know how to use ExtensionObjec

Post by Support Team »

Hello,

You need to set the numeric value of the enum value at the DataValue, that is returned in the Read method.

Code: Select all

DataValue dv = new DataValue()
{
    WrappedValue = new Variant((int) CncChannelProgStatus.Running)
}
UaExpert will get the information about the enum definition from the addressspace of the server.
Best regards
Unified Automation Support Team

Post Reply