WinTECH软件快速客户端开发DLL

基于订阅机制的OPC客户端通讯 基于订阅模式的OPC通讯---OPC终结篇一、前言二、订阅模式三、开发工具3.1实现数据交互的一般接口3.2实现订阅模式的接口四、总结 一、前言 这将是OPC通讯的终结篇, 二、订阅模式 三、开发工具 3.1实现数据交互的一般接口 3.2实现订阅模式的接口 3 四、总结 ... 阅读详情

WinTECH软件快速客户端开发DLL(WTclient),提供了一种应用API方便地将定制应用和任何OPC Server相结合的方式。所有COM和OPC的细节均由DLL来处理,这使得一个应用可以轻松的从服务器获取数据点,而不用关心接口后的实际完成过程。这些DLL可以方便和已有的或者新的应用相结合。其中提供了面向OPC1.0和OPC2.0数据访问标准所需的全部OPC接口,同时也提供了浏览接口和连接到简单警报/事件服务器的支持。
  The WinTECH Software Rapid Client Development DLL, (WTclient), provides an easy to use API for integrating a custom application with data from any OPC Server.  All the details of COM and OPC are handled by the DLL, which allows an application to easily obtain data points from a Server, without having to be concerned with the actual implementation of the underlying interfaces.  The DLL may be easily integrated with existing applications, or new ones.  All required OPC Interfaces are supported for both OPC 1.0 and OPC 2.0 Data Access Standards as well as the Browse Interface and support for connecting to a simple Alarms & Events Server.
  这个用户指导应该被当作一本OPC数据访问和OPC警报/事件规范手册文档使用,其中的所有资料都可在OPC主网站http://www.opcfoundation.org上找到。
  This user’s guide should be used as a companion document to the OPC Data Access and OPC Alarms & Events Specifications available from the OPC Foundation web-site at http://www.opcfoundation.org.
应用WTclient.dll创建自定制OPC客户端
将应用和WTclient.lib连接(Link WTclient.lib with the Application)  WTclient.lib内有DLL文件中API的出口定义,将这个文件包含到你的定制应用的工程文件中,同时将WTclientAPI.h包含到会调用DLL的模块中。如果应用Visual Basic进行编程,需要将VBA范例中(随demo提供)的module1.bas包含到你的工程中。
  WTclient.lib contains the export definitions for the DLL’s API.  Include this file with the project files for the custom application and include WTclientAPI.h with those modules which will be making calls into the DLL.  If programming in Visual Basic, include the module1.bas from the VBA_example, (supplied with the demo), into your project.
DCOM初始化(DCOM Initialization)  从WTClient.DLL2.0版本开始,初始化DCOM是客户端应用的责任了。2.0版本之前,WTClient.dll在DLLMain函数中执行DCOM和安全初始化的过程,并在dll下载时调用CoUninitialize函数。由于不同windows dll文件的加载顺序,这会带来一些问题。这些初始化调用被移动到了一个新的输出函数(WTclientCoInit())中,用户的应用可以在主要可执行线程启动的时候调用这个函数。WTclientCoInit()将DCOM初始化为多线程并使用默认安全设定。你的应用可以选择自行初始化DCOM替代这个输出函数。任何情况下,你的应用都必须在终止时调用CoUninitialize()函数。
  Beginning with WTClient.DLL Version 2.0, it is now the Client Application's responsibility to properly initialize DCOM.  Prior to Version 2.0, WTClient.dll performed DCOM and Security initialization in the DLLMain function and called CoUninitialize when the dll was unloaded.  This presented some problems due to the load-order of various Windows dll’s.  These initialization calls have been moved to a new exported function, (WTclientCoInit ()), that the user application can call during the startup of the main executable thread. WTclientCoInit () initializes DCOM as multi-threaded and uses default security.  Your application may choose to perform DCOM initialization itself rather than using the exported function.  In either case, your application MUST call CoUninitialize() when terminating.
获取OPC服务器列表(Obtaining the List of OPC Servers)  WTclient.dll有两个输出函数可以允许控制应用来通过其获取可用的OPC服务器列表。
  WTclient.dll exports two functions that allow the controlling application to obtain a list of available OPC Servers.
int NumberOfOPCServers (BOOL UseOPCENUM, LPCSTR MachineName);

  OPCENUM是由OPC Foundation提供的一个组件,它允许预期的客户端应用获取本地以及远程可用服务器列表。可惜的是,在写这个组件的时候,OCENUM的操作并没有很好的跨平台一致性。WTclient.dll允许应用尝试使用OPCENUM组件来获取服务器列表,或者越过OPCENUM组件通过扫描Windows登记的本地拷贝来获取列表。如果使用了OPCENUM,你可以通过传递远程机器的名称来获取远程服务器列表。
  OPCENUM is a component supplied by the OPC Foundation to allow prospective client applications to obtain a list of available servers on the local or remote machine.  Unfortunately, at the time of this writing, the operation of OPCENUM is not consistant across all platforms.  WTclient.dll allows the application to attempt to use the OPCENUM component to obtain the list of Servers, or to bypass OPCENUM and obtain the list by scanning the local copy of the Windows Registry.  If OPCENUM is used, you can pass the name of a remote machine to obtain the remote server list.
  一旦WTclietn.dll返回了服务器的数目,应用就可以通过调用如下所示的函数来对服务器名称列表进行枚举:
  Once the number of servers has been returned from WTclient.dll, the application can iterate through the list of names by calling:
