OPCDA.NET Reference Manual
OpcServer Class Members
See Also  Fields  Properties  Methods  Events Send Feedback
OpcDaNetUA.Net4 Assembly > OPCDA.NET Namespace : OpcServer Class


Glossary Item Box

The following tables list the members exposed by OpcServer.

Public Constructors

 NameDescription
Public ConstructorOpcServer Constructor Constructor  
Top

Public Fields

 NameDescription
Public FieldAuthenticationWindowsIntegrated Authentication mode selection. The default is false.  
Public FieldCertificateDomainMustMatch Determines if certificates with a non-matching domain are accepted.  
Public FieldPreferredEndpointWith UA option only.
Use this endpoint at connect if possible.  
Public FieldUaAccessWithoutSecurityPreferredWith UA option only.
Request to access the UA server with minimal security if true, otherwise with maximal. The default is false (maximal security).  
Top

Public Properties

 NameDescription
Public PropertyConnectThroughNIOSFALSE (default ): remote servers are connected so that no local server registration is needed. The remote server has to be browsed to find the required information. Some OPC V1 server do not register category information and may not browse correctly. Such servers cannot be connected this way.
TRUE: Remote servers are connected through the .Net COM Interop Services. The server needs to be registered locally for this to work. In-Process servers have to be connected this way.  
Public PropertyDeclareV2 Forces the wrapper to use OPC DA V2 functions to emulate OPC DA V3 methods where supported.  
Public PropertyErrorsAsExecptions The property determines the error handling. If TRUE then all errors throw an exception. If false then most error are indicated in the HRESULT function value. A few methods return a data result and always throw an exception on errors.  
Public PropertyHostInfo This read-only property holds the access information of the currently connected OPC server.  
Public PropertyisConnectedDA Indicates if the OPC DA server is connected  
Public PropertyKeepAliveEmulationThreadIntervalExecution interval in milliseconds of the KeepAlive emulation thread.
In each interval the thread makes a GetStatus server call and makes client callbacks as required for each activated group. The client has to call the OpcGroup.SetKeepAlive method for at least one group of an OPC DA V2 server for the KeepAlive emulation to be started.  
Public Propertystatic (Shared in Visual Basic)onNotifyUntrustedCertificate Handler that is called when the server certificate is untrusted.  
Public PropertyServerName This read-only property holds the name of the currently connected OPC server.  
Public Propertystatic (Shared in Visual Basic)UaAppConfigFileAutoCreate If not null then an application configuration file is created unless it already exists. The defined name is used as the appliction name.  
Public PropertyUaConfigFileName  
Public PropertyUaNamespaceURIsNamespaceURIs that match the NodeIDs persisted in the client application.
If the application doesn't set this property before Connect() then the URIs are tried to be loaded from the file app.url.XML in the same directory as the app.exe executable.
url is the UA server URL without the xxx://
This XML file is auto-generated at Connect() if the application didn't set this property.
The property can be set to an empty string array ( new string[]{} ) to disable the namespace wrapper feature.  
Public PropertyUaTraceMask  
Public PropertyuaWrapperWith UA option only.
UA wrapper instance. The applicaiton can use this link to access UA wrapper methods directly. The link is null for instancs of non-UA servers.  
Public Propertystatic (Shared in Visual Basic)Version This static read-only property holds the OPCDA.NET version number  
Top

Public Methods

 NameDescription
Public MethodAddBrowseTreeOverloaded.  creates a new BrowseTree class for convenient browsing of the servers item tree structure.  
Public MethodAddGroupOverloaded. Add a new group. ( IOPCServer::AddGroup )
The OPC parameters DeadBand and LocaleId are set to zero.
Error code returned, no exception thrown. Added in V2.1  
Public MethodAddRefreshGroupOverloaded. Create a RefreshGroup object.
The RefreshGroup class offers a set of functions for simplified asynchronuous server access. These methods are not defined in the OPC standard and the RefreshGroup class is actually a software layer above the OpcGroup class. It handles the OPC group management functions internally and allows a simple access to items by just specifiyng the item name. A data cache is maintained for all added or referenced items. This cache is updated from the OPC group data callback function. The user can always read up-to-date values from the cache but also can attach his own callback handler.  
Public MethodAddSyncIOGroupCreate a SyncIOGroup object.
The SyncIOGroup class offer a set of functions for simplified synchronuous read/write access to server items. These methods are not defined in the OPC standard and the SyncIOGroup class is actually a software layer above the OpcGroup class. It handles the OPC group management functions internally and allows a simple access to items by just specifiyng the item name.  
Public MethodBrowseThis OPC DA V3 method browses a single branch of the address space and returns zero or more OPCBROWSEELEMENT structures ( OPCDA V3, IOPCBrowse::Browse ).
In the OPCDA.NET Professional Edition this method is available also for OPCDA V2 servers. With OPCDA V2 servers the method is emulated by calling the available OPCDA V2 browse methods.

