Comments (10)
I did an error on my side. With the UA_Server_addNode_begin() and UA_Server_addNode_finish() and the HasInterface reference it works just fine.
from sample-server.
At the moment, there are no specific attributes for interfaces, as in MachineTools, Interfaces are only used for TypeDefinitions, e.g. here, but it should work the same way.
As for all acessable OPC UA Variable a C++ variable must be available, the State must use another type than ns0::BaseObject_t
(as this has no members).
E.g. (Unchecked, only as a demonstration)
struct IWWState_t {
BinableMember<ns0::StateVariable_t> CurrentState;
}
REFL_TYPE(
woodworking::IWWState_t ,
UmatiServerLib::attribute::UaObjectType(UmatiServerLib::constexp::NodeId(constants::NsWoodworkingUri, UA_WOODWORKINGID_IWWSTATE)))
REFL_FIELD(CurrentState)
Then this IWWState_t
should be fine for using in WwMachine_t
for State, if State is a mandatory member.
For optional members which ony use Interfaces, this will not work as expected because the instanciation will use the methods from open62541 to instanciate an object, which will result in an Object of the inteface type (without HasInterface Reference). In this case additional implementations are required.
from sample-server.
In the Woodworking case the IWwStateType has two children of BaseObjectTypes, which a hasInterface Reference to another Type. And each of these BaseObjectTypes have again children of BaseObjectTypes with hasInterface references.
So I couldn't directly adapt your example.
I tried to implement the interface Types, and also dummy structs, that inherit from the interface types to use them. But i couldn't get it to work. Here is the complete code how i tried to implement the type definitions:
ChristophRuckstetter@b695d37
from sample-server.
After investigation, I detected two issues:
- Overview in IWwBaseState_t is an object, so it must be BindableMember instead of BindableMemberValue and some Fields are missing in the reflection (Fixed here: ChristophRuckstetter#1)
- UA_Server_addObjectNode from open62541 seems to ignore HasInterface references when creating the instance. (see also: open62541/open62541#4363 and open62541/open62541#3813) This must be fixed in open62541 for all mandatory childs, as the server expects that UA_Server_addObjectNode create a valid instance.
from sample-server.
from sample-server.
I applied this patch (open62541/open62541#4479) to my open62541 build and tried to bring up the State/Machine/Flags Object by defining the Flags as optional in the TypeDefinitions and calling InstantiateOptional() on Instantiation (ChristophRuckstetter@ab81879) .
This compiles fine, but on runtime it throws the following exception: "terminate called after throwing an instance of 'std::runtime_error'
what(): Could not create optional node, Error: BadTypeDefinitionInvalid".
Is there something else that needs to be done to get the optional objects with hasinterface reference instantiated?
from sample-server.
With #330 also in develop
from sample-server.
On https://github.com/ccvca/Sample-Server/tree/ww_fix 9f9ac79 I fixed a bug, which causes the instanciation of abstract types. But I was not able to fully succeed in creating the optional Object, as I don't know a way to add the childs of that interface:
https://github.com/ccvca/Sample-Server/blob/9f9ac79f752b903421db5acc57a7fbfbc5a9be3a/UmatiServerLib/Instantiation.cpp#L158
open62541/open62541#4479 only supports HasInterfaces on TypeDefinition, but in this case an Object of type BaseObjectType in created and the interfaces are added afterwards.
from sample-server.
Optional children can also be added by implementing the optional child callback. Open62541 will then ask for every optional child if it should be added when an object is added to the server and adds it if the callback function returns true.
My pull request should also support HasInterface references on BaseObjectType objects, but in this case, the object creation must be done via the UA_Server_addNode_begin() and UA_Server_addNode_finish() functions.
from sample-server.
@basyskom-jvoe I tried to create the object with UA_Server_addNode_begin() and UA_Server_addNode_finish() and the object was created properly with the HasInterface reference, but the mandatory children as defined by the interface type weren't created.
I'm not sure if it should behave like that.
When I use UA_Server_addObjectNode (and the optional child callback returns true for the relevant object), the object is created properly with the HasInterface reference, and the mandatory children are also there.
from sample-server.
Related Issues (20)
- Reporting a vulnerability HOT 2
- Unable to pull main image HOT 4
- Image not available HOT 4
- Stacklight - SignalColor and SignalMode are NULL HOT 3
- Configuration HOT 5
- EngineeringUnits of MachineTools instances not complete
- Make use of NodeSet injector in open62541
- Update FullGMS to Release Version of OPC UA for GMS
- BUG: LibreSSL 3.5.3 dev release does not build the server HOT 7
- TODOS PubSub MQTT
- BUG: Rework CI for deleting container images HOT 1
- Discovery URL count and Endpoint Count defer
- GMS SensorType example HOT 3
- Dependency Dashboard
- Adapt Stacklight Implementation to corrected OPC 10000-200 version HOT 1
- Server causes client disconnect when large chunked messages are read with SignAndEncrypt HOT 2
- Finalize implementation of PubSub in SampleServer
- ShowcaseMachine / FullMachineTool update to UA4MT 1.01.1
- EPIC: Stabilize SampleServer
- Container image "main" draws 100% CPU on one core HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sample-server.