44
|
1 |
//
|
|
2 |
// * Copyright 2004 Neusoft America Inc.
|
|
3 |
// * All rights reserved.
|
|
4 |
// * This component and the accompanying materials are made available
|
|
5 |
// * under the terms of the Eclipse Public License v1.0
|
|
6 |
// * which accompanies this distribution, and is available
|
|
7 |
// * at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
// *
|
|
9 |
// * Contributors:
|
|
10 |
// * Keith Collins (Neusoft America Inc.) original software development and additional code and modifications.
|
|
11 |
// * Thomas Gahagen (Neusoft America Inc.) additional code and modifications.
|
|
12 |
// * Zhen Yuan (Neusoft America Inc.) additional code and modifications.
|
|
13 |
// *
|
|
14 |
// * Description: This file contains the declaration for class CChannelMgrBase.
|
|
15 |
// * Class CChannelMgrBase is an abstract class that is inherted by
|
|
16 |
// * classes that define a single 3GPP 27.010 based logical channel (DLC).
|
|
17 |
// * Derived classes are either control, command and data channels.
|
|
18 |
//
|
|
19 |
|
|
20 |
// ChannelMgrBase.h
|
|
21 |
|
|
22 |
/** @file ChannelMgrBase.h
|
|
23 |
*
|
|
24 |
* This file contains the declaration for class CChannelMgrBase.
|
|
25 |
* Class CChannelMgrBase is an abstract class that is inherted by
|
|
26 |
* classes that define a single 3GPP 27.010 based logical channel (DLC).
|
|
27 |
* Derived classes are either control, command and data channels.
|
|
28 |
*/
|
|
29 |
|
|
30 |
#ifndef _CHANNELMGRBASE_H_
|
|
31 |
#define _CHANNELMGRBASE_H_
|
|
32 |
|
|
33 |
#include <e32base.h>
|
|
34 |
#include <c32comm.h>
|
|
35 |
#include "CsyGlobals.h"
|
|
36 |
#include "timeouter.h"
|
|
37 |
|
|
38 |
class CPortFactory;
|
|
39 |
class CMux0710Protocol;
|
|
40 |
class CPortC32InterfaceBase;
|
|
41 |
class CPortC32Interface;
|
|
42 |
class CFrameToBPQueue;
|
|
43 |
class CFrameToClientQueue;
|
|
44 |
class CChannelObserverAo;
|
|
45 |
class CCsyMsgBufBpFrame;
|
|
46 |
|
|
47 |
/**
|
|
48 |
* CChannelMgrBase is an abstract class that is inherted by
|
|
49 |
* classes that define a single 3GPP 27.010 based logical channel (DLC).
|
|
50 |
* Derived classes are either control or cmd/data channels.
|
|
51 |
*/
|
|
52 |
class CChannelMgrBase : public CBase, public MTimeoutObserver
|
|
53 |
{
|
|
54 |
public:
|
|
55 |
enum TCsyChannelState
|
|
56 |
{
|
|
57 |
ECsyChannelStateDisconnected, // Channel is Disconnected
|
|
58 |
ECsyChannelStateParameterNegotiating, // Channel was disconnected and has sent Parameter Negotiation
|
|
59 |
ECsyChannelStateConnecting, // Channel was disconnected and has sent a SABM to be connected
|
|
60 |
ECsyChannelStateMSCsent,
|
|
61 |
ECsyChannelStateWaitingForChannelReady,
|
|
62 |
ECsyChannelStateConnected, // Channel is Connected, Data can be transmitted
|
|
63 |
ECsyChannelStateDisconnecting, // Channel was connected and is now waiting to be disconnected
|
|
64 |
ECsyChannelStateFlowControlOff, // Channel has been Xoff'd by the baseband
|
|
65 |
ECsyChannelStateTransmitError // Not receive after timeout and retransmite, Link error
|
|
66 |
};
|
|
67 |
|
|
68 |
public:
|
|
69 |
CChannelMgrBase(const TUint8 aDlcNum,
|
|
70 |
CPortFactory& aPortFactory,
|
|
71 |
CMux0710Protocol& aMux0710Protocol);
|
|
72 |
|
|
73 |
virtual ~CChannelMgrBase();
|
|
74 |
|
|
75 |
TInt Connect();
|
|
76 |
TInt Disconnect();
|
|
77 |
TInt ParameterNegotiate();
|
|
78 |
|
|
79 |
void ProcessRecvFrame(CCsyMsgBufBpFrame* aBpFrame);
|
|
80 |
|
|
81 |
TDes8& RefToMsgBuffer();
|
|
82 |
|
|
83 |
TUint8 GetDlcNumber() const;
|
|
84 |
TCsyChannelState GetChannelState() const;
|
|
85 |
|
|
86 |
void WaitForChannelReady();
|
|
87 |
void NotifyChannelReady();
|
|
88 |
|
|
89 |
CPortC32InterfaceBase* GetC32Port() const;
|
|
90 |
|
|
91 |
void MscReceived(TUint8 aV24Signals);
|
|
92 |
TInt SendMscCommand(TUint8 aV24Signals);
|
|
93 |
|
|
94 |
void ModemAndCsyToClientFlowCtrl(const TFlowControl aFlowControl);
|
|
95 |
void ReceivedV24Signals(const TUint8 aV24Signals);
|
|
96 |
|
|
97 |
inline TFlowControl CsyToModemFlowControl();
|
|
98 |
TInt SetCsyToModemFlowControl(TFlowControl aFlowControl);
|
|
99 |
|
|
100 |
TInt PlaceOnOutboundQueue();
|
|
101 |
void WriteCancel();
|
|
102 |
|
|
103 |
inline TFlowControl GetModemAndCsyToClientFlowControl();
|
|
104 |
|
|
105 |
public://From MTimeoutObserver
|
|
106 |
void TimedOut();
|
|
107 |
|
|
108 |
protected:
|
|
109 |
void ConstructL();
|
|
110 |
|
|
111 |
void IssueNotificationRequest();
|
|
112 |
|
|
113 |
virtual void ProcessRecvUihFrame(CCsyMsgBufBpFrame* aBpFrame) = 0;
|
|
114 |
void ProcessNonUihRecvFrame(CCsyMsgBufBpFrame* aBpFrame);
|
|
115 |
|
|
116 |
protected:
|
|
117 |
|
|
118 |
TUint8 iV24Signals;
|
|
119 |
|
|
120 |
const TUint8 iDlcNum;
|
|
121 |
|
|
122 |
TCsyChannelState iChannelState;
|
|
123 |
CPortFactory& iPortFactory;
|
|
124 |
CPortC32InterfaceBase* iPortC32Interface;
|
|
125 |
CMux0710Protocol& iMux0710Protocol;
|
|
126 |
|
|
127 |
TBuf8<KMaxIpPacketSize> iDataToSendToModem;
|
|
128 |
|
|
129 |
TBool iChannelReady;
|
|
130 |
TBool iInitFinished;
|
|
131 |
|
|
132 |
TInt iTimeoutVal;
|
|
133 |
TInt iTxCountLimit;
|
|
134 |
TInt iTxCount;
|
|
135 |
|
|
136 |
CChannelObserverAo* iChannelObserverAo;
|
|
137 |
CActiveTimeouter* iTimeouter;
|
|
138 |
|
|
139 |
TBool iMscReplyExpected;
|
|
140 |
|
|
141 |
// modem -> csy flow control - controls the CSY sending frames to the modem
|
|
142 |
TFlowControl iCsyAllowedToSendFrames;
|
|
143 |
|
|
144 |
// csy -> modem flow control - controls the modem sending frames to the CSY
|
|
145 |
TFlowControl iModemAllowedToSendFrames;
|
|
146 |
TBool iDelayedWriteToModem;
|
|
147 |
|
|
148 |
};
|
|
149 |
|
|
150 |
// Inline methods
|
|
151 |
|
|
152 |
inline TFlowControl CChannelMgrBase::CsyToModemFlowControl()
|
|
153 |
/**
|
|
154 |
* Return the current CSY to modem flow control status for this channel.
|
|
155 |
*/
|
|
156 |
{
|
|
157 |
return iModemAllowedToSendFrames;
|
|
158 |
}
|
|
159 |
|
|
160 |
inline TUint8 CChannelMgrBase::GetDlcNumber() const
|
|
161 |
/**
|
|
162 |
* Return the DLC number of the channel manager object.
|
|
163 |
*
|
|
164 |
* @return DLC number
|
|
165 |
*/
|
|
166 |
{
|
|
167 |
return iDlcNum;
|
|
168 |
}
|
|
169 |
|
|
170 |
inline CChannelMgrBase::TCsyChannelState CChannelMgrBase::GetChannelState() const
|
|
171 |
/**
|
|
172 |
* Return the channel state.
|
|
173 |
*
|
|
174 |
* @return Channel state
|
|
175 |
*/
|
|
176 |
{
|
|
177 |
return iChannelState;
|
|
178 |
}
|
|
179 |
|
|
180 |
inline CPortC32InterfaceBase* CChannelMgrBase::GetC32Port() const
|
|
181 |
/**
|
|
182 |
* Return a pointer to the C32 port associated with this channel manager object.
|
|
183 |
*
|
|
184 |
* @return Pointer to the C32 port associated with this channel manager object
|
|
185 |
*/
|
|
186 |
{
|
|
187 |
return iPortC32Interface;
|
|
188 |
}
|
|
189 |
|
|
190 |
inline TFlowControl CChannelMgrBase::GetModemAndCsyToClientFlowControl()
|
|
191 |
/**
|
|
192 |
* Return the current flow control state of the channel.
|
|
193 |
*
|
|
194 |
* @return Flow control state
|
|
195 |
*/
|
|
196 |
{
|
|
197 |
return iCsyAllowedToSendFrames;
|
|
198 |
}
|
|
199 |
|
|
200 |
/* CChannelObserverAo use to block until channel init is finished
|
|
201 |
*/
|
|
202 |
class CChannelObserverAo :public CActive
|
|
203 |
{
|
|
204 |
public:
|
|
205 |
static CChannelObserverAo* NewL();
|
|
206 |
~CChannelObserverAo();
|
|
207 |
|
|
208 |
void StartWait();
|
|
209 |
void ChannelReady();
|
|
210 |
|
|
211 |
protected:// from CActive
|
|
212 |
void RunL();
|
|
213 |
void DoCancel();
|
|
214 |
|
|
215 |
private:
|
|
216 |
CChannelObserverAo();
|
|
217 |
};
|
|
218 |
|
|
219 |
#endif // _CHANNELMGRBASE_H_ |