-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix HistoryRead bit not set in Server object EventNotifier when history capabilities are enabled #3252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
…ry capabilities Co-authored-by: romanett <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3252 +/- ##
==========================================
- Coverage 57.74% 57.71% -0.04%
==========================================
Files 365 365
Lines 79419 79443 +24
Branches 13865 13868 +3
==========================================
- Hits 45862 45852 -10
- Misses 29310 29331 +21
- Partials 4247 4260 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…read-bit-server-object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The History Read / Write bits are correctly set now in the Server Object
…read-bit-server-object
m_configuration); | ||
|
||
// Initialize history capabilities and update Server EventNotifier accordingly | ||
DiagnosticsNodeManager.GetDefaultHistoryCapabilities(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is already called in the next method
Problem
When implementing an OPC UA server with event history support, the HistoryRead bit (0x04) in the EventNotifier attribute of the Server object was not being set, even when
AccessHistoryEventsCapability
was configured to true in the ServerCapabilities. This prevented OPC UA clients from discovering that the server supports historical event reads on the Server object.According to the OPC UA specification, when a server supports history read capabilities, the Server object's EventNotifier should have the HistoryRead bit set to indicate this capability to clients.
Solution
This PR implements a systematic approach to synchronize the Server object's EventNotifier with the configured history capabilities:
1. New Virtual Method in DiagnosticsNodeManager
Added
UpdateServerEventNotifier()
method that:AccessHistoryEventsCapability
orAccessHistoryDataCapability
is enabledpublic virtual
to allow customization in derived classes2. Automatic Initialization in ServerInternalData
Modified
CreateServerObject()
to:GetDefaultHistoryCapabilities()
to ensure history capabilities are initializedUpdateServerEventNotifier()
to update the Server EventNotifier based on the configured capabilities3. Integration Test
Added
ServerEventNotifierHistoryReadBit
test in ReferenceServerTest.cs that verifies:AccessHistoryEventsCapability
andAccessHistoryDataCapability
Example Usage
After this fix, servers with history capabilities enabled will automatically have the correct EventNotifier bits set:
For runtime updates:
Compatibility
Addresses
Fixes the issue described in the original problem statement where setting
AccessHistoryEventsCapability
to true should result in the HistoryRead bit being set on the EventNotifier attribute of the Server object.Co-authored-by: @romanett
Original prompt
Fixes #2081
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.