subscription.h

来自「此为Insight opc client InfoServerExplorer源」· C头文件 代码 · 共 135 行

H
135
字号
/////////////////////////////////////////////////////////////////////////////
//
//  OPC DataAccess VC++ Client:	subscription.h
//								(Header File)
//
/////////////////////////////////////////////////////////////////////////////
//
//          Author: Raphael Imhof
//    Initial Date: 12/10/98
//       $Workfile: subscription.h $
//       $Revision: 1 $
//           $Date: 7/27/99 5:23p $
//   Target System: Microsoft Windows NT 4.0
//     Environment: Visual C++ 5.0 / OPC DataAccess 2.0
//         Remarks: 
//
/////////////////////////////////////////////////////////////////////////////
//
//     Description: interface of the connection point class:
//					COPCConnectionPoint (for OPC 2.0 data notification)
//
/////////////////////////////////////////////////////////////////////////////
//
//  History of Changes     (Please remove very old comments and blank lines!)
//            $Log: /IDK/OPCServer/clients/VC++/InfoServerExplorer/subscription.h $
// 
// 1     7/27/99 5:23p Imhof
// 
// 1     7/27/99 5:19p Imhof
// 
// 4     1/15/99 6:43p Imhof
// Updated legal notice.
// 
// 3     12/15/98 4:24p Imhof
// 
// 2     12/11/98 5:58p Imhof
// Made modifications for OPC 2.0.
// 
// 
// 
//  $Nokeywords:$ (To avoid useless search while checking in.)
/////////////////////////////////////////////////////////////////////////////
//  Copyright (C) 1998, Siemens Building Technologies, Inc. Landis Division
//
// SIEMENS BUILDING TECHNOLOGIES, INC. IS PROVIDING THE FOLLOWING
// EXAMPLES OF CODE AS SAMPLE ONLY.
//
// SIEMENS BUILDING TECHNOLOGIES, INC.  MAKES NO REPRESENTATIONS
// OR WARRANTIES OF ANY KIND  WITH RESPECT TO THE VALIDTY OF THE 
// CODES   OR   DESIRED   RESULTS   AND   DISCLAIMS   ALL   SUCH 
// REPRESENTATIONS   AND   WARRANTIES,  INCLUDING  FOR  EXAMPLE, 
// WARRANTIES  OF  MERCHANTABILITY  AND FITNESS FOR A PARTICULAR 
// PURPOSE.    SIEMENS  BUILIDNG  TECHNOLOGIES,  INC.  DOES  NOT 
// REPRESENT  OR  WARRANT  THAT  THE  FOLLOWING CODE SAMPLES ARE 
// ACCURATE, VALID, COMPLETE OR CURRENT.
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_SUBSCRIPTION_H__7EF80D83_8EEE_11D2_ADDC_00104B2C9D06__INCLUDED_)
#define AFX_SUBSCRIPTION_H__7EF80D83_8EEE_11D2_ADDC_00104B2C9D06__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000



#include <opcda.h>
extern CComModule _Module;
#include <atlcom.h>

class COPCConnectionPoint :
	public IOPCDataCallback,
   	public CComObjectRoot
	/*
	We assume that the app (main thread) is mostly idle (message based windows application). 
	Therefore the event server should not be blocked.
	This could happen when using single threading (our case).
	If that happens we should change to multithreading:
	public CComObjectRootEx<CComMultiThreadModel>
	This requires the use of critical sections !
	You need multithreading when you are using a single threaded
	non windows message app.
	*/
{
public:
	COPCConnectionPoint();
	virtual ~COPCConnectionPoint();


BEGIN_COM_MAP(COPCConnectionPoint)
   COM_INTERFACE_ENTRY(IOPCDataCallback)
END_COM_MAP()

DECLARE_NOT_AGGREGATABLE(COPCConnectionPoint)

	// The OPC connection points callback functions
	STDMETHODIMP OnDataChange(		DWORD		dwTransid,
									OPCHANDLE   hGroup,
									HRESULT     hrMasterpwQualities,
									HRESULT     hrMastererroror,
									DWORD       dwCount,
									OPCHANDLE*	phClientItems,
									VARIANT*	pvValues,
									WORD*		pwQualities,
									FILETIME*	pftTimeStamps,	
									HRESULT*	pErrors);

	STDMETHODIMP OnReadComplete(	DWORD       dwTransid,
									OPCHANDLE   hGroup,
									HRESULT     hrMasterpwQualities,
									HRESULT     hrMastererroror,
									DWORD       dwCount,
									OPCHANDLE*	phClientItems,
									VARIANT*	pvValues,
									WORD*		pwQualities,
									FILETIME*	pftTimeStamps,
									HRESULT*	pErrors);

	STDMETHODIMP OnWriteComplete(	DWORD       dwTransid,
									OPCHANDLE   hGroup,
									HRESULT     hrMastererror,
									DWORD       dwCount,
									OPCHANDLE*	phClientItems,
									HRESULT*	pErrors);

	STDMETHODIMP OnCancelComplete(	DWORD       dwTransid,
									OPCHANDLE   hGroup);

	BOOL Init(CGroup* pGroup);
	BOOL Term(CGroup* pGroup);
};

#endif // !defined(AFX_SUBSCRIPTION_H__7EF80D83_8EEE_11D2_ADDC_00104B2C9D06__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?