Professional OPC
Development Tools

logos

Question about possibility of programmatically subscribe / unsubscribe property in live binding

More
21 Mar 2016 14:48 #3946 by support
This appears to be actually a "live mapping", not a "live binding" question.

The DAClientMapper object has following method that can be used:
public void Subscribe(bool active, [NotNull] IEnumerable<IDAClientMapping> mappings)

The 'active' flag indicates whether to subscribe or unsubscribe. This method accepts a list of mappings that should be affected. They may not be easy to obtain, and therefore, in addition, there are extension methods that allow various form of selecting the mappings:
static public void SubscribeTarget(
            [NotNull] this DAClientMapper clientMapper,
            bool active,
            [NotNull] Predicate<IEnumerable<string>> mappingTagsPredicate,
            [NotNull] object targetObject,
            bool recurse)

The above method enumerates all mapping on a target object (and possibly all below it, recursively), and you provide a predicate (a test) that for each of the mapping decides whether it should be affected or not.
static public void SubscribeTarget(
            [NotNull] this DAClientMapper clientMapper, 
            bool active,
            [NotNull] string mappingTag, 
            [NotNull] object targetObject, 
            bool recurse)

The above method selects the mapping based on mapping tags (read the doc - they can be specified using attributes as well).
static public void SubscribeTarget(
            [NotNull] this DAClientMapper clientMapper,
            bool active,
            [NotNull] object targetObject,
            bool recurse)

The above method affects all mapping on a given target object, without further distinction.

I hope this helps.
Best regards

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

More
21 Mar 2016 11:32 #3944 by miron
Hi,
I have question, about possibility of programmatically subscribe / unsubscribe
C# property which was marked by "[DAItem(Operations = DAItemMappingOperations.Subscribe)]".

After mapping C# object I would like to unsubscribe / subscribe some chosen property
which was marked by this attribute [DAItem(Operations = DAItemMappingOperations.Subscribe)].

Is it possible?
How I could accomplish it?

Thank you.

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

Moderators: support
Time to create page: 0.171 seconds

      

 Recommend this on Google