# cbGetStatus()

Returns the status about the background operation currently running.

## Function Prototype

C/C++

int cbGetStatus(int BoardNum, int *Status, long *CurCount, long *CurIndex, int FunctionType)

Visual Basic

Function cbGetStatus(ByVal BoardNum&, Status%, CurCount&, CurIndex&, FunctionType&) As Long

## Arguments

BoardNum

The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99.

Status

Status indicates whether or not a background process is currently executing.

CurCount

The CurCount argument specifies how many points have been input or output since the Background process started. Use it to gauge how far along the operation is towards completion. Generally, CurCount returns the total number of samples transferred between the DAQ board and the Windows data buffer at the time cbGetStatus() was called.

When you set both the CONTINUOUS and BACKGROUND options, CurCount's behavior depends on the board model. Refer to the board-specific information in the Universal Library User's Guide for the behavior of your board.

With recent MCC DAQ designs, the CurCount argument continually increases in increments of the packet size as Windows' circular data buffer recycles, until it reaches 231. Since the Count argument is a signed integer, at 2,147,483,647 + 1, the Count rolls back to a negative number (-2,147,483,647). The Count argument resumes incrementing, eventually reaching 0 and increasing back up to 2,147,483,647.

The CurIndex argument is usually more useful than the CurCount argument in managing data collected when you set both the CONTINUOUS and BACKGROUND options.

CurIndex

The CurIndex argument is an index into the Windows data buffer. This index points to the start of the last completed channel scan that was transferred between the DAQ board and the Windows data buffer. If no points in the buffer have been transferred, CurIndex equals –1 in most cases.

For CONTINUOUS operations, CurIndex rolls over when the Windows data buffer is full. This rollover indicates that "new" data is now overwriting "old" data. Your goal is to process the old data before it gets overwritten. You can keep ahead of the data flow by copying the old data out of the buffer before new data overwrites it.

The CurIndex argument can help you access the most recently transferred data. Your application does not have to process the data exactly when it becomes available in the buffer – in fact, you should avoid doing so unless absolutely necessary. The CurIndex argument generally increments by the packet size, but in some cases the CurIndex increment can vary within the same scan. One instance of a variable increment is when the packet size is not evenly divisible by the number of channels.

You should determine the best size of the "chunks" of data that your application can most efficiently process, and then periodically check on the CurIndex argument value to determine when that amount of additional data has been transferred.

Refer to the Universal Library User's Guide for information on your board, particularly when using Pre-Trigger.

FunctionType

Specifies which scan to retrieve status information about. Refer to the FunctionType argument values section below.

## Returns

- Error code or 0 if no errors
- Status – Returns the status of the operation:
- 0 – a background process is not currently executing.
- 1 – a background process is currently executing.
- CurCount – Returns the current number of samples collected.
- CurIndex – Returns the Current sample index.

### FunctionType argument values

AIFUNCTION | Specifies analog input scans started with cbAInScan() or cbAPretrig().
AOFUNCTION | Specifies analog output scans started with cbAOutScan().
DIFUNCTION | Specifies digital input scans started with cbDInScan().
DOFUNCTION | Specifies digital output scans started with cbDOutScan().
CTRFUNCTION | Specifies counter background operations started with cbCStoreOnInt() or cbCInScan().
DAQIFUNCTION | Specifies a synchronous input scan started with cbDaqInScan().
DAQOFUNCTION | Specifies a synchronous output scan started with cbDaqOutScan().