It is assumed that the underlying server address space is hierarchical. A flat space will always be presented to the client as not having children. A hierarchical space can be presented to the client as either not having children or having children. A hierarchical presentation of the server address space would behave much like a file system, where the directories are the branches or paths, and the files represent the leaves or items. For example, a server could present a control system by showing all the control networks, then all of the devices on a selected network, and then all of the classes of data within a device, then all of the data items of that class. A further breakdown into vendor specific ‘Units’ and ‘Lines’ might be appropriate for a BATCH system.
The browse position is initially set to the ‘root’ of the address space. On subsequent calls, the client may choose to browse from the continuation point. This browse can also be filtered by a vendor specific filter string. The itemID must be the value of ItemID returned with a BrowseElement from a previous call to browse or an empty string (used to indicate a top level browse). The ItemID is a fully qualified descriptor for the element that can be used for further browsing and as an item id if BrowseElement.IsItem is set. Note, that it is possible for a single element to be both an item and have children (e.g. complex data items). If the level specified ItemID is valid, but does not have any children, then the Browse will succeed, but the result will be a zero length BrowseElements array.
If the filter criteria result in an empty result, then the Browse will still succeed.  
Public MethodBrowseAccessPathsProvides a way to browse the available AccessPaths for an ITEM ID. ( IOPCBrowseServerAddressSpace:: BrowseAccessPaths )
Clients are allowed to get Access Path Enumerators for more than one item at a time. Changing the browse position will not affect any enumerator the client already has. AccessPath is the "how" for the server to get the data specified by the itemID (the what). The client uses this function to identify the possible access paths for the specified itemID.  
Public MethodBrowseCurrentBranchOverloaded. DEPRECIATED. Use one of the BrowseOPCItemIDs overloads instead.
ItemId browse method returning a string array instead of an enumerator. The OPC standard does not provide this method.  
Public MethodBrowseOPCItemIDsOverloaded. Returns a string[] with a list of ItemIDs/branches as determined by the passed parameters. The position from the which the browse is done can be set via ChangeBrowsePosition. ( IOPCBrowseServerAddressSpace:: BrowseOPCItemIDs )
The returned string array may be empty if no ItemIDs satisfied the filter constraints. The strings returned represent the BRANCHs and LEAFS contained in the current level. They do NOT include any delimiters or 'parent' names. (See GetItemID). Whenever possible the server should return strings which can be passed directly to AddItems. However, it is allowed for the Server to return a 'hint' string rather than an actual legal Item ID. For example a PLC with 32000 registers could return a single string of "0 to 31999" rather than return 32,000 individual strings from the enumerator. For this reason (as well as the fact that browser support is optional) clients should always be prepared to allow manual entry of ITEM ID strings. In the case of 'hint' strings, there is no indication given as to whether the returned string will be acceptable by AddItem or ValidateItem.  
Public MethodChangeBrowsePositionChange the current browse position. Move up, down or to in the hierarchical address space. ( IOPCBrowseServerAddressSpace:: ChangeBrowsePosition )
The function will return E_FAIL if called for a FLAT space. An error is returned if the passed string does not represent a 'branch'. Moving UP from the 'root' will return E_FAIL.
Note OPC_BROWSE_TO is new for version 2.0. Clients should be prepared to handle E_INVALIDARG if they pass this to a 1.0 server.  
Public MethodChangeUser Signal the server that the client has changed the user credentials of its proxy blanket.  
Public MethodConnectOverloaded. Connect to the named remote OPC Server.
An instance of the OPC COM server is created. The server is launched if it is not already running in the same user. If different applications access the same OPC server then you need to configure DCOM so that all applications launch the OPC server under the same user. Otherwise multiple instances of the OPC server are created.
The OpcEnum server browser is accessed on the remote machine to find the CLSID of the named OPC server.

The Disconnect method needs to be called to release the OPC server before the client program exits.  
Public MethodDisconnect Disconnect from the OPC server. The COM interface are released.  
Public MethodGetErrorStringReturn the description for the specified error. If any error occurs an OPCException is thrown.
The expected behavior is that this will include handling of Win32 errors as well (such as RPC errors).
Note that if this method is being called via DCOM then it is very possible that RPC or other network related errors will be returned. For this reason it is probably good practice for the client to attempt to call a local Win32 function such as FormatMessage if this function fails.  
Public MethodGetItemIDOverloaded.  Get the full item name of the specified name in the current branch. (IOPCBrowseServerAddressSpace::GetItemID ) If any error occurs an OPCException is thrown.  
Public MethodGetItemPropertiesReturn a list of the current data values for the passed ID codes. ( IOPCItemProperties::GetItemProperties )
NOTE: The paramters of this method differ from the OPC standard to make it more convenient to use.  
Public MethodGetLocaleID Get the current default LocalID. ( IOPCCommon::GetLocaleID )  
Public MethodGetPropertiesReturns the properties for a set of items. ( OPCDA V3, IOPCBrowse::GetProperties )
In the OPCDA.NET Professional Edition this method is available also for OPCDA V2 servers. With OPCDA V2 servers the method is emulated by calling the available OPCDA V2 item properties methods.

