Professional OPC
Development Tools

logos

PHP ItemChanged Events For Multiple Subscribed Items

More
10 Apr 2014 17:34 - 10 Apr 2014 17:34 #1824 by support
This is one way of doing it; it is not usually very efficient.

The primary means of associating the notifications with something useful to your application is using the State argument to the SubscribeItem method. You can pass in any information you like, a different one for each item, and when the notification is raised, you can retrieve the State property from the event arguments object, and use it according to the design of you app.
Last edit: 10 Apr 2014 17:34 by support.

Please Log in or Create an account to join the conversation.

More
10 Apr 2014 17:12 #1823 by LordAshes
I found a VB6 example among your examples which illustrated the use of ItemDescriptor->ItemId to get this information. Thanks.

Please Log in or Create an account to join the conversation.

More
10 Apr 2014 14:58 #1822 by LordAshes
In the Download section of your website, when you click PHP, there is an example that shows how to use PHP with the ItemChanged event. The example shows how to read the Vtq of the changed item. Looking through your documentation the Vtq class provides properties such as Value, Timestamp and Quality but I don't see how to determine the item (OPC tag) that actually tripped the event.

In the case of the PHP example provided, only item (OPC tag) is subscribed to so the item is implied but if the example is expended to include multiple subscribed tags, one would need to know which item (OPC tag) caused the event trip.

The ItemChanged event (at least in the example) provides a $varSender parameter (which might be the item that tripped the event) but I have not been able to successfully display its contents or identify its class type so that I can use the documentation to determine what properties it has.

Or is this not possible and one needs to register a separate event for each subscribed item?

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.230 seconds

      

 Recommend this on Google