📄 group.h
字号:
/////////////////////////////////////////////////////////////////////////////
//
// OPC DataAccess VC++ Client: Group.h
// (Header File)
//
/////////////////////////////////////////////////////////////////////////////
//
// Author: Raphael Imhof
// Initial Date: 11/04/98
// $Workfile: Group.h $
// $Revision: 1 $
// $Date: 7/27/99 5:22p $
// Target System: Microsoft Windows NT 4.0
// Environment: Visual C++ 5.0 / OPC DataAccess 1.0/2.0
// Remarks:
//
/////////////////////////////////////////////////////////////////////////////
//
// Description: interface of the CGroup class.
// Encapsulation of group related methods.
//
//
/////////////////////////////////////////////////////////////////////////////
//
// History of Changes (Please remove very old comments and blank lines!)
// $Log: /IDK/OPCServer/clients/VC++/InfoServerExplorer/Group.h $
//
// 1 7/27/99 5:22p Imhof
//
// 1 7/27/99 5:18p Imhof
//
// 11 2/24/99 2:02p Imhof
// Added ValidateItem option and support
//
// 10 1/15/99 6:43p Imhof
// Updated legal notice.
//
// 9 12/14/98 4:46p Imhof
// Modifications for OPC 2.0
//
// 8 12/11/98 5:58p Imhof
// Made modifications for OPC 2.0.
//
// 7 11/12/98 2:39p Imhof
// Reenabled the remove item
//
// 6 11/10/98 2:20p Imhof
// Added file header's.
//
// $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_GROUP_H__451D47C6_2B19_11D2_AD89_00104B2C9D06__INCLUDED_)
#define AFX_GROUP_H__451D47C6_2B19_11D2_AD89_00104B2C9D06__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CItem;
class CInfoServer;
#include "base.h"
#include "item.h"
#include "infoserver.h"
#include <opcda.h>
/*
transaction const
can be any number, doesn't need to be type specific.
*/
const DWORD TRANSACTION_REFRESH = 6014; //returned in OnDataChange()
const DWORD TRANSACTION_READ = 6015; //returned in OnReadComplete()
const DWORD TRANSACTION_WRITE = 6000; //returned in OnWriteComplete()
const DWORD TRANSACTION_CANCEL = 6016; //returned in OnCancelComplete()
class CGroup : public CBase<IOPCGroupStateMgt>
{
public:
unsigned int GetItems(CArray<CItem*, CItem*>** items);
CGroup();
virtual ~CGroup();
BOOL AddItem();
BOOL ReCreateItemOnServer(CItem** item); //add group on server
BOOL RemoveItem(CItem** item);
BOOL RemoveItems(CArray<CItem*, CItem*>* remove_items);
BOOL Refresh(OPCDATASOURCE dwSource);
BOOL ReloadItems(); //reloads the items of a group from the server
DWORD GetUpdateRate();
void SetUpdateRate(DWORD dwUpdateRate);
long GetTimeBias();
void SetTimeBias(long lTimeBias);
float GetDeadBand();
void SetDeadBand(float fDeadBand);
LCID GetLCID();
void SetLCID(LCID lcid);
//OPC 2.0 data change
BOOL GetDataChangeEnabled(BOOL* bEnable, BOOL bReadFromServer = TRUE);
BOOL SetDataChangeEnabled(BOOL bEnable, BOOL bWriteToServer = TRUE);
BOOL Advise();
BOOL UnAdvise();
void SetOPCSTMFormatWriteCompleteConnection(DWORD dwConnection);
void SetOPCSTMFormatDataTimeConnection(DWORD dwConnection);
void SetOPCSTMFormatDataConnection(DWORD dwConnection);
DWORD GetOPCSTMFormatWriteCompleteConnection();
DWORD GetOPCSTMFormatDataTimeConnection();
DWORD GetOPCSTMFormatDataConnection();
//OPC 2.0 connection point
void SetOPCDataAccessConnectionPoint(DWORD dwConnection);
DWORD GetOPCDataAccessConnectionPoint();
CInfoServer* GetInfoServer();
void SetInfoServer(CInfoServer* pInfoServer);
BOOL Cancel(); //cancel an async operation
BOOL ReadItemsSync(OPCDATASOURCE dwSource, DWORD dwNumItems, OPCHANDLE* phServer);
BOOL ReadItemsAsync(OPCDATASOURCE dwSource, DWORD dwNumItems, OPCHANDLE* phServer);
BOOL CommandItemsSync(DWORD dwNumItems, OPCHANDLE* phServer, VARIANT* pItemValues);
BOOL CommandItemsAsync(DWORD dwNumItems, OPCHANDLE* phServer, VARIANT* pItemValues);
BOOL ValidateItems(DWORD dwNumItems, OPCITEMDEF* pItemArray);
//dynmaic transaction handling
void SetCurrentTransactionID(DWORD dwCurrentTransaction);
DWORD GetCurrentTransactionID();
void SetCurrentCancelID(DWORD dwCurrentCancelID);
DWORD GetCurrentCancelID();
BOOL CheckForOpenTransactions();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGroup)
public:
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
protected:
DECLARE_DYNCREATE(CGroup)
private:
CArray<CItem*, CItem*> m_Items;
//group parameters
DWORD m_dwUpdateRate;
long m_lTimeBias;
float m_fDeadBand;
LCID m_dwLCID;
//OPC 2.0 only
BOOL m_bDataChange;
//OLE connection key from advise
DWORD m_dwOPCSTMFormatWriteCompleteConnection; //OPCSTMFORMATWRITECOMPLETE
DWORD m_dwOPCSTMFormatDataTimeConnection; //OPCSTMFORMATDATATIME
DWORD m_dwOPCSTMFormatDataConnection; //OPCSTMFORMATDATA
//connection points connection point
DWORD m_dwOPCDataAccessConnectionPoint;
DWORD m_dwCurrentTransactionID; //if no transaction active then 0
DWORD m_dwCancelID; //if no transaction active then 0
CInfoServer* m_pInfoServer;
};
#endif // !defined(AFX_GROUP_H__451D47C6_2B19_11D2_AD89_00104B2C9D06__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -