|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.prosysopc.ua.UaApplication
com.prosysopc.ua.client.UaClient
public class UaClient
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 thenconnect() 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 |
|---|
public static final Double MAX_CACHE_AGE
| Constructor Detail |
|---|
public UaClient()
connect().
public UaClient(String uri)
throws URISyntaxException
connect().
uri - the server URI to connect to.
URISyntaxException - if the URI is not valid.public UaClient(UaAddress address)
| Method Detail |
|---|
public static UaApplication.Protocol getDefaultProtocol()
public static void setDefaultProtocol(UaApplication.Protocol defaultProtocol)
defaultProtocol - the defaultProtocol to setpublic void addServerStatusListener(ServerStatusListener serverStatusListener)
hasServerStatusListener(ServerStatusListener), the listener is not added again.
serverStatusListener - the listener object
public Subscription addSubscription(Subscription subscription)
throws ServiceException,
StatusException
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.
subscription - The subscription to add.
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.getSubscription(int),
getSubscriptionCount(),
removeSubscription(com.prosysopc.ua.client.Subscription)
public org.opcfoundation.ua.core.CallResponse call(org.opcfoundation.ua.core.CallMethodRequest... MethodsToCall)
throws ServiceException
call(NodeId, NodeId, Variant...) to call several methods at once to reduce the payload
required for making the calls.
MethodsToCall - The method call structures.
ServiceExceptioncallAsync(org.opcfoundation.ua.core.CallMethodRequest...)
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(CallMethodRequest...) instead if you need to
call several methods at the same time.
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.
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.public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> callAsync(org.opcfoundation.ua.core.CallMethodRequest... methodsToCall)
methodsToCall - The method call structures.
CallResponse). You can poll it, set a listener or wait for the result (or
error).call(org.opcfoundation.ua.core.CallMethodRequest...)
public void connect()
throws ServiceException,
ConnectException,
SessionActivationException,
InvalidServerEndpointException
isConnected(), will not do anything.
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 endpointspublic void disconnect()
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.
public void disconnect(long timeout)
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).
timeout - timeout (in milliseconds) for the CloseSession call. Must be a positive value. 0
tells it to wait infinitely for a response.
public void disconnect(long timeout,
TimeUnit timeUnit)
disconnect(long)public void disconnect(org.opcfoundation.ua.builtintypes.UnsignedInteger timeout)
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).
timeout - timeout (in milliseconds) for the CloseSession call. UnsignedInteger.ZERO tells
it to wait infinitely for a response.
public org.opcfoundation.ua.core.EndpointDescription[] discoverEndpoints()
throws InvalidServerEndpointException,
ConnectException,
ServiceException
getProtocol().
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
public org.opcfoundation.ua.core.EndpointDescription[] discoverEndpoints(UaApplication.Protocol... protocols)
throws InvalidServerEndpointException,
ConnectException,
ServiceException
protocols - the transport protocols for which the endpoints are requested. If omitted,
getProtocol() is used.
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 failspublic OperationLimits getActualOperationLimits()
public int getActualPublishRequestSetpoint()
getPublishRequestSetpoint()public AddressSpace getAddressSpace()
getAddressSpace in class UaApplicationpublic ApplicationIdentity getApplicationIdentity()
setApplicationIdentity(com.prosysopc.ua.ApplicationIdentity) to
define it, before connecting to the server.public String getAuditEntryId()
public org.opcfoundation.ua.encoding.EncoderContext getEncoderContext()
getEncoderContext in class UaApplicationpublic org.opcfoundation.ua.core.EndpointDescription getEndpoint()
isConnected().
public org.opcfoundation.ua.core.EndpointConfiguration getEndpointConfiguration()
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. |
public String getHost()
public org.opcfoundation.ua.transport.https.HttpsSettings getHttpsSettings()
public org.opcfoundation.ua.builtintypes.DiagnosticInfo[] getLastOperationDiagnostics()
getLastServiceResult(),
getLastServiceDiagnostics(),
getLastResponseTimestamp()public org.opcfoundation.ua.builtintypes.DateTime getLastResponseTimestamp()
getLastServiceResult(),
getLastServiceDiagnostics(),
getLastOperationDiagnostics()public org.opcfoundation.ua.builtintypes.DiagnosticInfo getLastServiceDiagnostics()
getLastOperationDiagnostics(),
getLastServiceResult(),
getLastResponseTimestamp()public org.opcfoundation.ua.builtintypes.StatusCode getLastServiceResult()
getLastOperationDiagnostics(),
getLastServiceDiagnostics(),
getLastResponseTimestamp()public UaClientListener getListener()
public Locale getLocale()
public org.opcfoundation.ua.builtintypes.UnsignedInteger getMaxResponseMessageSize()
public org.opcfoundation.ua.common.NamespaceTable getNamespaceTable()
getNamespaceTable(boolean) to force a
refresh.
getNamespaceTable in class UaApplication
public org.opcfoundation.ua.common.NamespaceTable getNamespaceTable(boolean forceRefresh)
throws ServiceException,
StatusException
isConnected() is true.
forceRefresh - request that the array is refreshed from the server, even if it has been
read already
StatusException - if the namespace array read from the server is not valid
ServiceException - if the namespace array could not be readpublic EnumSet<UaApplication.DiagnosticMask> getOperationDiagnosticMask()
public int getPort()
public UaApplication.Protocol getProtocol()
public double getPublishRequestFactor()
setPublishRequestFactor(double)public int getPublishRequestSetpoint()
getActualPublishRequestSetpoint() is actually calculated based on
getPublishRequestFactor() and getSubscriptionCount() and automatically
adjusted, if the server sends Bad_TooManyPublishRequest errors for the PublishRequests.
getPublishRequestFactor() should be used)getActualPublishRequestSetpoint(),
setPublishRequestSetpoint(int)public org.opcfoundation.ua.builtintypes.UnsignedInteger getPublishRequestTimeout()
public org.opcfoundation.ua.transport.SecureChannel getSecureChannel()
throws ServerConnectionException
ServerConnectionExceptionpublic org.opcfoundation.ua.transport.security.SecurityMode getSecurityMode()
public ApplicationIdentity getServerIdentity()
public String getServerName()
public org.opcfoundation.ua.core.ServerState getServerState()
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.
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.
public org.opcfoundation.ua.core.ServerStatusDataType getServerStatus()
throws StatusException,
ServerConnectionException
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.
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 availablegetServerTimeDifference()public org.opcfoundation.ua.builtintypes.StatusCode getServerStatusError()
public org.opcfoundation.ua.common.ServerTable getServerTable()
isConnected() is true.
StatusException - if the server array read from the server is not valid
ServiceException - if the server array could not be read
public org.opcfoundation.ua.common.ServerTable getServerTable(boolean forceRefresh)
throws ServiceException,
StatusException
isConnected() is true.
forceRefresh - request that the array is refreshed from the server, even if it has been
read already
StatusException - if the server array read from the server is not valid
ServiceException - if the server array could not be readpublic long getServerTimeDifference()
getServerStatus()public EnumSet<UaApplication.DiagnosticMask> getServiceDiagnosticMask()
public org.opcfoundation.ua.application.Session getSession()
isConnected(). Otherwise it will be null.
public String getSessionName()
getSession().public double getSessionTimeout()
connect(). The revised value can be checked from the current session,
available from getSession().public long getStatusCheckInterval()
public long getStatusCheckTimeout()
updateServerStatus()
getStatusCheckInterval()public Subscription getSubscription(int index)
getSubscriptionCount(),
addSubscription(com.prosysopc.ua.client.Subscription),
removeSubscription(com.prosysopc.ua.client.Subscription),
getSubscriptionById(UnsignedInteger),
getSubscriptions()public Subscription getSubscriptionById(org.opcfoundation.ua.builtintypes.UnsignedInteger subscriptionId)
subscriptionId - the ID of the subscription
getSubscriptionCount(),
addSubscription(com.prosysopc.ua.client.Subscription),
removeSubscription(com.prosysopc.ua.client.Subscription),
getSubscription(int)public int getSubscriptionCount()
getSubscription(int),
addSubscription(com.prosysopc.ua.client.Subscription),
removeSubscription(com.prosysopc.ua.client.Subscription),
getSubscriptions()public Subscription[] getSubscriptions()
getSubscriptionCount(),
addSubscription(com.prosysopc.ua.client.Subscription),
removeSubscription(com.prosysopc.ua.client.Subscription),
getSubscriptionById(UnsignedInteger),
getSubscription(int)
public List<org.opcfoundation.ua.transport.security.SecurityMode> getSupportedSecurityModes()
throws InvalidServerEndpointException,
ServerConnectionException,
ServiceException
ServiceException
ServerConnectionException
InvalidServerEndpointException
public org.opcfoundation.ua.core.UserTokenPolicy[] getSupportedUserIdentityTokens()
throws ServerConnectionException,
ServiceException
ServiceException - if the service call fails
ServerConnectionExceptionpublic int getTimeout()
public TypeDictionary getTypeDictionary()
TypeDictionary that can be used to parse unknown Structures. NOTE! this
method should only be called after connect(), otherwise it will return null.
public String getUri()
setUri(String) or alternatively with setEndpoint(EndpointDescription).
public UserIdentity getUserIdentity()
public boolean hasServerStatusListener(ServerStatusListener serverStatusListener)
serverStatusListener - the listener to check
public boolean hasSubscription(org.opcfoundation.ua.builtintypes.UnsignedInteger subscriptionId)
subscriptionId - the ID of the subscription
public org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteAtTimes(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.DateTime[] reqTimes)
throws StatusException,
ServerConnectionException,
ServiceException
nodeId - the NodeId of the node whose history should be deletedreqTimes - an array of DateTimes at which history should be deleted
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
public org.opcfoundation.ua.core.HistoryUpdateResult historyDeleteEvents(org.opcfoundation.ua.builtintypes.NodeId nodeId,
List<org.opcfoundation.ua.builtintypes.ByteString> eventIds)
throws StatusException,
ServerConnectionException,
ServiceException
nodeId - the NodeId of the node whose history should be deletedeventIds - a list of eventIds (each id is a byte array) of the events that should be
deleted
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
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
nodeId - the NodeId of the node whose history should be deletedstartTime - the start of the interval to be deletedendTime - the end of the interval to be deleted
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
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
nodeId - the NodeId of the node whose history should be deletedstartTime - the start of the interval to be deletedendTime - the end of the interval to be deleted
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
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
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.
getLastOperationDiagnostics().
ServerConnectionException - if not connected to the server
ServiceException - if the service call fails
IllegalArgumentException - if details cannot be encodedhistoryReadAsync(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)
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)
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.
HistoryReadResponse.
ServerConnectionException - if not connected to the server
IllegalArgumentException - if details cannot be encodedhistoryRead(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)
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
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.
nodeId - the NodeId of the node whose history should be readreqTimes - the timestamps from which history should be readindexRange - 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
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)
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
historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...)
instead.
nodeId - the NodeId of the node whose history should be readreqTimes - the timestamps from which history should be readindexRange - 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 valuesuseSimpleBounds - 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).
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)
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
historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...)
instead.
nodeId - the NodeId of the node whose history should be readstartTime - the beginning of the time intervalendTime - the end of the time interval. If endTime is less than startTime the data will be
returned in reverse ordernumValuesPerNode - 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 UnsignedIntegertimestampsToReturn - which timestamps to return with the valuesfilter - 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).
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)
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
historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...)
instead.
nodeId - the NodeId of the node whose history should be readstartTime - the beginning of the time intervalendTime - the end of the time interval. If endTime is less than startTime the data will be
returned in reverse ordernumValuesPerNode - 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 UnsignedIntegerindexRange - 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
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)
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
historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...)
instead.
nodeId - the NodeId of the node whose history should be readstartTime - the beginning of the time intervalendTime - 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 structureindexRange - which elements of arrays to return, null returns all. this parameter is
always null if the value is not an arraytimestampsToReturn - which timestamps to return with the values
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)
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
historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...)
instead.
nodeId - the NodeId of the node whose history should be readstartTime - the beginning of the time intervalendTime - 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 UnsignedIntegerreturnBounds - whether values at the boundaries, corresponding to startTime and endtime,
should be included in the result setindexRange - which elements of arrays to return, null returns all. this parameter is
always null if the value is not an arraytimestampsToReturn - which timestamps to return with the values
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)
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
historyRead(HistoryReadDetails, TimestampsToReturn, Boolean, HistoryReadValueId...)
instead.
nodeId - the NodeId of the node whose history should be readstartTime - the beginning of the time intervalendTime - 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 setindexRange - which elements of arrays to return, null returns all. this parameter is
always null if the value is not an arraytimestampsToReturn - which timestamps to return with the values
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)
public org.opcfoundation.ua.core.HistoryUpdateResult[] historyUpdate(org.opcfoundation.ua.core.HistoryUpdateDetails... details)
throws ServerConnectionException,
ServiceException
details - the history update definitions
getLastOperationDiagnostics().
ServerConnectionException - if not connected to the server
ServiceException - if the service call fails
IllegalArgumentException - if details cannot be encoded
public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> historyUpdateAsync(org.opcfoundation.ua.core.HistoryUpdateDetails... details)
throws ServerConnectionException
details - the history update definitions
HistoryUpdateResponse.
ServerConnectionException - if not connected to the server
IllegalArgumentException - if details cannot be encoded
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
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)
nodeId - the NodeId of the node whose history should be readperformInsertReplace - 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
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
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
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)
nodeId - the NodeId of the node whose history should be readperformInsertReplace - 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
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call fails
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
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)
nodeId - the NodeId of the node whose history should be readperformInsertReplace - which action to take in updating (INSERT, REPLACE, UPDATE)updateValues - the values to be updated in history
StatusException - if the operation fails
ServerConnectionException - if we are not connected to the server
ServiceException - if the service call failspublic boolean isAutoReconnect()
public boolean isConnected()
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.
public boolean isKeepSubscriptions()
public boolean isValidateDiscoveredEndpoints()
discoverEndpoints().setValidateDiscoveredEndpoints(boolean)
public org.opcfoundation.ua.core.ReadResponse read(Double maxAge,
org.opcfoundation.ua.core.TimestampsToReturn timestampsToReturn,
org.opcfoundation.ua.core.ReadValueId... nodesToRead)
throws ServiceException
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());
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.
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_TimestampsToReturnInvalidreadAsync(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[])
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 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
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.
ReadResponse). You can poll it, set a listener or wait for the result (or
error).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...)
public org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
throws ServiceException,
StatusException
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.
nodeId - The node to read. Only local nodes are supported.attributeId - The attribute to read. See Attributes for valid values.
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.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...)
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
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.
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).
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.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...)
public org.opcfoundation.ua.builtintypes.DataValue readAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
throws ServiceException,
StatusException
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.
nodeId - The node to read.attributeId - The attribute to read. See Attributes for valid values.
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.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...)
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
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.
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).
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.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...)
public org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger... attributeIds)
throws ServiceException,
StatusException
read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read
several nodes or attributes.
nodeId - The node to read. Only local nodes are supported.attributeIds - The attributes to read. See Attributes for valid values.
ServiceException - If the server returns a bad ServiceResult code for the service call.
StatusException - If the server returns a bad status for the value.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...)
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(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read
several nodes or attributes.
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).
ServiceException - If the server returns a bad ServiceResult code for the service call.
StatusException - If the server returns a bad status for the value.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...)
public org.opcfoundation.ua.builtintypes.DataValue[] readAttributes(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger... attributeIds)
throws ServiceException
read(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read
several nodes or attributes.
nodeId - The node to read.attributeIds - The attributes to read. See Attributes for valid values.
ServiceException - If the server returns a bad ServiceResult code for the service call.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...)
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(java.lang.Double, org.opcfoundation.ua.core.TimestampsToReturn, org.opcfoundation.ua.core.ReadValueId...) instead, when you need to read
several nodes or attributes.
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).
ServiceException - If the server returns a bad ServiceResult code for the service call.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...)
public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId)
throws ServiceException,
StatusException
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.
nodeId - The node to read. Only local nodes are supported.
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.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)
public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
Double maxCacheAge)
throws ServiceException,
StatusException
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.
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).
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.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)
public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
org.opcfoundation.ua.utils.NumericRange indexRange)
throws ServiceException,
StatusException
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}));
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.
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.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)
public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.ExpandedNodeId nodeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
Double maxCacheAge)
throws ServiceException,
StatusException
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);
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).
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.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)
public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId)
throws ServiceException,
StatusException
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.
nodeId - The node to read.
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.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)
public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
Double maxCacheAge)
throws ServiceException,
StatusException
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.
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).
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.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)
public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.utils.NumericRange indexRange)
throws ServiceException,
StatusException
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}));
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.
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.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)
public org.opcfoundation.ua.builtintypes.DataValue readValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.utils.NumericRange indexRange,
Double maxCacheAge)
throws ServiceException,
StatusException
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);
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).
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.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)
public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds)
throws ServiceException,
StatusException
nodeIds - The nodes to read. Only local nodes are supported.
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.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)
public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds,
org.opcfoundation.ua.utils.NumericRange[] indexRanges)
throws ServiceException,
StatusException
nodeIds - The nodes to read. Only local nodes are supported.indexRanges - Optional ranges of array indexes from which the values should be read.
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.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)
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
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.
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.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)
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
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).
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.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)
public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.ExpandedNodeId[] nodeIds,
org.opcfoundation.ua.core.TimestampsToReturn timestamps)
throws ServiceException,
StatusException
nodeIds - The nodes to read. Only local nodes are supported.timestamps - Define which timestamps to return with each value.
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.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)
public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds)
throws ServiceException
nodeIds - The nodes to read.
ServiceException - If the server returns a bad ServiceResult code for the service call.
Read the exception for the error details and diagnostics.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)
public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
org.opcfoundation.ua.utils.NumericRange[] indexRanges)
throws ServiceException
nodeIds - The nodes to read.indexRanges - Optional ranges of array indexes from which the values should be read.
ServiceException - If the server returns a bad ServiceResult code for the service call.
Read the exception for the error details and diagnostics.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)
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
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.
ServiceException - If the server returns a bad ServiceResult code for the service call.
Read the exception for the error details and diagnostics.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)
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
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).
ServiceException - If the server returns a bad ServiceResult code for the service call.
Read the exception for the error details and diagnostics.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)
public org.opcfoundation.ua.builtintypes.DataValue[] readValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
org.opcfoundation.ua.core.TimestampsToReturn timestamps)
throws ServiceException
nodeIds - The nodes to read.timestamps - Define which timestamps to return with each value.
ServiceException - If the server returns a bad ServiceResult code for the service call.
Read the exception for the error details and diagnostics.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)
public boolean reconnect()
throws ServiceException,
ConnectException,
SessionActivationException
setAutoReconnect(boolean) to disable the automatic system first.
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)public void registerModel(ClientCodegenModel codegenModel)
codegenModel - the model created by the codegen.public boolean removeServerStatusListener(ServerStatusListener serverStatusListener)
serverStatusListener -
public org.opcfoundation.ua.builtintypes.StatusCode removeSubscription(Subscription subscription)
throws ServiceException
isConnected() the subscription is also
deleted from the server.
subscription -
ServiceException - if the service call fails.removeSubscriptions(com.prosysopc.ua.client.Subscription[]),
addSubscription(com.prosysopc.ua.client.Subscription),
getSubscription(int),
getSubscriptionCount()
public org.opcfoundation.ua.builtintypes.StatusCode[] removeSubscriptions(Subscription[] subscriptions)
throws ServiceException
isConnected() the subscriptions are also
removed from the server.
subscriptions - The subscriptions to remove.
ServiceException - if the service call fails.removeSubscription(com.prosysopc.ua.client.Subscription),
addSubscription(com.prosysopc.ua.client.Subscription),
getSubscription(int),
getSubscriptionCount()
public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.StatusCode[]> removeSubscriptionsAsync(Subscription... subscriptions)
throws ServiceException
isConnected() the
subscriptions are also removed from the server. The method does not wait for the operation to
terminate before it returns.
subscriptions - The subscriptions to remove.
ServiceExceptionremoveSubscriptions(com.prosysopc.ua.client.Subscription[]),
addSubscription(com.prosysopc.ua.client.Subscription),
getSubscription(int),
getSubscriptionCount()public void resetEndpoint()
setEndpoint(EndpointDescription) with null.
public org.opcfoundation.ua.builtintypes.ServiceResponse serviceRequest(org.opcfoundation.ua.builtintypes.ServiceRequest request)
throws ServiceException
request - The service request object, e.g. TestStackRequest
ServiceException - if the service call failsserviceRequestAsync(org.opcfoundation.ua.builtintypes.ServiceRequest)
public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> serviceRequestAsync(org.opcfoundation.ua.builtintypes.ServiceRequest request)
throws ServiceException
request - The service request object, e.g. TestStackRequest
ServiceException
public org.opcfoundation.ua.builtintypes.ServiceResponse sessionlessRequest(org.opcfoundation.ua.builtintypes.ServiceRequest request)
throws InvalidServerEndpointException,
ServerConnectionException,
ServiceException
isConnected() (with a session), serviceRequest(ServiceRequest) will be
called.
request - the service request to send
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 failspublic void setAddress(UaAddress address)
public void setApplicationIdentity(ApplicationIdentity applicationIdentity)
connect() to it.
applicationIdentity - public void setAuditEntryId(String auditEntryId)
auditEntryId - the auditEntryId to setpublic void setAutoReconnect(boolean doAutoReconnect)
doAutoReconnect - When true, the UaClient will try to reconnect automatically to the
server, when communication fails.
public void setEndpoint(org.opcfoundation.ua.core.EndpointDescription endpoint)
throws URISyntaxException
isConnected() when changing the endpoint.
endpoint - the endpoint to use.
URISyntaxException - if the endpointurl is not validsetUri(String)public void setKeepSubscriptions(boolean keepSubscriptions)
keepSubscriptions - public void setListener(UaClientListener listener)
listener - the listener to setpublic void setLocale(Locale locale)
locale - the locale to setpublic void setMaxResponseMessageSize(int maxResponseMessageSize)
maxResponseMessageSize - the maxResponseMessageSize to set, the value must be a positive
value. Default is 0, which means that it is not used.public void setMaxResponseMessageSize(org.opcfoundation.ua.builtintypes.UnsignedInteger maxResponseMessageSize)
maxResponseMessageSize - the maxResponseMessageSize to set. Default is 0, which means that
it is not used. Null is interpreted as 0.public void setOperationDiagnosticMask(EnumSet<UaApplication.DiagnosticMask> operationDiagnosticMask)
operationDiagnosticMask - setServiceDiagnosticMask(java.util.EnumSet) public void setPublishRequestFactor(double publishRequestFactor)
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.public void setPublishRequestSetpoint(int publishRequestSetpoint)
getPublishRequestFactor() and getSubscriptionCount() and
automatically adjusted, if the server sends Bad_TooManyPublishRequest errors for the
PublishRequests.
publishRequestSetpoint - the new setpoint value. Use 0 to reset the counter to the default
(calculated) value.public void setPublishRequestTimeout(long publishRequestTimeout)
UnsignedInteger.MAX_VALUE (~infinite)
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.
public void setPublishRequestTimeout(long publishRequestTimeout,
TimeUnit timeUnit)
UnsignedInteger.MAX_VALUE (~infinite)
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)setPublishRequestTimeout(long)public void setPublishRequestTimeout(org.opcfoundation.ua.builtintypes.UnsignedInteger publishRequestTimeout)
UnsignedInteger.MAX_VALUE
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.
public void setSecurityMode(org.opcfoundation.ua.transport.security.SecurityMode securityMode)
throws ServerConnectionException
isConnected().
securityMode - the new security mode
ServerConnectionException - if connected when calledpublic void setServiceDiagnosticMask(EnumSet<UaApplication.DiagnosticMask> serviceDiagnosticMask)
serviceDiagnosticMask - setOperationDiagnosticMask(java.util.EnumSet) public void setSessionName(String sessionName)
sessionName - the sessionName to setpublic void setSessionTimeout(double sessionTimeout)
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)
sessionTimeout - the sessionTimeout to set.
public void setSessionTimeout(long sessionTimeout,
TimeUnit timeUnit)
public void setStatusCheckInterval(long statusCheckInterval)
statusCheckInterval - The interval in milliseconds. Use 0 to disable the status check.setStatusCheckTimeout(long)
public void setStatusCheckInterval(long statusCheckInterval,
TimeUnit timeUnit)
public void setStatusCheckTimeout(long statusCheckTimeout)
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
statusCheckTimeout - the statusCheckTimeout to set (in milliseconds)setStatusCheckInterval(long)
public void setStatusCheckTimeout(long statusCheckTimeout,
TimeUnit timeUnit)
setStatusCheckTimeout(long)public void setTimeout(long timeOut)
setTimeout(UnsignedInteger) to set it. The default
value null indicates that the OperationTimeout defined by getEndpointConfiguration()
should be used.
time - the new timeout value to set, in milliseconds
public void setTimeout(long timeOut,
TimeUnit timeUnits)
public void setTimeout(org.opcfoundation.ua.builtintypes.UnsignedInteger timeOut)
getEndpointConfiguration() should be used.
timeOut - the new timeout value to set, in milliseconds
public void setUri(String uri)
throws URISyntaxException
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().
uri - The server URI to set.
URISyntaxException - If the uri is not valid
public void setUserIdentity(UserIdentity userIdentity)
throws SessionActivationException
isConnected(), the session
is reactivated using the new user identity.
userIdentity - the new identity. If null, the default, anonymous authentication is set
SessionActivationException - if the session activation fails with the new identitypublic void setValidateDiscoveredEndpoints(boolean validateDiscoveredEndpoints)
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.
validateDiscoveredEndpoints - the validateDiscoveredEndpoints to setpublic void updateServerStatus()
public org.opcfoundation.ua.core.WriteResponse write(org.opcfoundation.ua.core.WriteValue... nodesToWrite)
throws ServiceException
nodesToWrite - List of Nodes and their Attributes to write.
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo
and Bad_TooManyOperations.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)public org.opcfoundation.ua.transport.AsyncResult<org.opcfoundation.ua.builtintypes.ServiceResponse> writeAsync(org.opcfoundation.ua.core.WriteValue... nodesToWrite)
// 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]);
nodesToWrite - List of Nodes and their Attributes to write. For each entry in this list, a
StatusCode is returned.
WriteResponse). You can poll it, set a listener or wait for the result (or
error).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)
public boolean writeAttribute(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
Object value)
throws ServiceException,
StatusException
nodeId - The nodeattributeId - 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.
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_TypeMismatchwrite(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)
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
nodeId - The nodeattributeId - 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.
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_TypeMismatchwrite(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)
public boolean writeValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
Object value)
throws ServiceException,
StatusException
nodeId - The nodevalue - 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.
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_TypeMismatchwrite(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)
public boolean writeValue(org.opcfoundation.ua.builtintypes.NodeId nodeId,
Object value,
org.opcfoundation.ua.utils.NumericRange indexRange)
throws ServiceException,
StatusException
nodeId - The nodevalue - 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
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_TypeMismatchwrite(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)
public org.opcfoundation.ua.builtintypes.StatusCode[] writeValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
Object[] value)
throws ServiceException,
StatusException
nodeIds - The nodevalue - 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.
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo
and Bad_TooManyOperations.
StatusExceptionwrite(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)
public org.opcfoundation.ua.builtintypes.StatusCode[] writeValues(org.opcfoundation.ua.builtintypes.NodeId[] nodeIds,
Object[] values,
org.opcfoundation.ua.utils.NumericRange[] indexRanges)
throws ServiceException,
StatusException
nodeIds - The nodevalues - 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.
ServiceException - If the call fails. Expected ServiceResult codes are Bad_NothingToDo
and Bad_TooManyOperations.
StatusExceptionwrite(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)protected void addSubscriptionAck(org.opcfoundation.ua.core.SubscriptionAcknowledgement ack)
protected void finalize()
throws Throwable
finalize in class ObjectThrowableprotected org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[] getHttpsSecurityPolicies()
getSecurityMode() is typically NONE, but the transport security must be a secure one.
Default is HttpsSecurityPolicy.ALL.
setHttpsSecurityPolicies(org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[])protected void resetPublishRequestSetpoint()
protected void resetSubscriptionsAfterRemove(Subscription[] subscriptions,
org.opcfoundation.ua.builtintypes.StatusCode[] result)
subscriptions - result - protected void setHttpsSecurityPolicies(org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[] httpsSecurityPolicies)
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.
httpsSecurityPolicies - the policies to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||