#ifndef RQRAWSCANPROTECTED_H
#define RQRAWSCANPROTECTED_H

#include "RQMemoryBlockNodeInternal.h"
#include "RQRawScan.h"

#ifdef __cplusplus
extern "C" {
#endif

	typedef struct 
	{
		// See RQ_State structure for descriptions of these members ...
		
		unsigned short	RPPS[RQ_MAXIMUM_NUMBER_OF_ELEMENTS] ; 
		unsigned long	numberToCheckEitherSide;
		float			proportionToTriggerOff;
		unsigned long	oversampleCountThisStep[RQ_MAXIMUM_NUMBER_OF_STEPS];

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

		RQ_StoreGateValue storeGateValue[RQ_MAXIMUM_NUMBER_OF_ELEMENTS][RQ_MAXIMUM_NUMBER_OF_GATES_COMPILE_TIME];
		NDTS_Boolean isCRCCheckPresent ;
 		RQ_MemoryBlockNode *pDataA ;
		RQ_MemoryBlockNode *pDataB ;
	} RQ_RawScanProtected ;

	RQ_API NDTS_Boolean CALL_CONV RQ_AllocRawScanDataAMemoryBlockNode(RQ_RawScan *pRawScan) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_FreeRawScanDataAMemoryBlockNode(RQ_RawScan *pRawScan) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_AllocRawScanDataBMemoryBlockNode(RQ_RawScan *pRawScan) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_FreeRawScanDataBMemoryBlockNode(RQ_RawScan *pRawScan) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_MoveRawScanDataToRawScan(RQ_RawScan *pDestination, RQ_RawScan *pSource) ;
	RQ_API NDTS_Boolean CALL_CONV RQ_ValidateRawScan(RQ_RawScan *pRawScan) ;

	RQ_API RQ_RawScanProtected * CALL_CONV RQ_ReturnRawScanInternal(RQ_RawScan *pRawScan) ;
	RQ_API TPoolHandle CALL_CONV RQ_ReturnLastAScanBodyPool() ;


#ifdef __cplusplus
}
#endif


#endif