FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
06-26-2020 09:54 AM
Hi
Is there any sample code available of how to use metadata and flatbuffers for a node in the datalayer?
Solved! Go to Solution.
06-29-2020 03:43 PM
Hi Borje,
I'am currently working on an example with metadata and flatbuffers.
void onMetadata(const std::string &address, const ResponseCallback &callback)
{
flatbuffers::FlatBufferBuilder builder;
auto emptyString = builder.CreateString("This is a Description");
AllowedOperationsBuilder allowedOperations(builder);
allowedOperations.add_read(true);
allowedOperations.add_write(false);
allowedOperations.add_create(true);
allowedOperations.add_delete_(false);
auto operations = allowedOperations.Finish();
comm::datalayer::MetadataBuilder metadata(builder);
metadata.add_description(emptyString);
metadata.add_descriptionUrl(emptyString);
metadata.add_operations(operations);
auto metaFinished = metadata.Finish();
builder.Finish(metaFinished);
comm::datalayer::Variant variant;
variant.shareFlatbuffers(builder);
callback(comm::datalayer::DlResult::DL_OK, &variant);
}
You need something like that, in the next sdk there will be an example.