A new BGGroup object is created and added to this BGServer instance. In the OPC DA server a group is added to the associated server instance and the group is associated with the new BGGroup object.
A BGGroup is required for data change handling and for read/write operations.
Visual Basic (Declaration) | |
---|---|
Public Overloads Sub AddGroup( _ ByVal groupName As String, _ ByVal active As Boolean, _ ByVal requestedUpdateRate As Integer, _ ByVal clientHandle As Integer, _ ByVal doAdviseCallbacks As Boolean, _ ByVal DataChangedHandler As DataChangeEventHandler, _ ByVal tag As Object, _ ByVal onCompleted As OnBGSrvAddGroup _ ) |
C# | |
---|---|
public void AddGroup( string groupName, bool active, int requestedUpdateRate, int clientHandle, bool doAdviseCallbacks, DataChangeEventHandler DataChangedHandler, object tag, OnBGSrvAddGroup onCompleted ) |
Parameters
- groupName
- The name identifies the group in the group list and enables the user to search the BGGroup object by the name. The group is created in the server with this name.
- active
- The initial active state og the gorup. Data change callbacks occur only for active groups. Ifa group is to be used with read/write operations only then the state can be set to inactive in order to prevent data changed callbacks. The handling of read/write operations is not influenced by the active state of the group.
- requestedUpdateRate
- The fastest rate the server is allowed to make data changed callbacks. The server may use a modified rate if the requested rate is outside of the server's allowed range.
- clientHandle
- This handle is returned in data change callbacks to allow the user to associate the values with the proper item. It's only used if multiple groups use the same callback handler and the item client handles are not unique over all groups.
- doAdviseCallbacks
- Determines if AdviseIOPCCallbacks is called to enbale the callback handling.
- DataChangedHandler
- This method is called from the server on data changed events. The BGGroup intercepts the callback and synchronizes it with the user thread by calling BeginInvoke of the of the Form object associated with the underlying BGServer object.
Can be null (Nothing) if no callback handling is required. - tag
- This object is passed to the competion handler and allows the user to pass any information that may be needed in the completion handler. null (nothing) can be specified if the application does not require to pass any information.
- onCompleted
- Competion notification handler. void xxx( BGException ex, BGGroup group, object tag ){}