Skip to main content

i4scada Knowledge Base

OPCIO.DLL Error Codes

Abstract

Check out this article and learn more details about the i4scada OPCIO.DLL error codes.

Method

Type

Error Code

OPCIOInit()

Return value

0 = always

OPCIOReset()

Return value

0 = always

OPCIOStart()

Return value

0 = always

OPCIOPollForAsyncData(VARIANT *pServerHandle, VARIANT *pGroupHandle, VARIANT *pItemHandle, VARIANT *pValue, VARIANT *pQuality, VARIANT *pTimeStamp)

Return value

0 = here comes the data

1 = no data available

OPCIOPollForAsyncGroupData(int nGroupHandle, VARIANT *pItemHandle, VARIANT *pValue, VARIANT *pQuality, VARIANT *pTimeStamp)

Return value

0 = here comes the data

1 = no data available OR wrong group handle

OPCIOConnectServer(VARIANT vaCLSID, VARIANT vaComputerName, int *pServerHandle)

Return value

-1 = at least one of input parameters is of wrong variant type

0 = OK

-6 = vaCLSID is not and CLSID and toolkit browsing call ( browse Server) for the OPC servers returned error

-7 = vaCLSID is not and CLSID and there are no OPC servers on the target machine

-2 = vaCLSID is not and CLSID and there is no such OPC server on the target machine

-3 = OPC server was located but addServer failed

-5 = start was executed on the OPC server but its state is not started

OPCIOConnectServer2

Return value

0 = OK

-1 = at least one of input parameters is of wrong variant type

-2 = vaCLSID is not and CLSID and there is no such OPC server on the target machine

-3 = OPC server was located but addServer failed

-5 = start was executed on the OPC server but its state is not started

-6 = vaCLSID is not and CLSID and toolkit browsing call ( browse Server) for the OPC servers returned error

-7 = vaCLSID is not and CLSID and there are no OPC servers on the target machine

OPCIODisconnectServer(int nServerHandle)

Return value

-1 = invalid server handle

0 = OK

OPCIOGetServerState(int nServerHandle, int *pServerState)

Return value

-1 = invalid server handle

-2 = getStatus of server failed by the background thread

0 = OK or server status was not retrieved yet by the background thread

pServerState

-2 = unable to retrieve server state

server status = when return code is 0, at the beginning value is predefined as OPC_STATUS_RUNNING

typedef 
enum tagOPCSERVERSTATE {
	OPC_STATUS_RUNNING = 1,
	OPC_STATUS_FAILED = OPC_STATUS_RUNNING + 1,
	OPC_STATUS_NOCONFIG	= OPC_STATUS_FAILED + 1,
	OPC_STATUS_SUSPENDED = OPC_STATUS_NOCONFIG + 1,
	OPC_STATUS_TEST = OPC_STATUS_SUSPENDED + 1,
	OPC_STATUS_COMM_FAULT = OPC_STATUS_TEST + 1}
OPCSERVERSTATE;  

OPCIORestart(int nServerHandle)

Return value

0 = OK

OPCIOCreateGroup(int nServerHandle, VARIANT vaGroupName, int nUpdateRate, int *pGroupHandle)

Return value

-1 = vaGroupName is of wrong type OR wrong server handle

-3 = addGroup failed

-4 = connect failed

-5 = start failed

0 = OK

OPCIOTerminateGroup(int nGroupHandle)

Return value

-1 = wrong group handle

0 = OK

OPCIOCreateItem(int nGroupHandle, VARIANT vaItemName, int *pItemHandle, int *pItemDataType)

Return value

-1 = wrong group handle or itemName parameter is of wrong type

-3 = addItem fails

-4 = is not connected after connect was executed

-5 = item is not started after item start was executed

0 = OK

OPCIOCreateItems(int nGroupHandle, VARIANT vaItemName, VARIANT *pItemHandle, VARIANT *pItemDataType, VARIANT *pError)

Return value

-1 = vaItemName is of wrong type

-2 = wrong group handle

-3 = group is not started after group start was executed or group is not connected after group connect was executed ( depending of input parameters of OPCIOCreateItem )

0 = success

VARIANT *pError

-1 = addItem fails on this item

-2 = this item is not connected OR is not started

0 = OK

OPCIOCreateItems2

Return value

-1 = vaItemName is of wrong type

-2 = wrong group handle

-3 = group is not started after group start was executed or group is not connected after group connect was executed ( depending of input parameters of OPCIOCreateItem )

0 = success

VARIANT *pError

-1 = addItem fails on this item

-2 = this item is not connected OR is not started

0 = OK

OPCIOTerminateItem(int nItemHandle)

Return value

-1 = invalid item handle

0 = OK

OPCIOSyncReadGroup(int nGroupHandle, VARIANT vaItemHandle, VARIANT *pValue, VARIANT *pQuality, VARIANT *pTimeStamp, VARIANT *pError)

Return value

-1 = vaItemHandle is invalid or is of wrong type or all items have wrong handles or group handle is invalid

-2 = syncRead fails

0 = success

pError

-1 = invalid item handle

2 = cannot convert item value to the type supported by VB

1 = item reading failed

0 = success

OPCIOSyncWriteGroup(int nGroupHandle, VARIANT vaItemHandle, VARIANT vaValue, VARIANT *pError)

Return value

-1 = vaItemHandle is of wrong type or vaValue is of wrong type or group handle is invalid or there is something wrong with all item values and/or handles

-2 = syncWrite fails

0 = OK

pError

-1 = invalid item handle

-3 = cannot convert item array value to the type supported by VB

-2 = cannot convert item value to the type supported by VB

1 = item write fails

0 = item write succeeds

OPCIOAsyncWriteGroup(int nGroupHandle, VARIANT vaItemHandle, VARIANT vaValue, VARIANT *pError)

Return value

-1 = vaItemHandle is of wrong type or vaValue is of wrong type or group handle is invalid or there is something wrong with all item values and/or handles

-2 = asyncWrite fails

0 = OK

pError

-1 = invalid item handle

-3 = cannot convert item array value to the type supported by VB

-2 = cannot convert item value to the type supported by VB

1 = item write fails

0 = item write succeeds

OPCIOBrowse(VARIANT vaCLSID, VARIANT vaComputerName, int *pIsV3, VARIANT *pName, VARIANT *pAccess, VARIANT *pTrueVartype, VARIANT *pIlusionVartype)

Return value

-1 = vaCLSID or vaComputerName are of the wrong type

-6 = vaCLSID is not and CLSID and toolkit browsing call ( browse Server) for the OPC servers returned error

-7 = vaCLSID is not and CLSID and there are no OPC servers on the target machine

-2 = vaCLSID is not and CLSID and there is no such OPC server on the target machine

-3 = OPC server was located but addServer failed

-4 = connect failed

0 = OK

OPCIOActivateItems

-1 = Invalid group handle

-2 = At least one item handle is Invalid

-100 = failed to execute state transition of the group and of all required items