C# 클래스 Opc.Ua.Client.Session

Manages a session with a server.
상속: SessionClient, IDisposable
파일 보기 프로젝트 열기: OPCFoundation/UA-.NET 1 사용 예제들

공개 메소드들

메소드 설명
AddSubscription ( Subscription subscription ) : bool

Adds a subscription to the session.

BeginBrowse ( RequestHeader requestHeader, ViewDescription view, NodeId nodeToBrowse, uint maxResultsToReturn, BrowseDirection browseDirection, NodeId referenceTypeId, bool includeSubtypes, uint nodeClassMask, AsyncCallback callback, object asyncState ) : IAsyncResult

Begins an asynchronous invocation of the Browse service.

BeginBrowseNext ( RequestHeader requestHeader, bool releaseContinuationPoint, byte continuationPoint, AsyncCallback callback, object asyncState ) : IAsyncResult

Begins an asynchronous invocation of the BrowseNext service.

BeginPublish ( int timeout ) : IAsyncResult

Sends an additional publish request.

Browse ( RequestHeader requestHeader, ViewDescription view, NodeId nodeToBrowse, uint maxResultsToReturn, BrowseDirection browseDirection, NodeId referenceTypeId, bool includeSubtypes, uint nodeClassMask, byte &continuationPoint, ReferenceDescriptionCollection &references ) : ResponseHeader

Invokes the Browse service.

BrowseNext ( RequestHeader requestHeader, bool releaseContinuationPoint, byte continuationPoint, byte &revisedContinuationPoint, ReferenceDescriptionCollection &references ) : ResponseHeader

Invokes the BrowseNext service.

Call ( NodeId objectId, NodeId methodId ) : IList

Calls the specified method and returns the output arguments.

ChangePreferredLocales ( StringCollection preferredLocales ) : void

Updates the preferred locales used for the session.

Close ( ) : StatusCode

Disconnects from the server and frees any network resources.

Close ( int timeout ) : StatusCode

Disconnects from the server and frees any network resources with the specified timeout.

Create ( ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, bool updateBeforeConnect, bool checkDomain, string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales ) : Session

Creates a new communication session with a server by invoking the CreateSession service

Create ( ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, bool updateBeforeConnect, string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales ) : Session

Creates a new communication session with a server by invoking the CreateSession service

EndBrowse ( IAsyncResult result, byte &continuationPoint, ReferenceDescriptionCollection &references ) : ResponseHeader

Finishes an asynchronous invocation of the Browse service.

EndBrowseNext ( IAsyncResult result, byte &revisedContinuationPoint, ReferenceDescriptionCollection &references ) : ResponseHeader

Finishes an asynchronous invocation of the BrowseNext service.

FetchNamespaceTables ( ) : void

Updates the local copy of the server's namespace uri and server uri tables.

FetchReferences ( NodeId nodeId ) : ReferenceDescriptionCollection

Fetches all references for the specified node.

FetchTypeTree ( ExpandedNodeId typeId ) : void

Updates the cache with the type and its subtypes.

This method can be used to ensure the TypeTree is populated.

FindComponentIds ( NodeId instanceId, IList componentPaths, NodeIdCollection &componentIds, List &errors ) : void

Finds the NodeIds for the components for an instance.

FindDataDescription ( NodeId encodingId ) : ReferenceDescription

Returns the data description for the encoding.

FindDataDictionary ( NodeId descriptionId ) : DataDictionary

Returns the data dictionary that constains the description.

Load ( string filePath ) : IEnumerable

Load the list of subscriptions saved in a file.

Open ( string sessionName, IUserIdentity identity ) : void

Establishes a session with the server.

Open ( string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales ) : void

Establishes a session with the server.

ReadAvailableEncodings ( NodeId variableId ) : ReferenceDescriptionCollection

Returns the available encodings for a node

ReadDisplayName ( IList nodeIds, List &displayNames, List &errors ) : void

Reads the display name for a set of Nodes.

ReadValue ( NodeId nodeId ) : DataValue

Reads the value for a node.

ReadValue ( NodeId nodeId, Type expectedType ) : object

Reads the value for a node an checks that it is the specified type.

ReadValues ( IList variableIds, IList expectedTypes, List &values, List &errors ) : void

Reads the values for a set of variables.

Reconnect ( ) : void

Reconnects to the server after a network failure.

Recreate ( Session template ) : Session

