#ifndef __CTimer__
#define __CTimer__
#include "IrDATypes.h"
#include <IOKit/IOWorkLoop.h>
#include <IOKit/IOTimerEventSource.h>
#include "IrDATimerEventSource.h"
class CTimer;
class CTimer : public OSObject
{
OSDeclareDefaultStructors(CTimer);
public:
typedef IrDATimerEventSource::Action Action;
static CTimer *cTimer(IOWorkLoop *work, OSObject *owner, Action callback);
Boolean init(IOWorkLoop *work, OSObject *owner, Action callback);
void free(void);
void StartTimer(TTimeout delay, UInt32 sig); void StopTimer(void);
UInt32 GetSignature(void);
IrDATimerEventSource *GetIOTimer(void);
static void grim_reaper(thread_call_param_t param0, thread_call_param_t param1);
private:
static void timeout(OSObject *owner, IrDATimerEventSource *sender);
UInt32 fSig;
IrDATimerEventSource *fTimerSrc; IOWorkLoop *fWorkLoop; OSObject *fOwner; Action fCallback; thread_call_t fGrimReaper; Boolean fBusy; };
inline UInt32 CTimer::GetSignature() { return fSig; }
inline IrDATimerEventSource * CTimer::GetIOTimer() { return fTimerSrc; }
#endif // __CTimer__