DANSrv Reference
AppPlugin Class Members
See Also  Fields  Methods  Send Feedback
NSPluginNet4 Assembly > NSPlugin Namespace : AppPlugin Class


Glossary Item Box

The following tables list the members exposed by AppPlugin.

Public Constructors

 NameDescription
Public ConstructorAppPlugin Constructor  
Top

Public Fields

 NameDescription
Public FieldonAddMethod Handler in the UA generic server that adds a method definition. (Inherited from NSPlugin.GenericServer)
Top

Public Methods

 NameDescription
Public MethodBrowse

Virtual mode browse handling.

Called only from the Professional edition generic server when BrowseMode VIRTUAL is configured in the GetServerParameters() implementation.

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 in the GetServerParameters() implementation.

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 in the GetServerParameters() implementation.

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 in the GetServerParameters() implementation.

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. (Inherited from NSPlugin.GenericServer)
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.

(Inherited from NSPlugin.GenericServer)
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.

(Inherited from NSPlugin.GenericServer)
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.

The definitions for the DA server are used if the empty strings ("") are defined.
Note: 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. If the application uses the ServerInstancesChange method to supervise the instance creation/destruction it's better to define a different CLSID/ProgID for DA and AE.

(Inherited from NSPlugin.GenericServer)
Public MethodGetItemProperties

Virtual mode browse handling.

Called only from the Professional edition generic server when BrowseMode VIRTUAL is configured in the GetServerParameters() implementation.

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/XDARap 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 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/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 default method can be replaced by defining a method overload in ServerAdapt.cs/vb. 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 XDASrv 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 MethodGetVersion  
Public MethodLogEvent  
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 custom item properties defined for the specified item. The OPC standard properties 1..6 should not be included. They are handled in the generic server.  
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 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. DEPRECIATED! This overload is is only called if the overload with the client handle argument is not defined. 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.
When this method is called depends on the ValidateMode set in the GetServerParameters() implementation.
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. DEPRECIATED! This overload is is only called if the overload 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 writeCacheUpdateMode selection set in the GetModeDefinitions() implementation.
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

© 2002-2017 Copyright Advosol Inc. All Rights Reserved.