ServerState Property
General info
Label |
Server State |
Description |
The current status of the OPC server. |
Data type |
UInt32 |
Default value |
0 (syslib.model.codes.OpcComServerStatus.OPC_SERVER_STATUS_UNKNOWN) |
Type |
CodingGroup |
Code |
553 |
Symbolic name |
MODEL_PROP_SERVERSTATE |
Lua access code |
syslib.model.properties.ServerState |
Available since |
1.0 |
- Parent properties
Attributes
| Name | Tooltip |
|---|---|
| PROP_VISIBLE | The property is visible in DataStudio and can be read by the inmation APIs. |
| PROP_VOLATILE | The property exists during runtime of the service only and is not saved to the image. |
| PROP_DETECTABLE | Property is detectable by system-driven server endpoint investigation. |
| PROP_HAS_DEFAULT | The property has a default value as standard. |
Codings
Coding group: OpcComServerStatus
| Name | Code | Label | Tooltip |
|---|---|---|---|
OPC_SERVER_STATUS_UNKNOWN |
0 |
<unknown> |
|
OPC_SERVER_STATUS_RUNNING |
1 |
Running |
|
OPC_SERVER_STATUS_FAILED |
2 |
Failed |
|
OPC_SERVER_STATUS_NOCONFIG |
3 |
No Configuration |
|
OPC_SERVER_STATUS_SUSPENDED |
4 |
Suspended |
|
OPC_SERVER_STATUS_TEST |
5 |
Test Mode |
|
OPC_SERVER_STATUS_COMM_FAULT |
6 |
Communication Fault |
Examples
Read from or write to the ServerState property.
-- Read from the ServerState
syslib.getvalue("<OBJECT FULL PATH>.OPCComCRuntimeInformation.OpcComCStateInformation.ServerState")
-- Write to the ServerState
syslib.setvalue("<OBJECT FULL PATH>.OPCComCRuntimeInformation.OpcComCStateInformation.ServerState",
syslib.model.codes.OpcComServerStatus.OPC_SERVER_STATUS_UNKNOWN)
TcpConfig tcpcfg = new TcpConfig() { HostNameOrIp = "localhost", Port = 6512 };
SecurityCredentials sc = new SecurityCredentials() { ProfileName = "<username>", Password = "<password>" };
StatelessInterface sli = new StatelessInterface(tcpcfg);
// Read from the ServerState
Result result = sli.ReadValue(sc, new ReadItem("<OBJECT FULL PATH>.OPCComCRuntimeInformation.OpcComCStateInformation.ServerState"));
// Write to the ServerState
Result result = sli.WriteValue(sc, new WriteItem(OpcComServerStatus.OPC_SERVER_STATUS_UNKNOWN, "<OBJECT FULL PATH>.OPCComCRuntimeInformation.OpcComCStateInformation.ServerState"));
A switch-like function of the codings.
function get_coding_name(code)
local _ocss = syslib.model.codes.OpcComServerStatus
if _ocss.OPC_SERVER_STATUS_UNKNOWN==code then return 'OPC_SERVER_STATUS_UNKNOWN'
elseif _ocss.OPC_SERVER_STATUS_RUNNING==code then return 'OPC_SERVER_STATUS_RUNNING'
elseif _ocss.OPC_SERVER_STATUS_FAILED==code then return 'OPC_SERVER_STATUS_FAILED'
elseif _ocss.OPC_SERVER_STATUS_NOCONFIG==code then return 'OPC_SERVER_STATUS_NOCONFIG'
elseif _ocss.OPC_SERVER_STATUS_SUSPENDED==code then return 'OPC_SERVER_STATUS_SUSPENDED'
elseif _ocss.OPC_SERVER_STATUS_TEST==code then return 'OPC_SERVER_STATUS_TEST'
elseif _ocss.OPC_SERVER_STATUS_COMM_FAULT==code then return 'OPC_SERVER_STATUS_COMM_FAULT'
end
end
return get_coding_name(syslib.model.codes.OpcComServerStatus.OPC_SERVER_STATUS_UNKNOWN)