Data Access IDL Specification (OPC2.0 Specification)

xiaoxiao2021-03-06  40

The Current Files Require Midl Compiler 3.00.15 or Later and The Win NT 4.0 Release SDK.

Use the command line midl // oicf opcda.idl.

The resulting opcda.h File Should Be Included In All Clients and Servers.

............

NOTE:. This IDL file and the Proxy / Stub generated from it should NEVER be modified in any way If you add vendor specific interfaces to your server (which is allowed) you must generate a SEPARATE vendor specific IDL file to describe only those interfaces and A Separate Vendor Specific Proxystub Dll To Marshall Only Those Interfaces.

NOTE: See the opc overview document (opcovw.doc) for a listic and disucssion of opccomn.idl.

// opcda.idl

// Revision: 6/17/98 04:00 PM (EST)

// VersionInfo 2.0.0.0

// 12/05/97 ACC Fixed Uncertain Bits, Add Asyncio2, Opcdatacallback,

// OpciteMproperties, Browse_to

// 06/19/98 ACC Change V2 Uuids Prior To Final Release

// TO Avoid Conflict with 'Old' Opcda Automation UUIDS

// Change Name of 3 Methods on asyncio2 to

// Cancel2, SetENABLE, GetENABLE TO ELIMINATE CONFLICTS

//

Import "OAIDL.IDL";

Typedef enum tagopcdataserce {

OPC_DS_CACHE = 1,

OPC_DS_DEVICE} OpcDataSource;

TypedEf enum tagopcbrowsetype {

OPC_BRANCH = 1,

OPC_LEAF,

OPC_FLAT} OPCBRowSetyPE;

Typedef enum tagopcnamespacetype {

OPC_NS_HIERARCHIAL = 1,

OPC_NS_FLAT} opcnamespacety;

Typedef enum tagopcbrowsedirection {

OPC_BROWSE_UP = 1,

OPC_BROWSE_DOWN, OPC_BROWSE_TO} OPCBROWSEDIRECTION;

// ** Note ** The 1.0 IDL Contained An Error for Accessrights.

// They Should Not Have Been An Enum.

// The Yy Should Have Been Two Mask Bits As Noted Here.cpp_quote ("# Define OPC_Readable 1)

CPP_QUOTE ("# define opc_writeable 2")

TypedEf enum tagopceutype {

OPC_NOENUM = 0,

OPC_Analog,

OPC_ENUMERATED} opcEutype;

Typedef enum tagopcserverstate {

OPC_STATUS_RUNNING = 1,

OPC_STATUS_FAILED,

OPC_STATUS_NOCONFIG,

OPC_STATUS_SUSPENDED,

OPC_STATUS_TEST} opcserverstate;

TypedEf Enum TagopcenumScope {OPC_ENUM_PRIVATE_CONNECTIONS = 1,

OPC_ENUM_PUBLIC_CONNACTIONS,

OPC_ENUM_ALL_CONNECTIONS,

OPC_ENUM_PRIVATE,

OPC_ENUM_PUBLIC,

OPC_ENUM_ALL} OPCENUMSCOPE;

Typedef dword opchandle;

