|
1 // Copyright (c) 2004-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 // C32 Baseband Channel Adaptor(BCA) APIs. |
|
15 // This file contains the definition of the C32Bca interface. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef MBca2Impl_H |
|
25 #define MBca2Impl_H |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <comms-infras/commsbufpond.h> |
|
29 #include <comms-infras/commsbufchain.h> |
|
30 #include <networking/bca2factory.h> |
|
31 |
|
32 const TInt KMaxIPPacket = 1500; |
|
33 const TInt KIPTagHeaderLength = 2; |
|
34 const TInt KMaxIPPacketAndHeader = KMaxIPPacket + KIPTagHeaderLength; |
|
35 |
|
36 //forward declarations |
|
37 namespace BasebandChannelAdaptation |
|
38 { |
|
39 class MBca; |
|
40 namespace C32Bca |
|
41 { |
|
42 class CC32BcaFactory; |
|
43 } |
|
44 } |
|
45 |
|
46 namespace BasebandChannelAdaptation2 |
|
47 { |
|
48 class MBca2Factory; |
|
49 class MBca2; |
|
50 struct MBca2::TBcaParams; |
|
51 class MUpperControl; |
|
52 class MUpperDataReceiver; |
|
53 class MLowerDataSender; |
|
54 } |
|
55 |
|
56 /** This namespace includes the BCA component names.*/ |
|
57 namespace BasebandChannelAdaptation2 |
|
58 { |
|
59 namespace C32BcaShim |
|
60 { |
|
61 /** |
|
62 * The interface to the factory responsible for C32BCAshim creation. */ |
|
63 NONSHARABLE_CLASS(MBca2FactoryImpl): public CBase, public MBca2Factory |
|
64 { |
|
65 public: |
|
66 virtual void Release(); |
|
67 virtual MBca2* NewBcaL(); |
|
68 }; |
|
69 |
|
70 class CReceiver : public CActive |
|
71 { |
|
72 public: |
|
73 CReceiver(BasebandChannelAdaptation::MBca* aMBca); |
|
74 ~CReceiver(); |
|
75 |
|
76 public: // Inherited from CActive. |
|
77 virtual void RunL(); |
|
78 virtual void DoCancel(); |
|
79 void SetParams(MUpperDataReceiver* aDataReceiver, const MBca2::TBcaParams* aBcaParams); |
|
80 void StartListening(); |
|
81 |
|
82 private: |
|
83 TBuf8<KMaxIPPacketAndHeader> iData; |
|
84 const MBca2::TBcaParams* iBcaParams; |
|
85 RCommsBufChain iBufChain; |
|
86 BasebandChannelAdaptation::MBca* iMBca; |
|
87 MUpperDataReceiver* iDataReceiver; |
|
88 }; |
|
89 |
|
90 |
|
91 class CSender : public CActive |
|
92 { |
|
93 public: |
|
94 CSender(BasebandChannelAdaptation::MBca* aMBca); |
|
95 ~CSender(); |
|
96 |
|
97 public: // Inherited from CActive. |
|
98 virtual void RunL(); |
|
99 virtual void DoCancel(); |
|
100 TInt Send(TRequestStatus& aStatus,RCommsBufChain& aPdu); |
|
101 void SendBuffer(const TDesC8& aBuffer); |
|
102 |
|
103 private: |
|
104 TRequestStatus* iSendRequest; |
|
105 TBuf8<KMaxIPPacketAndHeader> iSendBuffer; |
|
106 BasebandChannelAdaptation::MBca* iMBca; |
|
107 }; |
|
108 |
|
109 //forward decl |
|
110 class MLowerDataSenderImpl; |
|
111 NONSHARABLE_CLASS(MBca2Impl): public CBase, public MBca2 |
|
112 { |
|
113 public: |
|
114 MBca2Impl(); |
|
115 ~MBca2Impl(); |
|
116 void ConstructL(); |
|
117 |
|
118 virtual TInt Open(MUpperControl& aControl, |
|
119 MUpperDataReceiver& aData, |
|
120 const TBcaParams& aBcaParams); |
|
121 |
|
122 virtual void Start(); |
|
123 |
|
124 virtual MLowerDataSender& GetSender(); |
|
125 |
|
126 virtual void Close(); |
|
127 |
|
128 virtual void Release(); |
|
129 |
|
130 virtual void SetFlowControl(TBlockOption aOption); |
|
131 |
|
132 virtual void Control(TRequestStatus& aStatus, |
|
133 TUint aOptLevel, |
|
134 TUint aOptName, |
|
135 TDes8& aOpt); |
|
136 |
|
137 virtual void CancelControl(); |
|
138 |
|
139 |
|
140 private: |
|
141 MUpperControl* iControl; |
|
142 const MBca2::TBcaParams* iBcaParams; |
|
143 MLowerDataSenderImpl* iLowerDataSender; |
|
144 CReceiver* iReceiver; |
|
145 BasebandChannelAdaptation::MBca* iMBca; |
|
146 BasebandChannelAdaptation::C32Bca::CC32BcaFactory* iC32BcaFactory; |
|
147 TBool iRecvBlocked:1; |
|
148 }; |
|
149 |
|
150 |
|
151 NONSHARABLE_CLASS(MLowerDataSenderImpl): public MLowerDataSender |
|
152 { |
|
153 public: |
|
154 static MLowerDataSenderImpl* NewL(BasebandChannelAdaptation::MBca* aMBca); |
|
155 MLowerDataSenderImpl(); |
|
156 void ConstructL(BasebandChannelAdaptation::MBca* aMBca); |
|
157 void SetControl(MUpperControl* aControl); |
|
158 virtual ~MLowerDataSenderImpl(); |
|
159 virtual TSendResult Send(RCommsBufChain& aCommsBufChain); |
|
160 private: |
|
161 CSender* iSender; |
|
162 MUpperControl* iControl; |
|
163 TBool iSendBlocked:1; |
|
164 }; |
|
165 } |
|
166 } |
|
167 #endif //MBca2Impl_H |
|
168 |