libvkdaq
VKINGING DAQ Library API Reference
 
Loading...
Searching...
No Matches

Functions

int32_t VkDaqGetTaskAttribute (const char *task, const char *attrName, char attrValue[], int32_t size)
 Get task attribute value.
 

Detailed Description

Function Documentation

◆ VkDaqGetTaskAttribute()

int32_t VkDaqGetTaskAttribute ( const char *  task,
const char *  attrName,
char  attrValue[],
int32_t  size 
)

Get task attribute value.

data type parameter describe
const char* task Task name(string type, for example"Task1")
const char* attrName Attribute name.Available values:
"Attributes": Query all attribute names of the current task. The returned attribute names are separated by commas.
"Channels": Query all channel names of the current task. The returned channel names are separated by commas.
"ChannelsAvailable": Query the available channel names for the current task. The returned channel names are separated by commas.
"Name": Query task name.
"Status": Query task status.
"PID": Query the task creator process ID.
"EXE": Query the process application path of the task creator.
"Mode":Master-Slave Mode.
"SamplingFrequency":SamplingFrequency.
"Detail":Detailed task configuration information in JSON format.
char[] attrValue[] Character array, used to store attribute values, multiple values ​​are separated by commas.
int32_t size The size of the attrValue arrays.

Returns
On success, return value >= 0.
On failure, returns a negative error number.For detail, please Call VkDaqGetLastErrorInfo

C language reference

#include <stdio.h>
#include "libvkdaq.h"
int main(int argc, char* argv[])
{
const char* task = "task1";
char value[4096] = { 0 };
int32_t size = sizeof(value);
int32_t result = VkDaqCreateTask(task);
result = VkDaqCreateAIVoltageChan(task, "dev1/AIN1", "", VkDaq_Val_SingleEnded, -10.0, 10.0, VkDaq_Val_Volts, "");
result = VkDaqCfgSampClkTiming(task, VkDaq_Val_ClkSrc_OnBoardClk, 1000, VkDaq_Val_Rising, VkDaq_Val_ContSamps, 0);
result = VkDaqStartTask(task);
result = VkDaqGetTaskAttribute(task,"Channels", value, size);
printf("Task Channels = %s \n",value);
if (result >= 0) {
printf("Successful\n");
}
else {
printf("Failed\n");
}
return 0;
}
int32_t VkDaqCreateAIVoltageChan(const char *task, const char *chans, const char *reserved1, int32_t terminalConfig, double minVal, double maxVal, int32_t units, const char *reserved2)
Create AI Voltage Channel.
int32_t VkDaqCreateTask(const char *task)
Create task.
int32_t VkDaqGetTaskAttribute(const char *task, const char *attrName, char attrValue[], int32_t size)
Get task attribute value.
int32_t VkDaqStartTask(const char *task)
Start task.
int32_t VkDaqCfgSampClkTiming(const char *task, int32_t source, double samplingFrequency, int32_t reserved, int32_t sampleMode, int32_t sampsPerChanToAcquire)
Set the source of the sampling clock, the rate of the sampling clock, and the number of samples to be...