Skip to content
Snippets Groups Projects
Commit a51a7b68 authored by Sonia Minolli's avatar Sonia Minolli
Browse files

Set input buffer size with total nb of samples in callback mode (CPPAPIS-18)

parent fa02c19f
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,12 @@ namespace ni660Xsl
*/
virtual void set_buffer_depth(unsigned long _nb_samples);
/**
* Set the total number of samples to receive.
* @param _nb_samples Total number of samples per channel.
*/
virtual void set_total_nb_pts(unsigned long _nb_samples);
/**
* Set the overrun strategy
* @param _strategy The strategy to apply.
......
......@@ -34,7 +34,8 @@ start_point_(ni::current_read_position),
offset_(0),
timeout_(1.0),
mode_(ni::continuous),
use_callback_(false)
use_callback_(false),
total_nb_pts_(1000)
{
}
// ============================================================================
......@@ -104,6 +105,17 @@ void BufferedAcquisition::set_callback_mode(bool _enabled)
this->use_callback_ = _enabled;
}
// ============================================================================
// BufferedAcquisition::set_total_nb_pts
// ============================================================================
void BufferedAcquisition::set_total_nb_pts(unsigned long _nb_samples)
{
//std::cout<<<<"BufferedAcquisition::set_total_nb_pts<-"<<std::endl;
this->total_nb_pts_ = _nb_samples;
//std::cout<<<<"BufferedAcquisition::set_total_nb_pts->"<<std::endl;
}
// ============================================================================
// BufferedAcquisition::get_raw_buffer
// ============================================================================
void BufferedAcquisition::get_raw_buffer(void)
......
......@@ -144,7 +144,15 @@ void BufferedEventCounting::configure(void)
}
//-------------------------configure acquisition buffer-------------------------------------------
if (this->use_callback_)
{
// Configure the input buffer size with the total number of point to be received
err = DAQmxCfgInputBuffer(this->task_handle_, this->total_nb_pts_);
}
else
{
err = DAQmxCfgInputBuffer(this->task_handle_, this->nb_samples_);
}
if (err < 0)
{
......
......@@ -144,7 +144,15 @@ void BufferedPositionMeasurement::configure (void)
//-------------------------configure buffer-------------------------------------------
//std::cout<<<<"BufferedPositionMeasurement::config buffer"<<std::endl;
if (this->use_callback_)
{
// Configure the input buffer size with the total number of point to be received
err = DAQmxCfgInputBuffer(this->task_handle_, this->total_nb_pts_);
}
else
{
err = DAQmxCfgInputBuffer(this->task_handle_, this->nb_samples_);
}
if(err < 0)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment