UaoForQuasar (UA Objects) is a code generation tool that creates type-safe OPC UA client classes in C++ based on quasar server designs. It simplifies OPC UA client development by generating client code that matches your quasar server's information model.
UA Objects uses a priori information from your OPC UA server's information schema to generate client classes that are specifically tailored to your application. This approach provides several benefits:
- No OPC UA expertise required - Create type-safe OPC UA clients without deep protocol knowledge
- Type safety - Generated code ensures type correctness at compile time
- Error handling - Built-in error handling for OPC UA operations
- Clean abstraction - Use your OPC UA server's objects directly in client code
- Client classes are specific to your quasar application design
- Currently handles only single requests to OPC UA Read Service (not batch operations)
- Requires Unified Automation SDK (UASDK)
- quasar Framework - UaoForQuasar must be deployed in a quasar project
- Reference: https://github.com/quasar-team/quasar
- Unified Automation SDK - The generated client code depends on UASDK
- Commercial: https://www.unified-automation.com/products/server-sdk/c-ua-server-sdk.html
- Evaluation license available for testing
- Python Dependencies
- Jinja2 (templating engine)
- colorama (terminal coloring)
- pyuaf (OPC UA Access Framework)
# In your quasar project directory
git submodule add https://github.com/quasar-team/UaoForQuasar.git
git submodule updateGenerate a client class for each quasar class you want to access:
python UaoForQuasar/generateClass.py MyClassYou can specify a C++ namespace for your generated code:
python UaoForQuasar/generateClass.py --namespace MyProject MyClassGenerated files will be placed in UaoForQuasar/generated/.
The following example shows how to use a generated client class:
#include <ClientSessionFactory.h>
// Include your generated client class
#include <MyClass.h>
#include <uaplatformlayer.h>
#include <iostream>
int main()
{
UaPlatformLayer::init();
UaClientSdk::UaSession* session = ClientSessionFactory::connect("opc.tcp://127.0.0.1:4841");
if (!session)
return -1;
MyClass myObject(session, UaNodeId("instance1", 2));
std::cout << "Value = " << myObject.readMyVariable() << std::endl;
return 0;
}A demo application is included to show how to use the generated client code:
- Navigate to the demo directory
- Adjust
demo.cppto use your generated class - Modify
CMakeLists.txtto set the correct paths for UASDK - Build the demo:
cd UaoForQuasar/demo/build
cmake ../
makeFor questions or issues, contact: paris.moschovakos@cern.ch