Utils.ziCreateAPISession(device_serial, maximum_supported_apilevel, varargin)

ZICREATEAPISESSION Create an API session for the specified device


Create an API session to DEVICE_SERIAL’s Data Server using the MAXIMUM_SUPPORTED_APILEVEL and return:

DEVICE (str): The device’s ID, this is the string that specifies the

device’s xnode branch in the data server’s node tree.

PROPS (struct): The device’s discovery properties as returned by ziDAQ’s

‘discoveryGet’ method.


DEVICE_SERIAL (str): A string specifying the device serial number. For

example, ‘uhf-dev2123’ or ‘dev2123’.

MAXIMUM_SUPPORTED_APILEVEL (int): The maximum API Level that is supported

by the Matlab code where the returned API session will be used. The maximum API Level you may use is defined by the device class. HF2 only supports API Level 1 and other devices support API Level 5. You should try to use the maximum level possible to enable extended API features.

Optional Varargin Inputs:

REQUIRED_DEVTYPE (str): The required device type, e.g., ‘HF2LI’ or

‘MFLI’. This is given by the value of the device node ‘/devX/features/devtype’ or the ‘devicetype’ discovery property. Raise an error if the DEVICE’s devtype does not match the REQUIRED_DEVTYPE.

REQUIRED_OPTIONS (cell array of str/regexp): The required device option

set. This should be in the same format as returned by the ‘options’ property as returned by ‘discoveryGet’, e.g., {‘PID’, ‘DIG’}, although the entry may be a regular expression, e.g., {‘MFK|MF|MD’, ‘DIG’} if the required option functionality has a different name on different device classes. Raise an error if the DEVICE’s option set does contain the REQUIRED_OPTIONS.

REQUIRED_ERR_MSG (str)An additional error message to print if either

the DEVICE specified by the DEVICE_SERIAL is not the REQUIRED_DEVTYPE or does not have the REQUIRED_OPTIONS.