beautypg.com

Daqflex software reference, Daqdevicemanager class, Daqdevicemanager.getdevicenames() – Measurement Computing DAQFlex User Guide User Manual

Page 24: Chapter 3

background image

24

Chapter 3

DAQFlex Software Reference

The DAQFlex Software API is an open source library that implements a simple message-based protocol

consisting of text-based commands, or messages. The API is written in C#, is designed for cross

platform portability, and does not require a separate configuration utility or a configuration file.

DAQFlex Software API contains two classes:

DaqDeviceManager class

DaqDevice class

DaqDeviceManager class

The

DaqDeviceManager

class includes the following methods:

GetDeviceNames()

– gets a list of devices that support the message-based protocol.

CreateDevice()

– creates a DaqDevice object, which contains the methods used to communicate

with a DAQ device.

ReleaseDevice()

– frees the resources associated with a DaqDevice object.

DaqDeviceManager.GetDeviceNames()

Gets a list of DAQ devices that support the message-based protocol.

C#:

static string[] GetDeviceNames(DeviceNameFormat format);

VB:

Shared Function GetDeviceNames(ByVal format As DeviceNameFormat) As
String()

Parameter

format

The format to use for a device name. This parameter is a DeviceNameFormat enumeration. The

enumeration values and the format of the return strings are listed below:

Value

Return string format

NameOnly

"Device name"

NameAndSerno

"Device name::Device serial number"

NameAndID

"Device name::Device ID"

NameSernoAndID

"Device name::Device serial number::Device ID"

Return value

An array of strings containing the device names of all DAQ devices that support the message-based

protocol.

Remarks

The values contained in the array can be used to create a

DaqDevice

object for the device that you

want to program.
The DaqDevice object is created using the DaqDeviceManager

CreateDevice

static method.

With the DaqDevice object, all DAQ operations are configured using one API method called

SendMessage

() rather than using multiple operation-specific methods.

The

NameOnly

format is not useful if multiple devices of the same type are connected, since the

application won't be able to differentiate between one device and the other. If you are using
multiple devices of the same type, then use one of the other formats.