1/*
2    File:       IrIASClient.h
3
4    Contains:   Methods for implementing IrIASClient
5
6*/
7
8
9#ifndef __IRIASCLIENT_H
10#define __IRIASCLIENT_H
11
12#include "IrDATypes.h"
13#include "IrStream.h"
14#include "IrEvent.h"
15
16
17// Forward reference
18class TIrGlue;
19class TLSAPConn;
20class CBufferSegment;
21class TIASAttribute;
22
23// Constants
24
25enum IASClientStates
26{
27    kIrIASClientDisconnected,
28    kIrIASClientConnected
29};
30
31enum IASClientReceiveStates
32{
33    kIASClientReceiveReply,
34    kIASClientReceiveWaitFinal
35};
36
37#define kIASClientBufferSize        128
38
39
40// Classes
41
42// --------------------------------------------------------------------------------------------------------------------
43//                      TIASClient
44// --------------------------------------------------------------------------------------------------------------------
45
46class TIASClient : public TIrStream
47{
48	    OSDeclareDefaultStructors(TIASClient);
49
50    public:
51	    static TIASClient * tIASClient(TIrGlue* irda, TIrStream* client);
52	    void                free();
53	    Boolean             Init(TIrGlue* irda, TIrStream* client);
54
55    private:
56
57	    // TIrStream override
58	    void                NextState(ULong event);
59
60	    void                HandleDisconnectedStateEvent(ULong event);
61	    void                HandleConnectedStateEvent(ULong event);
62
63	    IrDAErr             SendRequest();
64	    void                ParseInput();
65	    IrDAErr             ParseReply();
66
67	    void                GetStart();
68	    void                PutStart();
69	    void                LookupComplete(IrDAErr result);
70
71	    // Fields�
72
73	    UByte               fState;
74	    UByte               fReceiveState;
75
76	    TIrStream           *fClient;               // Client of IASClient
77	    TIrLookupRequest    *fLookupRequest;
78
79							// we create and free the following
80	    TLSAPConn           *fLSAPConn;             // My connection "handle"
81	    TIrEvent            *fRequestReply;         // Buffer for all requests/replies
82	    TIASAttribute       *fAttribute;
83	    CBufferSegment      *fGetPutBuffer;
84
85
86};
87
88#endif // __IRIASCLIENT_H
89