Item Definition

The ItemID is the fully qualified definition of a data item in the server, commonly referred to as the WHAT.  No other information is required to identify the data item for the client to be able to read/write values.

The Item definition (ItemID) used in the OPCITEMDEF(定义见最下) and elsewhere is a nul-terminated string that uniquely identifies an OPC data item.  The syntax of the identifier is server dependent (although it should include only printable UNICODE characters) and it provides a reference or ‘key’ to an ‘item’ in the data source. The item is anything that can be represented by a VARIANT although it is typically a single value such as an analog, digital or string value. 

For example, an item such as FIC101 might represent an entire record such as a Fieldbus, Hart

Foundation or ProfiBus data structure. Such behavior is specifically allowed but not required by OPC - the return of such structures is considered to be vendor specific behavior. 

Alternately FIC101.PV might represent one attribute of a record such as the process value.  This would probably take the form of a double which could be used by any client.  

As an extreme example, since the syntax of the item ID is server specific, additional information such as Counts, Engineering Units Scaling and Signal conditioning information could be embedded in the definition string (although this is not recommended). 

Examples:

A server which supports access to an existing DCS might support a simple syntax such as

 “TIC101.PV”

A server that supports low level access to a PLC might support a syntax such as

 “COM1.STATION:42.REG:40001;0,4095,-100.0,+1234.0”

OPCITEMDEF

typedef struct {

 [string]  LPWSTR  szAccessPath;

 [string]  LPWSTR  szItemID;

 BOOL    bActive ;

 OPCHANDLE   hClient;

 DWORD   dwBlobSize;

  [size_is(dwBlobSize)] BYTE * pBlob;

 VARTYPE   vtRequestedDataType;

 WORD    wReserved;

} OPCITEMDEF;
原文地址:https://www.cnblogs.com/gmth/p/2987033.html