registerDomain

registerDomain — registers to receive updates from domain points.

Syntax

For C++:

ST_STATUS registerDomain(LPCTSTR  domainname,
 int  flags);

For Java and C#:

Exception registerDomain(String  domainname,
 int  flags);

Parameters

domainname

The name of a domain.

flags

Specifies conditions and actions associated with registering the domain points, as follows (flags may be combined):

    DHC_FLAG_REG_FUTURE: points created in the future are also affected. If not set, then only those points existing (in the domain) at the time the command message is received by the DataHub are registered.

    DHC_FLAG_REG_QUALIFY: point names are to be transmitted with the domain name prepended to the point name, as domainname:pointname.

    DHC_FLAG_REG_ONCEONLY: the point values are transmitted only once, and the points remain unregistered. This mode is useful for obtaining an initial list of available points from which a selection is made of which ones to register.

Returns

For C++:

    ST_OK if the command was successfully sent to the DataHub. Since the command is sent asynchronously, the actual success or failure of the command must be determined through the onSuccess or onError message handlers.

    ST_NO_TASK if a connection to the DataHub does not exist.

    ST_ERROR if the connection socket is unable to send the message.

Description

This method registers the client to receive updates from the DataHub when the value of any points in the specified domain change. The onPointChange method is called for each point update received. The registerDomain method may be called more than once, and on different domains.

Upon registering the domain, all points currently in that domain of the DataHub are immediately transmitted to the client. Points that are subsequently created will only be sent if the DHC_FLAG_REG_FUTURE flag is specified. The DHC_FLAG_REG_QUALIFY flag is useful for distinguishing points from different domains that have the same name.

In a typical scenario, either there is no need to register for all points, or the point names are not even known. In either case, you can use the DHC_FLAG_REG_ONCEONLY flag to generate an initial list of all available points in the specified domain. Then you can call registerPoint on any points of interest, as they are received in onPointChange.

See Also

unregisterPoint, setDefaultDomain, registerPoint