how to configure struct UA_FieldMetaData for "char mystring[255]" type

14 views
Skip to first unread message

Jacky Bek

unread,
Feb 23, 2021, 6:36:17 AM2/23/21
to open62541
typedef struct {
    UA_String name;
    UA_LocalizedText description;
    UA_DataSetFieldFlags fieldFlags;
    UA_Byte builtInType;
    UA_NodeId dataType;
    UA_Int32 valueRank;
    size_t arrayDimensionsSize;
    UA_UInt32 *arrayDimensions;
    UA_UInt32 maxStringLength;
    UA_Guid dataSetFieldId;
    size_t propertiesSize;
    UA_KeyValuePair *properties;
} UA_FieldMetaData;

I realised that in order to prepare the meta data definition for string type, it requires additional parameters to be set (as compared to float type)..

Can you advise if the following settings is correct  & sufficient? e.g char myString[255]
======================================
UA_FieldMetaData_init (&pMetaData->fields[n]);
pMetaData->fields[n].builtInType = UA_NS0ID_STRING;
UA_NodeId_copy (&UA_TYPES[UA_TYPES_STRING].typeId, &pMetaData->fields[n].dataType);
pMetaData->fields[n].valueRank = -3; // scalar or 1 dimension;
pMetaData->fields[n].arrayDimensionsSize = 1;
pMetaData->fields[n].maxStringLength = 255;
pMetaData->fields[n].name = UA_STRING("2. Block Version");
Reply all
Reply to author
Forward
0 new messages