BOOL GetServerName (int index, LPSTR Buffer, int BufSize);

  一个由用户提供的字符缓冲区Buffer负责存放传递过来的index标识的服务器列表中某个服务器名字。BufSize标识用户提供的字符缓冲区的长度,并可以防止dll载入过长的名字。如果Buffer中返回了一个有效的服务器名称,GetServerName函数返回TRUE。
  A user supplied character buffer receives a name from the Server list as identified by a passed index.  BufSize identifies the length of the user supplied character buffer and prevents the dll from loading a name that's too long.  GetServerName returns TRUE if a valid Server name is returned in Buffer, otherwise the return value is FALSE.
  还有一个补充函数集允许应用获取可用的警报/事件服务器列表。
  A complementary set of functions allow the application to obtain a list of available Alarms & Events Servers.
int NumberOfOPC_AEServers (LPCSTR MachineName);
BOOL GetOPC_AEServerName (int index, char *pBuf, int BufSize);

建立OPC连接(Establishing an OPC Connection)HANDLE ConnectOPC(LPCSTR MachineName, LPCSTR ServerName, BOOL EnableDLLBuffering);
HANDLE ConnectOPC1(LPCSTR MachineName, LPCSTR ServerName, BOOL EnableDLLBuffering);
HANDLE ConnectOPC_AE(LPCSTR MachineName, LPCSTR ServerName);

  如果一个由计算机名称和服务器名称定义的和OPC服务器之间的连接可以被建立,则此函数返回一个有效的HANDLE。可以建立和不同的服务器的多个同步连接,此时返回的HANDLE标识了可用于以后创建组和项目的连接。如果传递一个空字符串作为计算机名称参数,标识的是本地计算机。WTclient会先尝试使用OPC2.0连接点接口进行连接,如果不可用,则会转而采用OPC1.0数据对象接口。
  This function returns a valid HANDLE if a connection could be established to the OPC Server defined by MachineName and ServerName.  Multiple simultaneous connections to different servers may be established, and the returned HANDLE identifies the connection for future calls to create groups and items.  Passing a Null String as the MachineName parameter identifies the local machine.  WTclient will attempt the connection using the OPC 2.0 ConnectionPoint Interface.  If not available, it will revert the the OPC 1.0 DataObject Interface.
  WTclient.dll的基本操作有两种模式。第一种模式用于支持'C-样式'回调函数的应用,在这种情况下,dll中没有缓冲区操作。由于可以从连接的OPC服务器接收到数据更改提示,回调可用于将新的信息传送给控制应用(此处涉及到下面会提及的EnableOPCNotification函数)。
  WTclient.dll operates in basically two modes.  The first is used with those applications which support 'C-Style' callback functions.  In this case, no buffering is performed inside the dll.  As data change notifications are received from the connected OPC Server, callbacks are used to pass the new information to the controlling application, (refer to EnableOPCNotification below)
  对于使用不支持回调函数的工具设计的那些应用(例如Visual Basic 5.0),WTclient会被配置为维护一个由应用创建的全部OPC项目(标签)列表的模式。当服务器数据改变时,dll中列表里相关的标签值会被更新,控制应用可以随时读取标签的值(此处涉及到下面会提及的ReadOPCItem函数)。
  For those applications designed using tools which do not support callback functions, (such as Visual Basic 5.0), WTclient may be configured to maintain a list of all OPC Items, (Tags), created by the application.  As data from the Server changes, the corresponding tag value in the dll's list will be updated.  The controlling application may read the value of a tag at any time, (refer to ReadOPCItem below).
  ConnectOPC1会总是尝试使用OPC1.0连接。
  ConnectOPC1 will always attempt an OPC 1.0 connection. 
  ConnentOPC_AE会建立一个和OPC警报/事件服务器的连接,此连接由计算机名称和服务器名称指定。
  ConnectOPC_AE will establish a connection to the OPC Alarms & Events Server specified by MachineName and ServerName.
void DisconnectOPC(HANDLE hConnect);void DisconnectOPC_AE(HANDLE hConnect);

  当一个应用终止的时候,它会负责从依附的服务器断开连接。DisconnectOPC()(或Disconnect_OPCAE())函数会对hConnect定义的连接执行一个彻底的连接关闭操作。
  When an application terminates, it is responsible for disconnecting from an attached Server.  The DisconnectOPC(), (or Disconnect_OPCAE()), function will provide a clean shutdown of the connection defined by hConnect.
获取服务器标签名列表(Obtaining a list of Server Tag Names)int  NumberOfOPCItems(HANDLE hConnect);
BOOL  GetOPCItemName (HANDLE hConnect, int index, char *pBuf, int BufSize);

  这两个函数和获取服务器名称列表函数的调用方式类似。NumberOfOPCItems()返回所连接OPC服务器支持的独有标签总数。依次地调用GetOPCItemName()会逐步遍历所有可用的标签名,最终允许控制应用选择一个项目或者提交一个浏览列表给用户。NumberOfOPCItems()会浏览服务器的全部项目名称列表并提供一个“FLAT”格式的列表。
  These two functions operate similarly to those which allow you to obtain the list of Server names.  NumberOfOPCItems() returns the total number of unique tags supported by a connected OPC Server.  Incrementally calling GetOPCItemName will step through all the available tag names to allow the controlling application to select an item or present a Browse list to the user.  NumberOfOPCItems will browse the complete list of item names from the server and present the list in a 'FLAT' format.
BOOL GetNameSpace (HANDLE hConnect, WORD *pNameSpace);
BOOL BrowseTo (HANDLE hConnect, LPCSTR NodeName);
char SetWTclientQualifier (char qualifier);
int  BrowseItems (HANDLE hConnect, WORD Filter);

  为了提供较好的应用等级体系命名空间访问服务器的方式,WTClient dll提供函数以便于应用直接从服务器端浏览项目名。GetNameSpace()函数允许应用决定服务器的命名空间。BrowseTo()函数负责将当前浏览位置移动到指定的名称处,BrowseItems()函数用服务器的节点名称来填充内部名称列表。BrowseTo()函数既可以和OPC_LEAF一起使用来读取当前浏览位置的叶片名称,也可以和OPC_BRANCH一起使用来当前浏览位置的读取枝条名称。这些名称可以被GetOPCItemName函数获取。WtClient动态链接库为NumberOfOPCItems()函数和BrowseItems()函数维护一个单一的名称列表,因此应用程序在浏览服务器命名空间的时候必须很小心,避免覆盖前一次调用的值。在各个等级的树的相互作用过程中,调用BrowseItems之后,所有的项目名称必须立刻拷贝到本地存储中。
  To provide better access to a server with a hierarchical name space, the WTClient dll provides functions to allow the application to browse item names directly from the server.  GetNameSpace allows the application to determine the namespace of the server.  BrowseTo moves the current browse position to the name specified, and BrowseItems fills the internal name array with node names from the server.  BrowseTo may be used with either OPC_LEAF to read the leaf names or OPC_BRANCH to read the branch names immediately below the current browse position.  The names may then be retrieved using the GetOPCItemName function.  The WtClient DLL maintains a single name array for use by NumberOfOPCItems and BrowseItems so the application must be careful when browsing the server namespace, not to overwrite values from a previous call.   During iteraction of the hierarchical tree, the all item names must be copied into local storage immediately after calling BrowseItems.
  NumberOfOPCItems()函数相当于在根节点处用OPC_FLAT方式调用BrowseItems()函数。
  Calling BrowseItems from the Root position using OPC_FLAT behaves identically to NumberOfOPCItems().
  SetWTclientQualifier()函数允许应用程序改变用来解析各个等级命名空间节点的划界字符。客户端应用一般认为缺省的划界符为‘.’,然而也有些服务器将‘.’字符用在了节点名字中。
  SetWTclientQualifier allows the application to change the delimiting character used to parse the nodes of a hierarchical namespace.  The default delimiter expected by the client dll is ‘.’, however, some servers use the ‘.’ character as part of the node name.
BOOL  SetBrowseFilters (HANDLE hConnect, LPCSTR UserString, VARTYPE DataType, DWORD AccessType);

  应用程序可以设置浏览过滤器来影响服务器返回的OPC项目个数。应用程序可以选择仅获取那些符合指定数据类型或者访问权限的项目。
  Browse filters may be set by the application to effect the number of OPC Items returned from the server.The application may choose to retrieve only those items of a certain data type or access rights.
创建OPC组和标签(Creating OPC Groups and Tags)HANDLE  AddOPCGroup (HANDLE hConnect, LPCSTR Name, DWORD *pRate, float *pDeadBand);
void  RemoveOPCGroup (HANDLE hConnect, HANDLE hGroup);

  WTclient.dll提供两个函数,允许你创建、移除一个OPC组。AddOPCGroup()函数返回一个唯一指定某个组的指针,这个指针对于其他的Wtclient函数是必需的。传送给做AddOPCGroup()参数的值由控制应用端决定,对于每个组都是明确的。Name不会被服务器采用,可以任意选取。pRate是一个指针,指向对象为所需刷新率(单位为毫秒),服务器端用这个刷新率提供客户端刷新后的返回值。
  WTclient.dll exports two functions which allow you to create and remove an OPC Group.  The AddOPCGroup() function returns a handle to uniquely identify the group, and must be supplied to other Wtclient functions to reference tags, etc.  The values passed to AddOPCGroup as parameters are determined by the controlling application and are specific to each Group.  The name is arbitrary and not used by the Server.  pRate is a pointer to  the desired refresh rate, (in milliseconds), that the server uses to provide updates back to the client.  The actual rate is returned from the server in pRate.
BOOL  ChangeOPCGroupState (HANDLE hConnect, HANDLE hGroup, BOOL Active));

  应用这个函数可以将指定的OPC组设定为激活状态(Active = TRUE)或者无效状态(Active = FALSE)。
  The defined OPC Group may be activated, (Active = TRUE), or deactivated, (Active = FALSE), using this function.