Recreates a session based on a specified template.

RemoveSubscription ( Subscription subscription ) : bool

Removes a subscription from the session.

RemoveSubscriptions ( IEnumerable subscriptions ) : bool

Removes a list of subscriptions from the sessiont.

Republish ( uint subscriptionId, uint sequenceNumber ) : bool

Sends a republish request.

Save ( string filePath ) : void

Saves all the subscriptions of the session.

Save ( string filePath, IEnumerable subscriptions ) : void

Saves a set of subscriptions.

Session ( ISessionChannel channel, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint ) : System

Constructs a new instance of the session.

Session ( ITransportChannel channel, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, X509Certificate2 clientCertificate ) : System

Constructs a new instance of the session.

The application configuration is used to look up the certificate if none is provided. The clientCertificate must have the private key. This will require that the certificate be loaded from a certicate store. Converting a DER encoded blob to a X509Certificate2 will not include a private key.

Session ( ITransportChannel channel, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, X509Certificate2 clientCertificate, EndpointDescriptionCollection availableEndpoints ) : System
Session ( ITransportChannel channel, Session template, bool copyEventHandlers ) : System

Initializes a new instance of the Session class.

UpdateSession ( IUserIdentity identity, StringCollection preferredLocales ) : void

Updates the user identity and/or locales used for the session.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Closes the session and the underlying channel.

GetSoftwareCertificates ( ) : SignedSoftwareCertificateCollection

Returns the software certificates assigned to the application.

OnApplicationCertificateError ( byte serverCertificate, ServiceResult result ) : void

Handles an error when validating the application instance certificate provided by the server.

OnKeepAlive ( ServerState currentState, System.DateTime currentTime ) : void

Called when the server returns a keep alive response.

OnKeepAliveError ( ServiceResult result ) : bool

Called when a error occurs during a keep alive.

OnSoftwareCertificateError ( SignedSoftwareCertificate signedCertificate, ServiceResult result ) : void

Handles an error when validating software certificates provided by the server.

ValidateSoftwareCertificates ( List softwareCertificates ) : void

Inspects the software certificates provided by the server.

비공개 메소드들

메소드 설명
AsyncRequestCompleted ( IAsyncResult result, uint requestId, uint typeId ) : void

Removes a completed async request.

AsyncRequestStarted ( IAsyncResult result, uint requestId, uint typeId ) : void

Adds a new async request.

CheckCertificateDomain ( ConfiguredEndpoint endpoint ) : void
Initialize ( ) : void

Sets the object members to default values.

Initialize ( ITransportChannel channel, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, X509Certificate2 clientCertificate ) : void

Initializes the channel.

OnKeepAlive ( object state ) : void

Sends a keep alive by reading from the server.

OnKeepAliveComplete ( IAsyncResult result ) : void

Checks if a notification has arrived. Sends a publish if it has not.

OnPublishComplete ( IAsyncResult result ) : void

Completes an asynchronous publish operation.

OnRaisePublishNotification ( object state ) : void

Raises an event indicating that publish has returned a notification.

Open ( string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales, bool checkDomain ) : void
ProcessPublishResponse ( ResponseHeader responseHeader, uint subscriptionId, UInt32Collection availableSequenceNumbers, bool moreNotifications, NotificationMessage notificationMessage ) : void

Processes the response from a publish request.

ReadNode ( NodeId nodeId ) : Node
RemoveRequest ( IAsyncResult result, uint requestId, uint typeId ) : AsyncRequestState

Removes a completed async request.

StartKeepAliveTimer ( ) : void

Starts a timer to check that the connection to the server is still available.

메소드 상세

AddSubscription() 공개 메소드

Adds a subscription to the session.
public AddSubscription ( Subscription subscription ) : bool
subscription Subscription The subscription to add.
리턴 bool

BeginBrowse() 공개 메소드

Begins an asynchronous invocation of the Browse service.
public BeginBrowse ( RequestHeader requestHeader, ViewDescription view, NodeId nodeToBrowse, uint maxResultsToReturn, BrowseDirection browseDirection, NodeId referenceTypeId, bool includeSubtypes, uint nodeClassMask, AsyncCallback callback, object asyncState ) : IAsyncResult
requestHeader RequestHeader The request header.
view ViewDescription The view to browse.
nodeToBrowse NodeId The node to browse.
maxResultsToReturn uint The maximum number of returned values..
browseDirection BrowseDirection The browse direction.
referenceTypeId NodeId The reference type id.
includeSubtypes bool If set to true the subtypes of the ReferenceType will be included in the browse.
nodeClassMask uint The node class mask.
callback AsyncCallback The callback.
asyncState object
리턴 IAsyncResult

