29
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2007 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 "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: Dataport specific network resource accessor implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_CDUNNETDATAPORT_H
|
|
20 |
#define C_CDUNNETDATAPORT_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#ifdef PRJ_USE_NETWORK_STUBS
|
|
24 |
#include <c32comm_stub.h>
|
|
25 |
#include <etelmm_stub.h>
|
|
26 |
#else
|
|
27 |
#include <etelmm.h>
|
|
28 |
#endif
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Class to store data needed for each separate "call"
|
|
32 |
* One TDunDataportEntity entity contains objects needed for one network data
|
|
33 |
* connection
|
|
34 |
*
|
|
35 |
* @lib dunutils.lib
|
|
36 |
* @since S60 v3.2
|
|
37 |
*/
|
|
38 |
NONSHARABLE_CLASS( TDunDataportEntity )
|
|
39 |
{
|
|
40 |
|
|
41 |
public:
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Dataport for one call
|
|
45 |
*/
|
|
46 |
RComm iDataport;
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Call for this entity
|
|
50 |
*/
|
|
51 |
RMobileCall iMobileCall;
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Specifies whether this entity is in use or not
|
|
55 |
*/
|
|
56 |
TBool iEntityInUse;
|
|
57 |
|
|
58 |
};
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Class for common network resource usage
|
|
62 |
* This class provides network side independent functionality
|
|
63 |
*
|
|
64 |
* @lib dunutils.lib
|
|
65 |
* @since S60 v3.2
|
|
66 |
*/
|
|
67 |
NONSHARABLE_CLASS( MDunNetwork )
|
|
68 |
{
|
|
69 |
|
|
70 |
public:
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Abstract; Initializes network
|
|
74 |
* Must be called before any other operation
|
|
75 |
*
|
|
76 |
* @since S60 3.2
|
|
77 |
* @return None
|
|
78 |
*/
|
|
79 |
virtual void InitializeL() = 0;
|
|
80 |
|
|
81 |
};
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Class for Dataport specific network resource usage
|
|
85 |
* This class is provides Dataport (RComm) dependent functionality
|
|
86 |
*
|
|
87 |
* @lib dunutils.lib
|
|
88 |
* @since S60 v3.2
|
|
89 |
*/
|
|
90 |
NONSHARABLE_CLASS( MDunNetDataport ) : public MDunNetwork
|
|
91 |
{
|
|
92 |
|
|
93 |
public:
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Abstract; Called when channel was created by transporter
|
|
97 |
* Initializes network for channel creation
|
|
98 |
*
|
|
99 |
* @since S60 3.2
|
|
100 |
* @param aComm Network ID returned when allocation successful
|
|
101 |
* @return Symbian error code on error, KErrNone otherwise
|
|
102 |
*/
|
|
103 |
virtual TInt AllocateChannel( RComm*& aComm ) = 0;
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Abstract; Called when channel was deleted/closed by transporter
|
|
107 |
* Uninitializes network for channel deletion/close
|
|
108 |
*
|
|
109 |
* @since S60 3.2
|
|
110 |
* @param aComm Network ID of owning entity that will be freed
|
|
111 |
* @return Symbian error code on error, KErrNone otherwise
|
|
112 |
*/
|
|
113 |
virtual TInt FreeChannel( RComm* aComm ) = 0;
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Gets index by network ID for Dataport
|
|
117 |
*
|
|
118 |
* @since S60 3.2
|
|
119 |
* @param aComm Index to get by this network ID
|
|
120 |
* @return Symbian error code on error, index otherwise
|
|
121 |
*/
|
|
122 |
virtual TInt GetIndexById( RComm* aComm ) = 0;
|
|
123 |
|
|
124 |
};
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Class for accessing network functionality through Dataport
|
|
128 |
* This class is needed by CDunTransporter to create abstract "channels"
|
|
129 |
* for data communication.
|
|
130 |
*
|
|
131 |
* @lib dunutils.lib
|
|
132 |
* @since S60 v3.2
|
|
133 |
*/
|
|
134 |
NONSHARABLE_CLASS( CDunNetDataport ) : public CBase, public MDunNetDataport
|
|
135 |
{
|
|
136 |
|
|
137 |
public:
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Two-phased constructor.
|
|
141 |
* @param aNumOfMaxChannels Maximum number of supported Dataport ports
|
|
142 |
* for DUN
|
|
143 |
* @return Instance of self
|
|
144 |
*/
|
|
145 |
static CDunNetDataport* NewL( TInt aNumOfMaxChannels );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Destructor.
|
|
149 |
*/
|
|
150 |
~CDunNetDataport();
|
|
151 |
|
|
152 |
// from base class MDunNetwork (MDunNetDataport -> MDunNetwork)
|
|
153 |
|
|
154 |
/**
|
|
155 |
* From MDunNetwork (MDunNetDataport -> MDunNetwork).
|
|
156 |
* Initializes network for Dataport
|
|
157 |
* Must be called before any other operation
|
|
158 |
*
|
|
159 |
* @since S60 3.2
|
|
160 |
* @return None
|
|
161 |
*/
|
|
162 |
void InitializeL();
|
|
163 |
|
|
164 |
// from base class MDunNetDataport
|
|
165 |
|
|
166 |
/**
|
|
167 |
* From MDunNetDataport.
|
|
168 |
* Called when channel was created by transporter for Dataport
|
|
169 |
* Initializes network for channel creation
|
|
170 |
*
|
|
171 |
* @since S60 3.2
|
|
172 |
* @param aComm Network ID returned when allocation successful
|
|
173 |
* @return Symbian error code on error, KErrNone otherwise
|
|
174 |
*/
|
|
175 |
TInt AllocateChannel( RComm*& aComm );
|
|
176 |
|
|
177 |
/**
|
|
178 |
* From MDunNetDataport.
|
|
179 |
* Called when channel was deleted/closed by transporter for Dataport
|
|
180 |
* Uninitializes network for channel deletion/close
|
|
181 |
*
|
|
182 |
* @since S60 3.2
|
|
183 |
* @param aComm Network ID of owning entity that will be freed
|
|
184 |
* @return Symbian error code on error, KErrNone otherwise
|
|
185 |
*/
|
|
186 |
TInt FreeChannel( RComm* aComm );
|
|
187 |
|
|
188 |
/**
|
|
189 |
* From MDunNetDataport.
|
|
190 |
* Gets index by network ID for Dataport
|
|
191 |
*
|
|
192 |
* @since S60 3.2
|
|
193 |
* @param aComm Index to get by this network ID
|
|
194 |
* @return Symbian error code on error, index otherwise
|
|
195 |
*/
|
|
196 |
TInt GetIndexById( RComm* aComm );
|
|
197 |
|
|
198 |
private:
|
|
199 |
|
|
200 |
CDunNetDataport( TInt aNumOfMaxChannels );
|
|
201 |
|
|
202 |
void ConstructL();
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Allocates phone objects for use
|
|
206 |
*
|
|
207 |
* @since S60 3.2
|
|
208 |
* @return None
|
|
209 |
*/
|
|
210 |
void AllocatePhoneObjectsL();
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Initializes first free entity
|
|
214 |
*
|
|
215 |
* @since S60 3.2
|
|
216 |
* @return Symbian error code on error, found index otherwise
|
|
217 |
*/
|
|
218 |
TInt InitializeFirstFreeEntity();
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Remove network entity by index
|
|
222 |
*
|
|
223 |
* @since S60 3.2
|
|
224 |
* @param aIndex Index which entity to remove
|
|
225 |
* @return Symbian error code on error, KErrNone otherwise
|
|
226 |
*/
|
|
227 |
TInt RemoveEntity( TInt aIndex );
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Deletes own internal data
|
|
231 |
*
|
|
232 |
* @since S60 3.2
|
|
233 |
* @return None
|
|
234 |
*/
|
|
235 |
void DeleteNetwork();
|
|
236 |
|
|
237 |
/**
|
|
238 |
* Deletes one network entity at index aIndex for Dataport
|
|
239 |
*
|
|
240 |
* @since S60 3.2
|
|
241 |
* @param aIndex Index where to delete an entity
|
|
242 |
* @param aCheckFree Check free status before deletion
|
|
243 |
* @return Symbian error code on error, KErrNone otherwise
|
|
244 |
*/
|
|
245 |
TInt DeleteNetworkEntity( TInt aIndex, TBool aCheckFree );
|
|
246 |
|
|
247 |
private: // data
|
|
248 |
|
|
249 |
/**
|
|
250 |
* Maximum number of supported Dataport ports for DUN
|
|
251 |
*/
|
|
252 |
TInt iNumOfMaxChannels;
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Array of abstractions of each "call".
|
|
256 |
* One TDunDataportEntity entity contains objects needed for one network
|
|
257 |
* data connection
|
|
258 |
*/
|
|
259 |
RArray<TDunDataportEntity> iEntities;
|
|
260 |
|
|
261 |
/**
|
|
262 |
* Communication server needed for Dataport port opening, port information
|
|
263 |
* fetching, and Dataport communication module loading and unloading
|
|
264 |
*/
|
|
265 |
RCommServ iCommServer;
|
|
266 |
|
|
267 |
/**
|
|
268 |
* Telephony server needed for opening iMobilePhone mobile phone session
|
|
269 |
* and for telephony module loading and unloading
|
|
270 |
*/
|
|
271 |
RTelServer iTelServer;
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Mobile phone server needed for opening iMobileLine mobile line session
|
|
275 |
*/
|
|
276 |
RMobilePhone iMobilePhone;
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Mobile line server needed for opening new calls to Dataport.
|
|
280 |
* Each new call is also new network data connection
|
|
281 |
*/
|
|
282 |
RMobileLine iMobileLine;
|
|
283 |
|
|
284 |
};
|
|
285 |
|
|
286 |
#endif // C_CDUNNETDATAPORT_H
|