HANDLE  AddOPCItem (HANDLE hConnect, HANDLE hGroup, LPCSTR ItemName);
void  RemoveOPCItem (HANDLE hConnect, HANDLE hGroup, HANDLE hItem);

  如果想要给指定的OPC组添加一个项目,只需使用组的指针以及待添加项目的标签名调用AddOPCItem函数即可,该函数会返回一个唯一标识指定项目的指针。如果请求的项目不存在,则函数将会返回INVALID_HANDLE_VALUE。当关闭一个组的时候,需要调用RemoveOPCItem()函数来清理已分配的内存。
  To add an item to a defined OPC Group, simply call the AddOPCItem function with the group's handle and the tag name of the desired item.  A handle value will be returned to uniquely define the item, INVALID_HANDLE_VALUE will be returned if the requested item does not exist).  Call RemoveOPCItem to clean-up allocated memory when closing a group.
BOOL  SetItemUpdateHandle (HANDLE hConnect,  HANDLE hGroup, HANDLE  hItem, HANDLE hUpdate);

  SetItemUpdateHandle()函数允许客户端应用定义一个独有的指针,供服务器在数据更新回调时使用。这个函数的提供是为了给客户端应用提供便利,以便于进行更有效率的程序设计,并可以对服务器提供的新数据进行操作。
  SetUpdateHandle allows the client application to specify a unique handle to be used by the server during Data Update Callbacks.  This function is provided as a convenience to the client application for more efficient design or handing new data presented by the server.
BOOL  GetOPCItemNameFromHandle (HANDLE hConnect,  HANDLE hGroup, HANDLE hItem,
                                                            char *pBuf, int BufSize);
 

  这个函数允许客户端应用通过传递AddOPCItem()函数返回的指针来获取OPC项目名。
  This function allows the client application to retrieve the OPC Item name by passing the handle returned from AddOPCItem.
BOOL  GetOPCItemType (HANDLE hConnect, HANDLE hGroup, LPCSTR ItemName, VARTYPE *pType,
                                        DWORD *pAccessRights);
 

  这个函数返回了指定项目的本地变量类型以及访问权限。
  This function returns the native variant type and access rights for the specified item.
int  NumberOfItemProperties (HANDLE hConnect, LPCSTR ItemName);
 

  这个函数返回了和指定标签相关的OPC项目属性数量。
  This function returns the number of OPC Item properties associated with the specified tag.
BOOL  GetItemPropertyDescription (HANDLE hConnect, int PropertyIndex, DWORD *pPropertyID,
                                                         VARTYPE *pVT, BYTE *pDescr, int BufSize);

  遍历NumberOfItemProperties()函数创建的列表,就可以获取每个项目属性的描述。
  A description of each item property may be obtained by iterating through the list created by NumberOfOPCItemProperties.
BOOL  ReadPropertyValue (HANDLE hConnect, LPCSTR Itemname, DWORD PropertyID, VARIANT *pValue);

  ReadPropertyValue()函数可以返回一个项目属性的当前值。
  The current value of an Item Property is returned by ReadItemProperty.
从服务器获取标签值更新(Getting updated Tag Values from the Server)BOOL  EnableOPCNotification (HANDLE hConnect, NOTIFYPROC lpCallback);

  如果你的应用支持回调,当连接的服务器发出了标签数据值改变的通知时,WTclient会提供回调操作。回调函数的原型定义如下:
  If your application supports callbacks, WTclient will issue the callback when notification from a connected Server indicates a change in the value of a Tag's data.  The prototype for the callback is defined as follows:
void CALLBACK EXPORT OPCUpdateCallback (HANDLE hGroup, HANDLE hItem, VARIANT *pVar,
                                                                       FILETIME timestamp, DWORD quality)

  由组指针和项目指针确定的标签的值、时间戳以及OPC品质标签都会在回调过程中提供给应用。
  The current value for a tag, timestamp and OPC Quality flags will be supplied to the application via the callback.  The Tag is identified by the associated handles identifying the group and item.
BOOL  ReadOPCItem (HANDLE hConnect, HANDLE hGroup, HANDLE hItem, VARIANT *pVar,
                                   FILETIME *pTimeStamp, DWORD *pQuality);

  如果WTclient已经配置为维护一个内部标签缓冲,控制应用可以使用ReadOPCItem函数读出当前标签的值。如果请求的项目不可用(或者没有选定DLL缓冲),函数会返回FALSE。
  If WTclient has been configured to maintain an internal buffer of tags, the controlling application may read the current value of a tag by using the ReadOPCItem function.  If the requested item is not available, (or if DLLBuffering has not been selected), the function will return FALSE.
HRESULT  ReadOPCItemFromDevice (HANDLE hConnect, HANDLE hGroup, HANDLE hItem, VARIANT *pVar,
                                                          FILETIME *pTimeStamp, DWORD *pQuality);

  这个函数执行了一个直接同步读取服务器端指定项目的操作。
  This function performs a synchronous read directly from the server for the specified item.
