FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
05-11-2022 10:39 PM - edited 05-11-2022 10:43 PM
Hi colleagues,
I'm using the SDK for developing a datalayer provider in my application. The code successfully compiles and runs on my PC, registering a bunch of nodes remotely in the ctrlX Core. The problem starts when trying to snap the app. When the ctrlX Core tries to start up the service for the snap, it throws the error below.
2022-05-09T05:06:44-03:00 focas-gateway.run[6227]: [2022-05-09 05:06:44.375] [info] Starting Datalayer Provider
2022-05-09T05:06:44-03:00 focas-gateway.run[6227]: terminate called after throwing an instance of 'std::system_error'
2022-05-09T05:06:44-03:00 focas-gateway.run[6227]: what(): Invalid argument
Some investigation led me to conclude that the app throws the std::system_error when reaches the call to m_datalayer.start(false), which makes me wonder if there still some setup to be made before calling itor maybe some unmet dependency. Although I got this provider code from the sdk samples-cpp, is it correct? Am I missing something?
Provider::Provider(Parser *parser) : m_parser(parser)
{
// The app throws when calling the method below.
m_datalayer.start(false); // type: comm::datalayer::DatalayerSystem
// Never reaches the code below
std::string connectionString = getConnectionString();
spdlog::info("Datalayer provider connection: {}", connectionString);
m_provider = m_datalayer.factory()->createProvider(connectionString);
if (m_provider->start() != DL_OK && !m_provider->isConnected()) {
m_error = true;
spdlog::error("Failed to instantiate datalayer provider connection");
throw std::runtime_error("Failed to instantiate datalayer provider connection");
}
}
Here is my snapcraft.yaml:
apps:
run:
command: bin/exec-runner
plugs:
- network
- network-bind
- datalayer
[...]
parts:
executable:
after: [dependencies]
plugin: dump
source: ./build/bin
organize:
"*": bin/
datalayer-lib:
after: [dependencies]
plugin: dump
source: https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/1.14.0/ctrlx-datalayer-1.7.13.deb
dependencies:
plugin: nil
stage-packages:
- libzmq5
Solved! Go to Solution.
05-19-2022 03:35 PM
Hello,
did you test the provided examples in the SDK? There are two C++ samples for a simple provider in the Data Layer:
Did you try out these examples and did the samples work for you?
Please have a look into the samples and check what you are doing different in your snap. I'm not aware of what you are doing in your snap but your snapcraft.yaml looks very different then any snapcraft.yaml we provide in our samples. What is the reason for that? Please especially have a look at the plug: datalayer we use in the samples.
Best regards,
Nick