/*
 * 
 * SerLEDDeviceSerial.H header file for class SerLEDDevice
 *
 */

#ifndef SERLEDDEVICESERIAL_H
#define SERLEDDEVICESERIAL_H
 
//c - c++
#include "vector"
#include "string"

//vdr
#include "vdr/thread.h"
 
//this
#include "SerLEDDevice.H"
 
 
/**  @class SerLEDDeviceSerial 
     handles a sreial device 
     @author felix@rauscher-muenchen.de
     @date Feb 2006
*/

class SerLEDDeviceSerial : public SerLEDDevice
	{
	private:
//==========================private data members================================
	//! file descriptor for the device file
		int _file_d;
	//! flog indicating that led is connected with wrong polarity
		std::vector<bool> _inverted;
	public:
//=========================static constants=====================================
	//! led numbers
		static const unsigned int RTS=0,
					  DTR=1;
//=========================constructor==========================================
	/** default constructor */
		inline SerLEDDeviceSerial() : _file_d(-1),
					_inverted(2, false)
				      
		{}
	/** initializing constructor
	@param items line in config file broken up in strings
	    
	*/
		inline SerLEDDeviceSerial(const std::vector<std::string> &items) :
							_file_d(-1),
						        _inverted(2, false)
			{
			Initialize(items);
			}
//=========================public member fuctions===============================
	/** Initialize 
	@param items line in config file broken up in strings
	*/
		void Initialize(const std::vector<std::string> &items);
	/** Get a led number - return -1 if led is invalid
	@param items line in config file broken up in strings
	
	*/
		int GetLEDNumber(const std::vector<std::string> & items);
	/** Turn on LED 
	    @param led either SerLEDDevice :: RTS or SerLEDDevice :: DTR
	*/
		void On(int led);
	/** Turn off LED 
	    @param led either SerLEDDevice :: RTS or SerLEDDevice :: DTR
	*/
		void Off(int led);
	};
     
#endif