Typedef struct tagopcgroupheader {

DWORD DWSIZE;

DWORD dwitemcount;

Opchandle hclientgroup;

DWORD DWTRANSACTIONID;

HRESULT HRSTATUS;

OpcGroupheader;

Typedef struct tagopcitemheader1 {

Opchandle hclient;

DWORD DWVALUEOFFSET;

Word wquality;

Word wreserved;

Filetime fttimestampitem;

} Opcitemheader1;

Typedef struct tagopcitemheader2 {

Opchandle hclient;

DWORD DWVALUEOFFSET;

Word wquality;

Word wreserved;

} Opcitemheader2;

Typedef struct tagopcgroupheaderwrite {

DWORD dwitemcount;

Opchandle hclientgroup;

DWORD DWTRANSACTIONID;

HRESULT HRSTATUS;

OpcGroupheaderwrite;

Typedef struct tagopcitemheaderwrite {

Opchandle hclient;

HRESULT DWERROR;

} Opcitemheaderwrite;

Typedef struct tagopcitemstate {

Opchandle hclient;

Filetime fttimestamp;

Word wquality;

Word wreserved;

Variant VDataValue;

} Opcitemstate;

Typedef struct tagopcserverstatus {

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 tagopcitemdemdef {

LPWSTR SZACCESSPATH;

[string] lpwstr szitemid;

Bool bacTive;

Opchandle hclient;

DWORD DWBLOBSIZE;

[size_is (dwblobsize)] byte * pblob;

VARTYPE VTREQUESTEDDATYPE;

Word wreserved;

} Opcitemdef;

Typedef struct tagopcitemattributes {

LPWSTR SZACCESSPATH;

[string] lpwstr szitemid;

Bool bacTive;

Opchandle hclient;

Opchandle hserver;

DWORD DWACCESSRIGHTS;

DWORD DWBLOBSIZE;

[size_is (dwblobsize)] byte * pblob;

VARTYPE VTREQUESTEDDATYPE;

VARTYPE VTCANONICALDATATYPE;

Opceutype dweutype;

Variant veuinfo;

} Opcitemattributes;

Typedef struct tagopcitemresult {

Opchandle hserver;

VARTYPE VTCANONICALDATATYPE;

Word wreserved;

DWORD DWACCESSRIGHTS;

DWORD DWBLOBSIZE;

[size_is (dwblobsize)] byte * pblob;

} Opcitemresult;

// ******************************************************** ****

// OPC Quality Flags

//

// masks for extracting Quality Subfields

// (Note 'Status' Mask Also Includes 'Quality' Bits)

//

CPP_QUOTE ("# define opc_quality_mask 0xc0")

CPP_QUOTE ("# define opc_status_mask 0xfc")

CPP_QUOTE ("# define opc_limit_mask 0x03")

// VALUES for Quality_mask bit Field

//

CPP_QUOTE ("# define opc_quality_bad 0x00")

CPP_QUOTE ("# define opc_quality_uncertain 0x40")

CPP_QUOTE ("# define opc_quality_good 0xc0")

// status_mask value for qualy = bad

//

CPP_QUOTE ("# define opc_quality_config_error 0x04")

CPP_QUOTE ("# define opc_quality_not_connected 0x08")

CPP_QUOTE ("# define opc_quality_device_failure 0x0c")

CPP_QUOTE ("# define opc_quality_sensor_failure 0x10")

CPP_QUOTE ("# define opc_quality_last_known 0x14")

CPP_QUOTE ("# define opc_quality_comm_failure 0x18")

CPP_QUOTE ("# define opc_quality_out_of_service 0x1c")

// status_mask value for qualy = Uncertain

//

CPP_QUOTE ("# define opc_quality_last_usable 0x44")

CPP_QUOTE ("# define opc_quality_sensor_cal 0x50")

CPP_QUOTE ("# define opc_quality_egu_exceeded 0x54")

CPP_QUOTE ("# define opc_quality_sub_normal 0x58")

// status_mask value for qualy = good

//

CPP_QUOTE ("# define opc_quality_local_override 0xd8")

// VALUES for LIMIT BITFIELD

//

CPP_QUOTE ("# define opc_limit_ok 0x00")

CPP_QUOTE ("# define opc_limit_low 0x01")

CPP_QUOTE ("# define opc_limit_high 0x02")

CPP_QUOTE ("# define opc_limit_const 0x03")

// ******************************************************** ****

// Interface definitions

//

// ******************************************************** ****

[

Object,

UUID (39C13A4D-011E-11D0-9675-0020AFD8ADB3),

Pointer_DEFAULT (UNIQUE)

]

Interface IOPCSERVER: IUNKNOWN

{

HRESULT ADDGROUP

[in, string] lpcwstr szname,

[in] BOOL BACTIVE,

DWORD DWREQUESTEDUPDATERATE,

[in] opchandle hclientgroup, [unique, in] long * ptimebias,

[unique, in] float * ppercentdeadband,

DWORD DWLCID,

[OUT] opchandle * phservergroup,

[OUT] DWORD * PREVISEDUPDATERATE,

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,

Refiid Riid,

[OUT, IID_IS (RIID)] lpunknown * PPUNK

);

HRESULT GETSTATUS

[out] opcserverstatus ** ppserverstatus

);

HRESULT Removegroup

[in] opchandle hservergroup,

BOOL BFORCE

);

HRESULT CREATEGROUPENUMERATOR (

[in] opcenumscope dwscope,

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,

Refiid Riid,

[OUT, IID_IS (RIID)] lpunknown * PPUNK

);

HRESULT REMOVEPUBLICGROUP

[in] opchandle hservergroup,

BOOL BFORCE

);

}