将标签值写入到服务器(Writing Tag Values to the Server)DWORD  WriteOPCItem (HANDLE hConnect, HANDLE hGroup, HANDLE hItem, VARIANT *pVar, BOOL DoAsync);

Writing new data to the connected Server is accomplished via the WriteOPCItem function.  The identifying handles for the group and item must be supplied as well as the data to be written.  The DoAsync parameter instructs the dll to perform an Asynchronous write to the Server.  For Synchronous writes, the return value indicates the hResult returned from the server and a non-zero value indicates an error.  For Asynchronous writes, the return value is a Transaction ID that defines the asynchronous callback handle and a zero value indicates an error.
其他函数和回调函数(Miscellaneous Functions and callbacks)BOOL  GetSvrStatus (HANDLE hConnect, OPCSERVERSTATUS *pSvrStatus, int VendorInforBufSize);

The current status of the identified server is returned in the supplied buffer.
BOOL  SetClientName (HANDLE hConnect, LPCSTR Name);This function allows the client to define a name to designate the connection with the server.
BOOL  EnableErrorNotification (ERRORPROCAPI  lpCallback);
The WTClient dll can notify the client application of errors that occur during processing of data interface calls to an OPC Server.  Error messages may be generated by the dll if unexpected situations occur during processing of a user request.  The default operation of the dll is to display a user message in a dialog box describing the condition.  In most cases, it is more appropriate for the application itself to handle the error message rather than having the dialog generated by the dll.  If Error Notification is enabled, control will be passed to the application via the following callback:
void CALLBACK EXPORT ErrorMsgCallback (DWORD hResult, char *pMsg);
A textual description of the error is contained in pMsg along with the resultant hResult.
BOOL  EnableClientEventMsgs (EVENTMSGPROC  lpCallback);

The WTClient dll can also notify the client application of various events as they occur during operation of the connection with the server.  These events are basically used for debugging and represent normal activity associated with processing individual interfaces, (such as entering and exiting a particular function).  Generally, the client application does not need to be made aware of theses events, however, if it wishes to provide a low level description of how the connection is functioning, it can receive these debugging statements as they occur by enabling Event Msgs.
void CALLBACK EXPORT EventMsgCallback (char *pMsg);
A textual description of the event is contained in pMsg.
BOOL  EnableShutdownNotification (HANDLE hConnect, SHUTDOWNPROCAPI  lpCallback);

If a connected OPC Server wishes to shutdown, it may request that any or all clients disconnect.  The Client application should enable the shutdown notification within the WTClient dll to handle this request and terminate the connection.
void CALLBACK EXPORT ShutdownCallback (HANDLE hConnect);

The hConnect parameter identifies the server connection that is requesting the disconnect.
创建警报/事件订阅机制(Creating an Alarms & Events Subscription)BOOL Create_AE_Subscription (HANDLE hConnect, HANDLE SubscriptionHandle,
                                                  DWORD *pBufferTime, DWORD *pMaxSize);
BOOL WINAPI EnableAECallback (AE_PROC lpCallback);
BOOL WINAPI EnableExtendedAECallback (AE_PROC_EX lpCallback);

To begin receiving alarm and event messages from the connected server, a subscription must be in initiated and a callback procedure defined.  The application passes a SubscriptionHandle that the server uses to identify the connection to the callback.  pBufferTime and pMaxSize refer to the requested update frequency and the maximum number of events to be exchanged at one time.  (Note:  These values are for efficiency purposes only.  If the standard callback is used, the WTClient DLL will set up the connection and callback to the server.  The DLL will always issue a single callback to the application per event message, regardless of how many event messages are in the server callback to the dll.  If the extended version of the callback is used, these parameters have the effect as described in the OPC A&E Specification with respect to the ONEVENTSTRUCT.)
One of two callback procedures may be defined, depending upon the complexity of the client application.  Teh standard callback procedure is prototyped as follows:
void CALLBACK EXPORT AECallback (HANDLE SubscriptionHandle, char *pSource,
                                                         FILETIME timestamp, char *pMsg, DWORD severity);

The SubscriptionHandle is the same as created by the subscription,  pSource identifies the source of the event and pMsg is the description.
If additional information regarding the alarm & event notification, the client must enable the extended version of the callback:
void CALLBACK EXPORT ExtendedAECallback (HANDLE SubscriptionHandle, BOOL bRefresh,
                                                                        BOOL bLastRefresh, DWORD dwCount,
                                                                        ONEVENTSTRUCT *pEvents);

Notice that the extended version of the A&E Callback contains the unfiltered parameter list as returned by the server OnEvent Interface, and may contain more than one event message.
A&E服务器直接调用接口(A&E Server Direct Interface Calls)The following functions are provided to allow the client application to call directly into the attached A&E Server.  The parameter list is passed directly to the associated Server Interface without change and the resulting returned values originate from the server itself.  The WTClient.dll does not modify these parameters in any way and their definition is described in the OPC Alarms & Events Specification available from the OPC Foundation.  Please refer to this specification for a detailed description of each of the following functions.
BOOL  GetAESvrStatus (HANDLE hConnect, OPCEVENTSERVERSTATUS *pSvrStatus,
                                      int VendorInforBufSize);

