Ok, the new Modler 1.2.0 solved several problems that I had.
But there is still a problem when I use an abstract type (e.g.Integer) as a method parameter.
I have the following testMethod:
virtual UaStatus testMethod(const ServiceContext& serviceContext,
/*IN*/ OpcUa_Double IntegerArgument,
/*IN*/ OpcUa_Int32 Int32Argument,
/*IN*/ const UaInt32Array& Int32Argument_array);
If I change the type of IntegerArgument form Double to Integer, then in the generated h-file stands:
// MyExampleTyp method testMethod
//DataType not supported
I think there is no way to fix this so far. If I try to change the type after the code generation from Double to Integer, I get problems because the type is used in other parts of the code too.
I think I will use a subtype of Integer until the modeler can handle this.
Best regards
Problem when using an abstract type (e.g.Integer) as a method parameter.
Moderator: uamodeler
-
- Hero Member
- Posts: 21
- Joined: 07 Oct 2012, 11:18
- Support Team
- Hero Member
- Posts: 3071
- Joined: 18 Mar 2011, 15:09
Re:Problem when using an abstract type (e.g.Integer) as a method parameter.
Hi ChSch,
The Cpp Server Templates 1.3.1 do not support method calls with arguments with abstract DataTypes. If you want to use an abstract DataType like Integer, you have to
The Cpp Server Templates 1.3.1 do not support method calls with arguments with abstract DataTypes. If you want to use an abstract DataType like Integer, you have to
- Create the method with a non-abstract DataType like Double
- Generate the code
- Replace OpcUa_Double by OpcUa_Integer in the "initialize" and "createTypes" method
- Use UaVariant instead of OpcUa_Double for the arguments in "beginCall"
- Check the type like
Code: Select all
switch (IntegerArgument.type()) { case OpcUaType_SByte: case OpcUaType_Int16: case OpcUaType_Int32: case OpcUaType_Int64: case OpcUaType_Byte: case OpcUaType_UInt16: case OpcUaType_UInt32 case OpcUaType_UInt64: tmpRet = OpcUa_Good; break; default: tmpRet = OpcUa_BadTypeMismatch; } if (IntegerArgument.arrayType() != OpcUa_VariantArrayType_Scalar) { tmpRet = OpcUa_BadTypeMismatch; } inputArgumentResults[ 0 ] = tmpRet.statusCode(); if (tmpRet.isNotGood()) {ret = tmpRet;}
- Use UaVariant instead of OpcUa_Double in the method
Best regards
Unified Automation Support Team
Unified Automation Support Team