Sie sind auf Seite 1von 11

OPC Quick Reference

This section includes a quick reference for the methods on the Custom interfaces and the methods and
properties of the Automation Interface. These interfaces, their parameters and behavior are defined in
more detail later in the reference sections.

Custom Interface
Note: This section does not show additional standard enumerators used by this interface.

OPCServer
IOPCServer
IOPCServerPublicGroups (optional)
IOPCBrowseServerAddressSpace (optional)
IPersistFile (optional)
OPCGroup
IOPCGroupStateMgt
IOPCPublicGroupStateMgt (optional)
IOPCSyncIO
IOPCAsyncIO
IOPCItemMgt
IDataObject
EnumOPCItemAttributes
IEnumOPCItemAttributes

OPCServer Object

IOPCServer
HRESULT
HRESULT
HRESULT
HRESULT
HRESULT
HRESULT

AddGroup(szName, bActive, dwRequestedUpdateRate, hClientGroup, pTimeBias,


pPercentDeadband, dwLCID, phServerGroup, pRevisedUpdateRate, riid, ppUnk)
GetErrorString(dwError, dwLocale, ppString)
GetGroupByName(szName, riid, ppUnk)
GetStatus(ppServerStatus)
RemoveGroup(hServerGroup, bForce)
CreateGroupEnumerator(dwScope, riid, ppUnk)

IOPCServerPublicGroups (optional)
HRESULT
HRESULT

GetPublicGroupByName(szName, riid, ppUnk);


RemovePublicGroup(hServerGroup, bForce);

IOPCBrowseServerAddressSpace (optional)
HRESULT
HRESULT
HRESULT
HRESULT
HRESULT

QueryOrganization(pNameSpaceType );
ChangeBrowsePosition(dwBrowseDirection, szString );
BrowseOPCItemIDs( dwBrowseFilterType, szFilterCriteria, vtDataTypeFilter,
dwAccessRightsFilter, ppIEnumString );
GetItemID( szItemDataID, szItemID );
BrowseAccessPaths( szItemID, ppIEnumString );

IPersistFile (optional)
HRESULT
HRESULT
HRESULT
HRESULT
HRESULT

IsDirty();
Load(pszFileName, dwMode);
Save(pszFileName, fRemember);
SaveCompleted( pszFileName);
GetCurFileName( ppszFileName);

OPCGroup Object

IOPCGroupStateMgt
HRESULT
HRESULT
HRESULT
HRESULT

GetState(pUpdateRate, pActive, ppName, pTimeBias, pPercentDeadband, pLCID,


phClientGroup, phServerGroup)
SetState(pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias,
pPercentDeadband, pLCID, phClientGroup)
SetName(szName);
CloneGroup(szName, riid, ppUnk);

IOPCPublicGroupStateMgt (optional)
HRESULT
HRESULT

GetState(pPublic);
MoveToPublic(void);

IOPCSyncIO
HRESULT
HRESULT

Read(dwSource, dwNumItems, phServer, ppItemValues, ppErrors)


Write(dwNumItems, phServer, pItemValues, ppErrors)

IOPCAsyncIO
HRESULT
HRESULT
HRESULT
HRESULT

Read(dwConnection, dwSource, dwNumItems, phServer, pTransactionID, ppErrors,)


Write(dwConnection, dwNumItems, phServer, pItemValues, pTransactionID,
ppErrors);
Cancel (dwTransactionID);
Refresh(dwConnection, dwSource, pTransactionID);

IOPCItemMgt
HRESULT
HRESULT
HRESULT
HRESULT
HRESULT
HRESULT
HRESULT

AddItems(dwNumItems, pItemArray, ppAddResults, ppErrors)


ValidateItems(dwNumItems, pItemArray, bBlobUpdate, ppValidationResults,
ppErrors)
RemoveItems(dwNumItems, phServer, ppErrors)
SetActiveState(dwNumItems, phServer, bActive, ppErrors)
SetClientHandles(dwNumItems, phServer, phClient, ppErrors)
SetDatatypes(dwNumItems, phServer, pRequestedDatatypes, ppErrors)
CreateEnumerator(riid, ppUnk)

IDataObject
HRESULT
DAdvise(pFmt, adv, pSnk, pConnection);
HRESULT
DUnadvise(Connection);
Note: all other functions can be stubs which return E_NOTIMPL.

EnumOPCItemAttributes Object

IEnumOPCItemAttributes
HRESULT
HRESULT
HRESULT
HRESULT

Next(celt, ppItemArray, pceltFetched);


Skip(celt);
Reset( void);
Clone(ppEnumItemAttributes);

Custom Interface/Client Side

IAdviseSink (Client side)


HRESULT

OnDataChange(pFE, pSTM);