// ******************************************************** ****

[

Object,

UUID (39C13A4F-011E-11D0-9675-0020AFD8ADB3),

Pointer_DEFAULT (UNIQUE)

]

Interface IOPCBROWSESERVERVERADDRESSPACE: IUNKNOWN

{

HRESULT Queryorganization

[out] opcnamespacetype * PNamespaceType

);

HRESULT CHANGEBROWSEPSITION

[in] opcbrowsedirection dwbrowsedirection,

in, string] lpcwstr szstring

);

HRESULT Browseopcitemids ([in] opcbrowsetype dwbrowsefiltertype,

LPCWSTR SZFILTERCRITERIA,

[in] VARTYPE VTDATYPEFILTER,

DWORD DWACCESSRIGHTSFILTER,

[OUT] lpenumstring * PPIENUMSTRING

);

HRESULT GETITEMID

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

LPCWSTR SZNAME

);

HRESULT Clonegroup

[in, string] lpcwstr szname,

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] opcdataserce dwsource,

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[OUT, SIZE_IS (, DWCOUNT)] opcitemstate ** PPITEMVALUES,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT WRITE

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[in, size_is (dwcount)] Variant * PitemValues,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

}

// ******************************************************** ****

[

Object,

UUID (39C13A53-011E-11D0-9675-0020AFD8ADB3),

Pointer_DEFAULT (UNIQUE)

]

Interface Iopcasyncio: IUNKNOWN

{

HRESULT READ

DWORD DWCONNECTION,

[in] opcdataserce dwsource,

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[OUT] DWORD * PTRANSACTIONID,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT WRITE

DWORD DWCONNECTION,

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[in, size_is (dwcount)] Variant * PitemValues,

[OUT] DWORD * PTRANSACTIONID,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT REFRESH

DWORD DWCONNECTION,

[in] opcdataserce dwsource,

[OUT] DWORD * PTRANSACTIONID

);

HRESULT CANCEL ([In] DWORD DWTRANSACTIONID

);

}

// ******************************************************** ****

[

Object,

UUID (39C13A54-011E-11D0-9675-0020AFD8ADB3),

Pointer_DEFAULT (UNIQUE)

]

Interface Iopcitemmgt: IUNKNOWN

{

HRESULT ADDITEMS

DWORD DWCOUNT,

[in, size_is (dwcount)] opcitemdef * Pitemarray,

[OUT, SIZE_IS (, DWCOUNT)] opcitemResult ** PPADDRESULTS,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT VALIDATEMS

DWORD DWCOUNT,

[in, size_is (dwcount)] opcitemdef * Pitemarray,

[in] BOOL BBLOBUPDATE,

[OUT, SIZE_IS (, DWCOUNT)] opcitemResult ** PpValidationResults,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT REMOVEITEMS

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT SETACTIVESTATE

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[in] BOOL BACTIVE,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT SETCLIENTLES

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[in, size_is (dwcount)] opchandle * phclient,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT SETDATATYPES

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[in, size_is (dwcount)] VARTYPE * PrequestedDataTypes,

[OUT, SIZE_IS (, DWCOUNT) 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

Ulong Celt,

[OUT, SIZE_IS (, * PCELTFETCHED) OPCITEMATITRIBUTES ** PPITEMARRAY,

[out] ulong * PCELTFETCHED

);

HRESULT SKIP

Ulong Celt

);

HRESULT RESET

Void

);

HRESULT Clone

[OUT] ienumopcitemattributes ** ppenumItemAttributes

);

}

// Data Access v2.0 additions

[

Object,

UUID (39C13A70-011E-11D0-9675-0020AFD8ADB3),

Pointer_DEFAULT (UNIQUE)

]

Interface IopcDataCallback: iUnknown

{

HRESULT OONDATACHANGE

DWORD DWTRANSID,

Opchandle hgroup,

HRESULT HRMASTERQUALITY,

[in] HRESULT HRMASTERROR,

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phclientItems,

[in, size_is (dwcount)] Variant * PvValues,

[in, size_is (dwcount)] Word * Pwqualities,

[in, size_is (dwcount)] filetime * pfttimestamps,

[in, size_is (dwcount)] HRESULT * PERRORS

);