BeginBrowseNext() 공개 메소드

Begins an asynchronous invocation of the BrowseNext service.
public BeginBrowseNext ( RequestHeader requestHeader, bool releaseContinuationPoint, byte continuationPoint, AsyncCallback callback, object asyncState ) : IAsyncResult
requestHeader RequestHeader
releaseContinuationPoint bool
continuationPoint byte
callback AsyncCallback
asyncState object
리턴 IAsyncResult

BeginPublish() 공개 메소드

Sends an additional publish request.
public BeginPublish ( int timeout ) : IAsyncResult
timeout int
리턴 IAsyncResult

Browse() 공개 메소드

Invokes the Browse service.
public Browse ( RequestHeader requestHeader, ViewDescription view, NodeId nodeToBrowse, uint maxResultsToReturn, BrowseDirection browseDirection, NodeId referenceTypeId, bool includeSubtypes, uint nodeClassMask, byte &continuationPoint, ReferenceDescriptionCollection &references ) : ResponseHeader
requestHeader RequestHeader The request header.
view ViewDescription The view to browse.
nodeToBrowse NodeId The node to browse.
maxResultsToReturn uint The maximum number of returned values.
browseDirection BrowseDirection The browse direction.
referenceTypeId NodeId The reference type id.
includeSubtypes bool If set to true the subtypes of the ReferenceType will be included in the browse.
nodeClassMask uint The node class mask.
continuationPoint byte The continuation point.
references ReferenceDescriptionCollection The list of node references.
리턴 ResponseHeader

BrowseNext() 공개 메소드

Invokes the BrowseNext service.
public BrowseNext ( RequestHeader requestHeader, bool releaseContinuationPoint, byte continuationPoint, byte &revisedContinuationPoint, ReferenceDescriptionCollection &references ) : ResponseHeader
requestHeader RequestHeader
releaseContinuationPoint bool
continuationPoint byte
revisedContinuationPoint byte
references ReferenceDescriptionCollection
리턴 ResponseHeader

Call() 공개 메소드

Calls the specified method and returns the output arguments.
public Call ( NodeId objectId, NodeId methodId ) : IList
objectId NodeId The NodeId of the object that provides the method.
methodId NodeId The NodeId of the method to call.
리턴 IList

ChangePreferredLocales() 공개 메소드

Updates the preferred locales used for the session.
public ChangePreferredLocales ( StringCollection preferredLocales ) : void
preferredLocales StringCollection The preferred locales.
리턴 void

Close() 공개 메소드

Disconnects from the server and frees any network resources.
public Close ( ) : StatusCode
리턴 StatusCode

Close() 공개 메소드

Disconnects from the server and frees any network resources with the specified timeout.
public Close ( int timeout ) : StatusCode
timeout int
리턴 StatusCode

Create() 공개 정적인 메소드

Creates a new communication session with a server by invoking the CreateSession service
public static Create ( ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, bool updateBeforeConnect, bool checkDomain, string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales ) : Session
configuration ApplicationConfiguration The configuration for the client application.
endpoint ConfiguredEndpoint The endpoint for the server.
updateBeforeConnect bool If set to true the discovery endpoint is used to update the endpoint description before connecting.
checkDomain bool If set to true then the domain in the certificate must match the endpoint used.
sessionName string The name to assign to the session.
sessionTimeout uint The timeout period for the session.
identity IUserIdentity The user identity to associate with the session.
preferredLocales IList The preferred locales.
리턴 Session

Create() 공개 정적인 메소드

Creates a new communication session with a server by invoking the CreateSession service
public static Create ( ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, bool updateBeforeConnect, string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales ) : Session
configuration ApplicationConfiguration The configuration for the client application.
endpoint ConfiguredEndpoint The endpoint for the server.
updateBeforeConnect bool If set to true the discovery endpoint is used to update the endpoint description before connecting.
sessionName string The name to assign to the session.
sessionTimeout uint The timeout period for the session.
identity IUserIdentity The identity.
preferredLocales IList The user identity to associate with the session.
리턴 Session

