CmpIecVarAccess to get name of a type, not of a variable (instance)

berendej
2016-06-07
2016-06-08
  • berendej - 2016-06-07

    I have a type (structure) in my IEC application

    TYPE composite_t :
    STRUCT
    m_i : INT;
    m_f : REAL;
    END_STRUCT
    END_TYPE

    And somewhere in application I have an instance of this type:
    ct1 : composite_t := ( m_i := 1, m_f := 2 );

    I write component which uses CmpIecVarAccess interface, I'd like to get type information.

    I browse to "ct1" ( hNode is a handle to variable "ct1" ) and then I call:

    TypeDescAsUnion typeDesc;
    hTypeNode = IecVarAccGetTypeNode3(hInterface, hNode, &VarInfo, &result);
    IecVarAccGetTypeDesc(hInterface, hTypeNode, &typeDesc);

    And as a result I have a valid typeDesc.

    So the question is: Is it possible having typeDesc to get the name of the type ( i.e. "composite_t" ) ?
    Not the name of a variable ( "ct1" ) , but the name of a type?

    I tryed:
    char *szTypeName = CAL_IecVarAccGetNodeName(hInterface, hTypeNode, &result);
    But it doesn't work.

     
  • berendej - 2016-06-08

    I just got quick response from CoDeSys support ( thank you guys ! ).
    solution is :

    IecVarAccGetTypeName( hInterface, hTypeNode, &result)

    problem is solved.

     

Log in to post a comment.