1/* 2 File: IrLMP.h 3 4 Contains: Methods for implementing IrLMP 5 6*/ 7 8 9#ifndef __IRLMP_H 10#define __IRLMP_H 11 12#include "IrStream.h" 13#include "IrEvent.h" 14 15// Forward reference 16class TIrGlue; 17class TIrLAPConn; 18class TIrLAP; 19class CIrDiscovery; 20class CList; 21class CBufferSegment; 22 23// Constants 24 25#define kMaxReturnedAddrs 16 // Max slots => max addr 26#define kMaxAddrConflicts 8 // I'm only dealing w/8 at most 27 28enum IrLMPStates 29{ 30 kIrLMPReady, 31 kIrLMPDiscover, 32 kIrLMPResolveAddress 33}; 34 35 36// Classes 37 38// -------------------------------------------------------------------------------------------------------------------- 39// TIrLMP 40// -------------------------------------------------------------------------------------------------------------------- 41 42class TIrLMP : public TIrStream 43{ 44 OSDeclareDefaultStructors(TIrLMP); 45 46 public: 47 48 static TIrLMP * tIrLMP(TIrGlue* irda); 49 void free(void); 50 51 Boolean Init(TIrGlue* irda); 52 void Reset(); 53 54 void Demultiplexor(CBufferSegment* inputBuffer); 55 ULong FillInLMPDUHeader(TIrPutRequest* putRequest, UByte* buffer); 56 57 void StartOneSecTicker(); 58 void StopOneSecTicker(); 59 void TimerComplete(ULong refCon); 60 61 private: 62 63 // TIrStream override 64 void NextState(ULong event); 65 66 void HandleReadyStateEvent(ULong event); 67 void HandleDiscoverStateEvent(ULong event); 68 void HandleResolveAddressStateEvent(ULong event); 69 70 // Helper methods 71 72 Boolean AddrConflicts(CList* discoveredDevices, Boolean setAddrConflicts); 73 74 // Fields� 75 76 UByte fState; 77 UByte fTimerClients; 78 79 // Addr conflict resolution goop 80 ULong fNumAddrConflicts; 81 ULong fAddrConflicts[kMaxAddrConflicts]; 82 83 // deferred requests 84 CList* fPendingRequests; // requests waiting for ready state 85 86}; 87 88#endif // __IRLMP_H 89