📄 opc.idl
字号:
// OPC.IDL
// REVISION: 8/28 8:00 pm
import "oaidl.idl" ;
typedef enum { OPC_DS_CACHE = 1, OPC_DS_DEVICE } OPCDATASOURCE ;
typedef enum { OPC_BRANCH = 1, OPC_LEAF, OPC_FLAT} OPCBROWSETYPE;
typedef enum { OPC_NS_HIERARCHIAL = 1, OPC_NS_FLAT} OPCNAMESPACETYPE;
typedef enum { OPC_BROWSE_UP = 1, OPC_BROWSE_DOWN} OPCBROWSEDIRECTION;
typedef enum { OPC_READABLE = 1, OPC_WRITEABLE } OPCACCESSRIGHTS;
typedef enum { OPC_NOENUM = 0, OPC_ANALOG, OPC_ENUMERATED } OPCEUTYPE;
typedef enum { OPC_STATUS_RUNNING = 1,
OPC_STATUS_FAILED,
OPC_STATUS_NOCONFIG,
OPC_STATUS_SUSPENDED,
OPC_STATUS_TEST } OPCSERVERSTATE;
typedef enum { OPC_ENUM_PRIVATE_CONNECTIONS = 1,
OPC_ENUM_PUBLIC_CONNECTIONS,
OPC_ENUM_ALL_CONNECTIONS,
OPC_ENUM_PRIVATE,
OPC_ENUM_PUBLIC,
OPC_ENUM_ALL } OPCENUMSCOPE;
typedef DWORD OPCHANDLE;
typedef struct {
DWORD dwSize;
DWORD dwItemCount;
OPCHANDLE hClientGroup;
DWORD dwTransactionID;
HRESULT hrStatus;
} OPCGROUPHEADER;
typedef struct {
OPCHANDLE hClient;
DWORD dwValueOffset;
WORD wQuality;
WORD wReserved;
FILETIME ftTimeStampItem;
} OPCITEMHEADER1;
typedef struct {
OPCHANDLE hClient;
DWORD dwValueOffset;
WORD wQuality;
WORD wReserved;
} OPCITEMHEADER2;
typedef struct {
DWORD dwItemCount;
OPCHANDLE hClientGroup;
DWORD dwTransactionID;
HRESULT hrStatus;
} OPCGROUPHEADERWRITE;
typedef struct {
OPCHANDLE hClient;
HRESULT dwError;
} OPCITEMHEADERWRITE;
typedef struct {
OPCHANDLE hClient;
FILETIME ftTimeStamp;
WORD wQuality;
WORD wReserved;
VARIANT vDataValue;
} OPCITEMSTATE;
typedef struct {
FILETIME ftStartTime;
FILETIME ftCurrentTime;
FILETIME ftLastUpdateTime;
OPCSERVERSTATE dwServerState;
DWORD dwGroupCount;
DWORD dwBandWidth;
WORD wMajorVersion;
WORD wMinorVersion;
WORD wBuildNumber;
WORD wReserved;
[string] LPWSTR szVendorInfo;
} OPCSERVERSTATUS;
typedef struct {
[string] LPWSTR szAccessPath;
[string] LPWSTR szItemID;
BOOL bActive ;
OPCHANDLE hClient;
DWORD dwBlobSize;
[size_is(dwBlobSize)] BYTE * pBlob;
VARTYPE vtRequestedDataType;
WORD wReserved;
} OPCITEMDEF;
typedef struct {
[string] LPWSTR szAccessPath;
[string] LPWSTR szItemID;
BOOL bActive;
OPCHANDLE hClient;
OPCHANDLE hServer;
DWORD dwAccessRights;
DWORD dwBlobSize;
[size_is(dwBlobSize)] BYTE * pBlob;
VARTYPE vtRequestedDataType;
VARTYPE vtCanonicalDataType;
OPCEUTYPE dwEUType;
VARIANT vEUInfo;
} OPCITEMATTRIBUTES;
typedef struct {
OPCHANDLE hServer;
VARTYPE vtCanonicalDataType;
WORD wReserved;
DWORD dwAccessRights;
DWORD dwBlobSize;
[size_is(dwBlobSize)] BYTE * pBlob;
} OPCITEMRESULT;
[
object,
uuid(39c13a4d-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCServer : IUnknown
{
HRESULT AddGroup(
[in, string] LPCWSTR szName,
[in] BOOL bActive,
[in] DWORD dwRequestedUpdateRate,
[in] OPCHANDLE hClientGroup,
[unique, in] LONG * pTimeBias,
[unique, in] FLOAT * pPercentDeadband,
[in] DWORD dwLCID,
[out] OPCHANDLE * phServerGroup,
[out] DWORD * pRevisedUpdateRate,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);
HRESULT GetErrorString(
[in] HRESULT dwError,
[in] LCID dwLocale,
[out, string] LPWSTR * ppString
);
HRESULT GetGroupByName(
[in, string] LPCWSTR szName,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);
HRESULT GetStatus(
[out] OPCSERVERSTATUS ** ppServerStatus
);
HRESULT RemoveGroup(
[in] OPCHANDLE hServerGroup,
[in] BOOL bForce
);
HRESULT CreateGroupEnumerator(
[in] OPCENUMSCOPE dwScope,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN* ppUnk
);
}
[
object,
uuid(39c13a4e-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCServerPublicGroups : IUnknown
{
HRESULT GetPublicGroupByName(
[in, string] LPCWSTR szName,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);
HRESULT RemovePublicGroup(
[in] OPCHANDLE hServerGroup,
[in] BOOL bForce
);
}
[
object,
uuid(39c13a4f-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCBrowseServerAddressSpace: IUnknown
{
HRESULT QueryOrganization(
[out] OPCNAMESPACETYPE * pNameSpaceType
);
HRESULT ChangeBrowsePosition(
[in] OPCBROWSEDIRECTION dwBrowseDirection,
[in, string] LPCWSTR szString
);
HRESULT BrowseOPCItemIDs(
[in] OPCBROWSETYPE dwBrowseFilterType,
[in, string] LPCWSTR szFilterCriteria,
[in] VARTYPE vtDataTypeFilter,
[in] DWORD dwAccessRightsFilter,
[out] LPENUMSTRING * ppIEnumString
);
HRESULT GetItemID(
[in] LPWSTR szItemDataID,
[out, string] LPWSTR * szItemID
);
HRESULT BrowseAccessPaths(
[in, string] LPCWSTR szItemID,
[out] LPENUMSTRING * ppIEnumString
);
}
[
object,
uuid(39c13a50-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCGroupStateMgt : IUnknown
{
HRESULT GetState(
[out] DWORD * pUpdateRate,
[out] BOOL * pActive,
[out, string] LPWSTR * ppName,
[out] LONG * pTimeBias,
[out] FLOAT * pPercentDeadband,
[out] DWORD * pLCID,
[out] OPCHANDLE * phClientGroup,
[out] OPCHANDLE * phServerGroup
);
HRESULT SetState(
[unique, in] DWORD * pRequestedUpdateRate,
[out] DWORD * pRevisedUpdateRate,
[unique, in] BOOL * pActive,
[unique, in] LONG * pTimeBias,
[unique, in] FLOAT * pPercentDeadband,
[unique, in] DWORD * pLCID,
[unique, in] OPCHANDLE * phClientGroup
);
HRESULT SetName(
[in, string] LPCWSTR szName
);
HRESULT CloneGroup(
[in, string] LPCWSTR szName,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);
}
[
object,
uuid(39c13a51-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCPublicGroupStateMgt : IUnknown
{
HRESULT GetState(
[out] BOOL * pPublic
);
HRESULT MoveToPublic(
void
);
}
[
object,
uuid(39c13a52-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCSyncIO : IUnknown
{
HRESULT Read(
[in] OPCDATASOURCE dwSource,
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[out, size_is(,dwNumItems)] OPCITEMSTATE ** ppItemValues,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT Write(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in, size_is(dwNumItems)] VARIANT * pItemValues,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
}
[
object,
uuid(39c13a53-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCAsyncIO : IUnknown
{
HRESULT Read(
[in] DWORD dwConnection,
[in] OPCDATASOURCE dwSource,
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[out] DWORD * pTransactionID,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT Write(
[in] DWORD dwConnection,
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in, size_is(dwNumItems)] VARIANT * pItemValues,
[out] DWORD * pTransactionID,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT Refresh(
[in] DWORD dwConnection,
[in] OPCDATASOURCE dwSource,
[out] DWORD * pTransactionID
);
HRESULT Cancel(
[in] DWORD dwTransactionID
);
}
[
object,
uuid(39c13a54-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCItemMgt: IUnknown
{
HRESULT AddItems(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCITEMDEF * pItemArray,
[out, size_is(,dwNumItems)] OPCITEMRESULT ** ppAddResults,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT ValidateItems(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCITEMDEF * pItemArray,
[in] BOOL bBlobUpdate,
[out, size_is(,dwNumItems)] OPCITEMRESULT ** ppValidationResults,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT RemoveItems(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT SetActiveState(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in] BOOL bActive,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT SetClientHandles(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in, size_is(dwNumItems)] OPCHANDLE * phClient,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT SetDatatypes(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in, size_is(dwNumItems)] VARTYPE * pRequestedDatatypes,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
HRESULT CreateEnumerator(
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);
}
[
object,
uuid(39c13a55-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IEnumOPCItemAttributes : IUnknown
{
HRESULT Next(
[in] ULONG celt,
[out, size_is(,*pceltFetched)] OPCITEMATTRIBUTES ** ppItemArray,
[out] ULONG * pceltFetched
);
HRESULT Skip(
[in] ULONG celt
);
HRESULT Reset(
void
);
HRESULT Clone(
[out] IEnumOPCItemAttributes ** ppEnumItemAttributes
);
}
//
// OPCDISP.ODL
// Revision: 8/28 8:00 PM
//
// This is the ODL file for the OPC IDispatch Automation interfaces.
//
// This file will be processed by the Make Type Library (mktyplib) tool to
// produce the type library (OPCDisp.tlb).
#define DISPID_NEWENUM -4
[
uuid(39c13a56-011e-11d0-9675-0020afd8adb3),
version(1.0),
helpstring("OPCDisp")
]
library OPCDisp
{
importlib("stdole32.tlb");
[
uuid(39c13a57-011e-11d0-9675-0020afd8adb3),
dual,
oleautomation
]
interface IOPCServerDisp : IDispatch
{
//
// Properties
//
[ propget ]
HRESULT Count(
[out, retval] long * pCount
);
[ propget,
restricted,
id( DISPID_NEWENUM )
]
HRESULT _NewEnum(
[out, retval] IUnknown ** ppUnk
);
[ propget ]
HRESULT StartTime(
[out, retval] DATE * pStartTime
);
[ propget ]
HRESULT CurrentTime(
[out, retval] DATE * pCurrentTime
);
[ propget ]
HRESULT LastUpdateTime(
[out, retval] DATE * pLastUpdateTime
);
[ propget ]
HRESULT MajorVersion(
[out, retval] short * pMajorVersion
);
[ propget ]
HRESULT MinorVersion(
[out, retval] short * pMinorVersion
);
[ propget ]
HRESULT BuildNumber(
[out, retval] short * pBuildNumber
);
[ propget ]
HRESULT VendorInfo(
[out, retval] BSTR * pVendorInfo
);
//
// Methods
//
HRESULT Item(
[in] VARIANT Item,
[out, retval] IDispatch ** ppDisp
);
HRESULT AddGroup(
[in] BSTR Name,
[in] boolean Active,
[in] long ReqestedUpdateRate,
[in] long ClientGroupHandle,
[in] float * pPercentDeadband,
[in] long LCID,
[out] long * pServerGroupHandle,
[out] long * pRevisedUpdateRate,
[in, optional] VARIANT * pTimeBias,
[out, retval] IDispatch ** ppDisp
);
HRESULT GetErrorString(
[in] long Error,
[in] long Locale,
[out, retval] BSTR * ErrorString
);
HRESULT GetGroupByName(
[in] BSTR Name,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -