1/* 2 File: IrStream.h 3 4 Contains: Interface to the TIrStream abstract class 5 6 7*/ 8 9#ifndef __IRSTREAM_H 10#define __IRSTREAM_H 11 12#include "IrDATypes.h" 13#include "IrDALog.h" 14 15class TIrEvent; 16class CList; 17class TIrGlue; 18 19 20//-------------------------------------------------------------------------------- 21// TIrStream 22//-------------------------------------------------------------------------------- 23class TIrStream : public OSObject 24{ 25 OSDeclareAbstractStructors(TIrStream); 26public: 27 28 Boolean Init(TIrGlue *irda, EventTraceCauseDesc *trace = nil, UInt16 index = 0); 29 void free(void); 30 31 // Enqueue a request (response) to this stream 32 IrDAErr EnqueueEvent(TIrEvent *eventBlock); 33 34 // Subclasses implement this to get events queued for them 35 virtual void NextState(ULong event) = 0; 36 37 // Run the queue until it's empty, only one queue for all stream objects 38 static void RunQueue(); 39 40 // Return the current event 41 TIrEvent *GetCurrentEvent(); 42 43protected: 44 TIrGlue *fIrDA; // most stream objects need to get back to glue 45 46private: 47 static void DequeueEvent(); // get the next event to run from fNextEvent or the fifo 48 49 static TIrEvent *fCurrentEvent; // event we're running (not on the queue) 50 static TIrEvent *fNextEvent; // slight optimization to keep next event off the fifo 51 static CList *fPendingEventsList; // add to front, take from last, event FIFO 52 53#if (hasTracing > 0 && hasIrStreamTracing > 0) 54 EventTraceCauseDesc * fTraceArray; // Used by funky qtrace macro 55 UInt32 fTraceIndex; // one per IrStream object 56#endif 57 58}; // TIrStream 59 60inline TIrEvent *TIrStream::GetCurrentEvent(void) { return fCurrentEvent; } 61 62 63#endif /* __IRSTREAM_H */ 64