An OPCException is thrown if the OPC Server returns an error.  
Public MethodGetStandardProperties Read the OPC standard properties 1..6 for the specified items. This is a helper method that reads the items properties 1..6 using the OPC DA V2 GetItemProperties method. The properties are returned in an object with the proper data type for each property value.  
Public MethodGetStatusOverloaded. Get the current status of the OPC Server.
See OPC specs IOPCServer::GetStatus for details.  
Public MethodIsAvailableNT Query the current security configuration of the OPC server to determine if the current server configuration provides OPC Security by NT credentials.  
Public MethodIsAvailablePriv Query the current security configuration of the OPC server to determine if the current server configuration provides OPC Security by private credentials.  
Public MethodLogoff Remove the private credential established by the previous call to Logon(). OPC Security reverts to the state before the first call of Logon(), there are no private credentials active for the client.  
Public MethodLogon Changes the identity of the client application’s user. Future access to any security objects will be authorized with the new user’s credentials until a subsequent call to Logoff() or Logon(). For OPC Servers which also implement IOPCSecurityNT, access checking with NT credentials will be disabled until Logoff() is called.  
Public MethodLookupItemIDs Return a list of ITEMIDs (if available) for each of the passed ID codes. These indicate the ITEMID which could be added to an OPCGroup and used for more efficient access to the data corresponding to the Item Properties. ( IOPCItemProperties::LookupItemIDs ) NOTE: The paramters of this method differ from the OPC standard to make it more convenient to use.  
Public MethodQueryAvailableLocaleIDs Query the LocaleIDs supported by the OPC Server. ( IOPCCommon::QueryAvailableLocaleIDs ) If any error occurs a ThrowExceptionForHR is thrown.  
Public MethodQueryAvailableProperties Return a list of ID codes and descriptions for the available properties for this ITEMID. This list may differ for different ItemIDs. This list is expected to be relatively stable for a particular ItemID. That is, it could be affected from time to time by changes to the underlying system's configuration. ( IOPCItemProperties::QueryAvailableProperties )  
Public MethodQueryMinImpersonationLevel Information method to help a client to determine the minimal impersonation level the server requires to gain proper access to secured data sources.  
Public MethodQueryOrganizationQuery the server organization, flat or hierarchical. ( IOPCBrowseServerAddressSpace:: QueryOrganization )
Provides a way to determine if the underlying system is inherently flat or hierarchical and how the server may represent the information of the address space to the client.
FLAT and HIERARCHICAL spaces behave somewhat different. If the result is 'FLAT' then the client knows that there is no need to pass the BRANCH or LEAF flags to BrowseOPCItemIDs or to call ChangeBrowsePosition.  
Public MethodReadOverloaded. OPCDA V3. Reads a group of items with all the same maxAge
The purpose of this OPC V3 method is to provide an extremely easy way for simple applications to obtain OPC data. Programmers should be aware that in most servers, the design of the Group based OPC interfaces will provide much better performance than this method. In terms of performance, the user of this method should assume that it will behave as if he were to create a group, add the items, perform a single read or write and then delete the group.  
Public MethodRemoveGroupThe specified OPC server group is removed. This method is the same as the RemoveGroup method in the group class and usually the group class method is used. The RemoveGroup is available in the server class because the OPC specification defines it in the server interface.
The RemoveGroup method differs from IOPCServer::RemoveGroup by having a GroupObject reference parameter instead of the OPC server group handle.
 
Public MethodSetClientNameDefine a client name. ( IOPCCommon::SetClientName )
Allows the client to optionally register a client name with the server. This is included primarily for debugging purposes. The recommended behavior is that the client set his Node name and EXE name here.  
Public MethodSetLocaleID Set the default LocaleId for this session. ( IOPCCommon::SetLocaleID )  
Public MethodShowBrowseTree Create a new BrowseTree class for convenient browsing and display of the server's item tree structure.  
Public MethodShowBrowseTreeList Create a new BrowseTreeList class for convenient browsing and display of the servers item tree structure with the branches in a TreeView control and the items of each branch in a ListView control. An empty ShowBrowseTreeList object is created and the default BrowseTree ImageList is assigned to the TreeView and ListView control. The browse mode is set to BrowseModeOneLevel=true.  
Public MethodShutdownRTLogging DeltaV specific fature to control DeltaV server logging  
Public MethodWriteOPCDA V3. Writes a group of items.
The purpose of this OPC V3 method is to provide an extremely easy way for simple applications to write OPC data. Programmers should be aware that in most servers, the design of the Group based OPC interfaces will provide much better performance than this method. In terms of performance, the user of this method should assume that it will behave as if he were to create a group, add the items, perform a single Write or write and then delete the group.  
Public MethodWriteUaLog  
Top

Protected Methods

 NameDescription
Protected MethodFinalize  
Top

Public Events

 NameDescription
Public EventShutdownRequested ShutdownRequestEventHandler  
Public EventUaTraceNotification UA Trace Notifcation  
Top

See Also

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