Generic client: single sampling scheduler and monitored item fixes - #36
Generic client: single sampling scheduler and monitored item fixes#36viacheslauK wants to merge 12 commits into
Conversation
…rence and usage steps
…ructor to prevent use after destruction
8e76917 to
c3752de
Compare
…ependent, drop macOS skips
| | `DeviceNodeIDNumeric` | Int | `0` | at connect | | ||
| | `DeviceNamespaceIndex` | Int | `0` | at connect | | ||
|
|
||
| Everything except `TimestampMode` is read once while the device is being created; changing those |
There was a problem hiding this comment.
so everything except TimestampMode can be read only property
There was a problem hiding this comment.
also im not sure that its a great choice to publish user name and password. additionally username and location is existing in "General" property
PropertyObjectPtr config = instance.createDefaultAddDeviceConfig();
PropertyObjectPtr general = config.getPropertyValue("General");
general.setPropertyValue("Username", username);
general.setPropertyValue("Password", password);There was a problem hiding this comment.
and to get local id you can just type device.getLocalId() so the property just duplicates the functionality
There was a problem hiding this comment.
also im not sure that its a great choice to publish user name and password
It is really not a good way but it is not a subject of the PR. Also this will also go away with the introduction of an authentication manager. I would leave Password/Username as is right now.
There was a problem hiding this comment.
so everything except TimestampMode can be read only property
All these properties are outside of a device. They are used to create a device but only TimestampMode is displayed as a device property.
There was a problem hiding this comment.
and to get local id you can just type device.getLocalId() so the property just duplicates the functionality
LocalId property is used to set a device local Id (before creation)
| BEGIN_NAMESPACE_OPENDAQ_OPCUA_GENERIC | ||
|
|
||
| class OpcUaMonitoredItemFbImpl final : public FunctionBlock | ||
| class OpcUaMonitoredItemFbImpl final : public FunctionBlock, public ISampledItem |
There was a problem hiding this comment.
u can do
class OpcUaMonitoredItemFbImpl final : public FunctionBlockImpl<IFunctionBlock, ISampledItem>
{
}There was a problem hiding this comment.
It is not a real openDAQ interface. And I don't think we should make it that way.
| } | ||
| } | ||
|
|
||
| void SamplingScheduler::loop() |
There was a problem hiding this comment.
I would probably do the simple scheduler where the item set the fn, the scheduler should call, and inside the function should done all checks. if now samples, just return.
and maybe while registering callback get the id of fn (just incremental counter) so than you can remove function. or scheduler which has a queue of tasks, and inside fn you can re register the fn itself
Summary
Replaces the reader thread that each
OpcUaMonitoredItemFbImplused to own with oneSamplingSchedulerper device, and fixes several monitored-item defects found along the way.Changes
SamplingScheduler(new) drives every monitored item of a device from one thread, each item keeping its own deadline.OpcUaDataValue::isDateTime(); DateTime values now build a packet and are read asUA_DateTimeinstead ofreadScalar<UA_Int64>, including theUtcTimesubtype.SamplingIntervalrejects negative and above-uint32_tvalues; reads reject a null value, report a failed packet build, and catchstd::exception/...beyondOpcUaException.test_sampling_scheduler.cpp; device and monitored-item suites extended; test server publishes.dtand.utcnodes;USAGE.mdadds a property reference and walkthrough.