DOFSystemcreateSubscription Method (DOFObjectID, DOFInterfaceProperty, Int32, DOFSubscriptionListener, Object)OpenDOF Object Access Library
Used by a Requestor to begin and maintain a subscription, as specified using a context, to be notified of changes to a property's value.

Namespace: org.opendof.core.oal
Assembly: dof-oal (in dof-oal.dll) Version: 7.0.1.2
Syntax

C#
public DOFSubscription createSubscription(
	DOFObjectID oid,
	DOFInterfaceProperty property,
	int minPeriod,
	DOFSubscriptionListener listener,
	Object context
)

Parameters

oid
Type: org.opendof.core.oalDOFObjectID
The identifier of the object. This must not be null. May be DOFObjectID.BROADCAST.
property
Type: org.opendof.core.oalDOFInterfaceProperty
The property. Must not be null.
minPeriod
Type: SystemInt32
The minimum time, in milliseconds, that should elapse between property update notifications. Must be >= 0.
listener
Type: org.opendof.core.oalDOFSubscriptionListener
Listener to receive state-changed and value-changed notifications. Should not be null (or notifications cannot be received).
context
Type: SystemObject
An optional, user-definable object that will be passed back in listeners as a member of DOFOperation. May be null.

Return Value

Type: DOFSubscription
The DOFSubscription that may be used to destroy the subscription. Will not be null.
Exceptions

ExceptionCondition
DOFErrorException If parameters fail validation. Exception errorCode is:
  • NOT_READABLE for write-only property
DOFErrorException
Remarks

Used by a Requestor to begin and maintain a subscription, as specified using a context, to be notified of changes to a property's value. If oid is DOFObjectID.BROADCAST , DOFSubscription will subscribe to all matching providers at the time the subscription is created. Otherwise, it will select one matching provider and subscribe to its matching property. If there is no matching provider, then DOFSubscription will wait for one. If the provider goes away, then the search will resume for a matching provider.

To cancel the subscription, call DOFSubscription.destroy() .

NOTE: The Property's current value is always returned when the subscription is started.

NOTE: Intermediate changes that occur more frequently than minPeriod may be dropped to save bandwidth, but the most current value of the Property is always returned.

NOTE: An application must first express interest by calling beginInterest(DOFObjectID, DOFInterestLevel) for unicast subscriptions in order to determine the primary provider. If no interest is specified, then no non-local providers will be found.

See Also

Reference