Poll sampling status

<< Click to Display Table of Contents >>

Navigation:  NmxDLL Reference Guide > HowTo > Sampling > Get sampling status >

Poll sampling status

Polling the sampling status is done by calling the function NMX_Sampling_GetStatus_1. The following information is provided:

Current sampling status (e.g. running, finished, error).

Number of sampling elements. This is the number of measurement channels + digitale I/O bytes, which have been selected for sampling. After sampling has been prepared, this value remains static.

The number of samples, which have already been received by the NMX DLL.

The maximum number of samples, which will be recorded. For endless measurement, this is the maximum value for the respective data type.

 

C / C++


unsigned char ucStatus = 0;

unsigned long ulNElements = 0;

unsigned long long udSamplesReceived = 0;

unsigned long long udSamplesMax = 0;

if (clNmx->Sampling_GetStatus_1(pHandleNmx, &ucStatus, &ulNElements, &udSamplesReceived, &udSamplesMax) == NST_SUCCESS) {

 /* Use status data, e.g. display it on the GUI. */

}

 

Delphi


procedure TForm1.tmrSamplingTimer(Sender: TObject);

var

  ucStatus: byte;

  udSamplesReceived: uint64;

  udSamplesMax: uint64;

  ulNElements: cardinal;

begin

  ucStatus := 0;

  udSamplesReceived := 0;

  udSamplesMax := 0;

  ulNElements := 0;

 

  // Disable this timer

  tmrSampling.Enabled := false;

 

  if cNmx.Sampling_GetStatus_1(pHandleNmx, ucStatus, ulNElements, udSamplesReceived, udSamplesMax) = NST_SUCCESS then begin

   // Use status data, e.g. display it on the GUI.

  end;

 

  // Re-enable this timer

  tmrSampling.Enabled := true;

end;

 

C# / .Net


private void tmrSampling_Tick(object sender, EventArgs e)

{

  /* Disable this timer */

   tmrSampling.Enabled = false;

 

   Byte ucStatus = 0;

   UInt32 ulNElements = 0;

   UInt64 udSamplesReceived = 0;

   UInt64 udSamplesMax = 0;

  if (cNmx.Sampling_GetStatus_1(pDevice, ref ucStatus, ref ulNElements, ref udSamplesReceived, ref udSamplesMax) == NMX_MSTATUS.SUCCESS)

   {

      /* Use status data, e.g. display it on the GUI. */

   }

 

  /* Re-enable this timer */

   tmrSampling.Enabled = true;

}