|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef LINKESTABLISHMENT_H |
|
23 #define LINKESTABLISHMENT_H |
|
24 |
|
25 #include <e32base.h> |
|
26 |
|
27 class CDelay; |
|
28 class CHCTLBcsp; |
|
29 |
|
30 class TLinkState; |
|
31 class CLinkStateFactory; |
|
32 |
|
33 NONSHARABLE_CLASS(CLinkEstablishment) :public CBase |
|
34 /** |
|
35 CLinkEstablishment |
|
36 Provides the initial link establishment entity |
|
37 Owns |
|
38 CLinkStateFactory (State Pattern) |
|
39 |
|
40 This class is not intended for derivation. |
|
41 */ |
|
42 { |
|
43 public: |
|
44 void QueueReadForNextFrame(void); |
|
45 static CLinkEstablishment* NewL(CHCTLBcsp& aHCTLbcsp); |
|
46 ~CLinkEstablishment(); |
|
47 void ProcessLinkMsg(const TDesC8& aLinkMsg); |
|
48 |
|
49 |
|
50 void SendLinkMsg(const TDesC8& aLinkMsg); |
|
51 |
|
52 void SetState(const TLinkState& aLinkState); //<Change state of device |
|
53 |
|
54 |
|
55 //TLinkState Stub Functions |
|
56 |
|
57 void HandleLinkMsgSync(); |
|
58 void HandleLinkMsgSyncResp(); |
|
59 void HandleLinkMsgConf(); |
|
60 void HandleLinkMsgConfResp(); |
|
61 |
|
62 void StartShyTimer(); |
|
63 void StartConfTimer(); |
|
64 |
|
65 void StopShyTimer(); |
|
66 void StopConfTimer(); |
|
67 |
|
68 void Choke(); |
|
69 void UnChoke(); |
|
70 |
|
71 void HandlePeerReset(); |
|
72 void Reset(); |
|
73 |
|
74 TBool Muzzled(); |
|
75 void ResetMuzzled(); |
|
76 private: |
|
77 CLinkEstablishment(CHCTLBcsp& aHCTLbcsp); |
|
78 |
|
79 void ConstructL(); |
|
80 |
|
81 void ProcessConfResp(); |
|
82 void ProcessSyncResp(); |
|
83 void LinkStateMachine(const TDesC8& aLinkMsg); //processes received link messages |
|
84 void HandleConfTimeout(); |
|
85 void HandleShyTimeout(); |
|
86 static TInt ConfTimeout(TAny* aLink); |
|
87 static TInt ShyTimeout(TAny* aLink); |
|
88 |
|
89 private: |
|
90 enum TBcspLinkStateTransition |
|
91 { |
|
92 ESyncRecvd, |
|
93 EConfRecvd |
|
94 }; |
|
95 |
|
96 CHCTLBcsp& iHctlBcsp; |
|
97 CLinkStateFactory* iLinkStateFactory; |
|
98 const TLinkState* iLinkState; |
|
99 |
|
100 CDelay* iShyTimer; |
|
101 CDelay* iConfTimer; |
|
102 |
|
103 TInt iConfCnt; |
|
104 }; |
|
105 #endif //LINKESTABLISHMENT_H |
|
106 |