The following tables list the members exposed by GenericServer.
Name | Description | |
---|---|---|
GenericServer Constructor |
Name | Description | |
---|---|---|
Config | ||
onAddMethod | Handler in the UA generic server that adds a method definition. |
Name | Description | |
---|---|---|
AddItem | Generic server callback method. Add an item in the generic server cache. Item that are added to the generic server cache can be accessed from the OPC clients. | |
Browse | Virtual mode browse handling. Called only from the Professional edition generic server.
OPC DA V3 Browse method to browse the specified branch. This method is called when the server is configured for virtual mode browsing and a client calls the OPC DA V3 browse function. This method handles only the item browsing part of the OPC DA browse function. The GetItemProperties method is called to get the item's properties information. | |
BrowseChangePosition | Virtual mode browse handling. Called only from the Professional edition generic server when BrowseMode VIRTUAL is configured. Change the current browse branch to the specified branch in virtual address space. | |
BrowseGetFullItemID | Virtual mode browse handling. Called only from the Professional edition generic server when BrowseMode VIRTUAL is configured. This method returns the fully qualified name of the specified item in the current branch in the virtual address space. This name is used to add the item to the real address space. This method has to be implemented according the OPC DA V2 specification. | |
BrowseItemIDs | Virtual mode browse handling. Called only from the Professional edition generic server when BrowseMode VIRTUAL is configured. This method browses the items in the current branch of the virtual address space. It has to be implemented according the OPC DA V2 specification. | |
CreateServerItems | This method is called from the generic server at the startup, when the first client connects. All items supported by the server need to be defined by calling the AddItem callback method for each item. The Item IDs are fully qualified names ( e.g. Dev1.Chn5.Temp ) The branch separator character used in the fully qualified item name must match the separator character defined in the GetServerParameters method. | |
DefineCallbackAddMethod | Defines the method that can be called to add a UA Method definition. | |
DefineCallbacks | This method is called from the generic server at startup. It passes the callback methods supported by the generic server. These callback methods can be called anytime to exchange data with the generic server. The DefineCallbacks method must not be overloaded or changed. The default implementation stores the delegates for later callbacks. | |
DefineCallbacks2 | This method is called from the professional edition generic server V5.1 an newer at startup. It passes an additional callback methods supported by the professional edition generic server. The callback method can be called anytime to exchange data with the generic server. The DefineCallbacks2 method must not be overloaded or changed. The default implementation stores the delegates for later callbacks. | |
DeleteItem | Generic server callback method. Supported only by the Professional Edition generic server V5.1 or newer. The specified item is deleted in the generic server cache. Only items that are not currently referenced by any client (not added to a group by a client) can be deleted. | |
GetAEServerRegistryDef | Registration definitions for the Alarm/Event Server Option. This method is called from the generic server at startup for normal operation or for registration. It provides server registry information for this application required for DCOM registration. The DANSrv registers the OPC server accordingly. The XDARap XML DA server ignores most of the registration information. The default implementation in IGeneric.cs/vb initializes default values and tries to read the configuration definitions from the file DANSrv.exe.config respectively web.config for XML DA servers. The method can be replaced by defining an overload in ServerAdapt.cs/vb. | |
GetItemInfo | Generic server callback method. Supported in the Professional version only. Get information about the specified item from the generic server cache. | |
GetItemProperties | Virtual mode browse handling. Called only from the Professional edition generic server. Returns the the values of the requested properties for one item. This method is called in virtual browse mode for items that are not yet added to the generic cache. | |
GetModeDefinitions | Optional method. Called from DANSrv/uaPLUS Professional Edition generic server only. The default method can be replaced by defining an overload in ServerAdapt.cs/vb. The definitions can be made in the code to prevent them from being changed without a recompilation. | |
GetPropertyValue | Returns the values of the requested custom properties of the requested item. This method is not called for the OPC standard properties 1..6. These are handled in the generic server. | |
GetRefreshNeed | Generic server callback method. Get a list of items that currently need beeing refresh, from the generic server.
A refresh is needed when: | |
GetServerInfo | Generic server callback method. Supported in the Professional version only. Get information about the current server status. | |
GetServerInstanceInfo | Generic server callback method. Supported only by the Professional Edition generic server V5.1 or newer. Get information about all DA server instances / UA server sessions or the requested server instance/session only. This information may be used to identify the client application, especially when the client application. DA client may have to define a name using the SetClientName OPC method. Be aware that for DA clients the client name cannot yet be defined during the instance creation (ServerInstancesChange call for creation). The client application has to call SetClientName() to define the name. The client handle is passed as an argument to the plugin methods ValidateItems and WriteItems to enable the server to allow/deny the access based on the instance information. The NSPlugin code can use the handle to retrieve ServerInstanceInfo and possibly reject a request based on the client credentials. | |
GetServerParameters | This method is called from the generic server at startup, when the first client connects. The default method can be replaced by defining a method overload in ServerAdapt.cs. The definitions can be made in the code to protect them from being changed without a recompilation. | |
GetServerRegistryDef | This method is called from the generic server at startup for normal operation or for registration. It provides server registry information for this application required for DCOM registration. The DANSrv registers the OPC server accordingly. The XDARap XML DA server ignores most of the registration information. The default implementation in IGeneric.cs/vb initializes default values and tries to read the configuration definitions from the file DANSrv.exe.config respectively web.config for XML DA servers. The method can be replaced by defining an overload in ServerAdapt.cs/vb. | |
LookupItemID | Added in DANSrv V6.0 This method is called by the generic server only when LookupMode is defined as 'PluginHandled'. If the request is invalid the method returns null. Otherwise, it creates a unique name for the property item creates the property item by calling the generic server method AddItem(). The plug-in must update the cache value of this item by calling the SetItemValue() method whenever the property value changes. | |
QueryProperties | Query the properties defined for the specified item | |
RefreshItems | Refresh the items listed in the appHandles array in the cache. This method is called when a client executes a read from device or a read with maxAge argument | |
ServerInstancesChange | This method is called when: a) A client connects and therefore a new server instance has to be created. If the method returns an error code then no instance is created and the client connect is failed. b) A server instance is terminating (a client disconnects). This method cannot prevent this. The call is to inform the plugin of the status change. For a server with DA/AE functionality the configuration should define a different CLSID/ProID for DA and AE if application needs to supervise the instance creation. With the same CLSID for DA and AE on client connect an instance of each server type (DA and AE) is created and this method is called for each instance. At instance creation time it's not known what functionality the client is going to use. | |
SetItemValue | Generic server callback method. Write an item value into the cache. | |
SetServerState | Generic server callback method. Set the OPC server state value, that is returned in client GetStatus calls. | |
ShutDownRequest | Generic server callback method. Request the server to shutdown. Supported in the Professional version only. The server application terminates without returning. The plugin needs to terminate all threads and release all resources before this method is called. The generic server notifies all clients and then terminates the application. | |
ShutdownSignal | This method is called from the generic server when a Shutdown is executed. To ensure proper process shutdown, any communication channels should be closed and all threads terminated before this method returns. | |
ValidateItems | Overloaded. Only the Professional Edition generic server calls this method. DEPRECIATED! This overload is is only called if the overload with the instanceHandle argument is not defined. In new applications implement the method overload with the instanceHandle parameter. This method is called when the client accesses items that do not yet exist in the server's cache. OPC DA V2 clients typically first call AddItems() or ValidateItems(). OPC DA V3 client may access items directly using the ItemIO read/write functions. In XML DA the calls directly specify the item ID. If ValidateMode 'ALWAYS' is configured then the method is called for each client call, even if the item exists in the server cache. The access can be denied for a specific client by returning an error code in err[] for such items. This module can: - add the item to the servers real address space and return success. For each item to be added the callback method 'AddItem' has to be called. - return error for all or some items | |
WriteItems | Overloaded. Standard Edition Write handler. In the Professional Edition this overload is is only called if the method with the client handle argument is not defined. This method is called when a client executes a 'write' server call. The items specified in the appHandles array need to be written to the device. The cache update handling depends on the configuration parameter writeCacheUpdateMode For 0 (Generic): The cache is updated in the generic server after returning from the customization WiteItems method. Items with write error are not updated in the cache. For 1 (Custom): The customization module needs to update the cache by executing the SetItemValue callback method for each written item. The generic server does not update the cache. |