File
Returns the specified group’s channels names string, and the list of channels number associated with the channel's names.
GtDio6xFileGroupGetChannelList (hFile, pszGroupName, pszGroupChannelsNames, pnGroupChannelsNamesLen, lChannelListArraySize, palChannelListArray, pnStatus)
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 GtDio6xFileOpen. |
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. |
IChannelListArraySize |
LONG |
Specifies the number of channels in the palChannelListArray. |
palChannelListArrary |
PLONG |
Array containing the channels numbers associated with pszGroupChannelsNames string. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
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 passes the buffers length of the pszGroupName using the pnGroupNameLen paramter, when the function returns, the pnGroupNameLen parameters 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 passes the buffers length of the pszGroupChannelsNames using the pnGroupChannelsNamesLen paramters, when the function returns, the pnGroupChannelsNamesLen paramters returns the actual size of the buffer to of group’s channels names string.
The pszGroupChannelsNames uses semicolons between channels 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 returns with the channel's numbers associated with pszGroupChannelsNames string.
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
GtDio6xFileOpen(“C:\\MyFile.dio6x”, GTDIO6X_FILE_CREATE, &hFile, GTDIO6X_FILE_BOARD_TYPE_GX5296, &nStatus);
// Sets Channel count to 64
GtDio6xFileSetChannelCount(hFile, 64, &nStatus);
// Sets Step Count to 2
GtDio6xFileSetStepCount(hFile, 2, &nStatus);
// Fills the vector memory with a clock vector
GtDio6xFillVectors(hFile, 64, alChannelListArray, 0, 100, GTDIO6X_FILL_VECTORS_CLOCK, 'h', 'l', &nStatus);
// Assign channels numbers with names
GtDio6xChannelSetName(hFile, 0, "RESET", &nStatus);
GtDio6xChannelSetName(hFile, 1, "CLK_IN", &nStatus);
GtDio6xChannelSetName(hFile, 2, "CLK_OUT", &nStatus);
GtDio6xChannelSetName(hFile, 3, "SOURCE", &nStatus);
GtDio6xChannelSetName(hFile, 4, "GND", &nStatus);
GtDio6xChannelSetName(hFile, 10, "ADDR0", &nStatus);
GtDio6xChannelSetName(hFile, 11, "ADDR1", &nStatus);
GtDio6xChannelSetName(hFile, 12, "ADDR2", &nStatus);
GtDio6xChannelSetName(hFile, 13, "ADDR3", &nStatus);
GtDio6xChannelSetName(hFile, 14, "ADDR4", &nStatus);
GtDio6xChannelSetName(hFile, 15, "ADDR5", &nStatus);
// Adds new groups names and group of channels names to the file
GtDio6xFileGroupSet (hFile, “Group1”, "RESET;CLK_IN;CLK_OUT;SOURCE;GND;", &nStatus);
GtDio6xFileGroupSet (hFile, “Group2”, "ADDR0;ADDR1;ADDR2;ADDR3;ADDR4;ADDR5;", &nStatus);
// Return group name and channels names string at group name index 0 from the file
GtDio6xFileGroupGetName (hFile, 0, szGroupName, &nGroupNameLen, szGroupChannelsNames, &nGroupChannelsNamesLen, &nStatus);
// Return group name and channels names string at group name index 1 from the file
GtDio6xFileGroupGetName (hFile, 1, szGroupName, &nGroupNameLen, szGroupChannelsNames, &nGroupChannelsNamesLen, &nStatus);
// Read back “Group1” channels' names string, and the list of channels number associated with the channels names
GtDio6xFileGroupGetChannelList(hFile, “Group1”, szGroupChannelsNames, &nGroupChannelsNamesLen, 5, , alChannelList, pnStatus);
GtDio6xFileGroupGetChannelList(hFile, “Group2”, szGroupChannelsNames, &nGroupChannelsNamesLen, 6, , alChannelList, pnStatus);
// Close and save the file
GtDio6xFileClose(hFile, &nStatus);
GtDio6xFileOpen, GtDio6xFileSave, GtDio6xFileGroupDelete , GtDio6xFileGroupGet , GtDio6xFileGroupGetName, GtDio6xFileGroupSet ,GtDio6xGetErrorString