Skip to content

Conversation

@kostinkirill
Copy link
Contributor

Improvement for #2335

Added minimum polling interval for CHANGE_ON_EVENT subscription type

Copy link
Contributor

@chrisdutz chrisdutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally ok ... but in this case I guess we would need matching Duration-counterparts for:

  • addChangeOfStateTagAddress (Without consumer)
  • addChangeOfStateTag (Without consumer)
  • addChangeOfStateTag (With consumer)

addChangeOfStateTagAddress (Without consumer)
addChangeOfStateTagAddress (With consumer)
addChangeOfStateTag (Without consumer)
@kostinkirill
Copy link
Contributor Author

@chrisdutz added methods with dueration:

  • addChangeOfStateTagAddress (Without consumer)
  • addChangeOfStateTagAddress (With consumer)
  • addChangeOfStateTag (Without consumer)

@chrisdutz
Copy link
Contributor

I assume the next step would be to extend the ADS and possibly the OPC-UA driver to support this, right? Are you planning on continuing to work on this? I's prefer to mentor you through this as it's a bit like the "give a man a fish and he's fed for a day, teach him to fish and he's fed for life" sort of thing ;-)

@chrisdutz
Copy link
Contributor

The question now is: If a driver doesn't implement this Duration-based limiting ... should we throw an "unsupported" error, or should we silently forward it to the duration-less version and log a message?

@kostinkirill
Copy link
Contributor Author

I assume the next step would be to extend the ADS and possibly the OPC-UA driver to support this, right? Are you planning on continuing to work on this? I's prefer to mentor you through this as it's a bit like the "give a man a fish and he's fed for a day, teach him to fish and he's fed for life" sort of thing ;-)

I believe ADS drive already supports it, I've already checked the behavior and minInterval is applied for CHANGE_ON_EVENT subscriptions and works as epxected.
This the code where the minInterval is set up as cycleTimeInMs in AdsAddDeviceNotificationRequest
`AdsProtocolLogic#executeSubscribe:

return new AmsTCPPacket(new AdsAddDeviceNotificationRequest(configuration.getTargetAmsNetId(), configuration.getTargetAmsPort(),
                    configuration.getSourceAmsNetId(), configuration.getSourceAmsPort(),
                    0, getInvokeId(),
                    directAdsTag.getIndexGroup(),
                    directAdsTag.getIndexOffset(),
                    adsDataTypeTableEntry.getSize() * numberOfElements,
                    tag.getPlcSubscriptionType() == PlcSubscriptionType.CYCLIC ? AdsTransMode.CYCLIC : AdsTransMode.ON_CHANGE, // if it's not cyclic, it's on change or event
                    0, // there is no api for that yet
                    tag.getDuration().orElse(Duration.ZERO).toMillis()));

(the last argument)

As for OPCUA, I haven't checked it, but based on the code it should work as well

@kostinkirill
Copy link
Contributor Author

The question now is: If a driver doesn't implement this Duration-based limiting ... should we throw an "unsupported" error, or should we silently forward it to the duration-less version and log a message?

I'd say drive implements it

@chrisdutz
Copy link
Contributor

Interesting ... wasn't expecting that to work ;-)

But yeah ... having a look at the code, it actually makes sense. Cool ... so I guess this is ready to being merged ;-)

Thanks :-)

@chrisdutz chrisdutz merged commit af9008c into apache:develop Nov 11, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants