com.prosysopc.ua.client
Class UaClient

java.lang.Object
  extended by com.prosysopc.ua.UaApplication
      extended by com.prosysopc.ua.client.UaClient

public class UaClient
extends UaApplication

A client connection interface to an OPC UA server.

The Client implements main OPC UA client functionality, so that you can configure the server connection properties through it and connect to the specified server.

The connection is defined by the properties Protocol, Host and Port and ServerName. Alternatively, you can define URI, which is composed of those parameters.

In addition, you can define the SecurityMode, ClientIdentity and UserIdentity, which are used to define the connection security settings. When connected, you can access the ServerIdentity.

You can then connect() to the server, and start communications. You can check the Status of the server, or addServerStatusListener(ServerStatusListener) to monitor changes in the quality of the connection.

For communications, you can use the various read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) and write(org.opcfoundation.ua.core.WriteValue...) methods, or addSubscription(com.prosysopc.ua.client.Subscription) to monitor server data changes or notifications.

You can also call(org.opcfoundation.ua.core.CallMethodRequest...) server methods.

Note: although the class is not declared as final, it is not really designed for inheritance.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.prosysopc.ua.UaApplication
UaApplication.a, UaApplication.DiagnosticMask, UaApplication.Protocol
 
Field Summary
static Double MAX_CACHE_AGE
           
 
Constructor Summary
UaClient()
          Create a new server connection.
UaClient(String uri)
          Create a server connection using server URI.
UaClient(UaAddress address)
           
 
Method Summary
 void addServerStatusListener(ServerStatusListener serverStatusListener)
          Add a new listener for the ServerStatus events.
 Subscription addSubscription(Subscription subscription)
          Create a new subscription and add it to Subscriptions.
protected  void addSubscriptionAck(org.opcfoundation.ua.core.SubscriptionAcknowledgement ack)
           
 org.opcfoundation.ua.core.CallResponse call(org.opcfoundation.ua.core.CallMethodRequest... MethodsToCall)
          Call several methods at once.
 org.opcfoundation.ua.builtintypes.Variant[] call(org.opcfoundation.ua.builtintypes.NodeId objectId, org.opcfoundation.ua.builtintypes.NodeId methodId, org.opcfoundation.ua.builtintypes.Variant... inputArguments)
          Call a method in the server.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> callAsync(org.opcfoundation.ua.core.CallMethodRequest... methodsToCall)
          Call several methods asynchronously.
 void connect()
          Connect to the server.
 void disconnect()
          Disconnect from the server.
 void disconnect(long timeout)
          Disconnect from the server.
 void disconnect(long timeout, TimeUnit timeUnit)
           
 void disconnect(org.opcfoundation.ua.builtintypes.UnsignedInteger timeout)
          Disconnect from the server.
 org.opcfoundation.ua.core.EndpointDescription[] discoverEndpoints()
          Find the list of server end-points corresponding to getProtocol().
 org.opcfoundation.ua.core.EndpointDescription[] discoverEndpoints(UaApplication.Protocol... protocols)
          Find the list of server end-points corresponding to the defined protocols.
protected  void finalize()
           
 OperationLimits getActualOperationLimits()
           
 int getActualPublishRequestSetpoint()
           
 AddressSpace getAddressSpace()
          AddressSpace object used for browsing the addres space of the server and for using the View services.
 ApplicationIdentity getApplicationIdentity()
          The identity information of your OPC UA client application.
 String getAuditEntryId()
          Audit entry to include in service calls.
static UaApplication.Protocol getDefaultProtocol()
          The default protocol to use for URI, if none is defined in #setUri()
 org.opcfoundation.ua.encoding.EncoderContext getEncoderContext()
           
 org.opcfoundation.ua.core.EndpointDescription getEndpoint()
          The server endpoint that is used.
 org.opcfoundation.ua.core.EndpointConfiguration getEndpointConfiguration()
          Configuration parameters for the channel and endpoint.
 String getHost()
           
protected  org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[] getHttpsSecurityPolicies()
          The TLS security policies used for HTTPS communications.
 org.opcfoundation.ua.transport.https.HttpsSettings getHttpsSettings()
           
 org.opcfoundation.ua.builtintypes.DiagnosticInfo[] getLastOperationDiagnostics()
          The operation level diagnostic information related to the last service call.
 org.opcfoundation.ua.builtintypes.DateTime getLastResponseTimestamp()
          The timestamps of the response message of the last service call.
 org.opcfoundation.ua.builtintypes.DiagnosticInfo getLastServiceDiagnostics()
          The service level diagnostic information related to the last service call.
 org.opcfoundation.ua.builtintypes.StatusCode getLastServiceResult()
           
 UaClientListener getListener()
           
 Locale getLocale()
          The currently defined user locale.
 org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxResponseMessageSize()
           
 org.opcfoundation.ua.common.NamespaceTable getNamespaceTable()
          The server NamespaceTable.
 org.opcfoundation.ua.common.NamespaceTable getNamespaceTable(boolean forceRefresh)
          The server NamespaceTable.
 EnumSet<UaApplication.DiagnosticMask> getOperationDiagnosticMask()
          The currently requested operation diagnostics.
 int getPort()
           
 UaApplication.Protocol getProtocol()
           
 double getPublishRequestFactor()
           
 int getPublishRequestSetpoint()
          The current target of PublishRequests to send to the server.
 org.opcfoundation.ua.builtintypes.UnsignedInteger getPublishRequestTimeout()
           
 org.opcfoundation.ua.transport.SecureChannel getSecureChannel()
           
 org.opcfoundation.ua.transport.security.SecurityMode getSecurityMode()
           
 ApplicationIdentity getServerIdentity()
           
 String getServerName()
           
 org.opcfoundation.ua.core.ServerState getServerState()
          The current state of the server.
 org.opcfoundation.ua.core.ServerStatusDataType getServerStatus()
          The status of the server that we are connected.
 org.opcfoundation.ua.builtintypes.StatusCode getServerStatusError()
          In case the monitoring of Server Status fails, the related error code is available from here.
 org.opcfoundation.ua.common.ServerTable getServerTable()
          The server ServerTable.
 org.opcfoundation.ua.common.ServerTable getServerTable(boolean forceRefresh)
          The server ServerTable.
 long getServerTimeDifference()
          The current time difference between the server and the client.
 EnumSet<UaApplication.DiagnosticMask> getServiceDiagnosticMask()
           
 org.opcfoundation.ua.application.Session getSession()
          The current session.
 String getSessionName()
           
 double getSessionTimeout()
           
 long getStatusCheckInterval()
           
 long getStatusCheckTimeout()
          The timeout used for Server Status reads in updateServerStatus()
 Subscription getSubscription(int index)
          Get a subscription by index.
 Subscription getSubscriptionById(org.opcfoundation.ua.builtintypes.UnsignedInteger subscriptionId)
          Get a subscription with the subscription ID specified by the server.
 int getSubscriptionCount()
          Number of defined subscriptions.
 Subscription[] getSubscriptions()
          Get subscriptions.
 List<org.opcfoundation.ua.transport.security.SecurityMode> getSupportedSecurityModes()
          Get a list of security modes supported by the server.
 org.opcfoundation.ua.core.UserTokenPolicy[] getSupportedUserIdentityTokens()
          Find out the user identity types supported by the server.
 int getTimeout()
           
 TypeDictionary getTypeDictionary()
          Returns a TypeDictionary that can be used to parse unknown Structures.
 String getUri()
          The server URI.
 UserIdentity getUserIdentity()
          The current user identity to use for user authentication.
 boolean hasServerStatusListener(ServerStatusListener serverStatusListener)
          Check if the client already has the specified server status listener.
 boolean hasSubscription(org.opcfoundation.ua.builtintypes.UnsignedInteger subscriptionId)
          Checks if the client has a subscription with the specified ID.
 org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteAtTimes(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime[] reqTimes)
          Deletes history at specified times.
 org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteEvents(org.opcfoundation.ua.builtintypes.NodeId nodeId, List<org.opcfoundation.ua.builtintypes.ByteString> eventIds)
          Deletes specified events from history.
 org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteModified(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime startTime, org.opcfoundation.ua.builtintypes.DateTime endTime)
          Deletes modified history from a specified interval.
 org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteRaw(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime startTime, org.opcfoundation.ua.builtintypes.DateTime endTime)
          Deletes raw history from a specified interval.
 org.opcfoundation.ua.core.HistoryReadResult[] historyRead(org.opcfoundation.ua.core.HistoryReadDetails details, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn, Boolean releaseContinuationPoints, org.opcfoundation.ua.core.HistoryReadValueId... nodesToRead)
          Read history of nodes.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> historyReadAsync(org.opcfoundation.ua.core.HistoryReadDetails details, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn, Boolean releaseContinuationPoints, org.opcfoundation.ua.core.HistoryReadValueId... nodesToRead)
          Read history of nodes asynchronously.
 org.opcfoundation.ua.builtintypes.DataValue[] historyReadAtTimes(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime[] reqTimes, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
          Reads history at specified times.
 org.opcfoundation.ua.builtintypes.DataValue[] historyReadAtTimes(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime[] reqTimes, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn, Boolean useSimpleBounds)
          Reads history at specified times.
 org.opcfoundation.ua.core.HistoryEventFieldList[] historyReadEvents(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime startTime, org.opcfoundation.ua.builtintypes.DateTime endTime, org.opcfoundation.ua.builtintypes.UnsignedInteger numValuesPerNode, org.opcfoundation.ua.core.EventFilter filter, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
          Reads events from history.
 org.opcfoundation.ua.core.HistoryModifiedData historyReadModified(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime startTime, org.opcfoundation.ua.builtintypes.DateTime endTime, org.opcfoundation.ua.builtintypes.UnsignedInteger numValuesPerNode, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
          Reads Modified values from the history.
 org.opcfoundation.ua.builtintypes.DataValue[] historyReadProcessed(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime startTime, org.opcfoundation.ua.builtintypes.DateTime endTime, Double processingInterval, org.opcfoundation.ua.builtintypes.NodeId aggregateType, org.opcfoundation.ua.core.AggregateConfiguration aggregateConfiguration, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
          Reads processed history data.
 org.opcfoundation.ua.builtintypes.DataValue[] historyReadRaw(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime startTime, org.opcfoundation.ua.builtintypes.DateTime endTime, long numValuesPerNode, Boolean returnBounds, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
          Reads raw history data.
 org.opcfoundation.ua.builtintypes.DataValue[] historyReadRaw(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.DateTime startTime, org.opcfoundation.ua.builtintypes.DateTime endTime, org.opcfoundation.ua.builtintypes.UnsignedInteger numValuesPerNode, Boolean returnBounds, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
          Reads raw history data.
 org.opcfoundation.ua.core.HistoryUpdateResult[] historyUpdate(org.opcfoundation.ua.core.HistoryUpdateDetails... details)
          Update history data in the server.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> historyUpdateAsync(org.opcfoundation.ua.core.HistoryUpdateDetails... details)
          Update history data in the server.
 org.opcfoundation.ua.core.HistoryUpdateResult historyUpdateData(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.core.PerformUpdateType performInsertReplace, org.opcfoundation.ua.builtintypes.DataValue[] updateValues)
          Updates history data.
 org.opcfoundation.ua.core.HistoryUpdateResult historyUpdateEvent(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.core.PerformUpdateType performInsertReplace, org.opcfoundation.ua.core.EventFilter filter, org.opcfoundation.ua.core.HistoryEventFieldList[] eventData)
          Updates historical events in the server.
 org.opcfoundation.ua.core.HistoryUpdateResult historyUpdateStructureData(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.core.PerformUpdateType performInsertReplace, org.opcfoundation.ua.builtintypes.DataValue[] updateValues)
          Updates historical structure data.
 boolean isAutoReconnect()
          Automatic reconnection setting.
 boolean isConnected()
          Are we connected to the server?
 boolean isKeepSubscriptions()
           
 boolean isValidateDiscoveredEndpoints()
           
 org.opcfoundation.ua.core.ReadResponse read(Double maxAge, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn, org.opcfoundation.ua.core.ReadValueId... nodesToRead)
          This Service is used to read one or more Attributes of one or more Nodes.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> readAsync(Double maxAge, org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn, org.opcfoundation.ua.core.ReadValueId... nodesToRead)
          Read node attributes from the server asynchronously.
 org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
          Reads the value for the specified single node attribute.
 org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, org.opcfoundation.ua.utils.NumericRange indexRange, Double maxCacheAge)
          Reads the value for the specified single node attribute.
 org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
          Reads the value for the specified single node attribute.
 org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, org.opcfoundation.ua.utils.NumericRange indexRange, Double maxCacheAge)
          Reads the value for the specified single node attribute.
 org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger... attributeIds)
          Read all attributes of a Node.
 org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger[] attributeIds, org.opcfoundation.ua.utils.NumericRange[] indexRanges, Double maxCacheAge)
          Read all attributes of a Node.
 org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger... attributeIds)
          Read all attributes of a Node.
 org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger[] attributeIds, org.opcfoundation.ua.utils.NumericRange[] indexRanges, Double maxCacheAge)
          Read all attributes of a Node.
 org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
          Reads the value attribute of a node.
 org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, Double maxCacheAge)
          Reads the value attribute of a node.
 org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, org.opcfoundation.ua.utils.NumericRange indexRange)
          Reads the value attribute of a node.
 org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId, org.opcfoundation.ua.utils.NumericRange indexRange, Double maxCacheAge)
          Reads the value attribute of a node.
 org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId)
          Reads the value attribute of a node.
 org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId, Double maxCacheAge)
          Reads the value attribute of a node.
 org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.utils.NumericRange indexRange)
          Reads the value attribute of a node.
 org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.utils.NumericRange indexRange, Double maxCacheAge)
          Reads the value attribute of a node.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds, org.opcfoundation.ua.utils.NumericRange[] indexRanges)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds, org.opcfoundation.ua.utils.NumericRange[] indexRanges, org.opcfoundation.ua.core.TimestampsToReturn timestamps)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds, org.opcfoundation.ua.utils.NumericRange[] indexRanges, org.opcfoundation.ua.core.TimestampsToReturn timestamps, Double maxCacheAge)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds, org.opcfoundation.ua.core.TimestampsToReturn timestamps)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds, org.opcfoundation.ua.utils.NumericRange[] indexRanges)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds, org.opcfoundation.ua.utils.NumericRange[] indexRanges, org.opcfoundation.ua.core.TimestampsToReturn timestamps)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds, org.opcfoundation.ua.utils.NumericRange[] indexRanges, org.opcfoundation.ua.core.TimestampsToReturn timestamps, Double maxCacheAge)
          Reads the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds, org.opcfoundation.ua.core.TimestampsToReturn timestamps)
          Reads the value attribute of several nodes at once.
 boolean reconnect()
          Reconnect to the server.
 void registerModel(ClientCodegenModel codegenModel)
          Register an information model to use in the application.
 boolean removeServerStatusListener(ServerStatusListener serverStatusListener)
          Remove a listener from the ServerStatus events.
 org.opcfoundation.ua.builtintypes.StatusCode removeSubscription(Subscription subscription)
          Remove the subscription from Subscriptions.
 org.opcfoundation.ua.builtintypes.StatusCode[] removeSubscriptions(Subscription[] subscriptions)
          Remove subscriptions from Subscriptions.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.StatusCode[]> removeSubscriptionsAsync(Subscription... subscriptions)
          Remove subscriptions from Subscriptions, asynchronously.
 void resetEndpoint()
          Undefines the Endpoint.
protected  void resetPublishRequestSetpoint()
          Resets the setpoint
protected  void resetSubscriptionsAfterRemove(Subscription[] subscriptions, org.opcfoundation.ua.builtintypes.StatusCode[] result)
           
 org.opcfoundation.ua.builtintypes.ServiceResponse serviceRequest(org.opcfoundation.ua.builtintypes.ServiceRequest request)
          Send a custom service request to the server, synchronously.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> serviceRequestAsync(org.opcfoundation.ua.builtintypes.ServiceRequest request)
          Send a custom service request to the server, asynchronously.
 org.opcfoundation.ua.builtintypes.ServiceResponse sessionlessRequest(org.opcfoundation.ua.builtintypes.ServiceRequest request)
          Make a service request to the server over a secure channel.
 void setAddress(UaAddress address)
           
 void setApplicationIdentity(ApplicationIdentity applicationIdentity)
          Set the security identity of the client application.
 void setAuditEntryId(String auditEntryId)
          An identifier that identifies the Client's security audit log entry associated with the operations requested from the server.
 void setAutoReconnect(boolean doAutoReconnect)
          Define automatic reconnection.
static void setDefaultProtocol(UaApplication.Protocol defaultProtocol)
          The default protocol to use for URI, if none is defined in #setUri()
 void setEndpoint(org.opcfoundation.ua.core.EndpointDescription endpoint)
          Use the EndpointDescription to select the server endpoint to connect to.