Note: all other functions can be stubs which return E_NOTIMPL.

Automation Interface
OPCServer
IOPCServerDisp
IOPCServerPublicGroupsDisp (optional)
IOPCBrowseServerAddressSpaceDisp (optional)
OPCGroup
IOPCItemMgtDisp
IOPCGroupStateMgtDisp
IOPCSyncIODisp
IOPCAsyncIODisp
IOPCPublicGroupStateMgtDisp (optional)
OPCItem
IOPCItemDisp

OPCServer Object

IOPCServerDisp
Properties
Long
Object
DATE
DATE
DATE
Short
Short
Short
STRING

Count
_NewEnum
StartTime
CurrentTime
LastUpdateTime
MajorVersion
MinorVersion
BuildNumber
VendorInfo

Methods
Object
Object
String
Object

Item(Item)
AddGroup(Name, Active, ReqestedUpdateRate, ClientGroupHandle,
pPercentDeadband, LCID, pServerGroupHandle, RevisedUpdateRate, pTimeBias)
GetErrorString( Error, Locale )
GetGroupByName( Name )
RemoveGroup(ServerGroupHandle, Force)
SaveConfig(FileName)
LoadConfig(FileName)
SetEnumeratorType(Scope, Type)

IOPCServerPublicGroupsDisp (optional)
Methods
Object

GetPublicGroupByName( Name )
RemovePublicGroup(ServerGroupHandle, Force)

IOPCBrowseServerAddressSpaceDisp (optional)
Properties
Object
Long

_NewEnum
Organization

Methods

String

ChangeBrowsePosition(BrowseDirection, Position)
SetItemIDEnumerator(BrowseFilterType, FilterCriteria, DataTypeFilter,
AccessRightsFilter)
GetItemIDString(ItemDataID)
SetAccessPathEnumerator(ItemID)

OPCGroup Object

IOPCItemMgtDisp
Properties
Long
Object

Count
_NewEnum

Methods
Object

Item(ItemSpecifier)
AddItems(NumItems, ItemIDs, ActiveStates, ClientHandles, pServerHandles, pErrors,
pItemObjects, [AccessPaths], [RequestedDataTypes], [pBlobs],
[pCanonicalDataTypes], [pAccessRights])
ValidateItems(NumItems, ItemIDs, pErrors, [AccessPaths], [RequestedDataTypes],
[BlobUpdate], [pBlobs], [pCanonicalDataTypes], [pAccessRights])
RemoveItems(NumItems, ServerHandles, pErrors, Force)
SetActiveState(NumItems, ServerHandles, ActiveState, pErrors)
SetClientHandles(NumItems, ServerHandles, ClientHandles, pErrors)
SetDatatypes(NumItems, ServerHandles, RequestedDataTypes, pErrors)

IOPCGroupStateMgtDisp
Properties
BOOLEAN
LONG
LONG
STRING
LONG
LONG
FLOAT
LONG

ActiveStatus
ClientGroupHandle
ServerGroupHandle
Name
UpdateRate
TimeBias
PercentDeadBand
LCID

Methods
Object

CloneGroup([Name])

IOPCSyncIODisp
Properties
Methods
Object
Object

OPCRead(Source, NumItems, ServerHandles, pValues, [pQualities], [pTimeStamps],


[pErrors])
OPCWrite (NumItems, ServerHandles, Values, [pErrors])

IOPCASyncIODisp
Properties

Methods
Long
Long
Long
Long

AddCallbackReference(Context, pCallback)
DropCallbackReference(Connection)
OPCRead(Source, NumItems, ServerHandles, [pErrors])
OPCWrite (NumItems, ServerHandles, Values, [pErrors])
Cancel(TransactionID)
Refresh (Source)

IOPCPublicGroupStateMgtDisp
Properties
BOOLEAN

State

Methods
MoveToPublic()

OPCItem Object

IOPCItemDisp
Properties
String
LONG
BOOLEAN
VARIANT
LONG
String
LONG
Short
VARIANT
SHORT
DATE
LONG
Short
VARIANT
LONG

AccessPath
AccessRights
ActiveStatus
Blob
ClientHandle
ItemID
ServerHandle
RequestedDataType
Value
Quality
Timestamp
ReadError
EUType
EUInfo
WriteError

Methods
OPCRead(Source, pValue, [pQuality], [pTimeStamp])
OPCWrite(NewValue)

Automation Interface/Client Side


Sub OnDataChange( GroupHandle as Long, Count as Long, ClientHandles() as Long,
Values() as Variant, Qualities() as Long, GroupTime as Date,
TimeStamps() as Date )
Sub OnAsyncWriteComplete( GroupHandle as Long, Count as Long, CallbackHandles() as Long,
ItemResults() as Long )

Das könnte Ihnen auch gefallen