#ifndef RQRAWSCANPROTECTED_H
#define RQRAWSCANPROTECTED_H

#include "RawScanMemoryBlockNodeProtected.h"
#include "RawScan.h"

#ifdef __cplusplus
extern "C" {
#endif
	typedef struct 
	{
		// See NDTS_State structure for descriptions of these members ...
		
		unsigned short	RPPS[NDTS_MAXIMUM_NUMBER_OF_ELEMENTS] ; 
		unsigned long	numberToCheckEitherSide;
		float			proportionToTriggerOff;
		unsigned long	oversampleCountThisStep[NDTS_MAXIMUM_NUMBER_OF_STEPS];

		// aScanSamplesThisStep is in the unprotected structure where it can be read by the app software
		unsigned long aScanOffsetThisStep[NDTS_MAXIMUM_NUMBER_OF_ELEMENTS];
		unsigned long aScanBytesPerBScan;
		unsigned long gateOffsetThisStep[NDTS_MAXIMUM_NUMBER_OF_ELEMENTS];
		unsigned char gateCountThisStep[NDTS_MAXIMUM_NUMBER_OF_ELEMENTS]; // initialise all to 1
		unsigned long gateBytesPerBScan;

		NDTS_Boolean isCRCCheckPresent ;
 		RawScan_MemoryBlockNode *pDataA ;
		RawScan_MemoryBlockNode *pDataB ;

		unsigned long numberOfEncodersSupportedByHardware;
		unsigned long dualEncoderWritesToEnc0and1;  // On the RQ, when in dual encoder mode, the output of the dual encoder 
		// is written to both encoder 0 and encoder 1.
		// On the 2100, the dual encoder has its own output.

		NDTS_Boolean isLargeGateOutputData;

	} RawScan_RawScanProtected ;

	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_AllocRawScanDataAMemoryBlockNode(NDTS_RawScan *pRawScan) ;
	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_FreeRawScanDataAMemoryBlockNode(NDTS_RawScan *pRawScan) ;
	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_AllocRawScanDataBMemoryBlockNode(NDTS_RawScan *pRawScan) ;
	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_FreeRawScanDataBMemoryBlockNode(NDTS_RawScan *pRawScan) ;
	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_MoveRawScanDataToRawScan(NDTS_RawScan *pDestination, NDTS_RawScan *pSource) ;
	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_ValidateRawScan(NDTS_RawScan *pRawScan) ;

	RAW_SCAN_API RawScan_RawScanProtected * CALL_CONV RawScan_ReturnRawScanInternal(NDTS_RawScan *pRawScan) ;
	RAW_SCAN_API TPoolHandle CALL_CONV RawScan_ReturnLastAScanBodyPool() ;
	// The number of memory blocks used to store an a-scan.
	RAW_SCAN_API unsigned long CALL_CONV RawScan_ReturnRawScanAScanMemoryBlockListSize(NDTS_RawScan *pRawScan) ;
	// The number of memory blocks used to store a b-scan.
	RAW_SCAN_API unsigned long CALL_CONV RawScan_ReturnRawScanBScanMemoryBlockListSize(NDTS_RawScan *pRawScan) ;
	// The number of memory blocks used to store gate values.
	RAW_SCAN_API unsigned long CALL_CONV RawScan_ReturnRawScanGateValuesMemoryBlockListSize(NDTS_RawScan *pRawScan) ;

	RAW_SCAN_API unsigned long CALL_CONV RawScan_ReturnBytesPerSample(NDTS_SampleSize sampleSize) ;

	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_GetRawScanAScanHeader(NDTS_RawScan *pRawScan, unsigned long aScanIndex, unsigned long bScanIndex, RawScan_MemoryHandle **ppData) ;
	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_GetRawScanGateValuesBody(NDTS_RawScan *pRawScan, unsigned long bScanIndex, RawScan_MemoryHandle **ppData) ;



#ifdef __cplusplus
}
#endif


#endif