The current status of the identified server is returned in the supplied buffer.  
BOOL  Refresh_AE_Subscription (HANDLE hConnect, HANDLE hSubscription);

This function allows the client to request a refresh of the defined A&E subscription from the server.  
HRESULT  AckCondition (HANDLE hConnect, DWORD dwCount, LPWSTR szAcknowledgerID,
                                       LPWSTR szComment, LPWSTR *pszSource, LPWSTR *pszConditionName,
                                       FILETIME *pftActiveTime, DWORD *pdwCookie, HRESULT **ppErrors);

The client uses the AckCondition method to acknowledge one or more conditions in the Event Server.  The client receives event notifications from conditions via the IOPCEventSink::OnEvent callback.  This AckCondition method specifically acknowledges the condition becoming active or transitioning into a different sub-condition (and no other state transition of the condition).  One or more conditions belong to a specific event source – the source of the event notification.  For each condition-related event notification, the corresponding Source, Condition Name, Active Time and Cookie  is received by the client as part of the OnEvent callback parameters.  (Refer to the OPC Alarms & Events Specification for a detailed description of the parametr list and return value.)
HRESULT  EnableConditionByArea (HANDLE  hConnect, DWORD  dwNumAreas, LPWSTR *pszAreas);

Places all conditions for all sources within the specified process areas into the enabled state.  Therefore, the server will now generate condition-related events for these conditions. 
The effect of this method is global within the scope of the event server.  Therefore, if the server is supporting multiple clients, the conditions are enabled for all clients, and they will begin receiving the associated condition-related events. (Refer to the OPC Alarms & Events Specification for a detailed description of the parametr list and return value.)
HRESULT EnableConditionBySource (HANDLE  hConnect, DWORD  dwNumSources, LPWSTR *pszSources);

Places all conditions for the specified event sources into the enabled state.  Therefore, the server will now generate condition-related events for these conditions. 
The effect of this method is global within the scope of the event server.  Therefore, if the server is supporting multiple clients, the conditions are enabled for all clients, and they will begin receiving the associated condition-related events. (Refer to the OPC Alarms & Events Specification for a detailed description of the parametr list and return value.)
HRESULT DisableConditionByArea (HANDLE  hConnect, DWORD  dwNumAreas, LPWSTR  *pszAreas);

Places all conditions for all sources within the specified process areas into the disabled state.  Therefore, the server will now cease generating condition-related events for these conditions. 
The effect of this method is global within the scope of the event server.  Therefore, if the server is supporting multiple clients, the conditions are disabled for all clients, and they will stop receiving the associated condition-related events. (Refer to the OPC Alarms & Events Specification for a detailed description of the parametr list and return value.)
HRESULT DisableConditionBySource (HANDLE  hConnect, DWORD dwNumSources, LPWSTR  *pszSources);

Places all conditions for the specified event sources into the disabled state.  Therefore, the server will no longer generate condition-related events for these conditions. 
The effect of this method is global within the scope of the event server.  Therefore, if the server is supporting multiple clients, the conditions are disabled for all clients, and they will stop receiving the associated condition-related events. (Refer to the OPC Alarms & Events Specification for a detailed description of the parametr list and return value.)
HRESULT GetFilter  (HANDLE  hConnect, HANDLE  hSubscription, DWORD  *pdwEventType,
                               DWORD  *pdwNumCategories, DWORD  **ppdwEventCategories,
                               DWORD  *pdwLowSeverity, DWORD  *pdwHighSeverity, DWORD  *pdwNumAreas,
                               LPWSTR  **ppszAreaList, DWORD  *pdwNumSources, LPWSTR  **ppszSourceList);

Returns the filter currently in use for event subscriptions. (Refer to the OPC Alarms & Events Specification for a detailed description of the parametr list and return value.)
HRESULT SetFilter (HANDLE  hConnect, HANDLE hSubscription, DWORD dwEventType,
                              DWORD dwNumCategories, DWORD *pdwEventCategories, DWORD dwLowSeverity,
                              DWORD dwHighSeverity, DWORD dwNumAreas, LPWSTR *pszAreaList,
                              DWORD dwNumSources, LPWSTR *pszSourceList);

Sets the filtering criteria to be used for the event subscription.
Events may be selected using the following criteria:
• Type of event, i.e. simple, condition, or tracking.
• Event categories
• Lowest severity, i.e. all events with a severity greater than or equal to the specified severity.
• Highest severity, i.e. all events with a severity less than or equal to the specified severity.
• Process areas
• Event Sources
A list of values for a single criterion are logically ORed together (e.g. if two event categories are specified, event notifications for both categories will be received).  If multiple criteria are specified, they will be logically ANDed together, i.e. only those events satisfying all criteria will be selected.  An example is specifying both lowest severity and highest severity will result in the selection of events with severities lying between the two values.
An OPCEventSubscription object has only one filter.
 (Refer to the OPC Alarms & Events Specification for a detailed description of the parametr list and return value.)
