/*
 * 
 * SerLED.H header file for class SerLED
 *
 */


//c - c++
#include "vector"

//this
#include "SerLEDStatus.H"
#include "SerLEDDevice.H"

#ifndef SERLED_H
#define SERLED_H

/** @class SerLED
    represents a led connected to a serial port
    @author felix@rauscher-muenchen.de
    @date Feb 2006
*/

class SerLED
	{
	private:
//======================private data members====================================
	//!vector contining states like on, blink
		std::vector<SerLEDStatus *> _states;
		std::vector<bool> _active;
	//!device to which this led is connected
		SerLEDDevice * _device;
	//!led number SerLEDDevice :: RTS or SerLEDDevice :: DTR
		int _led;
	public:
//=====================constructor==============================================
	/** default constructor */
		inline SerLED() {};
	/** initializing constructor
	    @param dev device class
	    @param led  SerLEDDevice :: RTS or SerLEDDevice :: DTR
	*/
		inline SerLED(SerLEDDevice *dev, int led) : _device(dev),
							    _led(led)
			{}
//=====================public member functions==================================
	/** initialize
	    @param dev device class
	    @param led  SerLEDDevice :: RTS or SerLEDDevice :: DTR
	*/
		inline void Initialize(SerLEDDevice *dev, int led)
			{
			_device=dev; _led=led;
			}
	/** add an led state - this state will have less riority than all previously added states. Returns the state number
	    @param st State class
	*/
		inline unsigned int AddState(SerLEDStatus * st)
			{
			_states.push_back(st);
			_active.push_back(false);
			return _states.size()-1;
			}
	/** Activate state
	    @param nr state number as returned by AddState
	*/
		void Activate(unsigned int nr);
	/** Deactivate state
	    @param nr state number as returned by AddState
	*/
	        void DeActivate(unsigned int nr);
	};


#endif
