#pragma once


#pragma once

#include "PropertiesInterface.h"
#include "NDTSRS2A.h"
#include "NDTSRS2ATypes.h"


#ifdef RS2A_EXPORTS
#define RS2A_API __declspec(dllexport)
#else
#define RS2A_API __declspec(dllimport)
#endif

#ifdef STDCALL
#define CALL_CONV __stdcall
#else
#define CALL_CONV
#endif

using namespace System;
using namespace System::Runtime::InteropServices;
namespace NDTS
{
	namespace Managed
	{
		namespace RS2A
		{
			public ref class Snapshot
			{
			public:
				Snapshot();
				// These functions all work on a snapshot of data, including GetEncoderValue
				typedef array<short> AScanBuffer;
				bool getAScan(int bScanIndex, int aScanIndex, AScanBuffer ^%pBuffer) ;
				// .net compatible structure that is unpacked from the raw gate value obtained by the SDK
				value struct GateOutput
				{
					int distanceMetric;
					int amplitudeMetric;
					bool wasDistanceMeasured;
					bool wasAmplitudeMeasured;
				}  ;

				typedef array<int> IntArray;
				bool getGateData(int bScanIndex, int aScanIndex, [Out]IntArray ^%amplitudes, [Out]IntArray ^%depths);
				int getEncoderValue(int bScanIndex, int encoderIndex);
				void getEncoderValues(int bScanIndex, int numberOfEncoders, [Out]IntArray ^%pEncoderValuesArray);
				void resetEncoderValue(int encoderIndex);

			private:
				NDTS::RS2A::Snapshot *pSnapshot;
			};

			public ref class ErrorLog
			{
			public:
				ErrorLog();
				// The error log can be polled by the application or read when a function returns False.
				virtual String^getErrorLogLine(int lineNumber);
			private:
				NDTS::RS2A::ErrorLog *pErrorLog;
			};

			public ref class TCG
			{
			public:
				TCG();
				// TCG and gain normalisation

				// *pTCGCurve is an array of 32 bit numbers, one for each sample period.  
				// The TCG curve in the RapiDAQ is only 8 bits and each 32 bit number should be from 0..255.
				// 0 corresponds to 0dB of gain and 255 to 80dB.
				// numberOfPointsInCurve should match the A Scan range PIAScanRange.  It is used to prevent
				// a buffer overflow if the A Scan range of the application gets out of sync with the SDK
				typedef array<int> TCGBuffer;
				virtual bool setCurve(TCGBuffer ^%pTCGCurve, int numberOfPointsInCurve);

				// Other TCG settings are available via the properties interface
			private:
				NDTS::RS2A::TCG *pTcg;

			};

			public ref class RootProperty
			{
			public:
				Managed::SCO::Property ^getRootProperty();
			private:
				static bool isInitialised = false;
			};
			public ref class Test
			{
			public:
				bool runUnitTests();
			};
		}
	}
}