MFC范例ClientTstThe clientTst application was designed to demonstrate how an OPC Client application may be assembled using the WTclient dll.  clientTst was built using MSDEV Version 6.0.  All project and resource files are contained in the distribution file ClientTst.zip.
This simple application uses the standard MFC framework, (Application/Document/View), architecture generated by the Microsoft development platform for a multiple-document interface.  In this example,
only one Server connection is allowed at a time.  Menu options allow you to select a server using the local Windows Registry.  Adding an OPC Group will generate a new Document which will enable additional menu items for creating and viewing tags from the server.
MFC范例ClientTst2The ClientTst2 MFC application was designed to demonstrate a different technique for browsing the server namespace.  It was also designed using MSDEV 6.0 and the MFC framework.  ClientTst2 displays event messages from the WTClient.DLL as well s the current value for each subscribed tag.
MFC范例AEClientThe AEClient MFC application was designed to demonstrate a simple Alarms & Events logger.  It establishes a connection to a specified server and displays alarm and event messages as they occur.

WinTECH -WTclient.dll C++/OPC客户端的工具库 WinTECH -WTclient.dll C++/OPC客户端的工具库,很好用的工具 立即下载

相关推荐

行业中大名鼎鼎的WINtech 的OPC Server

相当不错的OPC server例程,虽说不多还是很好的。里面有WTOPCServer.DLL 的。

2021 不会还有人不会uniapp吧[狗头]

UniAPP 快速入门学习 一、UniAPP 介绍 (1)什么是 UniAPP ? uni-app 是一个使用 Vue.js 开发所有前端应用的框架,开发者编写一套代码,可发布到 iOS、Android、H5,以及各种小程序(微信/支付宝/百度/头条/ QQ /钉钉)等多个平台,方便开发者快速交付,不需要转换开发思维,不需要更改开发习惯。 (2)为什么要选择 UniAPP ? 开发者/案例数量更多 几十万应用、uni 统计月活12亿、70+ 微信 / QQ群 平台能力不受限 在跨端的同时,

CS_DGD的博客 1973

带领新手快速开发Android App【视频+源码 完整版】

第1章 课程介绍与项目准备 第2章 工具类封装与首页引导页开发 第3章 用户注册 登录 忘记重置密码开发 第4章 个人数据编辑 快递及号码地查询开发 第5章 语音机器人聊天开发 第6章 微信精选文章查看开发 第7章 美女图片加载 裁剪 缩放开发 第8章 语音播报 短信提醒 下载更新开发 第9章 二维码扫描生成 百度地图定位及绘制开发 第10章 细节优化与项目总结 【源码project】

OPC DA客户端的三种实现方式

http://www.dqjsw.com.cn/dianqi/OPC/310.html OPC DA客户端的三种实现方式 时间:2009-09-30 来源:未知 编辑:电气自动化技术网 点击:301次 字体设置: 大 中 小 1  引言      OPC(OLE for Process Control)是一个工业标准,他是许多世界领先的自动化和软、硬件公司与微软公司合作的结晶。管理

gencheng的专栏 2万+

WinTECH -WTclient.dll (时间限制为99年)

WTclient.dll,是一个OPC客户端开发工具,收费的,大概900多美元。如果不授权,基本连接30分钟就要断开。先破解修改为时间限制为99年

wtclient资源

wtclient的相关资料lib,dll以及api说明文档,欢迎下载

OPC:客户端开发——应用WTclient.dll使用手册部分中文版

WinTECH软件快速客户端开发DLL(WTclient),提供了一种应用API方便地将定制应用和任何OPC Server相结合的方式。所有COM和OPC的细节均由DLL来处理,这使得一个应用可以轻松的从服务器获取数据点,而不用关心接口后的实际完成过程。 这些DLL可以方便和已有的或者新的应用相结合。其中提供了面向OPC1.0和OPC2.0数据访问标准所需的全部OPC接口,同时也提供了浏览接口和连...

dashumak的博客 2036

opc62541_exe.rar

qt+ open62541客户端exe,非源码~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OPC通讯开发——客户端开发工具WTopcclient说明手册部分翻译及个人补充

前言    经过多个月的开发、现场测试和反馈修改,自己开发的OPC客户端终于真正能在现场使用了。由于工业现场的服务器很古老,只支持OPCDA架构,我们也只能按照DA的标准设计客户端。由于有着WTopcclient这个相对好用的客户端开发工具,在开发方面花费的精力还好,可是却苦了现场的同学,在DCOM配置上花费了不少功夫╮(╯-╰)╭,在这里向他们表示最高的敬意。    言归正传,WTopcclient在使用中,我几乎找遍了整个百度,真正有用的除了人家在.h里函数声明处加的注释,就只剩下一个英文说明书了,除此

NCEPUautomation的博客 1868

腾控科技--软件手册.pdf

腾控科技--软件手册pdf,腾控科技--软件手册

WTClient_WTclient.dll_

opc da client开发,WTclient.lib,WTclient.dll

OPC服务器开发之WtOPCSvr——开发文档(1)

WTOPCSvr DLL User’s Guide The WinTECH Software Rapid Development DLL for OPC Servers, (WTOPCSvr), provides an easy to use API for integrating custom data with OPC. All the details of COM and O...

