Main Content

serveritems

(To be removed) Query server or name space for fully qualified item IDs

Support for the OPC Data Access (DA) standard will be removed in a future release. Instead use OPC Unified Architecture (UA). See Version History.

Syntax

FQID = serveritems(DAObj,ItemID)
FQID = serveritems(DAObj)
FQID = serveritems(DAObj, 'Filter1',Val1,'Filter2',Val2, ...)
FQID = serveritems(NS)
FQID = serveritems(NS,ItemID)

Description

FQID = serveritems(DAObj,ItemID) returns a cell array of all fully qualified item IDs matching ItemID that are found on the OPC server defined by DAObj. DAObj must be a connected opcda object. ItemID is a partial character vector or string to search for, and can contain the wildcard character '*'. FQID is a character vector or cell array of character vectors. You can use FQID in a call to additem to construct daitem objects.

FQID = serveritems(DAObj) returns all fully qualified item IDs on the OPC server associated with DAObj.

FQID = serveritems(DAObj, 'Filter1',Val1,'Filter2',Val2, ...) allows you to filter the retrieved name space based on a number of available browse filters. Available filters are described in the following table:

Browse Filter

Description

'StartItemID'

Specify the FullyQualifiedID of a branch node, as a character vector or string. Only nodes contained in that branch node will be returned. Some OPC servers do not support partial name space retrieval based on this option: An error is generated if you attempt to use the 'StartItemID' browse filter on such a server.

'Depth'

Specify the depth of the name space that you want returned. A 'Depth' value of 1 returns only the nodes contained in the starting position. A 'Depth' value of 2 returns the nodes contained in the starting position and all of their nodes. A 'Depth' value of Inf returns all nodes.

'AccessRights'

Restricts the search to leaf nodes with particular access right characteristics. Specify 'read' to return nodes that include the read access right, and 'write' to return nodes that include the write access right. An empty character vector ('') returns nodes with any access rights.

'DataType'

Restricts the search to nodes with a particular canonical data type. Valid data types are 'double', 'single', 'int8', 'int16', 'int32', 'uint8', 'uint16', 'uint32', 'logical', 'currency', and 'date'. Use the 'DataType' filter to find server items with a specific data type, such as 'double' or 'date'.

FQID = serveritems(NS) and FQID = serveritems(NS,ItemID) search the name space structure defined by NS, rather than querying the OPC server. NS is the result of a call to getnamespace in either hierarchical or flat format.

Note that some servers may return item IDs that cannot be created on that server. These item IDs are usually branches of the OPC server name space.

You use the results of a call to serveritems in a call to serveritemprops to return the property information for items in the OPC server name space. The properties of the items in the server name space include the server item's canonical data type, limits, description, current value, etc.

Examples

Create a client for the Matrikon™ Simulation Server and connect to the server:

da = opcda('localhost', 'Matrikon.OPC.Simulation');connect(da);

Find all item IDs in the Matrikon Server containing the word 'Real':

realItmIDs = serveritems(da, '*Real*');

Add all items in the Random node to a group:

grp = addgroup(da, 'ServerItemsEx');
itm = additem(grp, serveritems(da, 'Random.*'));

Version History

Introduced before R2006a

expand all