open62541 1.5.7+3
open62541: ^1.5.7+3 copied to clipboard
Dart FFI bindings to the open62541 OPC UA stack. Provides client and server APIs for OPC UA over TCP, with subscriptions, custom types and mbedTLS encryption.
Changelog #
The version number tracks the bundled open62541
release, followed by a package revision suffix (+1, +2, ...) for Dart-side
changes that ship the same native library version.
1.5.7+3 #
- Dependency prune: dropped
tuple(theTuple2<NodeId, AttributeId>keys in the client's monitored-items bookkeeping are now Dart 3 records, same structural equality) and the unusedcollectiondependency. - Data-source reads carry a status code + source timestamp.
Server.addDataSourceVariableNodegainedonReadValue, a richer alternative toonRead(provide exactly one): it returns aDataSourceValue(value+statusCode+ optionalsourceTimestamp), letting a proxy serve e.g. its last-known value withBad_NoCommunicationwhile the backing device is down instead of silently reporting stale data as Good (a Bad status still carries the value, as OPC UA allows). On the client,Client.readValue(nodeId)(also onClientApi/ClientIsolate) returns aDataValue— decoded value, operationstatusCode(isGood/isUncertain/isBad),sourceTimestampandserverTimestamp— and does NOT throw on a non-Good operation status;Client.read/readAttributekeep their existing throw-on-non-Good behavior. Monitored items already surfaced a non-Good notification as a stream error event (the notification's value/timestamps are not delivered on the data stream); that behavior is unchanged and now documented — the error carries the decoded status. Also exported:statusCodeToStringand theUA_STATUSCODE_BADNOCOMMUNICATION/BADNOTWRITABLE/BADUSERACCESSDENIED/BADINTERNALERRORconstants. - Typed status-code rejection for data-source writes. New
UaStatusException(statusCode)(exported): a data-sourceonWritethat throws it answers the client with exactly that status code — e.g.Bad_NotWritable(0x803B0000) for a gate-denied write orBad_UserAccessDenied(0x801F0000) — instead of the genericBad_InternalErrorthat any other throw still maps to. The read dispatcher honors it symmetrically (onRead/onReadValuethrowing one fails the read with that code and no value). Client side, the code is now extractable:Client.writefails with aUaStatusExceptioncarrying the operation (or service) status instead of a formatted string, and a monitored-item stream's error event for a non-Good notification is aUaStatusExceptiontoo (was a string;ClientIsolatestill marshals stream/request errors as strings across the isolate boundary, so there the code survives only inside the message text). - Server session/subscription statistics. New
Server.statisticsreturns aServerStatisticssnapshot: the secure-channel counters (currentChannelCount,cumulatedChannelCount, rejected/timeout/abort/ purge) and session counters (currentSessionCount,cumulatedSessionCount, securityRejected/rejected/timeout/abort) fromUA_Server_getStatistics(), pluscurrentSubscriptionCount,cumulatedSubscriptionCountandcurrentMonitoredItemCount(the sum of the per-subscriptionmonitoredItemCounts) read from the NS0 server-diagnostics nodes. No native/CMake change was needed:UA_ENABLE_DIAGNOSTICSis ON by default in open62541 1.5.7 and was already part of this package's build — the subscription-side fields are typed nullable and come backnullonly on a build without those NS0 nodes. Regenerated the FFI bindings (additive) withUA_Server_getStatisticsand theUA_ServerStatistics/UA_SecureChannelStatistics/UA_SessionStatistics/UA_ServerDiagnosticsSummaryDataType/UA_SubscriptionDiagnosticsDataTypestructs;test/verify_sizes_test.dartpins their layouts against the native type table. - PubSub (OPC UA Part 14) support, UDP + UADP transport. The native build
now enables
UA_ENABLE_PUBSUBandUA_ENABLE_PUBSUB_INFORMATIONMODEL(bundled open62541 still v1.5.7; MQTT/SKS/raw-Ethernet transports stay off), andServergained an idiomatic PubSub API. Publisher side:addPubSubConnection(UDP multicast/unicast URL +PubSubPublisherId),addPublishedDataSet,addDataSetField(publishes an existing variable node),addWriterGroup(publishing interval; UADP message settings default to sending PublisherId/GroupHeader/WriterGroupId/PayloadHeader so readers can match) andaddDataSetWriter. Subscriber side (which in OPC UA also hangs off the server):addReaderGroup,addDataSetReader(matches publisherId/writerGroupId/dataSetWriterId and carries the DataSetMetaData built fromDataSetFieldMetaentries) andsetDataSetReaderTargetVariables(maps received fields positionally into local variable nodes). Components are created disabled;enableAllPubSubComponents/disableAllPubSubComponentsdrive the Part 14 state machine and the per-component states are readable viawriterGroupState/dataSetWriterState/readerGroupState/dataSetReaderState(PubSubState).triggerWriterGroupPublishpublishes on demand. Server.onValueChanged(nodeId): a broadcast stream of every value written to a variable node (client writes,Server.write, and PubSub DataSetReader deliveries into target variables), backed by open62541's after-write value notification — the idiomatic way to consume received PubSub values.NodeIdnow supports GUID identifiers (NodeId.fromGuid,isGuid(),guid,ns=X;g=...formatting). Needed because open62541 identifies DataSetFields by GUID NodeIds; previouslyNodeId.fromRawthrew on any GUID-typed id.- Regenerated the FFI bindings with the PubSub API surface
(
UA_Server_addPubSubConnection,UA_Server_addPublishedDataSet,UA_Server_addDataSetField,UA_Server_addWriterGroup,UA_Server_addDataSetWriter,UA_Server_addReaderGroup,UA_Server_addDataSetReader,UA_Server_setDataSetReaderTargetVariables, enable/disable/state functions, and the PubSub config structs).test/verify_sizes_test.dartpins the grownUA_ServerConfig(now embedsUA_PubSubConfiguration) and the PubSub config struct layouts;UA_ClientConfigis unchanged. - Not yet exposed: delta frames (
keyFrameCountis plumbed but open62541'senableDeltaFramesserver option is left off), metadata ConfigurationVersion handling, PubSub message security (SKS/security policies), MQTT/Ethernet transports, and standalone SubscribedDataSets.
1.5.7+2 #
- Bounded-send fix (native build hook): patch open62541's TCP send path so a
dead/half-open connection can no longer wedge the client forever. In
TCP_sendWithConnection(arch/posix/eventloop_posix_tcp.c), when the OS send buffer fills against a peer that keeps the socket open but stops draining,UA_sendreturnsEWOULDBLOCKand open62541 spins apoll(POLLOUT, 100ms)retry loop with no overall deadline;POLLOUTnever arrives (and on Windows WSAPoll never reportsPOLLHUP/POLLERRfor a peer gone without RST), so the call — made synchronously fromUA_Client_run_iterateon the client isolate's single event-loop thread — never returns and freezes the whole isolate. The fix adds a monotonic wall-clock deadline (compile-time constantUA62541_DART_SEND_DEADLINE_MS, default 5000 ms): on timeout the send is treated as a dead connection and shuts down exactly like any other send error, sorun_iteratereturns,connectStatusgoes bad, and the existingkeepConnectedsupervisor reconnects — no isolate killed, noUA_Clientleaked. The deadline is wall-clock and independent of what poll reports, so it fixes every platform including the Windows WSAPoll case. The change ships as a unified-diff patch file (hook/bounded_send_deadline.patch) that the build hook applies to the extracted open62541 source with a standard patch tool (git apply -p1, falling back topatch -p1); a missing patch file, a missing target file, or a non-zero exit from the patch tool fails the build loudly. Bundled open62541 is unchanged (still v1.5.7); this is a binding-only build change.
1.5.7+1 #
ClientIsolate.keepConnected/stopKeepConnected/reconnectStream: the auto-reconnect supervisor introduced forClientin 1.5.7 is now available on the isolate client too, by delegating to the native client's supervisor inside the isolate. This matters because the isolate client is where a dead session is the most invisible: the caller-siderunIterate()future only completes when native run_iterate returns non-GOOD, so a session that dies while iterate keeps reporting GOOD (seen in production: channel expiring mid-session-create, server FIN never surfacing) parks the caller forever with no error. WithkeepConnectedthe supervisor and its pump live inside the isolate, so recovery does not depend on any error ever reaching the caller. Starting it stops any caller-drivenrunIterate()loop — the supervisor owns the pump, same contract asClient.keepConnected.
1.5.7 #
- Bump bundled open62541 from
v1.5.6tov1.5.7.- Upstream v1.5.7 is a maintenance release focused on security hardening and
stability: rejects custom DataType definitions that overflow
memSize/membersSize, fixes a PubSub off-by-one heap-OOB read ingetFieldMetaData, guards several server-side use-after-free / NULL-deref / recursion-depth issues, and tightens URI and certificate-subject handling in plugins. See https://github.com/open62541/open62541/releases/tag/v1.5.7. - Regenerated the amalgamated header
(
third_party/open62541/open62541_modified.h), theremove_bitfields.patchline offsets, and the ffigen bindings (lib/src/third_party/open62541.g.dart) against v1.5.7. Struct layouts are unchanged:UA_ClientConfig(888 bytes) andUA_DataType(96 bytes) match the previous release, soverify_sizes_teststill passes.
- Upstream v1.5.7 is a maintenance release focused on security hardening and
stability: rejects custom DataType definitions that overflow
- Hardened the native build hook (
hook/build.dart): every third-party source archive is now fetched over HTTPS (scheme enforced in code) and verified against a pinned SHA-256 before use, failing the build loudly on mismatch. - Prepared the package for pub.flutter-io.cn publishing: expanded the description, added
homepage/issue_trackermetadata, raised the SDK floor to^3.10.0(native build hooks are stable from Dart 3.10), and added anexample/.
Native-build feature set (built from source at install time via Dart native
build hooks, downloading open62541 and mbedTLS 3.6.5 and building them with
CMake):
- Enable OPC UA encryption through mbedTLS (
SignAndEncrypt). - Force little-endian IEEE 754 float encoding so subnormal
Float/Doublevalues round-trip correctly on all supported targets. - Patch the client subscription handler so
deleteCallbackfires for every client-side subscription when the server reportsBadNoSubscription(OPC UA Part 4, 5.13.5). - Client APIs: connect/reconnect, browse and recursive tree browse, subscriptions and monitored items, secure connections with certificates.
- Server APIs: variable nodes, array and structure (custom type) nodes, data-type nodes, and variable monitoring streams.
- Supports Linux, macOS, Windows, Android and iOS.