Skip to content

Matlab API General Functions

Connect\Disconnect

connect

ziDAQ('connect', [host = '127.0.0.1'], [port = 8005], [apiLevel = 1]);

[host] = Server host string (default is localhost)
[port] = Port number (double)
         Use port 8005 to connect to the HF2 Data Server
         Use port 8004 to connect to the MF or UHF Data Server
[apiLevel] = Compatibility mode of the API interface (int64)
         Use API level 1 to use code written for HF2.
         Higher API levels are currently only supported
         for MF and UHF devices. To get full functionality for
         MF and UHF devices use API level 5.
To disconnect use 'clear ziDAQ'

connectDevice

ziDAQ('connectDevice', device, interface);

device (string) = Device serial to connect (e.g. 'DEV2000')
interface (string) = Interface, e.g., 'USB', '1GbE'.
Connect with the data server to a specified device over the
specified interface. The device must be visible to the server.
If the device is already connected the call will be ignored.
The function will block until the device is connected and
the device is ready to use. This method is useful for UHF
devices offering several communication interfaces.

disconnectDevice

ziDAQ('disconnectDevice', device);

device (string) = Device serial of device to disconnect.
This function will return immediately. The disconnection of
the device may not yet finished.

Node Info

listNodes

result = ziDAQ('listNodes', path, flags);

path (string) = Node path or partial path, e.g.,
         '/dev100/demods/'.
flags (int64) = Define which nodes should be returned, set the
        following bits to obtain the described behavior:
        int64(0) -> ZI_LIST_NODES_ALL 0x00
          The default flag, returning a simple
          listing of the given node
        int64(1) -> ZI_LIST_NODES_RECURSIVE 0x01
          Returns the nodes recursively
        int64(2) -> ZI_LIST_NODES_ABSOLUTE 0x02
          Returns absolute paths
        int64(4) -> ZI_LIST_NODES_LEAVESONLY 0x04
          Returns only nodes that are leaves,
          which means the they are at the
          outermost level of the tree.
        int64(8) -> ZI_LIST_NODES_SETTINGSONLY 0x08
          Returns only nodes which are marked
          as setting
        int64(16) -> ZI_LIST_NODES_STREAMINGONLY 0x10
          Returns only streaming nodes
        int64(32) -> ZI_LIST_NODES_SUBSCRIBEDONLY 0x20
          Returns only subscribed nodes
Returns a list of nodes with description found at the specified
path. Flags may also be combined, e.g., set flags to bitor(1, 2)
to return paths recursively and printed as absolute paths.

listNodesJSON

result = ziDAQ('listNodesJSON', path, flags);

path (string) = Node path or partial path, e.g.,
         '/dev100/demods/'.
flags (int64) = Define which nodes should be returned, set the
        following bits to obtain the described behavior.
        They are the same as for listNodes(), except that
        0x01, 0x02 and 0x04 are enforced:
        int64(8) -> ZI_LIST_NODES_SETTINGSONLY 0x08
          Returns only nodes which are marked
          as setting
        int64(16) -> ZI_LIST_NODES_STREAMINGONLY 0x10
          Returns only streaming nodes
        int64(32) -> ZI_LIST_NODES_SUBSCRIBEDONLY 0x20
          Returns only subscribed nodes
        int64(64) -> ZI_LIST_NODES_BASECHANNEL 0x40
          Return only one instance of a node in case of multiple
          channels
        int64(128) -> ZI_LIST_NODES_GETONLY 0x80
          Return only nodes which can be used with the get
          command
Returns a list of nodes with description found at the specified
path as a JSON formatted string. HF2 devices do not support
this functionality. Flags may also be combined, e.g., set flags
to bitor(1, 2) to return paths recursively and printed as
absolute paths.

help

result = ziDAQ('help', path);

path (string) = Node path or partial path, e.g.,
         '/dev100/demods/'.
Returns a formatted description of the nodes in the supplied path.
Only UHF and MF devices support this functionality.

Info

version

ziDAQ('version');

Returns the version of the API.

revision

ziDAQ('revision');

Returns the revision of the API.

commitHash

ziDAQ('commitHash');

Returns a unique key that identifies the source
code used to build the API.  

getConnectionAPILevel

result = ziDAQ('getConnectionAPILevel');

Returns ziAPI level used for the active connection.

Logging

setDebugLevel

ziDAQ('setDebugLevel', debuglevel);

debuglevel (int) = Debug level (trace:0, debug:1, info:2,
status:3, warning:4, error:5, fatal:6).
Enables debug log and sets the debug level.

writeDebugLog

ziDAQ('writeDebugLog', severity, message);

severity (int) = Severity (trace:0, debug:1, info:2, status:3,
warning:4, error:5, fatal:6).
message (str) = Message to output to the log.
Outputs message to the debug log (if enabled).

logOn

ziDAQ('logOn', flags, filename, [style]);

flags = LOG_NONE:             0x00000000
        LOG_SET_DOUBLE:       0x00000001
        LOG_SET_INT:          0x00000002
        LOG_SET_BYTE:         0x00000004
        LOG_SET_STRING:       0x00000008
        LOG_SYNC_SET_DOUBLE:  0x00000010
        LOG_SYNC_SET_INT:     0x00000020
        LOG_SYNC_SET_BYTE:    0x00000040
        LOG_SYNC_SET_STRING:  0x00000080
        LOG_GET_DOUBLE:       0x00000100
        LOG_GET_INT:          0x00000200
        LOG_GET_BYTE:         0x00000400
        LOG_GET_STRING:       0x00000800
        LOG_GET_DEMOD:        0x00001000
        LOG_GET_DIO:          0x00002000
        LOG_GET_AUXIN:        0x00004000
        LOG_GET_COMPLEX:      0x00008000
        LOG_LISTNODES:        0x00010000
        LOG_SUBSCRIBE:        0x00020000
        LOG_UNSUBSCRIBE:      0x00040000
        LOG_GET_AS_EVENT:     0x00080000
        LOG_UPDATE:           0x00100000
        LOG_POLL_EVENT:       0x00200000
        LOG_POLL:             0x00400000
        LOG_ALL :             0xffffffff
filename = Log file name
[style] = LOG_STYLE_TELNET: 0 (default)
          LOG_STYLE_MATLAB: 1
          LOG_STYLE_PYTHON: 2
Log all API commands sent to the Data Server. This is useful
for debugging.

logOff

ziDAQ('logOff');

Turn of message logging.

Synchronization

sync

ziDAQ('sync');

Synchronize all data paths. Ensures that get and poll
commands return data which was recorded after the
setting changes in front of the sync command. This
sync command replaces the functionality of all 'syncSet*',
'flush', and 'echoDevice' commands.