FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
06-07-2022 01:38 PM
Hello folks,
i try to create/add a node into the datalayer. I run an vritual-device out fo XWorks (ubuntu 20), and play aorund with the data-layer samples (C++)...
I could successfully connect to the device with the "DataLayerClient" sample , and successfully ping the device.
i worte a generic fun to create nodes :
but when i want to add (removeSync/createSync) a ne node the the dataLayer i get the "DL_INVALID_ADDRESS".
Do i have wrong charakters in the node path , or what are the issue?
Thanks in advance
Solved! Go to Solution.
06-07-2022 04:08 PM - edited 06-07-2022 04:09 PM
Hi schwebo,
The Data Layer has a Client<->Broker<->Provider architecture. The Data Layer is the broker in this architecture. And any app can be a Client or a Provider (or both).
So in general, you need a provider to make Data accessable in the Data Layer.
If you want to create a node with the createSync()-Methode (or createAsync), you need a provider which implements a onCreate callback-method, which gets called by the broker if a client does a createSync() on a address in the Data Layer which is registered for your provider. In addition the metadata of the provided node have to permit a create to this address.
You can have a look at the cpp-sample datalayer.provider.all-data. This sample-provider registers with a double wild card (see documentation for more information) to the address "sdk-cpp-all-data". Here it creates two branches "dynamic" and "static". At these branches the provider provides sub nodes for most of the data types of the Data Layer. The dynamic branch is changeable. Nodes can be written or even deleted by clients. Furthermore new nodes or whole sub branches can be created (with the use of createSync() of a client to a address below "sdk-cpp-alldata/dynamic").
Here you can get further and more detailed information about the Data Layer:
Best regards,
Nick
06-08-2022 05:55 AM
Good morning,
thank for your detail answer. But when we assume we have a bi-directnal connection, i have to instancuate a IClient and a IProvider interface in my app. That meand the IProvider does not implicit consume data like a IClient right !? (if i gathered from the API right)
Thank you Boris
06-08-2022 03:14 PM
Hi Boris,
a provider does not send queries (e.g. browse, read, write, create, delete, metadata) to nodes in the Data Layer. But the provider knows the data it providers in the Data Layer, since it has to know the answer to these queries.
In general you always have one provider for a specific path in the Data Layer, this provider has to keep the data for every node he is responsible for.
On the other hand you can have many different Clients which can consume this data, the provider makes available.
Best regards,
Nick