Qt 5.15.2 and RaspberryPi4: Problems with OPC-UA Client
-
Dear Community,
currently I am trying to set up an OPC-UA Client, which I would like to run on a Raspberry Pi 4. I am using a Xubuntu 20.04 Virtual Machine and Qt 5.15.2 for Development tasks. I have some problems with compiling the "connecToEndpoint" function and I cannot find the solution for this problem.
For the deployment of the modules "qtbase" and "qtopcua" on the Raspberry Pi 4 I used this guide for cross compilation: https://wapel.de/?p=842
Here is the part of project, which is not working:
void OpcuaModuleBackend::connectToEndpoint(const QString &url, qint32 index) { if (m_connected) return; QOpcUaProvider provider; if (index < 0 || index >= m_backends.size()) return; // Invalid index if (!m_client || (m_client && m_client->backend() != m_backends.at(index))) { m_client.reset(provider.createClient(m_backends.at(index))); if (m_client) QObject::connect(m_client.data(), &QOpcUaClient::stateChanged, this, &OpcuaModuleBackend::clientStateHandler); } if (!m_client) { qWarning() << "Could not create client"; m_successfullyCreated = false; return; } m_successfullyCreated = true; m_client->connectToEndpoint(QUrl(url)); }
And the error message after compiling:
Is there anyone, who had the same problem?
What can be the solution for this problem?Thank you in Advance!
-
Dear Community,
currently I am trying to set up an OPC-UA Client, which I would like to run on a Raspberry Pi 4. I am using a Xubuntu 20.04 Virtual Machine and Qt 5.15.2 for Development tasks. I have some problems with compiling the "connecToEndpoint" function and I cannot find the solution for this problem.
For the deployment of the modules "qtbase" and "qtopcua" on the Raspberry Pi 4 I used this guide for cross compilation: https://wapel.de/?p=842
Here is the part of project, which is not working:
void OpcuaModuleBackend::connectToEndpoint(const QString &url, qint32 index) { if (m_connected) return; QOpcUaProvider provider; if (index < 0 || index >= m_backends.size()) return; // Invalid index if (!m_client || (m_client && m_client->backend() != m_backends.at(index))) { m_client.reset(provider.createClient(m_backends.at(index))); if (m_client) QObject::connect(m_client.data(), &QOpcUaClient::stateChanged, this, &OpcuaModuleBackend::clientStateHandler); } if (!m_client) { qWarning() << "Could not create client"; m_successfullyCreated = false; return; } m_successfullyCreated = true; m_client->connectToEndpoint(QUrl(url)); }
And the error message after compiling:
Is there anyone, who had the same problem?
What can be the solution for this problem?Thank you in Advance!
@Mauda The error messages are actually quite clear: there is no connectToEndpoint() method in QOpcUaClient which takes a QUrl parameter. You also can see it if you check documentation: https://doc-snapshots.qt.io/qtopcua/qopcuaclient.html#connectToEndpoint
You have to pass a parameter of type https://doc-snapshots.qt.io/qtopcua/qopcuaendpointdescription.html -
Dear jsulm,
thank you for your reply and your help with description link.
That helped to solve the problem by my own.I replaced
m_client->connectToEndpoint(QUrl(url));
by
QOpcUaEndpointDescription d; d.setSecurityMode(QOpcUaEndpointDescription::None); d.setSecurityPolicy("http://opcfoundation.org/UA/SecurityPolicy#None"); d.setEndpointUrl("ServerAdress"); //Add your server adress m_client->connectToEndpoint(d);