DANSrvAE Reference
SetState Method
See Also  Send comments on this topic.
NSPlugin Assembly > NSPlugin Namespace > EventSubscription Class : SetState Method

active
TRUE (non-zero) to activate the subscription. FALSE (0) to deactivate the subscription. If the client deactivates the subscription, then the server will no longer send event notifications to the client based on that subscription, and has no responsibility to buffer or maintain the event notifications. Thus event notifications may be lost. Even if the subscription is inactive, the Refresh method will still function. In effect, this allows a client to obtain current condition states from time to time (by invoking Refresh) without the need to process event notifications in “real time”.
activeDefined
Must be TRUE for the 'active' property argument to be processed.
_bufferTime
New buffer time requested for the subscription by the client. If the revised buffer time does not equal the requested buffer time, then the server must return OPC_S_INVALIDBUFFERTIME, unless maxSize is also invalid in which case the server must return OPC_S_INVALIDMAXSIZE. See EventServer.CreateEventSubscription.
bufferTimeDefined
Must be TRUE for the 'bufferTime' property argument to be processed.
_maxSize
New maximum number of event notifications to send with a single OnEvent callback. If the requested MaxSize does not equal the revised MaxSize then the Server must return OPC_S_INVALIDMAXSIZE. See EventServer.CreateEventSubscription.
maxSizeDefined
Must be TRUE for the 'maxSize' property argument to be processed.
_clientSubscription
Client supplied handle for the subscription. This handle is returned in the data stream provided to the client’s IOPCEventSink by the subscription’s IConnectionPoint. Note that this is not a pointer, so you must pass the existing handle even if you do not want to change it.
revisedBufferTime
The buffer time that the server is actually providing, which may differ from bufferTime.
revisedMaxSize
The maximum number of events that the server will actually be sending in a single OnEvent callback, which may differ from dwMaxSize.

Glossary Item Box

Client can set various properties of the event subscription. Only properties with the xxxDefined flag = TRUE are processed.

Syntax

Visual Basic (Declaration) 
Public Function SetState( _
   ByVal active As Boolean, _
   ByVal activeDefined As Boolean, _
   ByVal _bufferTime As Integer, _
   ByVal bufferTimeDefined As Boolean, _
   ByVal _maxSize As Integer, _
   ByVal maxSizeDefined As Boolean, _
   ByVal _clientSubscription As Integer, _
   ByRef revisedBufferTime As Integer, _
   ByRef revisedMaxSize As Integer _
) As Integer
C# 
public int SetState( 
   bool active,
   bool activeDefined,
   int _bufferTime,
   bool bufferTimeDefined,
   int _maxSize,
   bool maxSizeDefined,
   int _clientSubscription,
   out int revisedBufferTime,
   out int revisedMaxSize
)

Parameters

active
TRUE (non-zero) to activate the subscription. FALSE (0) to deactivate the subscription. If the client deactivates the subscription, then the server will no longer send event notifications to the client based on that subscription, and has no responsibility to buffer or maintain the event notifications. Thus event notifications may be lost. Even if the subscription is inactive, the Refresh method will still function. In effect, this allows a client to obtain current condition states from time to time (by invoking Refresh) without the need to process event notifications in “real time”.
activeDefined
Must be TRUE for the 'active' property argument to be processed.
_bufferTime
New buffer time requested for the subscription by the client. If the revised buffer time does not equal the requested buffer time, then the server must return OPC_S_INVALIDBUFFERTIME, unless maxSize is also invalid in which case the server must return OPC_S_INVALIDMAXSIZE. See EventServer.CreateEventSubscription.
bufferTimeDefined
Must be TRUE for the 'bufferTime' property argument to be processed.
_maxSize
New maximum number of event notifications to send with a single OnEvent callback. If the requested MaxSize does not equal the revised MaxSize then the Server must return OPC_S_INVALIDMAXSIZE. See EventServer.CreateEventSubscription.
maxSizeDefined
Must be TRUE for the 'maxSize' property argument to be processed.
_clientSubscription
Client supplied handle for the subscription. This handle is returned in the data stream provided to the client’s IOPCEventSink by the subscription’s IConnectionPoint. Note that this is not a pointer, so you must pass the existing handle even if you do not want to change it.
revisedBufferTime
The buffer time that the server is actually providing, which may differ from bufferTime.
revisedMaxSize
The maximum number of events that the server will actually be sending in a single OnEvent callback, which may differ from dwMaxSize.

Return Value

HResult success/error code

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

© 2004-2017 Advosol Inc. All Rights Reserved.