#ifndef DCTERROR_H
#define DCTERROR_H

#ifdef __cplusplus
extern "C" {
#endif

#include "NDTSEnums.h"
#include "DataCollection.h"

// In the DC_ReturnCode types we use the following convention:
// low 8 bits = specific error value from this function
// next 8 bits = function returning error
// next 8 bits = SDK number
// top 8 bits reserved, currently always zero
// SDK values are:
// 0 = RQ
// 1 = pulser/receiver
// 2 = HLSDK 
// 3 = RQT - threading dll
// 4 = RQ3D - three D dll

	typedef enum
	{
		DC_OK															= 0x00030000,
		DC_OutOfMemory,												// Errors that may be returned from any function
		DC_NonFatalError,								
		DC_FatalError,									
		DC_ThreadHasShutdown,							
		DC_NoDataAvailable,								

		DC_Initialise_AlreadyInititialised								= 0x00030101,
		DC_Initialise_FailedToCreatePLXInterrupt,		

		DC_SetThreadState_InvalidState									= 0x00030201,
		DC_SetThreadState_MustNotBeCalledInsideRQLock,	
		DC_SetThreadState_TimeoutWaitingForThread,		
		DC_SetThreadState_ThreadFailedToAcknowledgeNewState,

		DC_ThreadMain_ReleaseSemaphoreReturnedError					= 0x00030301,

		DC_BankSwapAndUpdate_TimeOutWaitingForBankSwap					= 0x00030401,

		DC_GetRawScan_NoDataAvailableOrBuffered						= 0x00030501,

		DC_SetRequestEarlySampleData_DataFullError	= 0x00030601, 
		DC_SetRequestEarlySampleData_OneBankAlreadyFull,
		DC_SetRequestEarlySampleData_NoEarlySampleData,

		DC_InternalDataFormatError,
		DC_AScanDesynchronisation,
		DC_CScanDesynchronisation,
		DC_ReadRawScanBlocks_BadBlockCRC,
		DC_WaitForBankSwap_MissingTrigger,
		DC_WaitForBankSwap_DataFull,
		DC_WaitForBankSwap_TriggerOccurredBeforeProcessComplete,
		DC_WaitForBankSwap_SampleIncomplete,
		DC_WaitForBankSwap_TimeOut,
		DC_WaitForBankSwap_QueryTimerFail, 

		DC_GetRawScan_NotAllBlocksDMAOK,
		DC_GetSamples_PerformDMATransferFail, 
		DC_GetRawScan_InvalidNumberOfBScansInBank, 

		DC_FreeRawScanData_MissingRawScan,
		DC_FreeRawScanData_InvalidMode,						
		DC_FreeRawScanData_MissingData,

		DC_ReturnThreadStatePointer_InvalidCardIndex, 
		DC_NotInDoFullACaptureMode, 
		
		DC_LastError
	} DC_ReturnCode ;


// Must go after DC_ReturnCode has been defined
// Other files in the *.dll should not include NDTSErrorInternal.h directly
//#include "NDTSErrorInternal.h"

DC_API  DC_ReturnCode  DC_GetLastError();
DC_API  unsigned long DC_ReturnNumberOfErrorLogLines();
DC_API  NDTS_Boolean DC_GetErrorLogLine(unsigned long lineNumber, char *pMessageBuffer, unsigned long numberOfBytesInMessageBuffer);
DC_API  NDTS_Boolean DC_ClearErrorLog() ;

DC_API const char * CALL_CONV DC_GetCodeString(int errorCode);

#ifdef __cplusplus
}
#endif

#endif
