uaPLUS Reference
GenericServer Class Members
See Also  Fields  Methods  Send Feedback
NSPlugin Namespace : GenericServer Class


Glossary Item Box

The following tables list the members exposed by GenericServer.

Public Constructors

 NameDescription
Public ConstructorGenericServer Constructor  
Top

Public Fields

 NameDescription
Public Fieldstatic (Shared in Visual Basic)Config  
Public FieldonAddMethod Handler in the UA generic server that adds a method definition.  
Top

Public Methods

 NameDescription
Public Methodstatic (Shared in Visual Basic)AddItem

Generic server callback method.

Add an item in the generic server cache.
This method is typically called during the execution of the CreateServerItems or ValidateItems methods, but it can be called anytime an item needs to be added to the generic server cache.

Item that are added to the generic server cache can be accessed from the OPC clients.

 
Public MethodBrowse

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.

 
Public MethodBrowseChangePosition

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.
This method has to be implemented accordint the OPC DA V2 specification.

 
Public MethodBrowseGetFullItemID

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.

 
Public MethodBrowseItemIDs

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.

 
Public MethodCreateServerItems

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 generic server part creates an approriate hierachical address space. The sample code defines the application item handle as the the buffer array index. This handle is passed in the calls from the generic server to identify the item. It should allow quick access to the item definition / buffer. The handle may be implemented differently depending on the application.

The branch separator character used in the fully qualified item name must match the separator character defined in the GetServerParameters method.

 
Public MethodDefineCallbackAddMethod Defines the method that can be called to add a UA Method definition.  
Public MethodDefineCallbacks

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.

 
Public MethodDefineCallbacks2

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.

 
Public Methodstatic (Shared in Visual Basic)DeleteItemGeneric 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.  
Public MethodGetAEServerRegistryDefRegistration 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.
This method does typically not have to be changed. The wizard generated the GUIDs for this server and inserts the server names as defined in the wizard dialog.

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.
The definitions can be made in the code to prevent them from being changed without a recompilation.

 
Public Methodstatic (Shared in Visual Basic)GetItemInfo

Generic server callback method. Supported in the Professional version only.

Get information about the specified item from the generic server cache.

 
Public MethodGetItemProperties

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.

 
Public MethodGetModeDefinitions

Optional method. Called from DANSrv/uaPLUS Professional Edition generic server only.
Get working mode definitions for the generic server.
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 in XML DA servers.

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.

 
Public MethodGetPropertyValue 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.  
Public Methodstatic (Shared in Visual Basic)GetRefreshNeed

Generic server callback method.

Get a list of items that currently need beeing refresh, from the generic server.

A refresh is needed when:
- the timestamp is older then the maxAge argument
- Professional version only:
- the item is used by at least on client and the timestamp is older then the item defined maxAge. The item maxAge is the client defined sampling rate, if defined, otherwise the plug-in defined sampling rate is used. If this is undefined also then the maxAge argument is used.

 
Public Methodstatic (Shared in Visual Basic)GetServerInfo

Generic server callback method. Supported in the Professional version only.

Get information about the current server status.

 
Public Methodstatic (Shared in Visual Basic)GetServerInstanceInfoGeneric 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.  
Public MethodGetServerParameters

This method is called from the generic server at startup, when the first client connects.
It defines the application specific server parameters and operating modes.
The default implementation in IGeneric.cs initializes default values and tries to read the configuration definitions from the file DANSrv.exe.config respectively web.config for XML DA servers.

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.

 
Public MethodGetServerRegistryDef

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.
This method does typically not have to be changed. The wizard generated the GUIDs for this server and inserts the server names as defined in the wizard dialog.

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.
The definitions can be made in the code to prevent them from being changed without a recompilation.

 
Public MethodLookupItemIDAdded 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.  
Public MethodQueryProperties Query the properties defined for the specified item  
Public MethodRefreshItems

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
For OPC DA V2 read from device calls the method is called with all client requested items. In OPCDA V3 / XMLDA read calls the method is called only with the handles of the items that are currently in the cache older than maxAge.

 
Public MethodServerInstancesChangeThis 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.  
Public Methodstatic (Shared in Visual Basic)SetItemValue

Generic server callback method.

Write an item value into the cache.

 
Public Methodstatic (Shared in Visual Basic)SetServerState

Generic server callback method.

Set the OPC server state value, that is returned in client GetStatus calls.

 
Public Methodstatic (Shared in Visual Basic)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.

 
Public MethodShutdownSignalThis 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.  
Public MethodValidateItemsOverloaded. 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  
Public MethodWriteItemsOverloaded. 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.  
Top

See Also

© 2010-2018 Copyright Advosol Inc. All Rights Reserved.