Client (FB)¶
FUNCTION_BLOCK PUBLIC FINAL Client EXTENDS CBML.LConC IMPLEMENTS IClient
Function block for establishing a connection to an OPC UA server.
Usage (Declaration):
sPolicySHA256 : STRING := 'http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256';
sURL : STRING := 'opc.tcp://xxx:4840';
sSession : STRING := 'urn:xxx:CODESYS:UA.Client';
UAPolicy : UA.SecurityPolicy := (
sPolicy:=sPolicySHA256,
eSecurity:=UA.SECURITY_MODE.SIGN_AND_ENCRYPT
);
UAAuth : UA.UserNameAuth := (sUserName:=sUser, sPassword:=sPass);
UAClient : UA.Client := (
sURL := sURL,
sSession := sSession,
itfPolicy := UAPolicy,
itfAuth := UAAuth,
udiTimeout := 100000
);
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
xEnable
BOOL
LConC
Output
xBusy
BOOL
LConC
xError
BOOL
LConC
Input Const
itfAsyncProperty
0
sClientName
STRING
‘CODESYS OPC UA Client’
sURL
sSession
itfPolicy
0
itfAuth
0
udiTimeout
UDINT
0
itfNamespaceArray
0
Output
eErrorID
xActive
BOOL
TRUE if a Connection is established
itfConnection
The established connection to the related serverValid, as longxActive
=TRUE
eState
CONNECTION_STATE.UNKNOWN
Methods:
Structure: