author | mikaruus <mika.a.ruuskanen@nokia.com> |
Thu, 14 Jan 2010 10:44:58 +0200 | |
changeset 5 | 8ccc39f9d787 |
parent 0 | 63b37f68c1ce |
child 8 | 6295dc2169f3 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "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 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
#ifndef CMODEMATSRV_H |
|
21 |
#define CMODEMATSRV_H |
|
22 |
||
23 |
#include <e32svr.h> |
|
24 |
#include "cmodemathandler.h" //KMaxDteIdCount |
|
25 |
#include "modemattrace.h" |
|
26 |
||
27 |
const TUint8 KInitialDteId = 999; |
|
28 |
const TUint8 EAtCmd = 0; |
|
29 |
const TUint8 EGetNvramStatus = 1; |
|
30 |
||
31 |
/* |
|
32 |
* Reference: i_at_modem_fp_3.1.doc (3.5.2) |
|
33 |
* If the unsolicited data needs to be sent to all of the connected DTE sessions, |
|
34 |
* AT Modem server would send the unsolicited data indication to the client with |
|
35 |
* the dte id as 0xFF. The 0xFF value for the DTE id is reserved for the |
|
36 |
* unsolicited data indication. |
|
37 |
*/ |
|
38 |
const TUint8 KUnsolicitedDataDteId = 0xff; |
|
39 |
||
40 |
const TInt KATModemCommandArgumentIndex = 0; |
|
41 |
const TInt KATModemResponseArgumentIndex = 1; |
|
42 |
const TInt KATModemUnsolicitedDataIndex = 0; |
|
43 |
||
44 |
_LIT8( KEmptyString, ""); |
|
45 |
||
46 |
class CModemAtSession; |
|
47 |
class CAtMessage; |
|
48 |
||
49 |
/** |
|
50 |
* CModemAtSrv server core class. CModemAtsrc creates/deletes sessions. Dte-ids are allocated |
|
51 |
* by CmodemAtSrv. |
|
52 |
*/ |
|
53 |
NONSHARABLE_CLASS( CModemAtSrv ) : public CPolicyServer |
|
54 |
{ |
|
55 |
||
56 |
public: |
|
57 |
||
58 |
/** |
|
59 |
* Two-phased constructor. |
|
60 |
*/ |
|
61 |
static CModemAtSrv* NewLC(); |
|
62 |
||
63 |
/** |
|
64 |
* Destructor. |
|
65 |
*/ |
|
66 |
~CModemAtSrv(); |
|
67 |
||
68 |
/** |
|
69 |
* When session is closed, this function is called. |
|
70 |
* @param aSession Reference to the session |
|
71 |
*/ |
|
72 |
void ClientClosed( CModemAtSession* aSession ); |
|
73 |
||
74 |
/** |
|
75 |
* Session count |
|
76 |
* @return Number of sessions open |
|
77 |
*/ |
|
78 |
TInt SessionCount(); |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
79 |
|
0 | 80 |
/** |
81 |
* Connect session to the modem |
|
82 |
* @param CModemAtSession* aSession Pointer to the session |
|
83 |
* @return Connection status: KErrNone, KErrAlreadyExists |
|
84 |
*/ |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
85 |
TInt ConnectToModem( CModemAtSession* aSession); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
86 |
|
0 | 87 |
/** |
88 |
* HandleSignalInd |
|
89 |
* @param aDteId Device Terminal ID |
|
90 |
*/ |
|
91 |
void HandleSignalInd( const TInt aDteId ); |
|
92 |
/** |
|
93 |
* HandleUnsolicitedData |
|
94 |
* @param aDteId Device Terminal ID |
|
95 |
* @param aData Descriptor data |
|
96 |
*/ |
|
97 |
void HandleUnsolicitedData( const TInt aDteId, const TDesC8& aData ); |
|
98 |
/** |
|
99 |
* HandleIntermediateDataInd |
|
100 |
* @param aDteId Device Terminal ID |
|
101 |
* @param aPluginType Plugin type |
|
102 |
* @param aResponse Response buffer |
|
103 |
* @param aCommand Command buffer |
|
104 |
*/ |
|
105 |
void HandleIntermediateDataInd( const TInt aDteId, const TATPluginInterface aPluginType, const TDesC8& aResponse, const TUint8 aCommand ); |
|
106 |
||
107 |
/** |
|
108 |
* HandleATResponse |
|
109 |
* @param aDteId Device Terminal ID |
|
110 |
* @param aResponse Response buffer |
|
111 |
*/ |
|
112 |
void HandleATResponse( const TInt aDteId, const TDesC8& aResponse, const TUint8 aCommand ); |
|
113 |
||
114 |
/** |
|
115 |
* BroadcastModemConnected |
|
116 |
* @param aDteId Device Terminal ID |
|
117 |
* @param aErr KErrNone if connected, otherwise KErrGeneral |
|
118 |
*/ |
|
119 |
void BroadcastModemConnected(const TUint aDteId, TInt aErr ); |
|
120 |
||
121 |
/** |
|
122 |
* HandleCommandModeChange |
|
123 |
* @param aDteId Device Terminal ID |
|
124 |
* @param aMode Command mode 0 or data mode 1 |
|
125 |
*/ |
|
126 |
void HandleCommandModeChange( TInt aDteId, TCommandMode aMode ); |
|
127 |
||
128 |
/** |
|
129 |
* AddToSendFifo |
|
130 |
* @param aDteId Device Terminal ID |
|
131 |
* @param aPluginType Plugin type |
|
132 |
* @param aMessage RMessage2 container class |
|
133 |
*/ |
|
134 |
void AddToSendFifo( const TUint8 aDteId, const TATPluginInterface aPluginType, CAtMessage* aMessage ); |
|
135 |
||
136 |
/** |
|
137 |
* RemoveFirstFromSendFifo |
|
138 |
*/ |
|
139 |
void RemoveFirstFromSendFifo(); |
|
140 |
||
141 |
/** |
|
142 |
* SendNextFromFifo |
|
143 |
*/ |
|
144 |
void SendNextFromFifo(); |
|
145 |
||
146 |
/** |
|
147 |
* CancelFifoRequests |
|
148 |
* @param aSession Session class pointer |
|
149 |
*/ |
|
150 |
void CancelFifoRequests( const CModemAtSession* aSession ); |
|
151 |
||
152 |
/** |
|
153 |
* RemovePipe |
|
154 |
* @param aDteId Device Terminal ID |
|
155 |
*/ |
|
156 |
void RemovePipe( const TUint8 aDteId ); |
|
157 |
||
158 |
private: |
|
159 |
||
160 |
/** |
|
161 |
* Creates a new session to client |
|
162 |
* |
|
163 |
* @param aVersion the version |
|
164 |
* @param aMessage not used |
|
165 |
* @return The new created session |
|
166 |
*/ |
|
167 |
CSession2* NewSessionL( const TVersion& aVersion, |
|
168 |
const RMessage2& aMessage ) const; |
|
169 |
||
170 |
/** |
|
171 |
* Constructor |
|
172 |
* |
|
173 |
* @param aPriority This AO's priority |
|
174 |
*/ |
|
175 |
CModemAtSrv( TInt aPriority ); |
|
176 |
||
177 |
/** |
|
178 |
* Two-Phase constructor |
|
179 |
*/ |
|
180 |
void ConstructL(); |
|
181 |
||
182 |
||
183 |
private: // data |
|
184 |
||
185 |
RPointerArray<CModemAtSession> iSessions; //Sessions from R-interface |
|
186 |
CModemAtSession* iRouteTable[KPluginCount][KMaxDteIdCount]; //Messages are routed to session by this table |
|
187 |
RPointerArray<CAtMessage> iAtMessageArray; |
|
188 |
CModemAtHandler* iHandler; |
|
189 |
}; |
|
190 |
||
191 |
#endif // CMODEMATSRV_H |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
192 |