Dispose() 보호된 메소드

Closes the session and the underlying channel.
protected Dispose ( bool disposing ) : void
disposing bool
리턴 void

EndBrowse() 공개 메소드

Finishes an asynchronous invocation of the Browse service.
public EndBrowse ( IAsyncResult result, byte &continuationPoint, ReferenceDescriptionCollection &references ) : ResponseHeader
result IAsyncResult The result.
continuationPoint byte The continuation point.
references ReferenceDescriptionCollection The list of node references.
리턴 ResponseHeader

EndBrowseNext() 공개 메소드

Finishes an asynchronous invocation of the BrowseNext service.
public EndBrowseNext ( IAsyncResult result, byte &revisedContinuationPoint, ReferenceDescriptionCollection &references ) : ResponseHeader
result IAsyncResult
revisedContinuationPoint byte
references ReferenceDescriptionCollection
리턴 ResponseHeader

FetchNamespaceTables() 공개 메소드

Updates the local copy of the server's namespace uri and server uri tables.
public FetchNamespaceTables ( ) : void
리턴 void

FetchReferences() 공개 메소드

Fetches all references for the specified node.
public FetchReferences ( NodeId nodeId ) : ReferenceDescriptionCollection
nodeId NodeId The node id.
리턴 ReferenceDescriptionCollection

FetchTypeTree() 공개 메소드

Updates the cache with the type and its subtypes.
This method can be used to ensure the TypeTree is populated.
public FetchTypeTree ( ExpandedNodeId typeId ) : void
typeId ExpandedNodeId
리턴 void

FindComponentIds() 공개 메소드

Finds the NodeIds for the components for an instance.
public FindComponentIds ( NodeId instanceId, IList componentPaths, NodeIdCollection &componentIds, List &errors ) : void
instanceId NodeId
componentPaths IList
componentIds NodeIdCollection
errors List
리턴 void

FindDataDescription() 공개 메소드

Returns the data description for the encoding.
public FindDataDescription ( NodeId encodingId ) : ReferenceDescription
encodingId NodeId The encoding Id.
리턴 ReferenceDescription

FindDataDictionary() 공개 메소드

Returns the data dictionary that constains the description.
public FindDataDictionary ( NodeId descriptionId ) : DataDictionary
descriptionId NodeId The description id.
리턴 DataDictionary

GetSoftwareCertificates() 보호된 메소드

Returns the software certificates assigned to the application.
protected GetSoftwareCertificates ( ) : SignedSoftwareCertificateCollection
리턴 SignedSoftwareCertificateCollection

Load() 공개 메소드

Load the list of subscriptions saved in a file.
public Load ( string filePath ) : IEnumerable
filePath string The file path.
리턴 IEnumerable

OnApplicationCertificateError() 보호된 메소드

Handles an error when validating the application instance certificate provided by the server.
protected OnApplicationCertificateError ( byte serverCertificate, ServiceResult result ) : void
serverCertificate byte
result ServiceResult
리턴 void

OnKeepAlive() 보호된 메소드

Called when the server returns a keep alive response.
protected OnKeepAlive ( ServerState currentState, System.DateTime currentTime ) : void
currentState ServerState
currentTime System.DateTime
리턴 void

OnKeepAliveError() 보호된 메소드

Called when a error occurs during a keep alive.
protected OnKeepAliveError ( ServiceResult result ) : bool
result ServiceResult
리턴 bool

OnSoftwareCertificateError() 보호된 메소드

Handles an error when validating software certificates provided by the server.
protected OnSoftwareCertificateError ( SignedSoftwareCertificate signedCertificate, ServiceResult result ) : void
signedCertificate SignedSoftwareCertificate
result ServiceResult
리턴 void

Open() 공개 메소드

Establishes a session with the server.
public Open ( string sessionName, IUserIdentity identity ) : void
sessionName string The name to assign to the session.
identity IUserIdentity The user identity.
리턴 void

Open() 공개 메소드

Establishes a session with the server.
public Open ( string sessionName, uint sessionTimeout, IUserIdentity identity, IList preferredLocales ) : void
sessionName string The name to assign to the session.
sessionTimeout uint The session timeout.
identity IUserIdentity The user identity.
preferredLocales IList The list of preferred locales.
리턴 void

ReadAvailableEncodings() 공개 메소드

