版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、OPC client 在 VC 環(huán)境下編程一連接使用到變量的說明類型HRESULT說明函數(shù)返回值,用來檢測(cè)函數(shù)返回值(如:初始化 COM 庫,查找CLSID, 創(chuàng)建 OPC 服務(wù)等) ,提供函數(shù)執(zhí)行情況CLSIDLPWSTR全球唯一標(biāo)示符,用來確定OPC 服務(wù)的標(biāo)識(shí),從注冊(cè)表查找獲得LPSTR 和 LPWSTR 是 Win32 和 VC+ 所使用的一種字符串?dāng)?shù)據(jù)類型。 LPSTR 被定義成是一個(gè)指向以 NULL( 0) 結(jié)尾的8 位 ANSI 字符數(shù)組指針,而 LPWSTR 是一個(gè)指向以 NULL 結(jié)尾的 16 位雙字節(jié)字符數(shù)組指針OPC 接口說明IOPCServer*m_IOPCServer
2、;IOPCServer 接口及成員函數(shù)主要用于對(duì)組對(duì)象進(jìn)行創(chuàng)建 ,刪除 ,枚 舉和獲取當(dāng)前狀態(tài)等操作 .是OPC 服務(wù)器對(duì)象的主要接口 .接口及成員IOPCItemMgt*m_IOPCItemMgt;IOPCItemMgt 接口及成員函數(shù)用于 OPC 客戶程序添加、刪除 和組對(duì)象中組員等控制操作。IOPCSyncIO*m_IOPCSyncIO;IOPCSyncIO 用于同步數(shù)據(jù)訪問。OPCITEMDEFm_Items1;OPCITEMDEF 數(shù)組,包含著項(xiàng)的存取路徑, 定義和被請(qǐng)求的數(shù)據(jù)類OPCITEMRESULT *m_ItemResult;OPCHANDLEOPCITEMRESULT 數(shù)組
3、,服務(wù)器用來告訴客戶關(guān)于項(xiàng)的附加的信息(項(xiàng)句柄和規(guī)范的數(shù)據(jù)類型) m_GrpSrvHandle;OPC 服務(wù)的句柄,在多個(gè)函數(shù)中都會(huì)用到使用到的函數(shù)說明CoInitialize(NULL); 初始化 COM 庫CoInitialize 是 Windows 提供的 API 函數(shù),用來告訴Windows 以單線程的方式創(chuàng)建com 對(duì)象。應(yīng)用程序調(diào)用 com 庫函數(shù)(除CoGetMalloc 和內(nèi)存分配函數(shù))之前必須初始化 com 庫。返回值 S_OK : 該線程中 COM 庫初始化成功 S_FALSE 該線程中 COM 庫已經(jīng)被初始化 CoInitialize ()標(biāo)明以單線程方式創(chuàng)建。使用 Co
4、Initialize 創(chuàng)建可以使對(duì)象直接與線程連接,得到最高的性能。CoInitialize 并不裝載 COM 庫,它只用來初始化當(dāng)前線程使用什么樣的套間。使用這個(gè)函數(shù)后,線程就和一個(gè)套間建立了對(duì)應(yīng)關(guān)系。線程的套間模式?jīng)Q定了該線程如何調(diào)用 COM 對(duì)象,是否需要列集等。CoInitialize () 并不會(huì)干擾客戶和服務(wù)器之間的通信,它所做的事情是讓線程注冊(cè)一個(gè)套間,而線程運(yùn)行過程中必然在此套間。CoInitialize 和 CoUninitialize 必須成對(duì)使用查找 OPC 服務(wù)CLSIDFromProgID (LOPC 服務(wù)的名稱, &clsid);通過 ProgID, 查找注冊(cè)表中的
5、相關(guān)CLSID參數(shù): 1. 服務(wù)的名稱 2. CLSID 型變量,用來接收注冊(cè)表中查找到的 CLSID創(chuàng)建 OPC 服務(wù)器對(duì)象CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER ,IID_IOPCServer, (void*)&m_IOPCServer);創(chuàng)建 OPC 服務(wù)器對(duì)象,并查詢對(duì)象的 IID_IOPCServer 接口參數(shù): 1. CLSID 型變量,使用 CLSIDFromProgID 函數(shù)查找到的 CLSID函數(shù)功能描述:用指定的類標(biāo)識(shí)符創(chuàng)建一個(gè)Com 對(duì)象 ,用指定的類標(biāo)識(shí)符創(chuàng)建一個(gè)未初始化的對(duì)象。 當(dāng)在本機(jī)中只創(chuàng)建一個(gè)對(duì)象時(shí),
6、可以調(diào)用 CoCreateInstance; 在遠(yuǎn)程系統(tǒng)中創(chuàng)建一個(gè)對(duì)象時(shí),可以調(diào)用 CoCreateInstanceEx; 創(chuàng)建多個(gè)同一CLSID 的對(duì)象時(shí) , 可以參考CoGetClassObject 函數(shù)。函數(shù)原形: STDAPI CoCreateInstance( REFCLSID rclsid, /創(chuàng)建的 Com 對(duì)象的類標(biāo)識(shí)符(CLSID)LPUNKNOWN pUnkOuter,/ 指向接口IUnknown 的指針DWORD dwClsContext, / 運(yùn)行可執(zhí)行代碼的上下文 REFIID riid, / 創(chuàng)建的 Com 對(duì)象的接口標(biāo)識(shí)符 LPVOID * ppv / 用來接收指
7、向Com 對(duì)象接口地址的指針變量); 參數(shù): rclsid in 用來唯一標(biāo)識(shí)一個(gè)對(duì)象的 CLSID(128 位),需要用它來創(chuàng)建指定對(duì)象。pUnkOuterin 如果為 NULL, 表明此對(duì)象不是聚合式對(duì)象一部分。如果不是NULL, 則指針指向一個(gè)聚合式對(duì)象的Unknown 接口。dwClsContextin 組件類別 . 可使用 CLSCTX 枚舉器中預(yù)定義的值.riidin 引用接口標(biāo)識(shí)符,用來與對(duì)象通信。ppvout 用來接收指向接口地址的指針變量。如果函數(shù)調(diào)用成功 ,*ppv 包括請(qǐng)求的接口指針。返回值:S_OK指定的 Com 對(duì)象實(shí)例被成功創(chuàng)建。REGDB_E_CLASSNOTRE
8、G指定的類沒有在注冊(cè)表中注冊(cè) . 也可能是指定的 dwClsContext 沒有注冊(cè)或注冊(cè)表中的服務(wù)器類型損壞CLASS_E_NOAGGREGATION這個(gè)類不能創(chuàng)建為聚合型。E_NOINTERFACE指定的類沒有實(shí)現(xiàn)請(qǐng)求的接口 , 或者是 IUnknown 接口沒有暴露請(qǐng)求的接口 .注釋:CoCreateInstance 幫助者函數(shù)通過使用對(duì)象的 CLSID, 提供了一種便潔的方式與類對(duì)象連接 ,創(chuàng)建未初始化的實(shí)例 , 以及釋放類對(duì)象。它封裝了以下的功能:CoGetClassObject(rclsid, dwClsContext, NULL, IID_IClassFactory, &pCF)
9、;hresult = pCF-CreateInstance(pUnkOuter, riid, ppvObj);pCF-Release();當(dāng)在本機(jī)中只創(chuàng)建一個(gè)對(duì)象時(shí), 調(diào)用 CoCreateInstance 是最方便的 ;如果要在遠(yuǎn)程系統(tǒng)中創(chuàng)建一個(gè)對(duì)象時(shí),可以調(diào)用 CoCreateInstanceEx; 創(chuàng)建多個(gè)同一CLSID 的對(duì)象時(shí) , 可以參考CoGetClassObject 函數(shù) ;如果創(chuàng)建多個(gè)對(duì)象實(shí)例 ,可以獲得類對(duì)象的 IClassFactory 接口指針,并使用需要的方法,可以使用CoGetClassObject函數(shù)。在 CLSCTX 枚 舉 器 中 , 你 可 以 指 定 用
10、來 管 理 對(duì) 象 的 服 務(wù) 器 類 型 . 這 些 常 量 可 以 是CLSCTX_INPROC_SERVER, CLSCTX_INPROC_HANDLER, CLSCTX_LOCAL_SERVER或是它們的任何組合. 常量 CLSCTX_ALL 被定義為這三個(gè)值的組合 . 想獲得更多的有關(guān)這些常量的用法,請(qǐng)參考CLSCTX.添加組到 OPC 服務(wù)器m_IOPCServer- AddGroup (Lgrp1,/in組名TRUE,/in活動(dòng)狀態(tài)500,/in向服務(wù)器發(fā)送請(qǐng)求的刷新率1,/in 客戶端的操作句柄&TimeBias,/in 與標(biāo)準(zhǔn)時(shí)間的校正值&PercentDeadband,/i
11、n 要舍棄的數(shù)據(jù)LOCALE_ID,/in 服務(wù)器使用的語言&m_GrpSrvHandle,/out 添加組以后服務(wù)器返回的組句柄&RevisedUpdateRate,/out 服務(wù)器的數(shù)據(jù)刷新率IID_IOPCItemMgt,/in 添加組的接口類型(LPUNKNOWN*)&m_IOPCItemMgt); / out 服務(wù)器返回的接口對(duì)象指針AddGroup 函數(shù)的說明HRESULT AddGroup(in, string LPCWSTR szName,in BOOL bActive,in DWORD dwRequestedUpdateRate, in OPCHANDLE hClientGr
12、oup, unique, in LONG *pTimeBias, in FLOAT * pPercentDeadband, in DWORD dwLCID, out OPCHANDLE * phServerGroup, out DWORD *pRevisedUpdateRate, in REFIID riid,out, iid_is(riid) LPUNKNOWN * ppUnk );ParametersDescriptionszNameName of the group. The name must be unique among the other groups created by th
13、is client. If no name is provided (szName is pointer to a NUL string) the server will generate a unique name. The server generated name will also be unique relative to any existing public groups.bActiveFALSE if the Group is to be created as inactive.TRUE if the Group is to be created as active.dwReq
14、uestedUpdateRateClient Specifies the fastest rate at which data changes may be sent to OnDataChange for items in this group. This also indicates the desired accuracy of Cached Data. This is intended only to control the behavior of the interface. How the server deals with the update rate and how ofte
15、n it actually polls the hardware internally is an implementation detail. Passing 0 indicates the server should use the fastest practical rate. The rate is specified in milliseconds.hClientGroupClient provided handle for this group. refer to description of data types, parameters, and structures for m
16、ore information about this parameterpTimeBiasPointer to Long containing the initial TimeBias (in minutes) for the Group. Pass a NULL Pointer if you wish the group to use the default system TimeBias. See discussion of TimeBias in General Properties Section See Comments below.pPercentDeadbandThe perce
17、nt change in an item value that will cause a subscription callback for that value to a client. This parameter only applies to items in the group that have dwEUType of Analog. See discussion of Percent Deadband in General Properties Section. A NULL pointer is equivalent to 0.0.dwLCIDThe language to b
18、e used by the server when returning values (including EU enumeration as text foroperations on this group. This could also include such things as alarm or status conditions or digital contact states.phServerGroupPlace to store the unique server generated handle to the newly created group. The client
19、will use the server provided handle for many of the subsequent functions that the client requests the server to perform on the group.pRevisedUpdateRateThe server returns the value it will actually use for the UpdateRate which may differ from the RequestedUpdateRate.Note that this may also be slower
20、than the rate at which the server is internally obtaining the data and updating the cache.In general the server shouldround up the reque;to the next available supported rate. The rate is specified in milliseconds.Server returns HRESULT ofOPC_S_UNSUPPORTEDRATE when it returns a value in revisedUpdate
21、Rate that is different than RequestedUpdateRate.sted rateriidThe type of interface desired (e.g. IID_IOPCItemMgt)ppUnkWhere to store the returned interface pointer. NULL is returned for any FAILED HRESULT.添加項(xiàng)目m_IOPCItemMgt- AddItems TOC o 1-5 h z (1,m_Items,/&m_ItemResult,/&m_pErrors);/in添加1個(gè)itemin添
22、加的item的指針out添加item的結(jié)果out發(fā)生的錯(cuò)誤m_Items 的說明定義:OPCITEMDEFm_Items1;這個(gè)參數(shù)為OPCITEMDEF結(jié)構(gòu),包含著項(xiàng)的存取路徑,定義和被請(qǐng)求的數(shù)據(jù)類等。AddItems 函數(shù)說明HRESULT AddItems(in DWORD dwCount,in, size_is(dwCount) OPCITEMDEF * pItemArray,out, size_is(,dwCount) OPCITEMRESULT * ppAddResults,out, size_is(,dwCount) HRESULT * ppErrors);ParametersD
23、escriptiondwCountThe number of items to be addedpItemArrayArray of OPCITEMDEFs. These tell the server everything it needs to know about the item includingthe access path, definition and requested datatypeppAddResultsArray of OPCITEMRESULTs. This tells the client additional information about the item
24、 including the server assigned item handle and the canonical datatype.ppErrorsArray of HRESULTs. This tells the client which of the items was successfully added. For any item which failed it provides a reason.OPCITEMDEF 結(jié)構(gòu)說明typedef struct string LPWSTR szAccessPath;/OPC服務(wù)器存取路徑string LPWSTR szItemID;
25、/item的名稱BOOLbActive ;活動(dòng)狀態(tài)OPCHANDLEhClient;/操作句柄DWORDdwBlobSize;/item 的 pBlob 大小size_is(dwBlobSize) BYTE * pBlob;二進(jìn)制指針VARTYPEvtRequestedDataType;/數(shù)據(jù)類型由客戶端請(qǐng)求WORDwReserved;保留字 OPCITEMDEF;MemberUsed byDescriptionszAccessPathbothThe access path the server should associate with this item. By convention a
26、pointer to a NUL string specifies that the server should select the access path. Support for accesspath is optional NOTE: version 1 indicated that a NULL pointer would allow the server to pick the path however passing a NULL pointer will cause a fault in the proxy/stub code and thus is not allowed.s
27、zItemIDbothA null-terminated string that uniquely identifies the OPC data item. See the Item ID discussion and the AddItems function for specific information about the contents of this field.bActiveaddThis Boolean value affects the behavior various methods as described elsewhere in this specificatio
28、n.hClientaddThe handle the client wishes to associate with the item. See the OPCHANDLE for more specific information about the contents of this field.dwBlobSizebothThe size of the pBlob for this item.pBlobbothpBlob is a pointer to the Blob.vtRequestedDataTypebothThe data type requested by the client
29、. An error is returned (See Additems or Validateltems) if the server cannot provide the item in this format. Passing VT_EMPTY means the client will accept the servers canonical datatype.查詢同步接口m_IOPCItemMgt- Queryinterface (IID_IOPCSyncIO, (void*)&m_IOPCSyncIO);參數(shù):1. IID_IOPCSyncIO同步接口2.服務(wù)器返回的用于操作同步接
30、口的指針。同步接口讀取數(shù)據(jù)m_IOPCSyncIO- Read (OPC_DS_DEVICE, 1, phServer, &pItemValue, &pErrors);參數(shù):. OPC_DS_DEVICE 從OPC設(shè)備讀取另一個(gè)選擇是OPC_DS_CACHE從緩存讀取.讀取的數(shù)量.這個(gè)item的服務(wù)句柄.返回值的 OPCITEMSTATE結(jié)構(gòu)數(shù)值指針.返回的錯(cuò)誤指針HRESULT Read(in OPCDATASOURCE dwSource,in DWORD dwCount,in, size_is(dwCount) OPCHANDLE * phServer,out, size_is(,dwCo
31、unt) OPCITEMSTA TE * ppItemValues,out, size_is(,dwCount) HRESULT * ppErrors);ParametersDescriptiondwSourceThe data source ; OPC_DS_CACHE orOPC_DS_DEVICEdwCountThe number of items to be read.phServerThe list of server item handles for the items to be readppltemValuesArray of structures in which the i
32、tem values are returned.ppErrorsArray of HRESULTs indicating the success of the individual item reads. The errors correspond to the handles passed in phServer. This indicates whether the read succeeded in obtaining a defined value, quality and timestamp. NOTE any FAILED error code indicates that the
33、 corresponding Value, Quality and Time stamp are UNDEFINED.OPCITEMSTATE 結(jié)構(gòu)說明 typedef struct OPCHANDLEhClient;FILETIME ftTimeStamp;WORDwQuality;WORDwReserved;VARIANTvDataValue; OPCITEMSTA TE;MemberDescriptionhClientthe client provided handle for this itemftTimeStampUTC TimeStamp for this items value.
34、 If the device cannot provide a timestamp then the server should provide one.wQualityThe quality of this item.vDataValueThe value itself as a variant./釋放同步接口m_IOPCSyncIO-Release();m_IOPCSyncIO = NULL;/ 釋放item管理接口m_IOPCItemMgt-Release(); m_IOPCItemMgt = NULL;/ 釋放OPC服務(wù)器m_IOPCServer-Release();m_IOPCSer
35、ver = NULL;關(guān)閉COM庫CoUninitialize();異步 OPC 數(shù)據(jù)讀取 查詢 group 對(duì)象的異步接口m_IOPCItemMgt- QueryInterface (IID_IOPCAsyncIO2, (void*)&m_IOPCAsyncIO2);參數(shù): 1. IID_IOPCAsyncIO2 異步 2.0 接口2. 服務(wù)器返回的用于操作異步接口的指針。獲得 IOPCGroupStateMgt 接口m_IOPCItemMgt- QueryInterface (IID_IOPCGroupStateMgt,(void*) &m_IOPCGroupStateMgt);參數(shù): 1
36、. IID_IOPCGroupStateMgt 組狀態(tài)接口2. 服務(wù)器返回的用于操作接口的指針。建立異步回調(diào)CComObject* pCOPCDataCallback;/ 回調(diào)對(duì)象的指針通過 ATL 模板創(chuàng)建回調(diào)對(duì)象的實(shí)例CComObject:CreateInstance(&pCOPCDataCallback);查詢 IUnknown 接口LPUNKNOWN pCbUnk;pCbUnk = pCOPCDataCallback-GetUnknown();建立一個(gè)服務(wù)器的連接點(diǎn)與客戶程序接收器之間的連接.該函數(shù)封裝實(shí)現(xiàn)接收事件/ in 獲得的 IOPCGroupStateMgt 接口指針/ in
37、IUnknown 接口指針/ in 回調(diào)接口/ out 服務(wù)器返回的回調(diào)接口的標(biāo)識(shí)AtlAdvise 函數(shù)告訴一個(gè)可連接對(duì)象客戶想從此可連接對(duì)象接收事件HRESULT hRes = AtlAdvise ( m_IOPCGroupStateMgt, pCbUnk, IID_IOPCDataCallback, &m_dwAdvise);異步 OPC 數(shù)據(jù)釋放退出連接點(diǎn)時(shí)使用 AtlUnadviseHRESULT hRes = AtlUnadvise (m_IOPCGroupStateMgt, IID_IOPCDataCallback, m_dwAdvise); m_IOPCGroupStateMg
38、t-Release();/異步的以下釋放類似同步的OPC 釋放m_IOPCItemMgt-RemoveItems( 1,/ in 刪除項(xiàng)目phServer, / in 被刪除項(xiàng)目的服務(wù)句柄&pErrors / out 有錯(cuò)誤時(shí)的指針 );m_IOPCAsyncIO2-Release();/ 釋放異步接口m_IOPCAsyncIO2 = NULL;m_IOPCItemMgt-Release();/釋放 ITEM 接口m_IOPCItemMgt = NULL;m_IOPCServer-Release(); 釋放 OPC 服務(wù) m_IOPCServer = NULL;CoUninitialize()
39、;/ 釋放 COM用于客戶端的異步回調(diào)定義功能:客戶提供用來操作組的數(shù)據(jù)變化和刷新lOPCDataCallbackIOPCDataCallback:OnDataChangeHRESULT OnDataChange(in DWORD dwTransid,in OPCHANDLE hGroup,in HRESULT hrMasterquality,in HRESULT hrMastererror,in DWORD dwCount,in, sizeis(dwCount) OPCHANDLE * phClientItems,in, sizeis(dwCount) VARIANT * pvValues,
40、in, sizeis(dwCount) WORD * pwQualities,in, sizeis(dwCount) FILETIME * pftTimeStamps,in, sizeis(dwCount) HRESULT *pErrors );參數(shù)描述 dwTransid hGroup hrMasterquality hrMastererror dwCount phClientItems pvValues pwQualities pftTimeStamps pErrors事務(wù)標(biāo)識(shí)符,如果是一般的回調(diào),此值為 0。 組的客戶句柄。S_OK ,如果 OPC_QUALITY_MASK 是 OPC_
41、QUALITY_GOOD, 如果無錯(cuò)誤,返回 S_OK ,否則返回S_FALSE.。讀取的在客戶句柄表里的項(xiàng)數(shù)目。數(shù)據(jù)發(fā)生變化的項(xiàng)白客戶句柄表。數(shù)據(jù)發(fā)生變化的項(xiàng)的 VARIANTS 類型數(shù)據(jù)表。讀取的項(xiàng)的品質(zhì)值的表。讀取的項(xiàng)的時(shí)間戳表。項(xiàng)的HRESULTS 表。如果數(shù)據(jù)項(xiàng)的品質(zhì)變?yōu)閁NCERTAIN 或者服務(wù)器提供的更有用的錯(cuò)誤信息。否貝U為S_FALSEBAD,這里返回附加的ParametersDescriptiondwTransid0 if the call is the result of an ordinary subscription. If the call is the resu
42、lt of a call to Refresh2 then this is the value passed to Refresh2.hGroupThe Client handle of the grouphrMasterqualityS_OK if OPC_QUALITY_MASK for all qualitiesare OPC_QUALITY_GOOD, S_FALSE otherwise.hrMastererrorS_OK if all errors are S_OK, S_FALSE otherwis(dwCountThe number of items in the client
43、handle list客戶總是返回 S_OK 。ppErrors 返回碼返回碼描述S_OKE_FAILOPC_E_BADRIGHTSOPC_E_UNKNOWNITEMID項(xiàng)在服務(wù)器的地址空間是不可用的。phClientItemsThe list of client handles for the items which have changed.pvValuesA List of VARIANTS containing the values (in RequestedDataType) for the items which have changed.pwQualitiesA List of
44、Quality values for the itemspftTimeStampsA list of TimeStamps for the itemspErrorsA list of HRESULTS for the items. If the quality of a data item has changed to UNCERTAIN or BAD., this field allows the server to return additional server specific errors which provide more useful information to the us
45、er. See below.HRESULT返回碼返回碼描述S_OK項(xiàng)的數(shù)據(jù)的品質(zhì)是好的(OPC_QUALITY_GOOD )。項(xiàng)的操作失敗。操作的項(xiàng)是不可讀的。S_xxx, E_xxxS_xxx -賣方特殊信息。E_xxx -賣方指定的特殊錯(cuò)誤。對(duì)于所有的S_xxx錯(cuò)誤碼,客戶需要假設(shè)相應(yīng)的值,品質(zhì)和時(shí)間戳都已經(jīng)定義好了,不管品質(zhì)是UNCERTAIN 或者BAD,建議服務(wù)器賣主提供關(guān)于UNCRTAIN 或BAD項(xiàng)的附加的信息?;卣{(diào)發(fā)生在以下情況:一個(gè)或者多個(gè)的數(shù)據(jù)變化事件。事件在活動(dòng)Group中的活動(dòng)項(xiàng)的值或者品質(zhì)發(fā)生變化時(shí)發(fā)生。回調(diào)不會(huì)以超過刷新速率的速度發(fā)生。一般而言,除非值或者品質(zhì)發(fā)生變
46、化,否則回調(diào)不會(huì)發(fā)生。 transaction ID 為0。通過AsyncIO2 接口的刷新請(qǐng)求。一旦請(qǐng)求發(fā)生,在活動(dòng) Group中的OPCDataCallback:OnReadCompleteHRESULT OnReadComplete(in DWORD dwTransid,in OPCHANDLE hGroup,in HRESULT hrMasterquality,in HRESULT hrMastererror,活動(dòng)項(xiàng)都會(huì)刷新。Transaction ID 不為0。事務(wù)標(biāo)識(shí)符,如果是一般的回調(diào),此值為 0。組的客戶句柄。否則/S_OK ,如果 OPC_QUALITY_MASK 是 OPC
47、_QUALITY_GOOD, 為 S_FALSE 。如果無錯(cuò)誤,返回 S_OK,否則返回S_FALSE.。in DWORD dwCount,客戶句柄里的項(xiàng)數(shù)目in, sizeis(dwCount) OPCHANDLE * phClientItems, /項(xiàng)的客戶句柄表in, sizeis(dwCount) V ARIANT * pvValues, 數(shù)據(jù)發(fā)生變化的項(xiàng)的 VARIANTS 類型數(shù)據(jù)表。in, sizeis(dwCount) WORD * pwQualities,/ 讀取的項(xiàng)的品質(zhì)值的表。in, sizeis(dwCount) FILETIME * pftTimeStamps,/ 讀
48、取的項(xiàng)的時(shí)間戳表。in, sizeis(dwCount) HRESULT *pErrors 項(xiàng)的 HRESULTS 表。如果數(shù)據(jù)項(xiàng)的品質(zhì)變?yōu)閁NCERTAIN 或者 BAD ,這里返回附加的服務(wù)器提供的更有用的錯(cuò)誤信息);DescriptionThis method is provided by the client to handle notifications from the OPC Group on completion of Async Reads.IOPCDataCallback:OnWriteCompleteHRESULT OnWriteComplete( in DWORD dw
49、Transid, in OPCHANDLE hGroup, in HRESULT hrMasterError, in DWORD dwCount,事務(wù)標(biāo)識(shí)符,如果是一般的回調(diào),此值為 組的客戶句柄。0。如果無錯(cuò)誤,返回 S_OK,否則返回S_FALSE??蛻艟浔砝锏捻?xiàng)數(shù)目ParametersDescriptiondwTransidThe TransactionID returned to the client when the Read was initiated.hGroupThe Client handle of the grouphrMasterqualityS_OK if OPC_Q
50、UALITY_MASK for all qualitiesare OPC_QUALITY_GOOD, S_FALSE otherwise.hrMastererrorS_OK if all errors are S_OK, S_FALSE otherwisedwCountThe number of items in the client handle, values, qualities, times and errors lists. This may be less than the number of items passed to Read. Items for whic errors
51、were detected and returned from Read are not included in the callback.phClientItemsThe list of client handles for the items which were read. This is NOT guarenteed to be in any particular order although it will match the values, qualities, times and errors array.pvValuesA List of VARIANTS containing the values (in RequestedDataType) for the items.pwQualitiesA List of Quali
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024會(huì)計(jì)從業(yè)人員繼續(xù)學(xué)習(xí)考試
- 齊魯工業(yè)大學(xué)《版面編排設(shè)計(jì)》2023-2024學(xué)年第一學(xué)期期末試卷
- 南京信息工程大學(xué)《語言與數(shù)據(jù)可視化》2021-2022學(xué)年期末試卷
- 齊魯工業(yè)大學(xué)《產(chǎn)品模型制作》2022-2023學(xué)年期末試卷
- 光伏電站建設(shè)合同書
- 修車服務(wù)合同模板
- 城市高端住宅開發(fā)項(xiàng)目協(xié)議范本
- 農(nóng)藥制造過程質(zhì)量控制方法考核試卷
- 制糖業(yè)的品牌管理與市場(chǎng)推廣考核試卷
- 橡膠制品的品牌建設(shè)與推廣考核試卷
- 實(shí)驗(yàn)室消毒培訓(xùn)課件
- 中醫(yī)培訓(xùn)課件:《拔罐技術(shù)》
- 筋傷概論-骨傷科
- 惠安女課件完
- 鹽酸采購和儲(chǔ)存和使用安全管理
- 健身及體育運(yùn)動(dòng)服務(wù)領(lǐng)域:第一體育企業(yè)組織架構(gòu)及部門職責(zé)
- 安全保衛(wèi)常識(shí)課件
- 乳腺癌放療后的皮膚護(hù)理課件
- 《培訓(xùn)與開發(fā) 》課件
- 信賴性測(cè)試一覽表-
- 2024年國家能源集團(tuán)大渡河公司招聘筆試參考題庫含答案解析
評(píng)論
0/150
提交評(píng)論