#ifndef TIMIMAGER_H_
#define TIMIMAGER_H_

#ifdef TIMIMAGERLIBRARY_EXPORTS
#define TIMIMAGERLIBRARY_API __declspec(dllexport)
#else
#define TIMIMAGERLIBRARY_API __declspec(dllimport)
#endif

#include "IRDeviceDS.h"
#include "..\Automatic Fever Screening\VideoCapture.h"
#include "ImagerHandler.h"

namespace PIseries {

	const unsigned int MaxSize = 400;

	class TIMIMAGERLIBRARY_API  TIMImager : public thermoCamera::VideoCapture {

	public:

		/////////////////////////////////// Constructors ///////////////////////////////

		/**
		 * Standard constructor
		 */
		TIMImager();

		/**
		 * Constructor initializing xml file for IRDeviceDS (generic.xml)
		 */
		TIMImager(const char* xmlpath);

		/**
		 * Destructor
		 */
		~TIMImager()
		{		
			if (_clientForDeviceWasSetted)
			{
				_device->stopStreaming();
				if (_irimager) { delete _irimager; _irimager = NULL; }
				if (_device) { delete _device; _device = NULL; }
				if (_irimager_handler) { delete _irimager_handler; _irimager_handler = NULL; }
			}		
		}

		/**
		 * Method setting xml file for IRDevideDS (generic.xml)
		 */
		bool setXMLPath(const char* xmlpath);

		/**
		 * Virtual method for initializing camera
		* Method must call setWidth() and setHeight()
		 */
		virtual bool Initialize();

		/**
		 * Virtual method for launching streaming
		 */
		virtual bool StartStreaming();

		/**
		 * Virtual method for stopping streaming
		 */
		virtual bool StopStreaming();

	private:

		bool _isInit;

		bool _xmlIsSet;

		bool _clientForDeviceWasSetted;

		TCHAR _xmlPath[MaxSize];

		evo::IRImager* _irimager;

		evo::IRDeviceDS* _device;

		evo::IRDeviceParams _params;

		ImagerHandler* _irimager_handler;

		// private methods
		bool _initialize(char* path);

		bool _setXMLPath(const char* src);

		bool _setIRDeviceParams(evo::IRDeviceParams* params);

		void _initPrivateAttributes();

		bool _isXMLpathSet();

	};

}
 


#endif