Mr.Sugarcane 2143

Mplus实战:如何用潜在类别分析(LCA)快速搞定心理学数据分类?

本文详细介绍了如何运用Mplus软件进行潜在类别分析(LCA),以快速处理心理学数据并识别内部异质性群体。文章从数据准备、Mplus语法编写、模型拟合与选择,到结果解读与高级应用(如纳入协变量),提供了完整的实战指南,帮助研究者从变量视角转向个体视角,有效挖掘数据中的潜在子类别。

weixin_28318011的博客 410

[关于OPC的研究2]配置 WinTech的server和client程序

1 OPC Server Example - Windows XP Setup 打开控制面板 - 性能与维护 - 管理工具 - 本地安全策略; 选择安全选项 - “网络访问:本地账户的共享和安全访问”,默认选择是“仅来宾 - 本地用户以来宾身份验证”,修改为“经典 - 本地用户以自己的身份验证”; 在server和client两个机器上都要设置该项; 2 OPC Server Ex

天堂向左 2202

MATLAB与STK互联23:卫星对象操作(14)—仿真分析案例1,建立8个地面站,分析对卫星的可见性

学习到这里,我们有必要做个仿真分析案例,把之前我们学习的零散知识点串起来,看一下在真实的分析中怎么应用。 分析要求:建立8个地面站,分析每个地面站对某个轨道高度500km、倾角60°圆轨道的卫星,1天内的可见次数、可见弧长以及可见弧段间隔列表。 基本约束:地面站仰角8°~90°,作用距离<2000km,太阳矢量与地面站到卫星视线夹角不小于15°,可见弧段应大于30s。地面站站址可随机生成,但要求在南北纬50°范围内。 下面上代码: uiap = actxserver(‘STK11.application’)

ltylty001的博客 7491

RocketMQ 为什么要自己做一个 NameServer ?RocketMQ 5.x 版本中的 proxy、controller 和 container 分别有什么用 ?

1.独立运行的分散结构 2.简化实现,容忍部分数据不一致 Proxy:多语言支持、简化开发 Controller: 提高 Broker 的性能 Container:提高资源利用率,平衡负载

xaiobit_hl的博客 1490

windows客户端开发--也许是一条不归路

如今的Windows客户端开发,已经被同行嘲笑为鸡肋,甚至有些人认识做Windows客户端就是一个笑柄。食之无味,弃之可惜。不可否认,PC端没落的很快。但是想说的是,任何一门技术都有存在的道理。微软就是所有Windows客户端开发人员的大腿,虽然这个大腿让人捉摸不定,主方向总是变化。换言之,Windows客户端开发难度不小。如果你能轻松的驾驭指针、内存、类等等,即使有一个Windows客户端彻底完蛋

一蓑烟雨任平生 也无风雨也无晴 1万+

从驱动编译到数据传输:RK3588与FPGA的PCIe通信实战解析

本文详细解析了RK3588与FPGA通过PCIe通信的实战过程,涵盖驱动编译、数据传输及性能优化等关键步骤。通过XDMA驱动实现高效DMA传输,适用于视频处理、数据采集等高性能场景,帮助开发者快速掌握嵌入式系统中的PCIe通信技术。

weixin_29214691的博客 526

教你如何用最新的技术快速开发一个完整的Android客户端

原文地址:教你如何用最新的技术快速开发一个完整的Android客户端 http://www.eoeandroid.com/thread-329505-1-1.html (出处: eoe 移动开发者论坛) 在开源社区混了很久,也贡献了几个小的demo,但一直没有一个完整的项目出来。这次开源了一个完整的Android项目,教你如何用最新的技术,最流行的开源库做出一个很棒的Androi

ckdroid的专栏 1054

松材线虫病害智能检测:基于YOLOv8的无人机航拍数据集构建与模型优化

本文探讨了基于YOLOv8的无人机航拍技术在松材线虫病害智能检测中的应用。通过构建高质量巡检数据集和优化模型架构(如RepVit主干网络和跨尺度特征融合模块),显著提升了病害识别准确率。该方案在复杂森林环境中表现出色,将检测效率提高数倍,为林业病害防控提供了高效解决方案。

vulkan6gpu的博客 995

RTCA DO-160G标准详解:航空电子设备的全面环境适应性测试指南

第二章的主要目的是提供标准中使用的术语和定义。了解这些术语对于准确理解标准的要求至关重要,特别是在技术实施过程中。RTCA DO-160G 涉及多个学科的知识,包括航空、电子、电磁学和机械工程,因此需要确保使用的术语在所有学科中具有一致的定义。为了确保测试人员和工程师在执行测试时对所有条件和要求的理解一致,RTCA DO-160G 标准中定义了大量术语。环境应力:指的是设备在操作过程中可能遇到的外部物理或化学条件,包括温度、湿度、振动等。电磁干扰(EMI)

qq_41854911的博客 5276
上一篇: Foxboro OPCServer AIM*OPC DA Server V3.3在AW51F/AW51D上的安装
下一篇: The FactorySoft OPC Server
PerfectToday
博客等级 码龄18年 46粉丝 129原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值