Returns the available encodings for a node
public ReadAvailableEncodings ( NodeId variableId ) : ReferenceDescriptionCollection
variableId NodeId The variable node.
리턴 ReferenceDescriptionCollection

ReadDisplayName() 공개 메소드

Reads the display name for a set of Nodes.
public ReadDisplayName ( IList nodeIds, List &displayNames, List &errors ) : void
nodeIds IList
displayNames List
errors List
리턴 void

ReadValue() 공개 메소드

Reads the value for a node.
public ReadValue ( NodeId nodeId ) : DataValue
nodeId NodeId The node Id.
리턴 DataValue

ReadValue() 공개 메소드

Reads the value for a node an checks that it is the specified type.
public ReadValue ( NodeId nodeId, Type expectedType ) : object
nodeId NodeId The node id.
expectedType System.Type The expected type.
리턴 object

ReadValues() 공개 메소드

Reads the values for a set of variables.
public ReadValues ( IList variableIds, IList expectedTypes, List &values, List &errors ) : void
variableIds IList The variable ids.
expectedTypes IList The expected types.
values List The list of returned values.
errors List The list of returned errors.
리턴 void

Reconnect() 공개 메소드

Reconnects to the server after a network failure.
public Reconnect ( ) : void
리턴 void

Recreate() 공개 정적인 메소드

Recreates a session based on a specified template.
public static Recreate ( Session template ) : Session
template Session The Session object to use as template
리턴 Session

RemoveSubscription() 공개 메소드

Removes a subscription from the session.
public RemoveSubscription ( Subscription subscription ) : bool
subscription Subscription The subscription to remove.
리턴 bool

RemoveSubscriptions() 공개 메소드

Removes a list of subscriptions from the sessiont.
public RemoveSubscriptions ( IEnumerable subscriptions ) : bool
subscriptions IEnumerable The list of subscriptions to remove.
리턴 bool

Republish() 공개 메소드

Sends a republish request.
public Republish ( uint subscriptionId, uint sequenceNumber ) : bool
subscriptionId uint
sequenceNumber uint
리턴 bool

Save() 공개 메소드

Saves all the subscriptions of the session.
public Save ( string filePath ) : void
filePath string The file path.
리턴 void

Save() 공개 메소드

Saves a set of subscriptions.
public Save ( string filePath, IEnumerable subscriptions ) : void
filePath string
subscriptions IEnumerable
리턴 void

Session() 공개 메소드

Constructs a new instance of the session.
public Session ( ISessionChannel channel, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint ) : System
channel ISessionChannel The channel used to communicate with the server.
configuration ApplicationConfiguration The configuration for the client application.
endpoint ConfiguredEndpoint The endpoint use to initialize the channel.
리턴 System

Session() 공개 메소드

Constructs a new instance of the session.
The application configuration is used to look up the certificate if none is provided. The clientCertificate must have the private key. This will require that the certificate be loaded from a certicate store. Converting a DER encoded blob to a X509Certificate2 will not include a private key.
public Session ( ITransportChannel channel, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, X509Certificate2 clientCertificate ) : System
channel ITransportChannel The channel used to communicate with the server.
configuration ApplicationConfiguration The configuration for the client application.
endpoint ConfiguredEndpoint The endpoint use to initialize the channel.
clientCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 The certificate to use for the client.
리턴 System

Session() 공개 메소드

public Session ( ITransportChannel channel, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, X509Certificate2 clientCertificate, EndpointDescriptionCollection availableEndpoints ) : System
channel ITransportChannel
configuration ApplicationConfiguration
endpoint ConfiguredEndpoint
clientCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
availableEndpoints EndpointDescriptionCollection
리턴 System

Session() 공개 메소드

Initializes a new instance of the Session class.
public Session ( ITransportChannel channel, Session template, bool copyEventHandlers ) : System
channel ITransportChannel The channel.
template Session The template session.
copyEventHandlers bool if set to true the event handlers are copied.
리턴 System

UpdateSession() 공개 메소드

Updates the user identity and/or locales used for the session.
public UpdateSession ( IUserIdentity identity, StringCollection preferredLocales ) : void
identity IUserIdentity The user identity.
preferredLocales StringCollection The preferred locales.
리턴 void

ValidateSoftwareCertificates() 보호된 메소드

Inspects the software certificates provided by the server.
protected ValidateSoftwareCertificates ( List softwareCertificates ) : void
softwareCertificates List
리턴 void