protected  void setHttpsSecurityPolicies(org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[] httpsSecurityPolicies)
          The TLS security policies used for HTTPS communications.
 void setKeepSubscriptions(boolean keepSubscriptions)
          Defines that the Subscriptions should be left in the server, when {link disconnect} is called.
 void setListener(UaClientListener listener)
           
 void setLocale(Locale locale)
          Define the user locale, in which all localizable text is requested from the server.
 void setMaxResponseMessageSize(int maxResponseMessageSize)
          Define the maximum size, in bytes, for the body of any response message from the server.
 void setMaxResponseMessageSize(org.opcfoundation.ua.builtintypes.UnsignedInteger maxResponseMessageSize)
          Define the maximum size, in bytes, for the body of any response message from the server.
 void setOperationDiagnosticMask(EnumSet<UaApplication.DiagnosticMask> operationDiagnosticMask)
          Define the operational level diagnostic info to return for the service calls.
 void setPublishRequestFactor(double publishRequestFactor)
          The factor is used to calculate the number of pending publish requests we are trying to keep open in the server all the time.
 void setPublishRequestSetpoint(int publishRequestSetpoint)
          Define the target number of PublishRequests to send to the server.
 void setPublishRequestTimeout(long publishRequestTimeout)
          Define the timeout used for PublishRequests.
 void setPublishRequestTimeout(long publishRequestTimeout, TimeUnit timeUnit)
          /** Define the timeout used for PublishRequests using a specific TimeUnit.
 void setPublishRequestTimeout(org.opcfoundation.ua.builtintypes.UnsignedInteger publishRequestTimeout)
          Define the timeout used for PublishRequests.
 void setSecurityMode(org.opcfoundation.ua.transport.security.SecurityMode securityMode)
          Define the security mode to connect to.
 void setServiceDiagnosticMask(EnumSet<UaApplication.DiagnosticMask> serviceDiagnosticMask)
          Define the service level diagnostic info to return for the service calls.
 void setSessionName(String sessionName)
          Define a name for the session.
 void setSessionTimeout(double sessionTimeout)
          Set the requested session timeout.
 void setSessionTimeout(long sessionTimeout, TimeUnit timeUnit)
           
 void setStatusCheckInterval(long statusCheckInterval)
          Define the status check interval, that is, how often the server status is read, when isConnected.
 void setStatusCheckInterval(long statusCheckInterval, TimeUnit timeUnit)
           
 void setStatusCheckTimeout(long statusCheckTimeout)
          Define the timeout to use for Server Status reads in updateServerStatus().
 void setStatusCheckTimeout(long statusCheckTimeout, TimeUnit timeUnit)
           
 void setTimeout(long timeOut)
          Define the default communication timeout that is used for each synchronous service call.
 void setTimeout(long timeOut, TimeUnit timeUnits)
           
 void setTimeout(org.opcfoundation.ua.builtintypes.UnsignedInteger timeOut)
          Define the default communication timeout that is used for each synchronous service call.
 void setUri(String uri)
          The URI of the OPC UA server.
 void setUserIdentity(UserIdentity userIdentity)
          Define a new user identity.
 void setValidateDiscoveredEndpoints(boolean validateDiscoveredEndpoints)
          Define whether endpoints discovered from the server are validated against the endpoints returned for a session create request.
 void updateServerStatus()
          Read the current server status.
 org.opcfoundation.ua.core.WriteResponse write(org.opcfoundation.ua.core.WriteValue... nodesToWrite)
          Write values to the server.
 org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> writeAsync(org.opcfoundation.ua.core.WriteValue... nodesToWrite)
          Write node attributes to the server asynchronously.
 boolean writeAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, Object value)
          Write a single attribute value.
 boolean writeAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, Object value, org.opcfoundation.ua.utils.NumericRange indexRange)
          Write a single attribute value.
 boolean writeValue(org.opcfoundation.ua.builtintypes.NodeId nodeId, Object value)
          Write the value attribute of a node.
 boolean writeValue(org.opcfoundation.ua.builtintypes.NodeId nodeId, Object value, org.opcfoundation.ua.utils.NumericRange indexRange)
          Write the value attribute of a node.
 org.opcfoundation.ua.builtintypes.StatusCode[] writeValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds, Object[] value)
          Write the value attribute of several nodes at once.
 org.opcfoundation.ua.builtintypes.StatusCode[] writeValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds, Object[] values, org.opcfoundation.ua.utils.NumericRange[] indexRanges)
          Write the value attribute of several nodes at once.
 
Methods inherited from class com.prosysopc.ua.UaApplication
formatUri, getAggregateCalculator, getCertificateValidator, getKnownDataTypeDictionary, getOperationLimits, getRegisteredClasses, getSdkVersion, getVersion, registerClass, registerClass, registerClass, registerClasses, registerModelInternal, setCertificateValidator, setOperationLimits, validateApplicationCertificate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CACHE_AGE

public static final Double MAX_CACHE_AGE
Constructor Detail

UaClient

public UaClient()
Create a new server connection. Remember to specify the server URI or Host,Port,Protocol and ServerName as well as the ApplicationIdentity before calling connect().


UaClient

public UaClient(String uri)
         throws URISyntaxException
Create a server connection using server URI. Remember to specify the ApplicationIdentity before calling connect().

Parameters:
uri - the server URI to connect to.
Throws:
URISyntaxException - if the URI is not valid.

UaClient

public UaClient(UaAddress address)
Method Detail

getDefaultProtocol

public static UaApplication.Protocol getDefaultProtocol()
The default protocol to use for URI, if none is defined in #setUri()

Returns:
the defaultProtocol

setDefaultProtocol

public static void setDefaultProtocol(UaApplication.Protocol defaultProtocol)
The default protocol to use for URI, if none is defined in #setUri()

Parameters:
defaultProtocol - the defaultProtocol to set

addServerStatusListener

public void addServerStatusListener(ServerStatusListener serverStatusListener)
Add a new listener for the ServerStatus events. If hasServerStatusListener(ServerStatusListener), the listener is not added again.

Parameters:
serverStatusListener - the listener object

addSubscription

public Subscription addSubscription(Subscription subscription)
                             throws ServiceException,
                                    StatusException
Create a new subscription and add it to Subscriptions. If we are Connected to the server, the subscription is also added to the server. Otherwise, it will be added, when you connect to the server.

The server will assign an ID for each subscription.

Even if the createSubscription call fails, the subscription will still be added to the client object and it will be in getSubscriptions().

If the subscription belongs to another client, it will be moved to this client.

Parameters:
subscription - The subscription to add.
Returns:
the subscription The added subscription (the same object)
Throws:
ServiceException - if the server returns an error for a service call
StatusException - if the subscription was being transferred from another server session, but it failed.
See Also:
getSubscription(int), getSubscriptionCount(), removeSubscription(com.prosysopc.ua.client.Subscription)

call

public org.opcfoundation.ua.core.CallResponse call(org.opcfoundation.ua.core.CallMethodRequest... MethodsToCall)
                                            throws ServiceException
Call several methods at once. Use this method, instead of the other call(NodeId, NodeId, Variant...) to call several methods at once to reduce the payload required for making the calls.

Parameters:
MethodsToCall - The method call structures.
Returns:
The response message. Read the Results and DiagnosticInfo for each call.
Throws:
ServiceException
See Also:
callAsync(org.opcfoundation.ua.core.CallMethodRequest...)

call

public org.opcfoundation.ua.builtintypes.Variant[] call(org.opcfoundation.ua.builtintypes.NodeId objectId,
                                                        org.opcfoundation.ua.builtintypes.NodeId methodId,
                                                        org.opcfoundation.ua.builtintypes.Variant... inputArguments)
                                                 throws ServiceException,
                                                        MethodCallStatusException
Call a method in the server. Use call(CallMethodRequest...) instead if you need to call several methods at the same time.

Parameters:
objectId - The NodeId of the Object or ObjectType that is the source of a HasComponent Reference (or subtype of HasComponent Reference) to the Method.
methodId - NodeId of the Method to invoke in the object.
inputArguments - List of input argument values. An empty list indicates that there are no input arguments. The size and order of this list matches the size and order of the input arguments defined by the input InputArguments Property of the Method.

The name, a description and the data type of each argument are defined by the Argument structure in each element of the method node's InputArguments Property.

Returns:
The OutputArguments of the method result.
Throws:
ServiceException - if the method call fails
MethodCallStatusException - if the method returns a bad StatusCode.

The StatusCode is Bad_InvalidArgument, if at least one input argument broke a constraint (e.g. wrong data type, value out of range). Read the InputArgumentResults of the exception to learn which one was not correct.

If the Method execution failed in the server, the StatusCode is set accordingly.


callAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> callAsync(org.opcfoundation.ua.core.CallMethodRequest... methodsToCall)
Call several methods asynchronously.

Parameters:
methodsToCall - The method call structures.
Returns:
The asynchronous monitor, which will provide the response, when available (as CallResponse). You can poll it, set a listener or wait for the result (or error).
See Also:
call(org.opcfoundation.ua.core.CallMethodRequest...)

connect

public void connect()
             throws ServiceException,
                    ConnectException,
                    SessionActivationException,
                    InvalidServerEndpointException
Connect to the server.

The method connects to the server defined by Protocol, Host, Port & ServerName (which compose the server URI).

If Host is set to "localhost", it is converted to the public hostname of the current machine (because the server will not necessary listen to connections with the "localhost" name)

It then requests the server end-point matching the URI and the defined SecurityMode.

The method opens a session to the server, and finally activates it using the defined UserIdentity.

If there are Subscriptions already defined, they will be created in the server as well.

If already isConnected(), will not do anything.

Throws:
ServiceException - if there are service call errors while discovering the endpoints or adding the subscriptions to the server. Note that all the exceptions below are also subclasses of ServiceException.
ConnectException - if the connection fails
SessionActivationException - if the session cannot be activated with the UserIdentity
InvalidServerEndpointException - If the server endpoint defined by the parameters is not found from the servers list of supported endpoints

disconnect

public void disconnect()
Disconnect from the server.

The method closes the session to the server and disconnects the communication channel.

Use setKeepSubscriptions(boolean) to define, if the subscriptions should be kept in the the server, after disconnect (in case you wish to have them available when you reconnect, for example).

The method uses a default timeout of 60000 ms (1 minute) for the CloseSession call.


disconnect

public void disconnect(long timeout)
Disconnect from the server.

The method closes the session to the server and disconnects the communication channel.

Use setKeepSubscriptions(boolean) to define, if the subscriptions should be kept in the the server, after disconnect (in case you wish to have them available when you reconnect, for example).

Parameters:
timeout - timeout (in milliseconds) for the CloseSession call. Must be a positive value. 0 tells it to wait infinitely for a response.

disconnect

public void disconnect(long timeout,
                       TimeUnit timeUnit)
See Also:
disconnect(long)

disconnect

public void disconnect(org.opcfoundation.ua.builtintypes.UnsignedInteger timeout)
Disconnect from the server.

The method closes the session to the server and disconnects the communication channel.

Use setKeepSubscriptions(boolean) to define, if the subscriptions should be kept in the the server, after disconnect (in case you wish to have them available when you reconnect, for example).

Parameters:
timeout - timeout (in milliseconds) for the CloseSession call. UnsignedInteger.ZERO tells it to wait infinitely for a response.

discoverEndpoints

public org.opcfoundation.ua.core.EndpointDescription[] discoverEndpoints()
                                                                  throws InvalidServerEndpointException,
                                                                         ConnectException,
                                                                         ServiceException
Find the list of server end-points corresponding to getProtocol().

Returns:
list of end-points supported by the server at URI.
Throws:
InvalidServerEndpointException - if the URI is not valid.
ConnectException - if the list could not be retrieved - probably because the server could not be connected to.
ServiceException - if the service call fails

discoverEndpoints

public org.opcfoundation.ua.core.EndpointDescription[] discoverEndpoints(UaApplication.Protocol... protocols)
                                                                  throws InvalidServerEndpointException,
                                                                         ConnectException,
                                                                         ServiceException
Find the list of server end-points corresponding to the defined protocols.

Parameters:
protocols - the transport protocols for which the endpoints are requested. If omitted, getProtocol() is used.
Returns:
list of end-points supported by the server at URI.
Throws:
InvalidServerEndpointException - if the URI is not valid.
ConnectException - if the list could not be retrieved - probably because the server could not be connected to.
ServiceException - if the service call fails

getActualOperationLimits

public OperationLimits getActualOperationLimits()
Returns:
the actual operation limits i.e. the minimum of client and server limits

getActualPublishRequestSetpoint

public int getActualPublishRequestSetpoint()
Returns:
the actual setpoint for PublishRequests, either calculated or adjusted in case the server sent Bad_TooManyPublishRequests
See Also:
getPublishRequestSetpoint()

getAddressSpace

public AddressSpace getAddressSpace()
AddressSpace object used for browsing the addres space of the server and for using the View services.

Specified by:
getAddressSpace in class UaApplication
Returns:
The address space interface to the server

getApplicationIdentity

public ApplicationIdentity getApplicationIdentity()
The identity information of your OPC UA client application.

Returns:
the current identity of the client application. Use setApplicationIdentity(com.prosysopc.ua.ApplicationIdentity) to define it, before connecting to the server.

getAuditEntryId

public String getAuditEntryId()
Audit entry to include in service calls. The server can use the information to log audit entries, so that you can later track which application did what.

Returns:
the auditEntryId the ID to include in every service call.

getEncoderContext

public org.opcfoundation.ua.encoding.EncoderContext getEncoderContext()
Specified by:
getEncoderContext in class UaApplication
Returns:
the encoder context, which is used for mapping namespaces and nodeIds in the stack layer.

getEndpoint

public org.opcfoundation.ua.core.EndpointDescription getEndpoint()
The server endpoint that is used.

The endpoint is available only when isConnected().

Returns:
the endpoint or null, if no endpoint is in use.

getEndpointConfiguration

public org.opcfoundation.ua.core.EndpointConfiguration getEndpointConfiguration()
Configuration parameters for the channel and endpoint. The settings are used when connect() is called. So if you change them after that they will have no effect, unless you reconnect.

The parameters of the structure are:

Type Parameter Default value Description
Integer OperationTimeout 120000 (2 min) Default timeout used by the stack, if the request messages do not define any. It is recommended to use setTimeout(long), instead of setting the timeout here, though. It will define the timeout also in the messages.
Boolean UseBinaryEncoding true Binary encoding should be used always.
Integer MaxStringLength UnsignedShort.MAX_VALUE Maximum length for string parameters in service calls.
Integer MaxByteStringLength UnsignedShort.MAX_VALUE*16 Maximum length for byte array parameters in service calls.
Integer MaxArrayLength UnsignedShort.MAX_VALUE Maximum length for normal array parameters in service calls.
Integer MaxMessageSize UnsignedShort.MAX_VALUE*64 Maximum length for service call messages.
Integer MaxBufferSize UnsignedShort.MAX_VALUE Maximum buffer size to use in service calls.
Integer ChannelLifetime 120000 (2 min) The lifetime of the channel. This specifies how long the server will keep the channel open, in case it does not receive any requests from the client.
Integer SecurityTokenLifetime 3600000 (1 hour) The requested lifetime, in milliseconds, for security tokens. It specifies how often the client will renew the security token.

Returns:
the current endpointConfiguration

getHost

public String getHost()
Returns:
the host computer to connect to / to which we are connected.

getHttpsSettings

public org.opcfoundation.ua.transport.https.HttpsSettings getHttpsSettings()
Returns:
the HTTPS settings of the connection.

getLastOperationDiagnostics

public org.opcfoundation.ua.builtintypes.DiagnosticInfo[] getLastOperationDiagnostics()
The operation level diagnostic information related to the last service call.

Use setOperationDiagnosticMask to define which operation level diagnostic information you wish to receive with the service calls. If you suspect that the results contain diagnostics, check this array after the service call.

Note that if you perform parallel service calls, they must be synchronized so that you get the lastOperationDiagnostics for the previous call. Or use alternative calls, such as 'read', which return the diagnostics as part of the service result.

Returns:
the array of diagnostic information for the last service call or null, if none was returned
See Also:
getLastServiceResult(), getLastServiceDiagnostics(), getLastResponseTimestamp()

getLastResponseTimestamp

public org.opcfoundation.ua.builtintypes.DateTime getLastResponseTimestamp()
The timestamps of the response message of the last service call.

Returns:
the timestamp of the last response message.
See Also:
getLastServiceResult(), getLastServiceDiagnostics(), getLastOperationDiagnostics()

getLastServiceDiagnostics

public org.opcfoundation.ua.builtintypes.DiagnosticInfo getLastServiceDiagnostics()
The service level diagnostic information related to the last service call.

Use setServiceDiagnosticMask to define which service level diagnostics you wish to receive with the service calls. If you suspect that the results contain diagnostics, check this value after the service call.

Note that if you perform parallel service calls, they must be synchronized so that you get the lastServiceDiagnostics for the previous call. Or use alternative calls, such as 'read', which return the diagnostics as part of the service result.

If a service fails due to a bad ServiceResult, you can read the diagnostics to check if the server provide is additional information about the problem.

Returns:
the service level diagnostic information for the last service call or null, if none was returned
See Also:
getLastOperationDiagnostics(), getLastServiceResult(), getLastResponseTimestamp()

getLastServiceResult

public org.opcfoundation.ua.builtintypes.StatusCode getLastServiceResult()
Returns:
the lastServiceResult the service result of the last service call
See Also:
getLastOperationDiagnostics(), getLastServiceDiagnostics(), getLastResponseTimestamp()

getListener

public UaClientListener getListener()
Returns:
the listener

getLocale

public Locale getLocale()
The currently defined user locale. The server should return all localizble information in this locale.

Returns:
the requested user locale

getMaxResponseMessageSize

public org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxResponseMessageSize()
Returns:
the maximum size of any response message allowed for the server. Default is 0, which means that it is not used.

getNamespaceTable

public org.opcfoundation.ua.common.NamespaceTable getNamespaceTable()
The server NamespaceTable. Use the NamespaceTable to convert between NodeId and ExpandedNodeId and to find the list of namespaces that the server uses.

The table is requested from the server (from NodeId Server_NamespaceArray) when first accessed. Otherwise, it is returned from the cache. Use getNamespaceTable(boolean) to force a refresh.

Overrides:
getNamespaceTable in class UaApplication
Returns:
the namespaceTable

getNamespaceTable

public org.opcfoundation.ua.common.NamespaceTable getNamespaceTable(boolean forceRefresh)
                                                             throws ServiceException,
                                                                    StatusException
The server NamespaceTable. Use the NamespaceTable to convert between NodeId and ExpandedNodeId and to find the list of namespaces that the server uses.

The table is requested from the server (from NodeId Server_NamespaceArray) when first accessed. It is available only when isConnected() is true.

Parameters:
forceRefresh - request that the array is refreshed from the server, even if it has been read already
Returns:
the namespaceTable
Throws:
StatusException - if the namespace array read from the server is not valid
ServiceException - if the namespace array could not be read

getOperationDiagnosticMask

public EnumSet<UaApplication.DiagnosticMask> getOperationDiagnosticMask()
The currently requested operation diagnostics.

Returns:
requested the operation diagnostics.

getPort

public int getPort()
Returns:
the TCP port of the server to connect to / to which we are connected

getProtocol

public UaApplication.Protocol getProtocol()
Returns:
the communication protocol to use with the server

getPublishRequestFactor

public double getPublishRequestFactor()
Returns:
The publish request factor to use when determining the number of publish requests to send to the server.
See Also:
setPublishRequestFactor(double)

getPublishRequestSetpoint

public int getPublishRequestSetpoint()
The current target of PublishRequests to send to the server. If the setpoint is 0, getActualPublishRequestSetpoint() is actually calculated based on getPublishRequestFactor() and getSubscriptionCount() and automatically adjusted, if the server sends Bad_TooManyPublishRequest errors for the PublishRequests.

Returns:
the current publishRequestSetpoint (Default is 0, indicating that the getPublishRequestFactor() should be used)
See Also:
getActualPublishRequestSetpoint(), setPublishRequestSetpoint(int)

getPublishRequestTimeout

public org.opcfoundation.ua.builtintypes.UnsignedInteger getPublishRequestTimeout()
Returns:
timeout used for PublishRequests

getSecureChannel

public org.opcfoundation.ua.transport.SecureChannel getSecureChannel()
                                                              throws ServerConnectionException
Throws:
ServerConnectionException

getSecurityMode

public org.opcfoundation.ua.transport.security.SecurityMode getSecurityMode()
Returns:
the current security mode used in communications.

getServerIdentity

public ApplicationIdentity getServerIdentity()
Returns:
the identity information for the server application. This is only available when isConnected.

getServerName

public String getServerName()
Returns:
the server name part of the server URI.

getServerState

public org.opcfoundation.ua.core.ServerState getServerState()
The current state of the server.

If communication fails, isConnected() will still return true, but getServerState() will give ServerState.CommunicationFault.

If isAutoReconnect() is true, communication failures will be recovered automatically. Otherwise, you must call reconnect yourself, until it succeeds.

Returns:
the current state of the server. Equals to getServerStatus().getState(), when status is available; ServerState.CommunicationFault, when the status could not be read because of a communication problem; ServerState.Unknown when not isConnected() or if status could not be read for some other reason.

getServerStatus

public org.opcfoundation.ua.core.ServerStatusDataType getServerStatus()
                                                               throws StatusException,
                                                                      ServerConnectionException
The status of the server that we are connected. The status is updated every statusCheckInterval. Whenever it changes, you get a StatusChange event, which you can listen to. Or you can listen to StateChange, which is called whenever the server state changes.

Note that the status is only available when the client isConnected().

Note also that getServerState() returns the State part of the status - also when the status cannot be read, so it is easier to use for plain state checking.

Returns:
The current server status
Throws:
StatusException - if the server status could not be read from the server. Read the StatusCode of the exception to learn the reason for that. The same status is also available from ServerStatusError
ServerConnectionException - if we are not connected to the server, in which case the status is not available
See Also:
getServerTimeDifference()

getServerStatusError

public org.opcfoundation.ua.builtintypes.StatusCode getServerStatusError()
In case the monitoring of Server Status fails, the related error code is available from here. The respective exception is also raised, if you try to read the ServerStatus when the error is defined.

Returns:
The last status of the serverStatus read operation.

getServerTable

public org.opcfoundation.ua.common.ServerTable getServerTable()
The server ServerTable. Use the ServerTable to find the list of servers that the server uses.

The table is requested from the server (from NodeId Server_ServerArray) when first accessed. It is available only when isConnected() is true.

Returns:
the serverTable
Throws:
StatusException - if the server array read from the server is not valid
ServiceException - if the server array could not be read

getServerTable

public org.opcfoundation.ua.common.ServerTable getServerTable(boolean forceRefresh)
                                                       throws ServiceException,
                                                              StatusException
The server ServerTable. Use the ServerTable to find the list of servers that the server uses.

The table is requested from the server (from NodeId Server_ServerArray) when first accessed. It is available only when isConnected() is true.

Parameters:
forceRefresh - request that the array is refreshed from the server, even if it has been read already
Returns:
the serverTable
Throws:
StatusException - if the server array read from the server is not valid
ServiceException - if the server array could not be read

getServerTimeDifference

public long getServerTimeDifference()
The current time difference between the server and the client. The value is calculated from the value returned by the server for the ServerStatus.CurrentTime and comparing it to the current system time in the client. It can tell you the lag between the server and client communications, if the applications have synchronized clocks, or the difference between the clocks, if they are not synchronized.

Returns:
The current difference in time of the server and the client clock plus the communication delay. Or 0, if ServerStatus is not available.
See Also:
getServerStatus()

getServiceDiagnosticMask

public EnumSet<UaApplication.DiagnosticMask> getServiceDiagnosticMask()
Returns:
The currently defined set of Service Diagnostics to get from the server for each service call.

getSession

public org.opcfoundation.ua.application.Session getSession()
The current session.

Session is available when isConnected(). Otherwise it will be null.

Returns:
The current session or null if not isConnected.

getSessionName

public String getSessionName()
Returns:
the user defined session name. If the value is null, UAClient will autogenerate a new identifier at each connection. The currently used session name is part of the session information, available from getSession().

getSessionTimeout

public double getSessionTimeout()
Returns:
the requested SessionTimeout. The value will be revised by the server when you connect(). The revised value can be checked from the current session, available from getSession().

getStatusCheckInterval

public long getStatusCheckInterval()
Returns:
The current status check interval (in ms). Default is 1000 ms.

getStatusCheckTimeout

public long getStatusCheckTimeout()
The timeout used for Server Status reads in updateServerStatus()

Returns:
the statusCheckTimeout (in milliseconds)
See Also:
getStatusCheckInterval()

getSubscription

public Subscription getSubscription(int index)
Get a subscription by index.

Returns:
the subscription at index
See Also:
getSubscriptionCount(), addSubscription(com.prosysopc.ua.client.Subscription), removeSubscription(com.prosysopc.ua.client.Subscription), getSubscriptionById(UnsignedInteger), getSubscriptions()

getSubscriptionById

public Subscription getSubscriptionById(org.opcfoundation.ua.builtintypes.UnsignedInteger subscriptionId)
Get a subscription with the subscription ID specified by the server.

Parameters:
subscriptionId - the ID of the subscription
Returns:
the subscription
See Also:
getSubscriptionCount(), addSubscription(com.prosysopc.ua.client.Subscription), removeSubscription(com.prosysopc.ua.client.Subscription), getSubscription(int)

getSubscriptionCount

public int getSubscriptionCount()
Number of defined subscriptions.

Returns:
the number of subscription
See Also:
getSubscription(int), addSubscription(com.prosysopc.ua.client.Subscription), removeSubscription(com.prosysopc.ua.client.Subscription), getSubscriptions()

getSubscriptions

public Subscription[] getSubscriptions()
Get subscriptions.

Returns:
the subscriptions
See Also:
getSubscriptionCount(), addSubscription(com.prosysopc.ua.client.Subscription), removeSubscription(com.prosysopc.ua.client.Subscription), getSubscriptionById(UnsignedInteger), getSubscription(int)

getSupportedSecurityModes

public List<org.opcfoundation.ua.transport.security.SecurityMode> getSupportedSecurityModes()
                                                                                     throws InvalidServerEndpointException,
                                                                                            ServerConnectionException,
                                                                                            ServiceException
Get a list of security modes supported by the server. The security modes are defined by the endpoints returned by discoverEndpoints. Only the endpoints matching URI are accepted.

Returns:
the security modes
Throws:
ServiceException
ServerConnectionException
InvalidServerEndpointException

getSupportedUserIdentityTokens

public org.opcfoundation.ua.core.UserTokenPolicy[] getSupportedUserIdentityTokens()
                                                                           throws ServerConnectionException,
                                                                                  ServiceException
Find out the user identity types supported by the server.

Note that this is available only after connect, as it retrieves the tokens supported by the selected server endpoint.

Returns:
the tokens supported by the server we are connected to.
Throws:
ServiceException - if the service call fails
ServerConnectionException

getTimeout

public int getTimeout()
Returns:
the current communication timeout used (in ms), or -1 if default is used (or setTimeout(null) is called setTimeout(null) is called

getTypeDictionary

public TypeDictionary getTypeDictionary()
Returns a TypeDictionary that can be used to parse unknown Structures. NOTE! this method should only be called after connect(), otherwise it will return null.


getUri

public String getUri()
The server URI. The URI is composed of Protocol, Host, Port and ServerName. You can also set it using setUri(String) or alternatively with setEndpoint(EndpointDescription).

Returns:
the server URI

getUserIdentity

public UserIdentity getUserIdentity()
The current user identity to use for user authentication.

Returns:
the user identity used.

hasServerStatusListener

public boolean hasServerStatusListener(ServerStatusListener serverStatusListener)
Check if the client already has the specified server status listener.

Parameters:
serverStatusListener - the listener to check
Returns:
true if the client has the listener

hasSubscription

public boolean hasSubscription(org.opcfoundation.ua.builtintypes.UnsignedInteger subscriptionId)
Checks if the client has a subscription with the specified ID.

Parameters:
subscriptionId - the ID of the subscription
Returns:
true, if the client has a subscription with ID

historyDeleteAtTimes

public org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteAtTimes(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                          org.opcfoundation.ua.builtintypes.DateTime[] reqTimes)
                                                                   throws StatusException,
                                                                          ServerConnectionException,
                                                                          ServiceException
Deletes history at specified times.

Parameters:
nodeId - the NodeId of the node whose history should be deleted
reqTimes - an array of DateTimes at which history should be deleted
Returns:
the result of the operation as HistoryUpdateResult
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails

historyDeleteEvents

public org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteEvents(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                         List<org.opcfoundation.ua.builtintypes.ByteString> eventIds)
                                                                  throws StatusException,
                                                                         ServerConnectionException,
                                                                         ServiceException
Deletes specified events from history.

Parameters:
nodeId - the NodeId of the node whose history should be deleted
eventIds - a list of eventIds (each id is a byte array) of the events that should be deleted
Returns:
the result of the operation as HistoryUpdateResult
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails

historyDeleteModified

public org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteModified(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                           org.opcfoundation.ua.builtintypes.DateTime startTime,
                                                                           org.opcfoundation.ua.builtintypes.DateTime endTime)
                                                                    throws StatusException,
                                                                           ServerConnectionException,
                                                                           ServiceException
Deletes modified history from a specified interval.

Parameters:
nodeId - the NodeId of the node whose history should be deleted
startTime - the start of the interval to be deleted
endTime - the end of the interval to be deleted
Returns:
the result of the operation as HistoryUpdateResult
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails

historyDeleteRaw

public org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteRaw(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                      org.opcfoundation.ua.builtintypes.DateTime startTime,
                                                                      org.opcfoundation.ua.builtintypes.DateTime endTime)
                                                               throws StatusException,
                                                                      ServerConnectionException,
                                                                      ServiceException
Deletes raw history from a specified interval.

Parameters:
nodeId - the NodeId of the node whose history should be deleted
startTime - the start of the interval to be deleted
endTime - the end of the interval to be deleted
Returns:
the result of the operation as HistoryUpdateResult
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails

historyRead

public org.opcfoundation.ua.core.HistoryReadResult[] historyRead(org.opcfoundation.ua.core.HistoryReadDetails details,
                                                                 org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
                                                                 Boolean releaseContinuationPoints,
                                                                 org.opcfoundation.ua.core.HistoryReadValueId... nodesToRead)
                                                          throws ServerConnectionException,
                                                                 ServiceException
Read history of nodes.

Use this method to make a simultaneous read for several history values.

If the server cannot return all results in one response for any of the nodesToRead, it will define a continuation point in the respective HistoryReadResult. You can then make a subsequent history read request using the continuationPoint in the nodesToRead. If you do not wish to use the returned continuation points, make a new read with the same details and 'releaseContinuationPonts=true'.

You will need to be able to define a correct subtype of HistoryReadDetails for the call.

If you only need to read the history of one variable, you may wish to consider using one of the other historyReadXxx methods, which will do that for you. They will also take care of continuationPoint handling for you. The drawback is that they are only capable of reading one variable at a time.

Parameters:
details - specifies how the data should be read. Use one of the subclasses of HistoryReadDetails.
timestampsToReturn - defines which timestamp information should be returned. The parameter may not be TimestampsToReturn.Neither.
releaseContinuationPoints - if you do not want to use the continuation points returned by the previous request, define this parameter as true, to enable the server to release the continuation points that it reserved. Note though that when it is true, the server will not return any data, so in normal reads you must keep it false.
nodesToRead - The node data for which the history is requested. Define the continuationPoints here, if you wish to continue a previous request that returned continuationPoints.
Returns:
the history read results. If the results contain errors, you can examine the related diagnostic information from getLastOperationDiagnostics().
Throws:
ServerConnectionException - if not connected to the server
ServiceException - if the service call fails
IllegalArgumentException - if details cannot be encoded
See Also:
historyReadAsync(org.opcfoundation.ua.core.HistoryReadDetails, org.opcfoundation.ua.core.TimestampsToReturn, java.lang.Boolean, org.opcfoundation.ua.core.HistoryReadValueId...), historyReadAtTimes(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime[], org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn), historyReadEvents(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.UnsignedInteger, org.opcfoundation.ua.core.EventFilter, org.opcfoundation.ua.core.TimestampsToReturn), historyReadModified(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.UnsignedInteger, org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn), historyReadProcessed(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DateTime, java.lang.Double, org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.core.AggregateConfiguration, org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn), historyReadRaw(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DateTime, long, java.lang.Boolean, org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn)

historyReadAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> historyReadAsync(org.opcfoundation.ua.core.HistoryReadDetails details,
                                                                                                                      org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
                                                                                                                      Boolean releaseContinuationPoints,
                                                                                                                      org.opcfoundation.ua.core.HistoryReadValueId... nodesToRead)
Read history of nodes asynchronously.

Use this method to make a simultaneous read for several history values asynchronously.

If the server cannot return all results in one response for any of the nodesToRead, it will define a continuation point in the respective HistoryReadResult. You can then make a subsequent history read request using the continuationPoint in the nodesToRead. If you do not wish to use the returned continuation points, make a new read with the same details and 'releaseContinuationPonts=true'.

You will need to be able to define a correct subtype of HistoryReadDetails for the call.

If you only need to read the history of one variable, you may wish to consider using one of the other historyReadXxx methods, which will do that for you. They will also take care of continuationPoint handling for you. The drawback is that they are only capable of reading one variable at a time.

Parameters:
details - specifies how the data should be read. Use one of the subclasses of HistoryReadDetails.
timestampsToReturn - defines which timestamp information should be returned. The parameter may not be TimestampsToReturn.Neither.
releaseContinuationPoints - if you do not want to use the continuation points returned by the previous request, define this parameter as true, to enable the server to release the continuation points that it reserved. Note though that when it is true, the server will not return any data, so in normal reads you must keep it false.
nodesToRead - The node data for which the history is requested. Define the continuationPoints here, if you wish to continue a previous request that returned continuationPoints.
Returns:
the AsyncResult object that you can monitor for the results. The results will be provided as HistoryReadResponse.
Throws:
ServerConnectionException - if not connected to the server
IllegalArgumentException - if details cannot be encoded
See Also:
historyRead(org.opcfoundation.ua.core.HistoryReadDetails, org.opcfoundation.ua.core.TimestampsToReturn, java.lang.Boolean, org.opcfoundation.ua.core.HistoryReadValueId...), historyReadAtTimes(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime[], org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn), historyReadEvents(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.UnsignedInteger, org.opcfoundation.ua.core.EventFilter, org.opcfoundation.ua.core.TimestampsToReturn), historyReadModified(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.UnsignedInteger, org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn), historyReadProcessed(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DateTime, java.lang.Double, org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.core.AggregateConfiguration, org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn), historyReadRaw(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.DateTime, org.opcfoundation.ua.builtintypes.DateTime, long, java.lang.Boolean, org.opcfoundation.ua.utils.NumericRange, org.opcfoundation.ua.core.TimestampsToReturn)

historyReadAtTimes

public org.opcfoundation.ua.builtintypes.DataValue[] historyReadAtTimes(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                        org.opcfoundation.ua.builtintypes.DateTime[] reqTimes,
                                                                        org.opcfoundation.ua.utils.NumericRange indexRange,
                                                                        org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
                                                                 throws StatusException,
                                                                        ServerConnectionException,
                                                                        ServiceException,
                                                                        org.opcfoundation.ua.encoding.DecodingException
Reads history at specified times.

The method equals to historyReadAtTimes(NodeId, DateTime[], NumericRange, TimestampsToReturn, Boolean) called with useSimpleBounds=false.

The method will make subsequent calls to the server, as long as the server returns continuationPoints, to ensure that a full result set is retrieved. If you suspect that you may get too large results sets (to fit in memory, for instance) this way, it may be better to use historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...) instead.

Parameters:
nodeId - the NodeId of the node whose history should be read
reqTimes - the timestamps from which history should be read
indexRange - the range of array indexes to use for array values. If null, all values should be returned. The first array element is identified with 0. Should be null, if the variable is not an array.

Note that the range applies to each element of the history data samples; not to the elements of the returned array of data.

timestampsToReturn - which timestamps to return with the values
Returns:
the history values for the requested times
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
org.opcfoundation.ua.encoding.DecodingException - if the returned data could not be decoded (received as an ExtensionObject from the server)

historyReadAtTimes

public org.opcfoundation.ua.builtintypes.DataValue[] historyReadAtTimes(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                        org.opcfoundation.ua.builtintypes.DateTime[] reqTimes,
                                                                        org.opcfoundation.ua.utils.NumericRange indexRange,
                                                                        org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
                                                                        Boolean useSimpleBounds)
                                                                 throws StatusException,
                                                                        ServerConnectionException,
                                                                        ServiceException,
                                                                        org.opcfoundation.ua.encoding.DecodingException
Reads history at specified times.

The method will make subsequent calls to the server, as long as the server returns continuationPoints, to ensure that a full result set is retrieved. If you suspect that you may get too large results sets (to fit in memory, for instance) this way, it may be better to use historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...) instead.

Parameters:
nodeId - the NodeId of the node whose history should be read
reqTimes - the timestamps from which history should be read
indexRange - the range of array indexes to use for array values. If null, all values should be returned. The first array element is identified with 0. Should be null, if the variable is not an array.

Note that the range applies to each element of the history data samples; not to the elements of the returned array of data.

timestampsToReturn - which timestamps to return with the values
useSimpleBounds - whether the server is instructed to interpolate values using the SimpleBounds algorithm or the normal one as defined in (OPC UA Part 13. Aggregates Specification).
Returns:
the history values for the requested times
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
org.opcfoundation.ua.encoding.DecodingException - if the returned data could not be decoded (received as an ExtensionObject from the server)

historyReadEvents

public org.opcfoundation.ua.core.HistoryEventFieldList[] historyReadEvents(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                           org.opcfoundation.ua.builtintypes.DateTime startTime,
                                                                           org.opcfoundation.ua.builtintypes.DateTime endTime,
                                                                           org.opcfoundation.ua.builtintypes.UnsignedInteger numValuesPerNode,
                                                                           org.opcfoundation.ua.core.EventFilter filter,
                                                                           org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
                                                                    throws StatusException,
                                                                           ServerConnectionException,
                                                                           ServiceException,
                                                                           org.opcfoundation.ua.encoding.DecodingException
Reads events from history.

The method will make subsequent calls to the server, as long as the server returns continuationPoints, to ensure that a full result set is retrieved. If you suspect that you may get too large results sets (to fit in memory, for instance) this way, it may be better to use historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...) instead.

Parameters:
nodeId - the NodeId of the node whose history should be read
startTime - the beginning of the time interval
endTime - the end of the time interval. If endTime is less than startTime the data will be returned in reverse order
numValuesPerNode - the maximum number of events to return per call. If the value is 0, all events between startTime and endTime are returned in one call. The client will use continuation points automatically to request all events with subsequent reads, though. The value must fit in the range of UnsignedInteger
timestampsToReturn - which timestamps to return with the values
filter - the filter to use for selecting the events to include. You can use the ContentFilterBuilder to create the WhereClause of the filter, the same way that you do for the MonitoredEventItem.setEventFilter(EventFilter).
Returns:
the list of events corresponding to the request
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
org.opcfoundation.ua.encoding.DecodingException - if the returned data could not be decoded (received as an ExtensionObject from the server)

historyReadModified

public org.opcfoundation.ua.core.HistoryModifiedData historyReadModified(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                         org.opcfoundation.ua.builtintypes.DateTime startTime,
                                                                         org.opcfoundation.ua.builtintypes.DateTime endTime,
                                                                         org.opcfoundation.ua.builtintypes.UnsignedInteger numValuesPerNode,
                                                                         org.opcfoundation.ua.utils.NumericRange indexRange,
                                                                         org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
                                                                  throws StatusException,
                                                                         ServerConnectionException,
                                                                         ServiceException,
                                                                         org.opcfoundation.ua.encoding.DecodingException
Reads Modified values from the history.

If a value has been modified multiple times, all values for the time are returned. This means that a timestamp can appear in the array more than once.

The method will make subsequent calls to the server, as long as the server returns continuationPoints, to ensure that a full result set is retrieved. If you suspect that you may get too large results sets (to fit in memory, for instance) this way, it may be better to use historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...) instead.

Parameters:
nodeId - the NodeId of the node whose history should be read
startTime - the beginning of the time interval
endTime - the end of the time interval. If endTime is less than startTime the data will be returned in reverse order
numValuesPerNode - the maximum number of values to return per call. If the value is 0, all values between startTime and endTime are returned in one call. The client will use continuation points automatically to request all values with subsequent reads, though. The value must fit in the range of UnsignedInteger
indexRange - the range of array indexes to use for array values. If null, all values should be returned. The first array element is identified with 0. Should be null, if the variable is not an array.
timestampsToReturn - which timestamps to return with the values
Returns:
the read data values
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
org.opcfoundation.ua.encoding.DecodingException - if the returned data could not be decoded (received as an ExtensionObject from the server)

historyReadProcessed

public org.opcfoundation.ua.builtintypes.DataValue[] historyReadProcessed(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                          org.opcfoundation.ua.builtintypes.DateTime startTime,
                                                                          org.opcfoundation.ua.builtintypes.DateTime endTime,
                                                                          Double processingInterval,
                                                                          org.opcfoundation.ua.builtintypes.NodeId aggregateType,
                                                                          org.opcfoundation.ua.core.AggregateConfiguration aggregateConfiguration,
                                                                          org.opcfoundation.ua.utils.NumericRange indexRange,
                                                                          org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
                                                                   throws ServerConnectionException,
                                                                          ServiceException,
                                                                          org.opcfoundation.ua.encoding.DecodingException,
                                                                          StatusException
Reads processed history data. The server should return Aggregate values from the node history matching the requested timestamps.

The method will make subsequent calls to the server, as long as the server returns continuationPoints, to ensure that a full result set is retrieved. If you suspect that you may get too large results sets (to fit in memory, for instance) this way, it may be better to use historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...) instead.

Parameters:
nodeId - the NodeId of the node whose history should be read
startTime - the beginning of the time interval
endTime - the end of the time interval. If endTime is less than startTime the data will be returned in reverse order. EndTime must not be equal to startTime.
processingInterval - Interval between returned Aggregate values (in milliseconds). The value 0 indicates that there is no Interval defined.
aggregateType - The NodeId of the HistoryAggregate object that indicates the the Aggregates to be used when retrieving processed history. See [UA Part 13] for details.
aggregateConfiguration - Aggregate configuration structure
indexRange - which elements of arrays to return, null returns all. this parameter is always null if the value is not an array
timestampsToReturn - which timestamps to return with the values
Returns:
the read data values
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
org.opcfoundation.ua.encoding.DecodingException - if the returned data could not be decoded (received as an ExtensionObject from the server)

historyReadRaw

public org.opcfoundation.ua.builtintypes.DataValue[] historyReadRaw(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                    org.opcfoundation.ua.builtintypes.DateTime startTime,
                                                                    org.opcfoundation.ua.builtintypes.DateTime endTime,
                                                                    long numValuesPerNode,
                                                                    Boolean returnBounds,
                                                                    org.opcfoundation.ua.utils.NumericRange indexRange,
                                                                    org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
                                                             throws ServerConnectionException,
                                                                    org.opcfoundation.ua.encoding.DecodingException,
                                                                    ServiceException,
                                                                    StatusException
Reads raw history data. The server should return Raw values from the node history between the requested time interval.

The method will make subsequent calls to the server, as long as the server returns continuationPoints, to ensure that a full result set is retrieved. If you suspect that you may get too large results sets (to fit in memory, for instance) this way, it may be better to use historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...) instead.

Parameters:
nodeId - the NodeId of the node whose history should be read
startTime - the beginning of the time interval
endTime - the end of the time interval. If endTime is less than startTime the data will be returned in reverse order. EndTime must not be equal to startTime.
numValuesPerNode - the maximum number of values to return per call. If the value is 0, all values between startTime and endTime are returned in one call. The client will use continuation points automatically to request all values with subsequent reads, though. The value must fit in the range of UnsignedInteger
returnBounds - whether values at the boundaries, corresponding to startTime and endtime, should be included in the result set
indexRange - which elements of arrays to return, null returns all. this parameter is always null if the value is not an array
timestampsToReturn - which timestamps to return with the values
Returns:
the read data values
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
org.opcfoundation.ua.encoding.DecodingException - if the returned data could not be decoded (received as an ExtensionObject from the server)

historyReadRaw

public org.opcfoundation.ua.builtintypes.DataValue[] historyReadRaw(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                    org.opcfoundation.ua.builtintypes.DateTime startTime,
                                                                    org.opcfoundation.ua.builtintypes.DateTime endTime,
                                                                    org.opcfoundation.ua.builtintypes.UnsignedInteger numValuesPerNode,
                                                                    Boolean returnBounds,
                                                                    org.opcfoundation.ua.utils.NumericRange indexRange,
                                                                    org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn)
                                                             throws ServerConnectionException,
                                                                    ServiceException,
                                                                    org.opcfoundation.ua.encoding.DecodingException,
                                                                    StatusException
Reads raw history data. The server should return Raw values from the node history between the requested time interval.

The method will make subsequent calls to the server, as long as the server returns continuationPoints, to ensure that a full result set is retrieved. If you suspect that you may get too large results sets (to fit in memory, for instance) this way, it may be better to use historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...) instead.

Parameters:
nodeId - the NodeId of the node whose history should be read
startTime - the beginning of the time interval
endTime - the end of the time interval. If endTime is less than startTime the data will be returned in reverse order. EndTime must not be equal to startTime.
numValuesPerNode - the maximum number of events to return for a single node. If the value is 0, all values between startTime and endTime are returned.
returnBounds - whether values at the boundaries, corresponding to startTime and endtime, should be included in the result set
indexRange - which elements of arrays to return, null returns all. this parameter is always null if the value is not an array
timestampsToReturn - which timestamps to return with the values
Returns:
the read data values
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
org.opcfoundation.ua.encoding.DecodingException - if the returned data could not be decoded (received as an ExtensionObject from the server)

historyUpdate

public org.opcfoundation.ua.core.HistoryUpdateResult[] historyUpdate(org.opcfoundation.ua.core.HistoryUpdateDetails... details)
                                                              throws ServerConnectionException,
                                                                     ServiceException
Update history data in the server.

Parameters:
details - the history update definitions
Returns:
the history update results. If the results contain errors, you can examine the related diagnostic information from getLastOperationDiagnostics().
Throws:
ServerConnectionException - if not connected to the server
ServiceException - if the service call fails
IllegalArgumentException - if details cannot be encoded

historyUpdateAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> historyUpdateAsync(org.opcfoundation.ua.core.HistoryUpdateDetails... details)
                                                                                                                 throws ServerConnectionException
Update history data in the server.

Parameters:
details - the history update definitions
Returns:
AsyncResult object that can be monitored for the results. The results are available as HistoryUpdateResponse.
Throws:
ServerConnectionException - if not connected to the server
IllegalArgumentException - if details cannot be encoded

historyUpdateData

public org.opcfoundation.ua.core.HistoryUpdateResult historyUpdateData(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                       org.opcfoundation.ua.core.PerformUpdateType performInsertReplace,
                                                                       org.opcfoundation.ua.builtintypes.DataValue[] updateValues)
                                                                throws StatusException,
                                                                       ServerConnectionException,
                                                                       ServiceException
Updates history data.

Insert data functionality

Setting performInsertReplace = INSERT_1 inserts entries into the history database at the specified timestamps for one or more HistoricalDataNodes. If an entry exists at the specified timestamp, the new entry shall not be inserted; instead the StatusCode shall indicate Bad_EntryExists.

This function is intended to insert new entries at the specified timestamps; e.g., the insertion of lab data to reflect the time of data collection.

Replace data functionality

Setting performInsertReplace = REPLACE_2 replaces entries in the history database at the specified timestamps for one or more HistoricalDataNodes. If no entry exists at the specified timestamp, the new entry shall not be inserted; otherwise the StatusCode shall indicate Bad_NoEntryExists.

This function is intended to replace existing entries at the specified timestamp; e.g., correct lab data that was improperly processed, but inserted into the history database.

Update data functionality

Setting performInsertReplace = UPDATE_3 inserts or replaces entries in the history database for the specified timestamps for one or more HistoricalDataNodes. If the item has an entry at the specified timestamp, the new entry will replace the old one. If there is no entry at that timestamp, the function will insert the new data.

This function is intended to unconditionally insert/replace values and qualities; e.g., correction of values for bad sensors.

Good as a StatusCode for an individual entry is allowed when the server is unable to say whether there was already a value at that timestamp. If the server can determine whether the new entry replaces an entry that was already there, it should use Good_EntryInserted or Good_EntryReplaced to return that information.

(OPC UA Spec. Part 11 v 1.01 6.7.2)

Parameters:
nodeId - the NodeId of the node whose history should be read
performInsertReplace - determines which action of Insert, Replace or Update is performed. Update equals to "Insert or Replace" depending on whether the variable has an entry for the specified timestamp. For Insert and replace a StatusException with StatusCode Bad_EntryExists or Bad_NoEntryExists will be set for operationResults, respectively, if there already is an entry which is being inserted or is no entry that could be replaced.
updateValues - the values to be updated in history
Returns:
results of the operations as HistoryUpdateResult. See the operationResults for the individual result for each of the updateValues.
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails

historyUpdateEvent

public org.opcfoundation.ua.core.HistoryUpdateResult historyUpdateEvent(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                        org.opcfoundation.ua.core.PerformUpdateType performInsertReplace,
                                                                        org.opcfoundation.ua.core.EventFilter filter,
                                                                        org.opcfoundation.ua.core.HistoryEventFieldList[] eventData)
                                                                 throws StatusException,
                                                                        ServerConnectionException,
                                                                        ServiceException
Updates historical events in the server.

This function is intended to insert new entries; e.g., backfilling of historical Events.

Setting performInsertReplace = INSERT_1 inserts entries into the Event history database for one or more HistoricalEventNodes. The whereClause parameter of the EventFilter shall be empty. The SelectClause shall specify the EventType and the Time. The selectClause should specify the SourceNode and the SourceName. If the historian does not support archiving the specified EventType the StatusCode shall indicate Bad_TypeDefinitionInvalid. If the SourceNode is not a valid source for Events the StatusCode shall indicate Bad_SourceNodeIdInvalid. If the Time does not fall within range that can be stored the StatusCode shall indicate Bad_OutOfRange.If the selectClause does not include fields which are mandatory for the EventType the StatusCode shall indicate Bad_ArgumentsMissing. If the selectClause specifies fields which are not valid for the EventType or cannot be saved by the historian the StatusCode shall indicate Good_DataIgnored and the OperationResults array shall specify Bad_NotSupported for each ignored field.

The EventId is a server generated opaque value and a Client cannot assume it knows how to create value EventIds. If a Client does specify the EventId in the selectClause and it matches an existing Event the StatusCode shall indicate Bad_EntryExists. A Client must use a HistoryRead to discover any automatically generated EventIds.

If any errors occur while processing individual fields the StatusCode shall indicate Bad_ArgumentInvalid and the OperationResults array shall specify the exact error for each invalid field. The IndexRange parameter of the SimpleAttributeOperand is not valid for insert operations and the OperationResults shall specify Bad_IndexRangeInvalid if one is specified.

If no errors occur the StatusCode shall indicate Good and the OperationResults array shall be empty. If errors occur OperationResults array will have one element for each field specified in the selectClause.

A Client may instruct the Server to choose a suitable default value for a field by specifying a value of null. If the server is not able to select a suitable default the corresponding entry in the OperationResults array shall be Bad_InvalidArgument.

Replace event functionality

This function is intended to replace fields in existing Event entries; e.g., correct Event data that contained incorrect data due to a bad sensor.

Setting performInsertReplace = REPLACE_2 replaces entries in the Event history database for the specified filter for one or more HistoricalEventNodes. The whereClause parameter of the EventFilter shall specify the EventId Property. If no entry exists matching the specified filter, no updates will be performed, instead the StatusCode shall indicate Bad_NoEntryExists.

If the selectClause specifies fields which are not valid for the EventType or cannot be saved by the historian the StatusCode shall indicate Good_DataIgnored and the OperationResults array shall specify Bad_NotSupported for each ignored field.

If a field is valid for the EventType but cannot be changed the StatusCode shall indicate Good_DataIgnored and the corresponding entry in the OperationResults array shall be Bad_NotWriteable.

If fatal errors occur while processing individual fields the StatusCode shall indicate Bad_ArgumentInvalid and the OperationResults array shall specify the exact error.

If no errors occur the StatusCode shall indicate Good and the OperationResults array shall be empty. If errors occur OperationResults array will have one element for each field specified in the selectClause.

If a Client specifies a value of null for any field the Server shall set the value of the field to null. If a null value is not valid for the corresponding entry in the OperationResults array shall be Bad_InvalidArgument.

Update event functionality

This function is intended to unconditionally insert/replace Events; e.g., synchronizing a backup Event database.

Setting performInsertReplace = UPDATE_3 inserts or replaces entries in the Event history database for the specified filter for one or more HistoricalEventNodes.

The server will, based on its own criteria, attempt to determine if the Event already exists, if it does the existing Event will be deleted and the new Event will be inserted (retaining the EventId). If the event does not exist then a new Event will be inserted, including the generation of a new EventId.

All of the restrictions, behavoirs errors specified for the Insert functionality also apply to this function.

If an existing entry was replaced successfully the StatusCode shall be Good_EntryReplaced. If a new entry was created the StatusCode shall be Good_EntryInserted. If the server cannot determine whether it replaced or inserted an entry it the StatusCode shall be Good.

(OPC UA Spec. Part 11 v 1.01 6.7.4)

Parameters:
nodeId - the NodeId of the node whose history should be read
performInsertReplace - determines which action of Insert, Replace or Update is performed. Update equals to "Insert or Replace" depending on whether the variable has an entry for the specified timestamp.
filter - the filter defines the target of the operation.
eventData - the event data to be updated
Returns:
results of the operations as HistoryUpdateResult.
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails

historyUpdateStructureData

public org.opcfoundation.ua.core.HistoryUpdateResult historyUpdateStructureData(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                                org.opcfoundation.ua.core.PerformUpdateType performInsertReplace,
                                                                                org.opcfoundation.ua.builtintypes.DataValue[] updateValues)
                                                                         throws StatusException,
                                                                                ServerConnectionException,
                                                                                ServiceException
Updates historical structure data.

Structured History Data provides metadata describing an entry in the history database. The server shall define what uniqueness means for each Structured History Data structure type. For example, a server may only allow one Annotation per timestamp which means the timestamp is the unique key for the structure. Another server may allow for multiple Annotations to exist per user, so a combination username, Timestamp and message may be used as the unique key for the structure. In the following sections the terms "Structured History Data exists" and "at the specificed parameters" means a matching entry has been found at the specified timestamp using the Server's criteria for uniqueness.

In the case where the Client wishes to Replace a parameter that is part of the uniqueness criteria, the resulting StatusCode would be Bad_NoEntryExists. They will have to Remove the existing structure and Insert the new structure.

Insert functionality

Setting performInsertReplace = INSERT_1 inserts Structured History Data such as Annotations, into the history database at the specified parameters for one or more Properties of HistoricalDataNodes

If a Structured History Data entry already exists at the specified parameters the StatusCode shall indicate Bad_EntryExists.

Replace functionality

Setting performInsertReplace = REPLACE_2 replaces Structured History Data such as Annotations in the history database at the specified parameters for one or more Properties of HistoricalDataNodes.

If a Structured History Data entry does not already exist at the specified parameters, the StatusCode shall indicate Bad_NoEntryExists.

Update functionality

Setting performInsertReplace = UPDATE_3 inserts or replaces Structure Data such as Annotations in the history database at the specified parameters for one or more Properties of HistoricalDataNodes.

If a Structure History Data entry already exists at the specified parameters it is deleted and the value provided by the Client is inserted. If no existing entry exists the new entry is inserted.

If an existing entry was replaced successfully the StatusCode shall be Good_EntryReplaced. If a new entry was created the StatusCode shall be Good_EntryInserted. If the server cannot determine whether it replaced or inserted an entry it the StatusCode shall be Good.

Remove functionality

Setting performInsertReplace = REMOVE_4 removes Structure Data such as Annotations from the history database at the specified parameters for one or more Properties of HistoricalDataNodes.

If a Structure History Data entry exists at the specified parameters it is deleted. If Structured History Data does not already exist at the specified parameters, the StatusCode shall indicate Bad_NoEntryExists.

(OPC UA Spec. Part 11 v1.01 6.7.3)

Parameters:
nodeId - the NodeId of the node whose history should be read
performInsertReplace - which action to take in updating (INSERT, REPLACE, UPDATE)
updateValues - the values to be updated in history
Returns:
results of the operation as HistoryUpdateResult
Throws:
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails

isAutoReconnect

public boolean isAutoReconnect()
Automatic reconnection setting. When true, the UaClient will try to reconnect automatically to the server, when communication fails.

Returns:
the doAutoReconnect

isConnected

public boolean isConnected()
Are we connected to the server?

When isConnected, getSession returns a valid session. In other words, isConnected=(getSession() != null)

isConnected is basically changed by calling connect() and disconnect().

When isConnected, also check getServerState() to check if the server is actually running. If communication fails, isConnected will still return true, but getServerState() will give ServerState.CommunicationFault.

Returns:
true when we are connected to the server, false otherwise.

isKeepSubscriptions

public boolean isKeepSubscriptions()
Returns:
whether to keep subscriptions in the server when disconnecting.

isValidateDiscoveredEndpoints

public boolean isValidateDiscoveredEndpoints()
Returns:
true if the client should validate the endpoints returned by the server at session create against those returned for discoverEndpoints().
See Also:
setValidateDiscoveredEndpoints(boolean)

read

public org.opcfoundation.ua.core.ReadResponse read(Double maxAge,
                                                   org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
                                                   org.opcfoundation.ua.core.ReadValueId... nodesToRead)
                                            throws ServiceException
This Service is used to read one or more Attributes of one or more Nodes. For constructed Attribute values whose elements are indexed, such as an array, this Service allows Clients to read the entire set of indexed values as a composite, to read individual elements or to read ranges of elements of the composite.

The maxAge parameter is used to direct the Server to access the value from the underlying data source, such as a device, in case its own copy of the data is older than that which the maxAge specifies. If the Server cannot meet the requested max age, it returns its "best effort" value rather than rejecting the request.

Sample usage:

 ReadValueId[] nodesToRead = new ReadValueId[2];
 // Scalar value or complete array
 nodesToRead[0] = new ReadValueId(nodeId1, Attributes.Value, null,
 null);
 

// Part of an array NumericRange range = new NumericRange(1, 3); nodesToRead[10] = new ReadValueId(nodeId2, Attributes.Value, range.toString(), null);

final ReadResponse readResponse = read(UaClient.MAX_CACHE_AGE, TimestampsToReturn.Both, nodesToRead); final DataValue[] values = readResponse.getResults();

// Use the values: if (values[0].getStatusCode().isGood()) System.out.println(values[0].getValue()); if (values[1].getStatusCode().isGood()) System.out.println(values[1].getValue());

Parameters:
timestampsToReturn - An enumeration that specifies the Timestamps to be returned for each requested Variable Value Attribute.
maxAge - Maximum age of the value to be read in milliseconds. The age of the value is based on the difference between the ServerTimestamp and the time when the Server starts processing the request. For example if the Client specifies a maxAge of 500 milliseconds and it takes 100 milliseconds until the Server starts processing the request, the age of the returned value could be 600 milliseconds prior to the time it was requested.

If the Server has one or more values of an Attribute that are within the maximum age, it can return any one of the values or it can read a new value from the data source. The number of values of an Attribute that a Server has depends on the number of MonitoredItems that are defined for the Attribute. In any case, the Client can make no assumption about which copy of the data will be returned.

If the Server does not have a value that is within the maximum age, it shall attempt to read a new value from the data source. If the Server cannot meet the requested maxAge, it returns its "best effort" value rather than rejecting the request. This may occur when the time it takes the Server to process and return the new data value after it has been accessed is greater than the specified maximum age.

If maxAge is set to 0, the Server shall attempt to read a new value from the data source.

If maxAge is set to MAX_CACHE_AGE, the Server shall attempt to get a cached value. Negative values are invalid for maxAge.

nodesToRead - List of Nodes and their Attributes to read. For each entry in this list, a StatusCode is returned, and if it indicates success, the Attribute Value is also returned.

Note that DataEncoding may only be defined for the Value attribute - and the Java stack currently only supports the binary encoding. So typically, it is best to leave it to null.

Returns:
The complete response returned from the server. Use getResults() to read the DataValues. For each value, check StatusCode to learn if there were problems. Also check for DiagnosticInfos, if it contains server specific error information for the items. The following status codes are expected on failures: Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_DataEncodingInvalid, Bad_DataEncodingUnsupported, Bad_NotReadable, Bad_UserAccessDenied
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. The following result codes are expected: Bad_NothingToDo, Bad_TooManyOperations, Bad_MaxAgeInvalid, Bad_TimestampsToReturnInvalid
See Also:
readAsync(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), write(org.opcfoundation.ua.core.WriteValue...), writeAttribute(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger, java.lang.Object), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object), writeValues(org.opcfoundation.ua.builtintypes.NodeId[], java.lang.Object[])

readAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> readAsync(Double maxAge,
                                                                                                               org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
                                                                                                               org.opcfoundation.ua.core.ReadValueId... nodesToRead)
Read node attributes from the server asynchronously. This is a generic method, which you can use to read values for several nodes and attributes at once. You can also define specific parameters to optimize the returned data.

Example:

 // Read the name of the objects folder, asynchronously.

 NodeId myNodeId = Identifiers.ObjectsFolder;

 // Provide a state listener with the call to watch the state transitions
 // You may read the response when the state has changed to Complete
 // - or wait for it, as is done below.

 ClientServiceRequest r = server.readAsync(new StateListener<ClientServiceRequestState>() {

   @Override
   public void onStateTransition(IStatefulObject<ClientServiceRequestState, ?> sender,
       ClientServiceRequestState oldState, ClientServiceRequestState newState) {
     System.out.println(newState);
   }

 }, Server.MAX_CACHE_AGE, TimestampsToReturn.Both, new ReadValueId(myNodeId, Attributes.NodeId, null, null));
 ReadResponse response = (ReadResponse) r.waitForResult();
 assertTrue(response.getResponseHeader().getServiceResult().isGood());
 DataValue[] v = response.getResults();
 if (v[0].getStatusCode().isGood())
   System.out.println(v[0].getValue().getValue()); // DataValue.Variant.Object
 

Parameters:
timestampsToReturn - An enumeration that specifies the Timestamps to be returned for each requested Variable Value Attribute.
maxAge - Maximum age of the value to be read in milliseconds. The age of the value is based on the difference between the ServerTimestamp and the time when the Server starts processing the request. For example if the Client specifies a maxAge of 500 milliseconds and it takes 100 milliseconds until the Server starts processing the request, the age of the returned value could be 600 milliseconds prior to the time it was requested. If the Server has one or more values of an Attribute that are within the maximum age, it can return any one of the values or it can read a new value from the data source. The number of values of an Attribute that a Server has depends on the number of MonitoredItems that are defined for the Attribute. In any case, the Client can make no assumption about which copy of the data will be returned. If the Server does not have a value that is within the maximum age, it shall attempt to read a new value from the data source. If the Server cannot meet the requested maxAge, it returns its "best effort" value rather than rejecting the request. This may occur when the time it takes the Server to process and return the new data value after it has been accessed is greater than the specified maximum age. If maxAge is set to 0, the Server shall attempt to read a new value from the data source. If maxAge is set to the max Int32 value (@link Integer.MAX_VALUE), the Server shall attempt to get a cached value. Negative values are invalid for maxAge.
nodesToRead - List of Nodes and their Attributes to read. For each entry in this list, a StatusCode is returned, and if it indicates success, the Attribute Value is also returned.

Note that DataEncoding may only be defined for the Value attribute - and the Java stack currently only supports the binary encoding. So typically, it is best to leave it to null.

Returns:
The asynchronous monitor, which will provide the response, when available (as ReadResponse). You can poll it, set a listener or wait for the result (or error).
See Also:
read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), write(org.opcfoundation.ua.core.WriteValue...), writeAsync(org.opcfoundation.ua.core.WriteValue...)

readAttribute

public org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                                                 org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
                                                          throws ServiceException,
                                                                 StatusException
Reads the value for the specified single node attribute.

Note: Only use this function occasionally. Use readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]) or readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read. Only local nodes are supported.
attributeId - The attribute to read. See Attributes for valid values.
Returns:
The attribute value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readAttribute

public org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                                                 org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                                                                 org.opcfoundation.ua.utils.NumericRange indexRange,
                                                                 Double maxCacheAge)
                                                          throws ServiceException,
                                                                 StatusException
Reads the value for the specified single node attribute.

Note: Only use this function occasionally. Use readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]) or readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read. Only local nodes are supported.
attributeId - The attribute to read. See Attributes for valid values.
indexRange - An optional range of array indexes from which the value should be read. Applies to the Value attribute only.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The attribute value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readAttribute

public org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                 org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
                                                          throws ServiceException,
                                                                 StatusException
Reads the value for the specified single node attribute.

Note: Only use this function occasionally. Use readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]) or readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read.
attributeId - The attribute to read. See Attributes for valid values.
Returns:
The attribute value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readAttribute

public org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                 org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                                                                 org.opcfoundation.ua.utils.NumericRange indexRange,
                                                                 Double maxCacheAge)
                                                          throws ServiceException,
                                                                 StatusException
Reads the value for the specified single node attribute.

Note: Only use this function occasionally. Use readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]) or readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read.
attributeId - The attribute to read. See Attributes for valid values.
indexRange - An optional range of array indexes from which the value should be read. Applies to the Value attribute only.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The attribute value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readAttributes

public org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                                                    org.opcfoundation.ua.builtintypes.UnsignedInteger... attributeIds)
                                                             throws ServiceException,
                                                                    StatusException
Read all attributes of a Node. The read is specified with MAX_CACHE_AGE, enabling the server to return the current value it has in the cache for the attribute.

Note: Only use this function occasionally. Use read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read. Only local nodes are supported.
attributeIds - The attributes to read. See Attributes for valid values.
Returns:
The attribute values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call.
StatusException - If the server returns a bad status for the value.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readAttributes

public org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                                                    org.opcfoundation.ua.builtintypes.UnsignedInteger[] attributeIds,
                                                                    org.opcfoundation.ua.utils.NumericRange[] indexRanges,
                                                                    Double maxCacheAge)
                                                             throws ServiceException,
                                                                    StatusException
Read all attributes of a Node. The read is specified with MAX_CACHE_AGE, enabling the server to return the current value it has in the cache for the attribute.

Note: Only use this function occasionally. Use read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read. Only local nodes are supported.
attributeIds - The attributes to read. See Attributes for valid values.
indexRanges - Optional ranges of array indexes from which the values should be read. Applies to the Value attribute only.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The attribute values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call.
StatusException - If the server returns a bad status for the value.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readAttributes

public org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                    org.opcfoundation.ua.builtintypes.UnsignedInteger... attributeIds)
                                                             throws ServiceException
Read all attributes of a Node. The read is specified with MAX_CACHE_AGE, enabling the server to return the current value it has in the cache for the attribute.

Note: Only use this function occasionally. Use read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read.
attributeIds - The attributes to read. See Attributes for valid values.
Returns:
The attribute values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readAttributes

public org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                                    org.opcfoundation.ua.builtintypes.UnsignedInteger[] attributeIds,
                                                                    org.opcfoundation.ua.utils.NumericRange[] indexRanges,
                                                                    Double maxCacheAge)
                                                             throws ServiceException
Read all attributes of a Node. The read is specified with MAX_CACHE_AGE, enabling the server to return the current value it has in the cache for the attribute.

Note: Only use this function occasionally. Use read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read.
attributeIds - The attributes to read. See Attributes for valid values.
indexRanges - Optional ranges of array indexes from which the values should be read. Applies to the Value attribute only.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The attribute values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...)

readValue

public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
                                                      throws ServiceException,
                                                             StatusException
Reads the value attribute of a node.

Note: Only use this function occasionally. Use readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) or read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read. Only local nodes are supported.
Returns:
The value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValue

public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                                             Double maxCacheAge)
                                                      throws ServiceException,
                                                             StatusException
Reads the value attribute of a node.

Note: Only use this function occasionally. Use readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) or read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read. Only local nodes are supported.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValue

public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                                             org.opcfoundation.ua.utils.NumericRange indexRange)
                                                      throws ServiceException,
                                                             StatusException
Reads the value attribute of a node.

Note: Only use this function occasionally. Use readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) or read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

For example:

 // Read element #1 of the array
 client.readValue(arrayVariableId, new NumericRange(1));
 // Read elements #1-#3 of the one-dimensional array
 client.readValue(arrayVariableId, new NumericRange(1, 3));
 // Read elements #1-#2/#2-#3 of the two-dimensional array
 client.readValue(arrayVariableId, new NumericRange(new int[] {1, 2}, new int[] {2, 3}));
 

Parameters:
nodeId - The node to read. Only local nodes are supported.
indexRange - An optional range of array indexes from which the value should be read. Applies to the Value attribute only.
Returns:
The value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValue

public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
                                                             org.opcfoundation.ua.utils.NumericRange indexRange,
                                                             Double maxCacheAge)
                                                      throws ServiceException,
                                                             StatusException
Reads the value attribute of a node.

Note: Only use this function occasionally. Use readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) or read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

For example:

 // Read element #1 of the array - from device (maxCacheAge=0)
 client.readValue(arrayVariableId, new NumericRange(1), 0);
 // Read elements #1-#3 of the one-dimensional array
 client.readValue(arrayVariableId, new NumericRange(1, 3), 0);
 // Read elements #1-#2/#2-#3 of the two-dimensional array
 client.readValue(arrayVariableId, new NumericRange(new int[] {1, 2}, new int[] {2, 3}), 0);
 

Parameters:
nodeId - The node to read. Only local nodes are supported.
indexRange - An optional range of array indexes from which the value should be read. Applies to the Value attribute only.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValue

public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId)
                                                      throws ServiceException,
                                                             StatusException
Reads the value attribute of a node.

Note: Only use this function occasionally. Use readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) or read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read.
Returns:
The value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValue

public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                             Double maxCacheAge)
                                                      throws ServiceException,
                                                             StatusException
Reads the value attribute of a node.

Note: Only use this function occasionally. Use readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) or read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

Parameters:
nodeId - The node to read.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValue

public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                             org.opcfoundation.ua.utils.NumericRange indexRange)
                                                      throws ServiceException,
                                                             StatusException
Reads the value attribute of a node.

Note: Only use this function occasionally. Use readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) or read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

For example:

 // Read element #1 of the array
 client.readValue(arrayVariableId, new NumericRange(1));
 // Read elements #1-#3 of the one-dimensional array
 client.readValue(arrayVariableId, new NumericRange(1, 3));
 // Read elements #1-#2/#2-#3 of the two-dimensional array
 client.readValue(arrayVariableId, new NumericRange(new int[] {1, 2}, new int[] {2, 3}));
 

Parameters:
nodeId - The node to read.
indexRange - An optional range of array indexes from which the value should be read. Applies to the Value attribute only.
Returns:
The value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValue

public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                                                             org.opcfoundation.ua.utils.NumericRange indexRange,
                                                             Double maxCacheAge)
                                                      throws ServiceException,
                                                             StatusException
Reads the value attribute of a node.

Note: Only use this function occasionally. Use readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[]), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...) or read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read several nodes or attributes.

For example:

 // Read element #1 of the array - from device (maxCacheAge=0)
 client.readValue(arrayVariableId, new NumericRange(1), 0);
 // Read elements #1-#3 of the one-dimensional array
 client.readValue(arrayVariableId, new NumericRange(1, 3), 0);
 // Read elements #1-#2/#2-#3 of the two-dimensional array
 client.readValue(arrayVariableId, new NumericRange(new int[] {1, 2}, new int[] {2, 3}), 0);
 

Parameters:
nodeId - The node to read.
indexRange - An optional range of array indexes from which the value should be read. Applies to the Value attribute only.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The value (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds)
                                                         throws ServiceException,
                                                                StatusException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read. Only local nodes are supported.
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds,
                                                                org.opcfoundation.ua.utils.NumericRange[] indexRanges)
                                                         throws ServiceException,
                                                                StatusException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read. Only local nodes are supported.
indexRanges - Optional ranges of array indexes from which the values should be read.
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds,
                                                                org.opcfoundation.ua.utils.NumericRange[] indexRanges,
                                                                org.opcfoundation.ua.core.TimestampsToReturn timestamps)
                                                         throws ServiceException,
                                                                StatusException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read. Only local nodes are supported.
indexRanges - Optional ranges of array indexes from which the values should be read.
timestamps - Define which timestamps to return with each value. The default is to request TimestampsToReturn.Both.
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds,
                                                                org.opcfoundation.ua.utils.NumericRange[] indexRanges,
                                                                org.opcfoundation.ua.core.TimestampsToReturn timestamps,
                                                                Double maxCacheAge)
                                                         throws ServiceException,
                                                                StatusException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read. Only local nodes are supported.
indexRanges - Optional ranges of array indexes from which the values should be read.
timestamps - Define which timestamps to return with each value. The default is to request TimestampsToReturn.Both.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds,
                                                                org.opcfoundation.ua.core.TimestampsToReturn timestamps)
                                                         throws ServiceException,
                                                                StatusException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read. Only local nodes are supported.
timestamps - Define which timestamps to return with each value.
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds)
                                                         throws ServiceException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read.
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
                                                                org.opcfoundation.ua.utils.NumericRange[] indexRanges)
                                                         throws ServiceException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read.
indexRanges - Optional ranges of array indexes from which the values should be read.
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
                                                                org.opcfoundation.ua.utils.NumericRange[] indexRanges,
                                                                org.opcfoundation.ua.core.TimestampsToReturn timestamps)
                                                         throws ServiceException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read.
indexRanges - Optional ranges of array indexes from which the values should be read.
timestamps - Define which timestamps to return with each value. The default is to request TimestampsToReturn.Both.
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
                                                                org.opcfoundation.ua.utils.NumericRange[] indexRanges,
                                                                org.opcfoundation.ua.core.TimestampsToReturn timestamps,
                                                                Double maxCacheAge)
                                                         throws ServiceException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read.
indexRanges - Optional ranges of array indexes from which the values should be read.
timestamps - Define which timestamps to return with each value. The default is to request TimestampsToReturn.Both.
maxCacheAge - Maximum accepted age of the value. If the server has an older value in its cache, it should go and read a new value from the source (e.g. device) instead of returning the value from cache. The default equals to Integer.MAX_VALUE (as Double).
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

readValues

public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
                                                                org.opcfoundation.ua.core.TimestampsToReturn timestamps)
                                                         throws ServiceException
Reads the value attribute of several nodes at once.

Parameters:
nodeIds - The nodes to read.
timestamps - Define which timestamps to return with each value.
Returns:
The values (with status and timestamps)
Throws:
ServiceException - If the server returns a bad ServiceResult code for the service call. Read the exception for the error details and diagnostics.
See Also:
readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger), readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger...), read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object)

reconnect

public boolean reconnect()
                  throws ServiceException,
                         ConnectException,
                         SessionActivationException
Reconnect to the server. Reconnect will first create a new secure channel. If it succeeds, it will activate the current session with the new channel. If the session cannot be activated (i.e. the session has expired or the server restarted), it will create a new session.

It will also try to transfer the subscriptions to the new session, but if it does not succeed, the subscriptions are recreated.

Note that by default, UaClient will start an automatic reconnect sequence whenever the ServerState goes to CommunicationFault. If you wish to use manual reconnection, use setAutoReconnect(boolean) to disable the automatic system first.

Returns:
true if the method managed to reconnect using the old session; false if it connected with a new session
Throws:
ServiceException - if the service call to create the secure channel fails
ConnectException - if the session could not be created
SessionActivationException - if the session activation call fails (for example, user authentication failed)

registerModel

public void registerModel(ClientCodegenModel codegenModel)
Register an information model to use in the application. All the types in the model are then available for the application, when it constructs new instances.

Parameters:
codegenModel - the model created by the codegen.

removeServerStatusListener

public boolean removeServerStatusListener(ServerStatusListener serverStatusListener)
Remove a listener from the ServerStatus events.

Parameters:
serverStatusListener -
Returns:
true if the listener was in the list of event listeners

removeSubscription

public org.opcfoundation.ua.builtintypes.StatusCode removeSubscription(Subscription subscription)
                                                                throws ServiceException
Remove the subscription from Subscriptions. If isConnected() the subscription is also deleted from the server.

Parameters:
subscription -
Returns:
If connected, the result of the service call. Otherwise StatusCode.GOOD, if the subscription was removed from Subscriptions. If Subscriptions did not contain it, returns status code Good_NoData.
Throws:
ServiceException - if the service call fails.
See Also:
removeSubscriptions(com.prosysopc.ua.client.Subscription[]), addSubscription(com.prosysopc.ua.client.Subscription), getSubscription(int), getSubscriptionCount()

removeSubscriptions

public org.opcfoundation.ua.builtintypes.StatusCode[] removeSubscriptions(Subscription[] subscriptions)
                                                                   throws ServiceException
Remove subscriptions from Subscriptions. If isConnected() the subscriptions are also removed from the server.

Parameters:
subscriptions - The subscriptions to remove.
Returns:
If isConnected, the operation results (as StatusCodes). Otherwise StatusCode.GOOD for each subscription, if the subscription was removed from Subscriptions. If Subscriptions did not contain a subscription, returns status code Good_NoData for it.
Throws:
ServiceException - if the service call fails.
See Also:
removeSubscription(com.prosysopc.ua.client.Subscription), addSubscription(com.prosysopc.ua.client.Subscription), getSubscription(int), getSubscriptionCount()

removeSubscriptionsAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.StatusCode[]> removeSubscriptionsAsync(Subscription... subscriptions)
                                                                                                                    throws ServiceException
Remove subscriptions from Subscriptions, asynchronously. If isConnected() the subscriptions are also removed from the server. The method does not wait for the operation to terminate before it returns.

Parameters:
subscriptions - The subscriptions to remove.
Returns:
An AsyncResult, which will get the final Result of type StatusCode[], when the operation is ready. If isConnected, the operation results (as StatusCodes). Otherwise StatusCode.GOOD for each subscription, if the subscription was removed from Subscriptions. If Subscriptions did not contain a subscription, returns status code Good_NoData for it.
Throws:
ServiceException
See Also:
removeSubscriptions(com.prosysopc.ua.client.Subscription[]), addSubscription(com.prosysopc.ua.client.Subscription), getSubscription(int), getSubscriptionCount()

resetEndpoint

public void resetEndpoint()
Undefines the Endpoint. Same as calling setEndpoint(EndpointDescription) with null.


serviceRequest

public org.opcfoundation.ua.builtintypes.ServiceResponse serviceRequest(org.opcfoundation.ua.builtintypes.ServiceRequest request)
                                                                 throws ServiceException
Send a custom service request to the server, synchronously.

Parameters:
request - The service request object, e.g. TestStackRequest
Returns:
The service response. Cast this to the expected type, e.g. TestStackResponse
Throws:
ServiceException - if the service call fails
See Also:
serviceRequestAsync(org.opcfoundation.ua.builtintypes.ServiceRequest)

serviceRequestAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> serviceRequestAsync(org.opcfoundation.ua.builtintypes.ServiceRequest request)
                                                                                                                  throws ServiceException
Send a custom service request to the server, asynchronously.

Parameters:
request - The service request object, e.g. TestStackRequest
Returns:
The asynchronous monitor, which will provide the response, when available. You can poll it, set a listener or wait for the result (or error).
Throws:
ServiceException

sessionlessRequest

public org.opcfoundation.ua.builtintypes.ServiceResponse sessionlessRequest(org.opcfoundation.ua.builtintypes.ServiceRequest request)
                                                                     throws InvalidServerEndpointException,
                                                                            ServerConnectionException,
                                                                            ServiceException
Make a service request to the server over a secure channel. This method can be used in the rare case that you need to send a request without a session to the server.

If isConnected() (with a session), serviceRequest(ServiceRequest) will be called.

Parameters:
request - the service request to send
Returns:
the response to the request (cast it to the correct type)
Throws:
InvalidServerEndpointException - if Uri is not valid, or not listed in the server's list of endpoints
ServerConnectionException - if connection to the server fails
ServiceException - if the service call fails

setAddress

public void setAddress(UaAddress address)

setApplicationIdentity

public void setApplicationIdentity(ApplicationIdentity applicationIdentity)
Set the security identity of the client application. The information is used to define the security settings passed to the server when you connect() to it.

Parameters:
applicationIdentity -

setAuditEntryId

public void setAuditEntryId(String auditEntryId)
An identifier that identifies the Client's security audit log entry associated with the operations requested from the server. An empty string value means that this parameter is not used.

The AuditEntryId typically contains who initiated the action and from where it was initiated. The AuditEventId is included in the AuditEvent to allow human readers to correlate an Event with the initiating action.

Parameters:
auditEntryId - the auditEntryId to set

setAutoReconnect

public void setAutoReconnect(boolean doAutoReconnect)
Define automatic reconnection.

Default: true

Parameters:
doAutoReconnect - When true, the UaClient will try to reconnect automatically to the server, when communication fails.

setEndpoint

public void setEndpoint(org.opcfoundation.ua.core.EndpointDescription endpoint)
                 throws URISyntaxException
Use the EndpointDescription to select the server endpoint to connect to.

Note: Must be not isConnected() when changing the endpoint.

Parameters:
endpoint - the endpoint to use.
Throws:
URISyntaxException - if the endpointurl is not valid
See Also:
setUri(String)

setKeepSubscriptions

public void setKeepSubscriptions(boolean keepSubscriptions)
Defines that the Subscriptions should be left in the server, when {link disconnect} is called.

Parameters:
keepSubscriptions -

setListener

public void setListener(UaClientListener listener)
Parameters:
listener - the listener to set

setLocale

public void setLocale(Locale locale)
Define the user locale, in which all localizable text is requested from the server.

Locale is initialized to the default locale for the Java Virtual Machine.

Parameters:
locale - the locale to set

setMaxResponseMessageSize

public void setMaxResponseMessageSize(int maxResponseMessageSize)
Define the maximum size, in bytes, for the body of any response message from the server. The server should return Bad_ResponseTooLarge service fault if a response message exceeds this limit.

Parameters:
maxResponseMessageSize - the maxResponseMessageSize to set, the value must be a positive value. Default is 0, which means that it is not used.

setMaxResponseMessageSize

public void setMaxResponseMessageSize(org.opcfoundation.ua.builtintypes.UnsignedInteger maxResponseMessageSize)
Define the maximum size, in bytes, for the body of any response message from the server. The server should return Bad_ResponseTooLarge service fault if a response message exceeds this limit.

Parameters:
maxResponseMessageSize - the maxResponseMessageSize to set. Default is 0, which means that it is not used. Null is interpreted as 0.

setOperationDiagnosticMask

public void setOperationDiagnosticMask(EnumSet<UaApplication.DiagnosticMask> operationDiagnosticMask)
Define the operational level diagnostic info to return for the service calls.

Use EnumSet.allOf(DiagnosticMaskBit.class) to request all diagnostics.

Parameters:
operationDiagnosticMask -
See Also:
setServiceDiagnosticMask(java.util.EnumSet)

setPublishRequestFactor

public void setPublishRequestFactor(double publishRequestFactor)
The factor is used to calculate the number of pending publish requests we are trying to keep open in the server all the time. The factor is used to multiply the number of subscriptions. So, if you have 2 subscriptions and the factor is 2, we will send 4 publish requests to the server and when we get responses, we send the same amount of new requests. The result is rounded up, so that 1 will be the actual minimum number of requests.

The server may respond with Bad_TooManyPublishRequests, if we use a too big a factor, in which case we of course halt sending until we get a good response again.

Parameters:
publishRequestFactor - the new publish request factor. This should normally be at least 1. The default value is 2. When the latency to the server is high, you might like to increase the number.

If you set it to 0 (or negative), no publishRequests will be sent.


setPublishRequestSetpoint

public void setPublishRequestSetpoint(int publishRequestSetpoint)
Define the target number of PublishRequests to send to the server. The setpoint is calculated based on getPublishRequestFactor() and getSubscriptionCount() and automatically adjusted, if the server sends Bad_TooManyPublishRequest errors for the PublishRequests.

Parameters:
publishRequestSetpoint - the new setpoint value. Use 0 to reset the counter to the default (calculated) value.

setPublishRequestTimeout

public void setPublishRequestTimeout(long publishRequestTimeout)
Define the timeout used for PublishRequests.

The timeout is not necessary in a normal use case - the PublishRequests should live in the server until it has notifications to send via PublishResponses. In case you experience packet losses in communication, you may need to define a timeout for these messages, so that the client can re-send new PublishRequests even when the responses never arrive to the client. Make sure that the timeout does not overlap with the Subscription keep-alive times, though.

Default: UnsignedInteger.MAX_VALUE (~infinite)

Parameters:
publishRequestTimeout - the timeout in milliseconds, must be a positive value. 0 means no timeout, but it seems that some servers interpret this like timeout immediately.

setPublishRequestTimeout

public void setPublishRequestTimeout(long publishRequestTimeout,
                                     TimeUnit timeUnit)
/** Define the timeout used for PublishRequests using a specific TimeUnit.

The timeout is not necessary in a normal use case - the PublishRequests should live in the server until it has notifications to send via PublishResponses. In case you experience packet losses in communication, you may need to define a timeout for these messages, so that the client can re-send new PublishRequests even when the responses never arrive to the client. Make sure that the timeout does not overlap with the Subscription keep-alive times, though.

Default: UnsignedInteger.MAX_VALUE (~infinite)

Parameters:
publishRequestTimeout - the timeout publishRequestTimeout. 0 means no timeout, but it seems that some servers interpret this like timeout immediately.
timeUnit - the time unit of publishRequestTimeout (default is milliseconds)
See Also:
setPublishRequestTimeout(long)

setPublishRequestTimeout

public void setPublishRequestTimeout(org.opcfoundation.ua.builtintypes.UnsignedInteger publishRequestTimeout)
Define the timeout used for PublishRequests.

The timeout is not necessary in a normal use case - the PublishRequests should live in the server until it has notifications to send via PublishResponses. In case you experience packet losses in communication, you may need to define a timeout for these messages, so that the client can re-send new PublishRequests even when the responses never arrive to the client. Make sure that the timeout does not overlap with the Subscription keep-alive times, though.

Default: UnsignedInteger.MAX_VALUE

Parameters:
publishRequestTimeout - the timeout publishRequestTimeout. 0 means no timeout, but it seems that some servers interpret this like timeout immediately, so it will be converted to UnsignedInteger.MAX_VALUE.

setSecurityMode

public void setSecurityMode(org.opcfoundation.ua.transport.security.SecurityMode securityMode)
                     throws ServerConnectionException
Define the security mode to connect to. You cannot change the setting when isConnected().

Parameters:
securityMode - the new security mode
Throws:
ServerConnectionException - if connected when called

setServiceDiagnosticMask

public void setServiceDiagnosticMask(EnumSet<UaApplication.DiagnosticMask> serviceDiagnosticMask)
Define the service level diagnostic info to return for the service calls.

Use EnumSet.allOf(DiagnosticMaskBit.class) to request all diagnostics.

Parameters:
serviceDiagnosticMask -
See Also:
setOperationDiagnosticMask(java.util.EnumSet)

setSessionName

public void setSessionName(String sessionName)
Define a name for the session. The value is null by default, which will make the client to auto-generate a new session identifier at each connection.

Parameters:
sessionName - the sessionName to set

setSessionTimeout

public void setSessionTimeout(double sessionTimeout)
Set the requested session timeout. The value will be revised by the server when you connect(). The revised value can be checked from the current session, available from getSession().

Changes to the value will not take effect until you reconnect().

Default is one hour (3600000 ms)

Parameters:
sessionTimeout - the sessionTimeout to set.

setSessionTimeout

public void setSessionTimeout(long sessionTimeout,
                              TimeUnit timeUnit)

setStatusCheckInterval

public void setStatusCheckInterval(long statusCheckInterval)
Define the status check interval, that is, how often the server status is read, when isConnected.

Default is 1000 ms.

Parameters:
statusCheckInterval - The interval in milliseconds. Use 0 to disable the status check.
See Also:
setStatusCheckTimeout(long)

setStatusCheckInterval

public void setStatusCheckInterval(long statusCheckInterval,
                                   TimeUnit timeUnit)

setStatusCheckTimeout

public void setStatusCheckTimeout(long statusCheckTimeout)
Define the timeout to use for Server Status reads in updateServerStatus().

If you suspect that the server may be busy, or you get a lot of timeouts which cause the status to go to CommunicationFault, you should increase the timeout from the default.

Default: 10000 ms

Parameters:
statusCheckTimeout - the statusCheckTimeout to set (in milliseconds)
See Also:
setStatusCheckInterval(long)

setStatusCheckTimeout

public void setStatusCheckTimeout(long statusCheckTimeout,
                                  TimeUnit timeUnit)
See Also:
setStatusCheckTimeout(long)

setTimeout

public void setTimeout(long timeOut)
Define the default communication timeout that is used for each synchronous service call. This value is set to each service request and the OPCUA stack will wait for the response message for that long. In case the service calls fail, a ServiceException(Bad_Timeout) is thrown.

The default value is null, use setTimeout(UnsignedInteger) to set it. The default value null indicates that the OperationTimeout defined by getEndpointConfiguration() should be used.

Parameters:
time - the new timeout value to set, in milliseconds

setTimeout

public void setTimeout(long timeOut,
                       TimeUnit timeUnits)

setTimeout

public void setTimeout(org.opcfoundation.ua.builtintypes.UnsignedInteger timeOut)
Define the default communication timeout that is used for each synchronous service call. This value is set to each service request and the OPCUA stack will wait for the response message for that long. In case the service calls fail, a ServiceException(Bad_Timeout) is thrown.

The default value null indicates that the OperationTimeout defined by getEndpointConfiguration() should be used.

Parameters:
timeOut - the new timeout value to set, in milliseconds

setUri

public void setUri(String uri)
            throws URISyntaxException
The URI of the OPC UA server. The URI is used to locate the server at connect() call.

The server will be connected using the host name and port. It is then queried for endpoints and a suitable one will be picked, even when no exact match is found. In that case a warning message will be display in the log messages.

You cannot change the setting when isConnected().

Parameters:
uri - The server URI to set.
Throws:
URISyntaxException - If the uri is not valid

setUserIdentity

public void setUserIdentity(UserIdentity userIdentity)
                     throws SessionActivationException
Define a new user identity. If you change the identity when isConnected(), the session is reactivated using the new user identity.

Parameters:
userIdentity - the new identity. If null, the default, anonymous authentication is set
Throws:
SessionActivationException - if the session activation fails with the new identity

setValidateDiscoveredEndpoints

public void setValidateDiscoveredEndpoints(boolean validateDiscoveredEndpoints)
Define whether endpoints discovered from the server are validated against the endpoints returned for a session create request.

By default, the endpoints are validated, but some servers provide different endpointUrls for the GetEndpoints and CreateSession service responses and may therefore fail at connection. You can set this flag to false, if you know that the server is safe to be connected even without the check. The check is required for OPC UA compliance.

Parameters:
validateDiscoveredEndpoints - the validateDiscoveredEndpoints to set

updateServerStatus

public void updateServerStatus()
Read the current server status.


write

public org.opcfoundation.ua.core.WriteResponse write(org.opcfoundation.ua.core.WriteValue... nodesToWrite)
                                              throws ServiceException
Write values to the server.

The values are written to the data source, such as a device, and the Service does not return until it writes the values or determines that the value cannot be written. In certain cases, the Server will successfully write to an intermediate system or Server, and will not know if the data source was updated properly. In these cases, the Server should report a success code that indicates that the write was not verified. In the cases where the Server is able to verify that it has successfully written to the data source, it reports an unconditional success.

It is possible that the Server may successfully write some Attributes, but not others. Rollback is the responsibility of the Client.

If a Server allows writing of Attributes with the DataType LocalizedText, the Client can add or overwrite the text for a locale by writing the text with the associated LocaleId. Writing a null String for a locale will delete the String for that locale. Writing a null String for the text and a null String for the LocaleId will delete the entries for all locales.

Parameters:
nodesToWrite - List of Nodes and their Attributes to write.
Returns:
WriteResponse defines the result codes for each node in nodesToWrite. Results define the status codes. DiagnosticInfos define server specific additional codes.
Throws:
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo and Bad_TooManyOperations.
See Also:
read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...), writeAsync(org.opcfoundation.ua.core.WriteValue...), writeValues(org.opcfoundation.ua.builtintypes.NodeId[], java.lang.Object[]), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object), writeAttribute(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger, java.lang.Object)

writeAsync

public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> writeAsync(org.opcfoundation.ua.core.WriteValue... nodesToWrite)
Write node attributes to the server asynchronously. This is a generic method, which you can use to write values for several nodes and attributes at once.

Example:

 // Write the name of the objects folder, asynchronously.

 NodeId myNodeId = Identifiers.ObjectsFolder;

 // Provide a state listener with the call to watch the state transitions
 // You may read the response when the state has changed to Complete
 // - or wait for it, as is done below.

 ClientServiceRequest r = server.writeAsync(new StateListener<ClientServiceRequestState>() {
   @Override
   public void onStateTransition(IStatefulObject<ClientServiceRequestState, ?> sender,
       ClientServiceRequestState oldState, ClientServiceRequestState newState) {
     System.out.println(newState);
   }

 }, new WriteValue(OBJECTSFOLDER_NODEID, Attributes.BrowseName, null,
     new DataValue(new Variant(new QualifiedName("Obj")), StatusCode.GOOD)));
 WriteResponse response = (WriteResponse) r.waitForResult();
 StatusCode[] v = response.getResults();
 System.out.println(v[0]);
 

Parameters:
nodesToWrite - List of Nodes and their Attributes to write. For each entry in this list, a StatusCode is returned.
Returns:
The asynchronous monitor, which will provide the response, when available (as WriteResponse). You can poll it, set a listener or wait for the result (or error).
See Also:
write(org.opcfoundation.ua.core.WriteValue...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object), writeValues(org.opcfoundation.ua.builtintypes.NodeId[], java.lang.Object[]), writeAttribute(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger, java.lang.Object)

writeAttribute

public boolean writeAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                              org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                              Object value)
                       throws ServiceException,
                              StatusException
Write a single attribute value.

Note: Use write or writeAsync instead, when you need to write several values, since it will write them with a single call to the server.

Parameters:
nodeId - The node
attributeId - The attribute of the node. See Attributes for valid values.
value - The new value to write. The value may be a DataValue, Variant or of native data type. Use DataValue, if you wish to set the status and timestamp as well.
Returns:
true if the value was written already; false, if the server returns Good_CompletesAsynchronously. In case the write fails, the method will throw an exception
Throws:
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo and Bad_TooManyOperations.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics. Expected bad status codes are Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_WriteNotSupported, Bad_NotWritable, Bad_UserAccessDenied, Bad_OutOfRange, Bad_TypeMismatch
See Also:
write(org.opcfoundation.ua.core.WriteValue...), writeAsync(org.opcfoundation.ua.core.WriteValue...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object), readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger)

writeAttribute

public boolean writeAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                              org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                              Object value,
                              org.opcfoundation.ua.utils.NumericRange indexRange)
                       throws ServiceException,
                              StatusException
Write a single attribute value.

Note: Use write or writeAsync instead, when you need to write several values, since it will write them with a single call to the server.

Parameters:
nodeId - The node
attributeId - The attribute of the node. See Attributes for valid values.
value - The new value to write. The value may be a DataValue, Variant or of native data type. Use DataValue, if you wish to set the status and timestamp as well.
indexRange - An optional range of array indexes to which the value should be written to. Applies to the Value attribute only.
Returns:
true if the value was written already; false, if the server returns Good_CompletesAsynchronously. In case the write fails, the method will throw an exception
Throws:
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo and Bad_TooManyOperations.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics. Expected bad status codes are Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_WriteNotSupported, Bad_NotWritable, Bad_UserAccessDenied, Bad_OutOfRange, Bad_TypeMismatch
See Also:
write(org.opcfoundation.ua.core.WriteValue...), writeAsync(org.opcfoundation.ua.core.WriteValue...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object), readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger)

writeValue

public boolean writeValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                          Object value)
                   throws ServiceException,
                          StatusException
Write the value attribute of a node.

Note: Use writeValues (or write or writeAsync) instead, when you need to write several values, since it will write them with a single call to the server.

Parameters:
nodeId - The node
value - The new value to write. The value may be a DataValue, Variant or of native data type. Use DataValue, if you wish to set the status and timestamp as well.
Returns:
true if the value was written immediately; false, if the server returns Good_CompletesAsynchronously. In case the write fails, the method will throw an exception
Throws:
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo and Bad_TooManyOperations.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics. Expected bad status codes are Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_WriteNotSupported, Bad_NotWritable, Bad_UserAccessDenied, Bad_OutOfRange, Bad_TypeMismatch
See Also:
write(org.opcfoundation.ua.core.WriteValue...), writeValues(org.opcfoundation.ua.builtintypes.NodeId[], java.lang.Object[]), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeAttribute(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger, java.lang.Object)

writeValue

public boolean writeValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
                          Object value,
                          org.opcfoundation.ua.utils.NumericRange indexRange)
                   throws ServiceException,
                          StatusException
Write the value attribute of a node.

Note: Use writeValues (or write or writeAsync) instead, when you need to write several values, since it will write them with a single call to the server.

Parameters:
nodeId - The node
value - The new value to write. The value may be a DataValue, Variant or of native data type. Use DataValue, if you wish to set the status and timestamp as well.
indexRange - An optional range of array indexes to which the value should be written to
Returns:
true if the value was written already; false, if the server returns Good_CompletesAsynchronously. In case the write fails, the method will throw an exception
Throws:
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo and Bad_TooManyOperations.
StatusException - If the server returns a bad status for the value. Read the exception for the error details and diagnostics. Expected bad status codes are Bad_NodeIdInvalid, Bad_NodeIdUnknown, Bad_AttributeIdInvalid, Bad_IndexRangeInvalid, Bad_IndexRangeNoData, Bad_WriteNotSupported, Bad_NotWritable, Bad_UserAccessDenied, Bad_OutOfRange, Bad_TypeMismatch
See Also:
write(org.opcfoundation.ua.core.WriteValue...), writeValues(org.opcfoundation.ua.builtintypes.NodeId[], java.lang.Object[]), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeAttribute(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger, java.lang.Object)

writeValues

public org.opcfoundation.ua.builtintypes.StatusCode[] writeValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
                                                                  Object[] value)
                                                           throws ServiceException,
                                                                  StatusException
Write the value attribute of several nodes at once.

Parameters:
nodeIds - The node
value - The new values to write. The values may be DataValue, Variant or of native data type. Use DataValue, if you wish to set the status and timestamp as well.
Returns:
The status codes for each written value.
Throws:
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo and Bad_TooManyOperations.
StatusException
See Also:
write(org.opcfoundation.ua.core.WriteValue...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeAttribute(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger, java.lang.Object)

writeValues

public org.opcfoundation.ua.builtintypes.StatusCode[] writeValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
                                                                  Object[] values,
                                                                  org.opcfoundation.ua.utils.NumericRange[] indexRanges)
                                                           throws ServiceException,
                                                                  StatusException
Write the value attribute of several nodes at once.

Parameters:
nodeIds - The node
values - The new values to write. The values may be DataValue, Variant or of native data type. Use DataValue, if you wish to set the status and timestamp as well.
indexRanges - Optional ranges of array indexes to which the values should be written to.
Returns:
The status codes for each written value.
Throws:
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo and Bad_TooManyOperations.
StatusException
See Also:
write(org.opcfoundation.ua.core.WriteValue...), writeValue(org.opcfoundation.ua.builtintypes.NodeId, java.lang.Object), readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId), writeAttribute(org.opcfoundation.ua.builtintypes.NodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger, java.lang.Object)

addSubscriptionAck

protected void addSubscriptionAck(org.opcfoundation.ua.core.SubscriptionAcknowledgement ack)

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getHttpsSecurityPolicies

protected org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[] getHttpsSecurityPolicies()
The TLS security policies used for HTTPS communications. In HTTPS, the UA SecurityMode getSecurityMode() is typically NONE, but the transport security must be a secure one.

Default is HttpsSecurityPolicy.ALL.

Returns:
the httpsSecurityPolicies
See Also:
setHttpsSecurityPolicies(org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[])

resetPublishRequestSetpoint

protected void resetPublishRequestSetpoint()
Resets the setpoint


resetSubscriptionsAfterRemove

protected void resetSubscriptionsAfterRemove(Subscription[] subscriptions,
                                             org.opcfoundation.ua.builtintypes.StatusCode[] result)
Parameters:
subscriptions -
result -

setHttpsSecurityPolicies

protected void setHttpsSecurityPolicies(org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[] httpsSecurityPolicies)
The TLS security policies used for HTTPS communications. In HTTPS, the UA SecurityMode getSecurityMode() is typically NONE, but the transport security must be a secure one.

You can enable all or just some of the policies. The applications will then negotiate a common security mode with each other.

Default is HttpsSecurityPolicy.ALL.

Parameters:
httpsSecurityPolicies - the policies to set


Copyright © 2018. All rights reserved.