HRESULT OnReadcomplete

DWORD DWTRANSID,

Opchandle hgroup,

HRESULT HRMASTERQUALITY,

[in] HRESULT HRMASTERROR,

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phclientItems,

[in, size_is (dwcount)] Variant * PvValues,

[in, size_is (dwcount)] Word * Pwqualities,

[in, size_is (dwcount)] filetime * pfttimestamps,

[in, size_is (dwcount)] HRESULT * PERRORS

);

HRESULT ONWRITECOMPLETE

[in] DWORD DWTRANSID, [in] opchandle hgroup,

[in] HRESULT Hrmastererr,

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * PClientHandles,

[in, size_is (dwcount)] HRESULT * PERRORS

);

HRESULT oncancelcomplete

DWORD DWTRANSID,

Opchandle hgroup

);

}

// ******************************************************** ****

[

Object,

UUID (39C13A71-011E-11D0-9675-0020AFD8ADB3),

Pointer_DEFAULT (UNIQUE)

]

Interface Iopcasyncio2: IUNKNOWN

{

HRESULT READ

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

DWORD DWTRANSACTIONID,

[OUT] DWORD * PDWCANCELID,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT WRITE

DWORD DWCOUNT,

[in, size_is (dwcount)] opchandle * phserver,

[in, size_is (dwcount)] Variant * PitemValues,

DWORD DWTRANSACTIONID,

[OUT] DWORD * PDWCANCELID,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT REFRESH2 (

[in] opcdataserce dwsource,

DWORD DWTRANSACTIONID,

[OUT] DWORD * PDWCANCELID

);

HRESULT CANCEL2

DWORD DWCANCELID

);

HRESULT STENABLE

[in] bool benable

);

HRESULT GETENABLE

[OUT] BOOL * PBENABLE

);

}

// ******************************************************** ****

[

Object,

UUID (39C13A72-011E-11D0-9675-0020AFD8ADB3), Pointer_Default (unique)

]

Interface IOPCITEMPROPERTIES: IUNKNOWN

{

HRESULT QueryavailableProperties

LPWSTR SZITEMID,

[out] DWORD * PDWCOUNT,

[OUT, SIZE_IS (, * pdwcount) DWORD ** PPPROPERTYIDS,

[out, size_is (, * pdwcount)] LPWSTR ** PPDESCRIPTIONS,

[out, size_is (, * pdwcount)] VARTYPE ** PPVTDataTypes

);

HRESULT GETITEMPROPERTIES

LPWSTR SZITEMID,

DWORD DWCOUNT,

[in, size_is (dwcount)] DWORD * PDWPROPERTYIDS,

[OUT, SIZE_IS (, DWCOUNT)] Variant ** PPVDATA,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

HRESULT LOOKUPITEMIDS

LPWSTR SZITEMID,

DWORD DWCOUNT,

[in, size_is (dwcount)] DWORD * PDWPROPERTYIDS,

[OUT, STRING, SIZE_IS (, DWCOUNT)] LPWSTR ** PPSZNEWITEMIDS,

[OUT, SIZE_IS (, DWCOUNT) HRESULT ** PPERRORS

);

}

// this Typelib Is Generated As a Convenience To Users of High Level Tools

// Which is Capable of use or browsing type.

// 'smart pointers' in vc5 is one esample.

[

UUID (B28EEDB2-AC6F-11D1-84D5-00608CB8A7E9),

Version (1.0),

Helpstring ("Opcda 2.0 Type Library)

]

Library OPCDA

{

Importlib ("stdole32.tlb");

Importlib ("stdole2.tlb");

Interface IOPCServer;

Interface IOPCSERVERPUBLICGROUPS;

Interface IOPCBROWSESERVERVERADDRESSSPACE;

Interface IopcGroupStatemgt;

Interface IopcpublicGroupStatemgt;

Interface Iopcsyncio;

Interface Iopcasyncio;

Interface Iopcitemmgt;

Interface IEnumopciteMattribute;

Interface IopcDatacAllback;

Interface Iopcasyncio2;

Interface IopciteMproperties;

转载请注明原文地址:https://www.9cbs.com/read-72392.html

New Post(0)