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


//vdr
#include "vdr/thread.h"

//this 
#include "SerLEDStatus.H"


#ifndef SERLEDSTATUSFLASH_H
#define SERLEDSTATUSFLASH_H

/** @class SerLEDStatusFlash
    Status class for flashing LEDs
    @author felix@rauscher-muenchen.de
    @date Feb 2006
*/


class SerLEDStatusFlash : public SerLEDStatus
	{
	private:
//======================private data members====================================
	//! is true if led flashes
		bool _flashes;
	//!mutex it is locked while the led is swiched 	
		cMutex _switchlock;
	//!thread 
		pthread_t _flash_thread;
	//! on and off times for led
		int _on_time, _off_time;
//=====================private static member function===========================
	/** entry point for flash thread 
	    @pram cl pointer to the caling instance of the class
	*/
		static void * ThreadEntry(SerLEDStatusFlash *cl);
	public:
//=====================constructor==============================================
	/** default constructor */
		inline SerLEDStatusFlash() : SerLEDStatus(),
					     _flashes(false)
			{
			}
	/** initializing constructor
	    @param dev device class
	    @param led  SerLEDDevice :: RTS or SerLEDDevice :: DTR
	    @param on on time for led
	    @param off off time for led
	*/
		inline SerLEDStatusFlash(SerLEDDevice * dev, int led, int on, int off):
					SerLEDStatus(dev, led),
					_flashes(false),
					_on_time(on),
					_off_time(off)
			{
			}
//====================public member functions===================================
	/** Start Flashing */
		void Activate();
	/** Stop Flashing */
		void DeActivate();
	/** return true id led is flashing */
		inline bool IsActive() {return _flashes;}
	
	};

#endif
