Hi,
I have a OPCUA Server, it contains an object and the object contains a changeable variable by OPC Clients. I want to know when the client changes this variable's value. How can I implement this feature to my server code?
Note: I am using the UaModeler to create this object and other things
Thanks!
Getting Variable Value Data Change Event
Moderator: uasdkcpp
-
- Jr. Member
- Posts: 4
- Joined: 13 Sep 2023, 10:06
- Support Team
- Hero Member
- Posts: 3078
- Joined: 18 Mar 2011, 15:09
Re: Getting Variable Value Data Change Event
Hello alccetinkaya,
there are 3 ways to get there:
1) change the value handling of the variables and override the method writeValues in the NodeManager.
example: https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/L3GettingStartedLesson03.html
2) override the method afterSetAttributeValue in the NodeManager
example in the demoserver (project server_cpp_demo) - search for "NodeManagerDemo::afterSetAttributeValue"
3) create in internal subscription in the server to monitor variables for value changes
see: https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/classServerManager.html#a5abbca078144f65976ec2db25b71d2a0
This feature is also used in the demoserver (project server_cpp_demo) in HistoryManagerCache::startLogging
there are 3 ways to get there:
1) change the value handling of the variables and override the method writeValues in the NodeManager.
example: https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/L3GettingStartedLesson03.html
2) override the method afterSetAttributeValue in the NodeManager
example in the demoserver (project server_cpp_demo) - search for "NodeManagerDemo::afterSetAttributeValue"
3) create in internal subscription in the server to monitor variables for value changes
see: https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/classServerManager.html#a5abbca078144f65976ec2db25b71d2a0
This feature is also used in the demoserver (project server_cpp_demo) in HistoryManagerCache::startLogging
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 4
- Joined: 13 Sep 2023, 10:06
Re: Getting Variable Value Data Change Event
Thanks for the answer.
I decided to use option 2 and I can access the modified variable with the parameter "UaNode *pNode". I want to ask if it is possible to access other variables and change their values?
I decided to use option 2 and I can access the modified variable with the parameter "UaNode *pNode". I want to ask if it is possible to access other variables and change their values?