DioFileGroupGetChannelList

Applies To

File.

Purpose

Returns the specified group’s channels names string, and the list of channels number associated with the channels names.

Syntax

DioFileGroupGetChannelList (hFile, pszGroupName, pszGroupChannelsNames, pnGroupChannelsNamesLen, lChannelListArraySize, palChannelListArray, pnStatus)

Parameters

Name
Type
Comments
hFile
SHORT
Session identifier: File handle is used when communicating with a file. The File handle session identifier is returned by calling DioFileOpen.
pszGroupName
PCSTR
String specifying group name.
pszGroupChannelsNames
PSTR
Buffer to contain the returned group’s channels names (null terminated) string.
pnGroupChannelsNamesLen
PSHORT
Returns the actual size of the buffer to of group’s channels names string.
lChannelListArraySize
LONG
Size of the buffer to contain the board summary string.
palChannelListArray
PLONG
Array containing the channels numbers associated with pszGroupChannelsNames string.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

The function returns the specified group name and the group’s channels names string associated with the specified group name index.

The function returns the specified group name string, and the length of the string of the group name. The user pass the buffers length of the pszGroupName using the pnGroupNameLen paramter, when the function returns, the pnGroupNameLen paramters returns the actual size of the buffer to of group name string. The function also returns the specified group’s channels names string, and the length of the string associated with the specified group’s name. The user pass the buffers length of the pszGroupChannelsNames using the pnGroupChannelsNamesLen paramters, when the function returns, the pnGroupChannelsNamesLen paramters rreturns the actual size of the buffer to of group’s channels names string.

The pszGroupChannelsNames uses semicolons between channles name in the string, e.g. the following group’s channels names string "RESET;CLK_IN;CLK_OUT;SOURCE;GND;" has 5 channels names.

The palChannelListArrary parameter array reruns with the channels numbers associated with pszGroupChannelsNames string.

Example

The following example creates a new file with a board type as GX5296, sets the Channel count to 64 and Step Count to 2, fills the vector memory with a clock vector, adds two new group names and group of channels names to the file, and read back both groups:

 

SHORT nStatus;

SHORT hFile;

SHORT nGroupNameLen, nGroupChannelsNamesLen;

CHAR szGroupName [512];

CHAR szGroupChannelsNames [512];

LONG alChannelList[6];

nGroupNameLen = sizeof (szGroupName);

nGroupChannelsNamesLen = sizeof (szGroupChannelsNames);

// creates a new file with a board type as GX5296

DioFileOpen(“C:\\MyFile.dio6x”, GTDIO6X_FILE_CREATE, &hFile, GTDIO6X_FILE_BOARD_TYPE_GX5296, &nStatus);

// Sets Channel count to 64

DioFileSetChannelCount(hFile, 64, &nStatus);

// Sets Step Count to 2

DioFileSetStepCount(hFile, 2, &nStatus);

// Fills the vector memory with a clock vector

DioFillVectors(hFile, 64, alChannelListArray, 0, 100, GTDIO6X_FILL_VECTORS_CLOCK, 'h', 'l', &nStatus);

// Assign channels numbers with names

DioChannelSetName(hFile, 0, "RESET", &nStatus);

DioChannelSetName(hFile, 1, "CLK_IN", &nStatus);

DioChannelSetName(hFile, 2, "CLK_OUT", &nStatus);

DioChannelSetName(hFile, 3, "SOURCE", &nStatus);

DioChannelSetName(hFile, 4, "GND", &nStatus);

DioChannelSetName(hFile, 10, "ADDR0", &nStatus);

DioChannelSetName(hFile, 11, "ADDR1", &nStatus);

DioChannelSetName(hFile, 12, "ADDR2", &nStatus);

DioChannelSetName(hFile, 13, "ADDR3", &nStatus);

DioChannelSetName(hFile, 14, "ADDR4", &nStatus);

DioChannelSetName(hFile, 15, "ADDR5", &nStatus);

// Adds new groups names and group of channels names to the file

DioFileGroupSet (hFile, “Group1”, "RESET;CLK_IN;CLK_OUT;SOURCE;GND;", &nStatus);

DioFileGroupSet (hFile, “Group2”, "ADDR0;ADDR1;ADDR2;ADDR3;ADDR4;ADDR5;", &nStatus);

// Return group name and channels names string at group name index 0 from the file

DioFileGroupGetName (hFile, 0, szGroupName, &nGroupNameLen, szGroupChannelsNames, &nGroupChannelsNamesLen, &nStatus);

// Return group name and channels names string at group name index 1 from the file

DioFileGroupGetName (hFile, 1, szGroupName, &nGroupNameLen, szGroupChannelsNames, &nGroupChannelsNamesLen, &nStatus);

// Read back “Group1” channels names string, and the list of channels number associated with the channels names

DioFileGroupGetChannelList(hFile, “Group1”, szGroupChannelsNames, &nGroupChannelsNamesLen, 5, , alChannelList, pnStatus);

DioFileGroupGetChannelList(hFile, “Group2”, szGroupChannelsNames, &nGroupChannelsNamesLen, 6, , alChannelList, pnStatus);

// Close and save the file

DioFileClose(hFile, &nStatus);

 

See Also

DioFileOpen, DioFileClose, DioFileGroupDelete, DioFileGroupGet, DioFileGroupGetName , DioFileGroupSet, DioGetErrorString