/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013 Raytrix GmbH. All rights reserved.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once

#include "Rx.Interop.Runtime30/CameraProperties.h"

namespace Rx
{
	namespace Interop
	{
		namespace Runtime28
		{
			namespace EPixelType
			{
				enum ID;
			}
			namespace EDataType
			{
				enum ID;
			}
		}
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// namespace: Rx.Interop.Runtime30.Camera
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rx
{
	namespace Interop
	{
		namespace Runtime30
		{
			namespace Camera
			{
				/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
				/// <summary>
				/// 	Interface for native device class. This base provides functionality for using devices independently of their hardware
				/// 	interface type.
				/// </summary>
				/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
				class INativeDeviceControl
				{
				protected:

					virtual ~INativeDeviceControl() { };

				public:

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Opens the device and prepares the communication.
					/// </summary>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void Open() = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Closes the device and finalizes the communication.
					/// </summary>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void Close() = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Starts the acquisition of images.
					///
					/// 	This has to be called for image acquisition unrelated to the trigger mode used. The trigger mode has to be set while
					/// 	not capturing.
					/// </summary>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void StartCapture() = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Suspends the capturing.
					///
					/// 	With most cameras this just pauses the passing of the images while other cameras implement a real suspend which saves
					/// 	energy.
					/// </summary>
					///
					/// <param name="bSuspend"> [in] true to suspend. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void SuspendCapture(bool bSuspend) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Gets information about the image type the camera delivers. The camera must be open before calling this function.
					/// </summary>
					///
					/// <param name="ePixelType">	  [out] The pixeltype. </param>
					/// <param name="eDataType">	  [out] The datatype. </param>
					/// <param name="iBytesPerPixel"> [out] The number of bytes per pixel. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void GetImageType(Interop::Runtime28::EPixelType::ID& ePixelType, Interop::Runtime28::EDataType::ID& eDataType, int& iBytesPerPixel) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Stops the acquisition of images.
					/// </summary>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void StopCapture() = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Triggers an image capture.
					///
					/// 	In video mode it does nothing. In single capture mode performs a software trigger. Camera has to be open and should be
					/// 	capturing in software trigger mode.
					/// </summary>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void Trigger() = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Queries if a property is available.
					/// </summary>
					///
					/// <param name="eProp"> [in] The property in question. </param>
					///
					/// <returns> True if the property is available, false if not. </returns>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual bool IsPropertyAvailable(Interop::Runtime30::Camera::EProperty::ID eProp) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Gets a property value of type float.
					/// </summary>
					///
					/// <param name="eProp">  [in] The property in question. </param>
					/// <param name="fValue"> [out] The return value. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void GetProperty(Interop::Runtime30::Camera::EProperty::ID eProp, float& fValue) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Gets a property value of type int.
					/// </summary>
					///
					/// <param name="eProp">  [in] The property in question. </param>
					/// <param name="iValue"> [out] The return value. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void GetProperty(Interop::Runtime30::Camera::EProperty::ID eProp, int& iValue) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Gets a property value of type string.
					///
					/// 	To obtain the required buffer size, call this with pcValue = null.
					/// </summary>
					///
					/// <param name="eProp">	   [in] The property in question. </param>
					/// <param name="pcValue">	   [out] The user managed buffer that is used for storing the value. </param>
					/// <param name="iBufferSize"> The size of the given buffer in bytes. </param>
					///
					/// <returns> The number of bytes that is required to store the resultig string in pcValue, including the terminating 0. </returns>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual int GetProperty(Interop::Runtime30::Camera::EProperty::ID eProp, char* pcValue, int iBufferSize) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Sets a property value of type float.
					/// </summary>
					///
					/// <param name="eProp">  [in] The property to be changed. </param>
					/// <param name="fValue"> [in] The value to be set. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void SetProperty(Interop::Runtime30::Camera::EProperty::ID eProp, float fValue) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Sets a property value of type int.
					/// </summary>
					///
					/// <param name="eProp">  [in] The property to be changed. </param>
					/// <param name="iValue"> [in] The value to be set. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void SetProperty(Interop::Runtime30::Camera::EProperty::ID eProp, int iValue) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Sets a property value of type string.
					/// </summary>
					///
					/// <param name="eProp">   The property to be changed. </param>
					/// <param name="pcValue"> [in] The value to be set. This is a null terminated string. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void SetProperty(Interop::Runtime30::Camera::EProperty::ID eProp, const char* pcValue) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Gets the property value range of the given property of type float.
					/// </summary>
					///
					/// <param name="eProp"> [in] The property in question. </param>
					/// <param name="fMin">  [out] The minimum value for given property. </param>
					/// <param name="fMax">  [out] The maximum value for given property. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void GetPropertyRange(Interop::Runtime30::Camera::EProperty::ID eProp, float& fMin, float& fMax) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Gets the property value range of the given property of type int.
					/// </summary>
					///
					/// <param name="eProp"> [in] The property in question. </param>
					/// <param name="iMin">  [out] The minimum value for given property. </param>
					/// <param name="iMax">  [out] The maximum value for given property. </param>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual void GetPropertyRange(Interop::Runtime30::Camera::EProperty::ID eProp, int& iMin, int& iMax) = 0;

					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					/// <summary>
					/// 	Gets the property value range of the given arguments of type array int.
					/// </summary>
					///
					/// <param name="eProp">	  [in] The property in question. </param>
					/// <param name="piValues">   [out] The pointer to an array that contains the list of available values. The pointer has to point
					/// 						  to an array with iMaxValueCnt elements. The parameter iTotalValueCnt contains the total number
					/// 						  of available properties. If a null pointer is passed here, only the total number of available
					/// 						  parameters is returned in iTotalValueCnt. </param>
					/// <param name="iNumValues"> The number of values that can be stored in piValues. </param>
					///
					/// <returns> The number of integers that is required to store all available values. </returns>
					/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					virtual int GetPropertyRange(Interop::Runtime30::Camera::EProperty::ID eProp, int* piValues, int iNumValues) = 0;
				};
			}
		}
	}
}

#pragma make_public(Rx::Interop::Runtime30::Camera::INativeDeviceControl)
