/******************************************************************************
*
*	NDT Solutions RapiDAQ Software Development Kit v1.0beta
*
******************************************************************************
*
*  File:        RQOffline.h.
*
*  Description: Extract functions that work on previoulsly captured raw scan data
*
*
******************************************************************************/



#ifndef RQOffline_H
#define RQOffline_H


/*
*	 __cplusplus, __declspec(...), and __stdcall are Microsoft specific.
*/

#ifdef __cplusplus
extern "C" {
#endif

#include "NDTSEnums.h"
#include "RQRawScan.h"

	RQ_API NDTS_Boolean CALL_CONV RQ_ExtractAScan(unsigned long bScanIndex, unsigned long aScanIndex, RQ_RawScan *pRawScan, short *pAScan, unsigned long numberOfBufferValues) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_ExtractBScan(unsigned long bScanIndex, RQ_RawScan *pRawScan, short **ppBScan, unsigned long numberOfAScanPointers, unsigned long numberOfAScanBufferValues) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_ExtractCScan(int *pRPNSequence, unsigned long bScanIndex, unsigned long numberOfBScans, RQ_RawScan *pRawScan, RQ_CScan *pRawCScan, unsigned long numberOfBufferRows, unsigned long numberOfBufferColumns) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_ExtractGateValues(unsigned long bScanIndex, unsigned long aScanIndex, RQ_RawScan *pRawScan, RQ_GateOutput *pGateOutputs, unsigned long numberOfBufferValues) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_ExtractEncoderValue(unsigned long bScanIndex, unsigned long encoderIndex, RQ_RawScan *pRawScan, long *pEncoderValue) ;

	RQ_API NDTS_Boolean CALL_CONV RQ_ExtractAScanPtr(unsigned long bScanIndex, unsigned long aScanIndex, RQ_RawScan *pRawScan, short **ppAScan, unsigned long *pNumberOfAScanSamples) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_ExtractBScanPtrs(unsigned long bScanIndex, RQ_RawScan *pRawScan, short **ppBScan, unsigned long numberOfAScanPointers, unsigned long *pNumberOfAScanSamples) ;

	// This isn't a pure offline extract function as it pulls the requried AScan from the card rather than the rawScan, avoiding
	// the downloading of all the AScans from the card.
	// Now takes the gate data as input and only generates new gate values and copies A Scans if 
	// one of the gates in the raw scan fits the selection better than the existing gate values.
	// The raw scan is not padded with zeros but the minimum of the number of samples and the buffer size is copied.
	RQ_API NDTS_Boolean CALL_CONV RQ_ExtractSnapshotOutput(unsigned long cardIndex, RQ_RawScan *pRawScan, unsigned long step, unsigned long gateIndex, short *pBuffer, unsigned long numberOfBufferValues, short *pAmplitude, short *pDepth) ;

#ifdef __cplusplus
}
#endif


#endif
