|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Managing abstracted "channels" of network side communication |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CDUNTRANSPORTER_H |
|
20 #define C_CDUNTRANSPORTER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #ifdef PRJ_USE_NETWORK_STUBS |
|
24 #include <c32comm_stub.h> |
|
25 #else |
|
26 #include <c32comm.h> |
|
27 #endif |
|
28 #include <es_sock.h> |
|
29 #include "DunNetDataport.h" |
|
30 |
|
31 typedef TAny* TConnId; // supported now: RSocket*, RComm* |
|
32 |
|
33 const TInt KDunStreamTypeMask = 0x02; // 10 |
|
34 const TInt KDunOperationTypeMask = 0x01; // 01 |
|
35 |
|
36 enum TDunOperationType |
|
37 { |
|
38 EDunOperationTypeUndefined = KErrNotFound, |
|
39 EDunOperationTypeRead = 0x00, // 00 |
|
40 EDunOperationTypeWrite = 0x01 // 01 |
|
41 }; |
|
42 |
|
43 enum TDunMediaContext |
|
44 { |
|
45 EDunMediaContextUndefined = KErrNotFound, |
|
46 EDunMediaContextNetwork = 0, |
|
47 EDunMediaContextLocal |
|
48 }; |
|
49 |
|
50 enum TDunMedia |
|
51 { |
|
52 EDunMediaUndefined = KErrNotFound, |
|
53 EDunMediaNetwork = 0, |
|
54 EDunMediaRComm, |
|
55 EDunMediaRSocket |
|
56 }; |
|
57 |
|
58 enum TDunDirection |
|
59 { |
|
60 EDunDirectionUndefined = KErrNotFound, |
|
61 EDunReaderUpstream = 0x00, // 00 |
|
62 EDunWriterUpstream = 0x01, // 01 |
|
63 EDunReaderDownstream = 0x02, // 10 |
|
64 EDunWriterDownstream = 0x03 // 11 |
|
65 }; |
|
66 |
|
67 enum TDunStreamType |
|
68 { |
|
69 EDunStreamTypeUndefined = KErrNotFound, |
|
70 EDunStreamTypeUpstream = 0x00, // 00 |
|
71 EDunStreamTypeDownstream = 0x02 // 10 |
|
72 }; |
|
73 |
|
74 enum TDunState |
|
75 { |
|
76 EDunStateIdle, |
|
77 EDunStateTransferring, // Transporter state for data tranfer (up/downstream) |
|
78 EDunStateSignalCopy, // Transporter state for signal copying (RComm) |
|
79 EDunStateSignalNotify, // Transporter state for signal notifying (RSocket) |
|
80 EDunStateDataWaiting, // Transporter state for data waiting |
|
81 EDunStateSignalWaiting, // Transporter state for signal waiting |
|
82 EDunStateDataPushing, // Transporter state for data pushing (multiplexer) |
|
83 EDunStateCallListen, // Transporter state for call state listening |
|
84 EDunStateAtCmdHandling, // ATEXT state for AT command handling |
|
85 EDunStateAtCmdPushing, // ATEXT state for AT command reply pushing |
|
86 EDunStateAtCmdEchoing, // ATEXT state for AT command character echoing (text mode) |
|
87 EDunStateAtUrcHandling, // ATEXT state for URC handling |
|
88 EDunStateModeListening, // ATEXT state for mode change listening |
|
89 EDunStateEcomListening, // ATEXT state for ECOM change listening |
|
90 EDunStateNvramListening, // ATEXT state for NVRAM change listening |
|
91 EDunStateUiNoting // Transporter state for UI note showing |
|
92 }; |
|
93 |
|
94 enum TDunReasonType |
|
95 { |
|
96 EDunReasonTypeSignal, |
|
97 EDunReasonTypeRW, |
|
98 EDunReasonTypeRunL |
|
99 }; |
|
100 |
|
101 class CDunChanMan; |
|
102 class MDunPluginManager; |
|
103 class MDunTransporterUtility; |
|
104 class CDunTransUtils; |
|
105 class CDunConnWaiter; |
|
106 class TDunWaiterData; |
|
107 class CDunUpstream; |
|
108 class CDunDownstream; |
|
109 class CDunSignalCopy; |
|
110 class CDunSignalNotify; |
|
111 class CDunNoteHandler; |
|
112 |
|
113 /** |
|
114 * Class used for reporting connection error's reason and signal changes |
|
115 * of network side |
|
116 * Connection error can happen in read/write and RunL error cases |
|
117 * |
|
118 * @lib dunutils.lib |
|
119 * @since S60 v3.2 |
|
120 */ |
|
121 NONSHARABLE_CLASS( TDunConnectionReason ) |
|
122 { |
|
123 |
|
124 public: |
|
125 |
|
126 /** |
|
127 * Reason type of error; either R/W or RunL |
|
128 * or signal (network side) |
|
129 * Set in all cases (signal, R/W, RunL) |
|
130 */ |
|
131 TDunReasonType iReasonType; |
|
132 |
|
133 /** |
|
134 * Context of media where error occurred: network or local |
|
135 * Set in all error cases (signal, R/W, RunL) |
|
136 */ |
|
137 TDunMediaContext iContext; |
|
138 |
|
139 /** |
|
140 * Signal type of network side |
|
141 * Set if signal case, 0 otherwise |
|
142 */ |
|
143 TUint iSignalType; |
|
144 |
|
145 /** |
|
146 * Is signal high or low of network side |
|
147 * Set if signal case, 0 otherwise |
|
148 */ |
|
149 TBool iSignalHigh; |
|
150 |
|
151 /** |
|
152 * Direction of data transfer |
|
153 * Set if R/W case, EDunDirectionUndefined otherwise |
|
154 */ |
|
155 TDunDirection iDirection; |
|
156 |
|
157 /** |
|
158 * Error code of failure |
|
159 * Set if R/W or RunL case, KErrNone otherwise |
|
160 */ |
|
161 TInt iErrorCode; |
|
162 |
|
163 }; |
|
164 |
|
165 /** |
|
166 * Notification interface class to report line status |
|
167 * |
|
168 * @lib dunutils.lib |
|
169 * @since S60 v3.2 |
|
170 */ |
|
171 NONSHARABLE_CLASS( MDunConnMon ) |
|
172 { |
|
173 |
|
174 public: |
|
175 |
|
176 /** |
|
177 * Gets called when line status changes or when any type of error is |
|
178 * detected |
|
179 * |
|
180 * @since S60 3.2 |
|
181 * @param aConnId Connection ID for callback |
|
182 * @param aConnReason Reason for progress change |
|
183 * @return None |
|
184 */ |
|
185 virtual void NotifyProgressChangeL( |
|
186 TConnId aConnId, |
|
187 TDunConnectionReason aConnReason ) = 0; |
|
188 |
|
189 }; |
|
190 |
|
191 /** |
|
192 * Notification interface class to report service advertisement status changes |
|
193 * |
|
194 * @lib dunutils.lib |
|
195 * @since S60 v3.2 |
|
196 */ |
|
197 NONSHARABLE_CLASS( MDunServAdvMon ) |
|
198 { |
|
199 |
|
200 public: |
|
201 |
|
202 /** |
|
203 * Gets called when advertisement status changes to start |
|
204 * |
|
205 * @since S60 5.0 |
|
206 * @param aCreation ETrue if channel creation |
|
207 * EFalse if channel free |
|
208 * @return None |
|
209 */ |
|
210 virtual void NotifyAdvertisementStart( TBool aCreation ) = 0; |
|
211 |
|
212 /** |
|
213 * Gets called when advertisement status changes to end |
|
214 * |
|
215 * @since S60 5.0 |
|
216 * @return None |
|
217 */ |
|
218 virtual void NotifyAdvertisementEnd() = 0; |
|
219 |
|
220 }; |
|
221 |
|
222 /** |
|
223 * Notification interface class for buffer correction |
|
224 * This interface makes possible to change suggested local media buffer size |
|
225 * |
|
226 * @lib dunutils.lib |
|
227 * @since S60 v3.2 |
|
228 */ |
|
229 NONSHARABLE_CLASS( MDunBufferCorrection ) |
|
230 { |
|
231 |
|
232 public: |
|
233 |
|
234 /** |
|
235 * Notifies about request to change local media's buffer size |
|
236 * |
|
237 * @since S60 3.2 |
|
238 * @param aLength Suggested buffer length that will be used if no |
|
239 * correction done |
|
240 * @return New (corrected) buffer length |
|
241 */ |
|
242 virtual TInt NotifyBufferCorrection( TInt aLength ) = 0; |
|
243 |
|
244 }; |
|
245 |
|
246 /** |
|
247 * Class to store data needed for each separate "channel" |
|
248 * One TDunChannelData data contains objects needed for one channel |
|
249 * |
|
250 * @lib dunutils.lib |
|
251 * @since S60 v3.2 |
|
252 */ |
|
253 NONSHARABLE_CLASS( TDunChannelData ) |
|
254 { |
|
255 |
|
256 public: |
|
257 |
|
258 /** |
|
259 * RComm object of network side |
|
260 * Not own. |
|
261 */ |
|
262 RComm* iNetwork; |
|
263 |
|
264 /** |
|
265 * RComm object of local media side |
|
266 * If this is set then iSocket is not used |
|
267 * Not own. |
|
268 */ |
|
269 RComm* iComm; |
|
270 |
|
271 /** |
|
272 * RSocket object of local media side |
|
273 * If this is set then iComm is not used |
|
274 * Not own. |
|
275 */ |
|
276 RSocket* iSocket; |
|
277 |
|
278 /** |
|
279 * Name for the channel |
|
280 */ |
|
281 HBufC8* iChannelName; |
|
282 |
|
283 /** |
|
284 * Upstream read/write object |
|
285 * Reads data from local media and writes to network |
|
286 * Not own. |
|
287 */ |
|
288 CDunUpstream* iUpstreamRW; |
|
289 |
|
290 /** |
|
291 * Downstream read/write object |
|
292 * Reads data from network and writes to local media |
|
293 * Not own. |
|
294 */ |
|
295 CDunDownstream* iDownstreamRW; |
|
296 |
|
297 /** |
|
298 * Upstream buffer (Local -> Network) |
|
299 * Not own. |
|
300 */ |
|
301 TUint8* iBufferUpstream; |
|
302 |
|
303 /** |
|
304 * Downstream buffer (Local <- Network) |
|
305 * Not own. |
|
306 */ |
|
307 TUint8* iBufferDownstream; |
|
308 |
|
309 /** |
|
310 * Pointer to upstream's buffer (Local -> Network) |
|
311 * Not own. |
|
312 */ |
|
313 TPtr8* iBufferUpPtr; |
|
314 |
|
315 /** |
|
316 * Pointer to downstream's buffer (Local <- Network) |
|
317 * Not own. |
|
318 */ |
|
319 TPtr8* iBufferDownPtr; |
|
320 |
|
321 /** |
|
322 * Upstream signal copy |
|
323 * If this is set then iSignalNotify is not used |
|
324 * Not own. |
|
325 */ |
|
326 CDunSignalCopy* iUpstreamSignalCopy; |
|
327 |
|
328 /** |
|
329 * Downstream signal copy |
|
330 * If this is set then iSignalNotify is not used |
|
331 * Not own. |
|
332 */ |
|
333 CDunSignalCopy* iDownstreamSignalCopy; |
|
334 |
|
335 /** |
|
336 * Signal notifier |
|
337 * If this is set then the following are not used: |
|
338 * iUpstreamSignalCopy, iDownstreamSignalCopy |
|
339 * Not own. |
|
340 */ |
|
341 CDunSignalNotify* iSignalNotify; |
|
342 |
|
343 /** |
|
344 * Owner's UID |
|
345 */ |
|
346 TUid iOwnerUid; |
|
347 |
|
348 /** |
|
349 * Flag that indicates whether this channel is allocated or not |
|
350 */ |
|
351 TBool iChannelInUse; |
|
352 |
|
353 }; |
|
354 |
|
355 /** |
|
356 * Class to store data needed for each plugin service advertisement |
|
357 * One TDunChannelData data contains objects needed for one plugin |
|
358 * |
|
359 * @lib dunutils.lib |
|
360 * @since S60 v3.2 |
|
361 */ |
|
362 NONSHARABLE_CLASS( TDunServAdvData ) |
|
363 { |
|
364 |
|
365 public: |
|
366 |
|
367 /** |
|
368 * Owner's UID for which to have the monitor |
|
369 */ |
|
370 TUid iOwnerUid; |
|
371 |
|
372 /** |
|
373 * Service advertisement monitor |
|
374 * Not own. |
|
375 */ |
|
376 MDunServAdvMon* iServAdvMon; |
|
377 |
|
378 }; |
|
379 |
|
380 /** |
|
381 * Class for managing abstracted "channels" of network side communication |
|
382 * This is main class to be used by other components |
|
383 * |
|
384 * @lib dunutils.lib |
|
385 * @since S60 v3.2 |
|
386 */ |
|
387 NONSHARABLE_CLASS( CDunTransporter ) : public CBase |
|
388 { |
|
389 |
|
390 friend class CDunTransUtils; |
|
391 friend class CDunChanMan; |
|
392 |
|
393 public: |
|
394 |
|
395 /** |
|
396 * Two-phased constructor. |
|
397 * @param aPluginManager Callback to call when notification via |
|
398 * MDunPluginManager to be made |
|
399 * @param aNumOfMaxChannels Number of wanted maximum channels |
|
400 * (can be omitted with 0) |
|
401 * @return Instance of self |
|
402 */ |
|
403 IMPORT_C static CDunTransporter* NewL( MDunPluginManager* aPluginManager, |
|
404 TInt aNumOfMaxChannels=0 ); |
|
405 |
|
406 /** |
|
407 * Destructor. |
|
408 */ |
|
409 virtual ~CDunTransporter(); |
|
410 |
|
411 /** |
|
412 * Number of allocated channels, is the same number as allocated and active |
|
413 * (non-waiting) channels |
|
414 * |
|
415 * @since S60 3.2 |
|
416 * @return Number of allocated channels |
|
417 */ |
|
418 IMPORT_C TInt NumberOfAllocatedChannels(); |
|
419 |
|
420 /** |
|
421 * Number of waiting channels, is the same number as allocated and inactive |
|
422 * (waiting) channels |
|
423 * |
|
424 * @since S60 3.2 |
|
425 * @return Number of waiting channels |
|
426 */ |
|
427 IMPORT_C TInt NumberOfWaitingChannels(); |
|
428 |
|
429 /** |
|
430 * Gets the number of allocated channels by owner UID, is the same number |
|
431 * as allocated and active (non-waiting) channels |
|
432 * |
|
433 * @since S60 5.0 |
|
434 * @param aOwnerUid UID of the channel owner |
|
435 * @return Number of allocated channels by UID |
|
436 */ |
|
437 IMPORT_C TInt GetNumberOfAllocatedChannelsByUid( TUid aOwnerUid ); |
|
438 |
|
439 /** |
|
440 * Gets the number of waiting channels by owner UID, is the same number |
|
441 * as allocated and inactive (waiting) channels |
|
442 * |
|
443 * @since S60 5.0 |
|
444 * @param aOwnerUid UID of the channel owner |
|
445 * @return Number of waiting channels by UID |
|
446 */ |
|
447 IMPORT_C TInt GetNumberOfWaitingChannelsByUid( TUid aOwnerUid ); |
|
448 |
|
449 /** |
|
450 * Service advertisement status |
|
451 * |
|
452 * @since S60 5.0 |
|
453 * @return ETrue if OK to advertise, EFalse otherwise |
|
454 */ |
|
455 IMPORT_C TBool AdvertisementStatus(); |
|
456 |
|
457 /** |
|
458 * Creates a channel of communication between local media (aComm) and |
|
459 * network |
|
460 * Local media object pointer also works as a connection ID for the |
|
461 * allocated channel |
|
462 * |
|
463 * @since S60 3.2 |
|
464 * @param aComm Pointer to opened local media RComm ID object |
|
465 * @param aOwnerUid UID of the channel owner |
|
466 * @param aName Name for the channel |
|
467 * @param aEnqueuedFail ETrue if enqueued failure, EFalse otherwise |
|
468 * @param aCorrection Pointer to object implementing buffer correction |
|
469 * @return None |
|
470 */ |
|
471 IMPORT_C void AllocateChannelL( |
|
472 RComm* aComm, |
|
473 TUid aOwnerUid, |
|
474 const TDesC8& aName, |
|
475 TBool aEnqueuedFail, |
|
476 MDunBufferCorrection* aCorrection=NULL ); |
|
477 |
|
478 /** |
|
479 * Creates a channel of communication between local media (aSocket) and |
|
480 * network |
|
481 * Local media object pointer also works as a connection ID for the |
|
482 * allocated channel |
|
483 * |
|
484 * @since S60 3.2 |
|
485 * @param aSocket Pointer to opened local media RSocket ID object |
|
486 * @param aOwnerUid UID of the channel owner |
|
487 * @param aName Name for the channel |
|
488 * @param aEnqueuedFail ETrue if enqueued failure, EFalse otherwise |
|
489 * @param aNoFreeChans ETrue if no free channels, EFalse otherwise |
|
490 * @return None |
|
491 */ |
|
492 IMPORT_C void AllocateChannelL( |
|
493 RSocket* aSocket, |
|
494 TUid aOwnerUid, |
|
495 const TDesC8& aName, |
|
496 TBool aEnqueuedFail, |
|
497 TBool& aNoFreeChans ); |
|
498 |
|
499 /** |
|
500 * Frees an allocated channel by local media (aComm) connection ID |
|
501 * |
|
502 * @since S60 3.2 |
|
503 * @param aComm Pointer to opened local media RComm ID object |
|
504 * @return Symbian error code on error, KErrNone otherwise |
|
505 */ |
|
506 IMPORT_C TInt FreeChannel( RComm* aComm ); |
|
507 |
|
508 /** |
|
509 * Frees an allocated channel by local media (aSocket) connection ID |
|
510 * |
|
511 * @since S60 3.2 |
|
512 * @param aSocket Pointer to opened local media RSocket ID object |
|
513 * @return Symbian error code on error, KErrNone otherwise |
|
514 */ |
|
515 IMPORT_C TInt FreeChannel( RSocket* aSocket ); |
|
516 |
|
517 /** |
|
518 * Issues transfer requests for all transfer objects by local media |
|
519 * (aComm) connection ID |
|
520 * This will cause the Transporter by be ready for transferring data |
|
521 * |
|
522 * @since S60 3.2 |
|
523 * @param aComm Pointer to opened local media RComm ID object |
|
524 * @return None |
|
525 */ |
|
526 IMPORT_C void IssueTransferRequestsL( RComm* aComm ); |
|
527 |
|
528 /** |
|
529 * Issues transfer requests for all transfer objects by local media |
|
530 * (aSocket) connection ID |
|
531 * This will cause the Transporter by be ready for transferring data |
|
532 * |
|
533 * @since S60 3.2 |
|
534 * @param aSocket Pointer to opened local media RSocket ID object |
|
535 * @return None |
|
536 */ |
|
537 IMPORT_C void IssueTransferRequestsL( RSocket* aSocket ); |
|
538 |
|
539 /** |
|
540 * Stops transfers for all transfer objects by local media (aComm) |
|
541 * connection ID |
|
542 * |
|
543 * @since S60 3.2 |
|
544 * @param aComm Pointer to opened local media RComm ID object |
|
545 * @return Symbian error code on error, KErrNone otherwise |
|
546 */ |
|
547 IMPORT_C TInt StopTransfers( RComm* aComm ); |
|
548 |
|
549 /** |
|
550 * Stops transfers for all transfer objects by local media (aSocket) |
|
551 * connection ID |
|
552 * |
|
553 * @since S60 3.2 |
|
554 * @param aSocket Pointer to opened local media RSocket ID object |
|
555 * @return Symbian error code on error, KErrNone otherwise |
|
556 */ |
|
557 IMPORT_C TInt StopTransfers( RSocket* aSocket ); |
|
558 |
|
559 /** |
|
560 * Adds connection monitor callback for either local media or network side |
|
561 * by connection ID |
|
562 * Callbacks will be called read/write error is detected during endpoint |
|
563 * operation |
|
564 * |
|
565 * @since S60 3.2 |
|
566 * @param aComm Pointer to opened local media RComm ID object |
|
567 * @param aCallback Pointer to object whose callbacks will be called |
|
568 * @param aDirection Direction of operation to monitor for read/write error |
|
569 * @param aSignal ETrue if also signal notification wanted from network side |
|
570 * @return None |
|
571 */ |
|
572 IMPORT_C void AddConnMonCallbackL( RComm* aComm, |
|
573 MDunConnMon* aCallback, |
|
574 TDunDirection aDirection, |
|
575 TBool aSignal ); |
|
576 |
|
577 /** |
|
578 * Adds connection monitor callback for either local media or network side |
|
579 * by connection ID |
|
580 * Callbacks will be called when line status switches to high or low |
|
581 * |
|
582 * @since S60 3.2 |
|
583 * @param aSocket Pointer to opened local media RSocket ID object |
|
584 * @param aCallback Pointer to object whose callbacks will be called |
|
585 * @param aDirection Direction of operation to monitor for read/write error |
|
586 * @param aSignal ETrue if also signal notification wanted from network side |
|
587 * @return None |
|
588 */ |
|
589 IMPORT_C void AddConnMonCallbackL( RSocket* aSocket, |
|
590 MDunConnMon* aCallback, |
|
591 TDunDirection aDirection, |
|
592 TBool aSignal ); |
|
593 |
|
594 /** |
|
595 * Adds error to consider as no error condition when doing any of the four |
|
596 * endpoint's read/writer operation |
|
597 * |
|
598 * @since S60 3.2 |
|
599 * @param aError Error code to consider as "no error" |
|
600 * @param aComm Pointer to opened local media RComm ID object |
|
601 * @param aDirection One of four data transfer endpoints where to add a |
|
602 * skipped error code |
|
603 * @return None |
|
604 */ |
|
605 IMPORT_C void AddSkippedErrorL( TInt aError, |
|
606 RComm* aComm, |
|
607 TDunDirection aDirection ); |
|
608 |
|
609 /** |
|
610 * Adds error to consider as no error condition when doing any of the four |
|
611 * endpoint's read/writer operation |
|
612 * |
|
613 * @since S60 3.2 |
|
614 * @param aError Error code to consider as "no error" |
|
615 * @param aSocket Pointer to opened local media RSocket ID object |
|
616 * @param aDirection One of four data transfer endpoints where to add a |
|
617 * skipped error code |
|
618 * @return None |
|
619 */ |
|
620 IMPORT_C void AddSkippedErrorL( TInt aError, |
|
621 RSocket* aSocket, |
|
622 TDunDirection aDirection ); |
|
623 |
|
624 /** |
|
625 * Sets service advertisement monitor callback by owner UID |
|
626 * Callbacks will be called when advertisement status changes. |
|
627 * The callbacks are updated with every successfully completed |
|
628 * channel allocation/free (and allocation failure) so it is recommended |
|
629 * to call this method after AllocateChannelL(). |
|
630 * |
|
631 * @since S60 5.0 |
|
632 * @param aOwnerUid Owner's UID for which to have the monitor |
|
633 * @param aCallback Pointer to object whose callbacks will be called |
|
634 * @return None |
|
635 */ |
|
636 IMPORT_C void SetAdvertisementMonitorL( TUid aOwnerUid, |
|
637 MDunServAdvMon* aCallback ); |
|
638 |
|
639 /** |
|
640 * Frees service advertisement monitor callback by owner UID |
|
641 * |
|
642 * @since S60 5.0 |
|
643 * @param aOwnerUid Owner's UID for which to have the monitor |
|
644 * @param aCallback Pointer to object whose callbacks will be called |
|
645 * @return Symbian error code on error, KErrNone otherwise |
|
646 */ |
|
647 IMPORT_C TInt FreeAdvertisementMonitor( TUid aOwnerUid, |
|
648 MDunServAdvMon* aCallback ); |
|
649 |
|
650 private: |
|
651 |
|
652 CDunTransporter( MDunPluginManager* aPluginManager, |
|
653 TInt aNumOfMaxChannels ); |
|
654 |
|
655 void ConstructL(); |
|
656 |
|
657 /** |
|
658 * Initializes the transporter, must be called as the first operation |
|
659 * |
|
660 * @since S60 3.2 |
|
661 * @return KErrAlreadyExists = already initialized, |
|
662 * KErrGeneral = network initialization failed, |
|
663 * KErrNone otherwise |
|
664 */ |
|
665 TInt InitializeL(); |
|
666 |
|
667 /** |
|
668 * UnInitializes the transporter, can be called as the last operation |
|
669 * |
|
670 * @since S60 3.2 |
|
671 * @return None |
|
672 */ |
|
673 void UnInitialize(); |
|
674 |
|
675 /** |
|
676 * Initialize the transporter |
|
677 * |
|
678 * @since S60 3.2 |
|
679 * @return Symbian error code on error, KErrNone otherwise |
|
680 */ |
|
681 TInt InitializeOnDemand(); |
|
682 |
|
683 /** |
|
684 * UnInitialize the transporter |
|
685 * |
|
686 * @since S60 3.2 |
|
687 * @return Symbian error code on error, KErrNone otherwise |
|
688 */ |
|
689 TInt UnInitializeOnDemand(); |
|
690 |
|
691 /** |
|
692 * Returns index of media for connection ID |
|
693 * |
|
694 * @since S60 3.2 |
|
695 * @param aConnId Connection ID for media |
|
696 * @param aMediaContext Context of media to search for; either local or |
|
697 * network |
|
698 * @return Symbian error code on error, found index otherwise |
|
699 */ |
|
700 TInt GetMediaIndex( TConnId aConnId, |
|
701 TDunMediaContext aMediaContext=EDunMediaContextLocal ); |
|
702 |
|
703 /** |
|
704 * Returns index of media for connection ID |
|
705 * |
|
706 * @since S60 3.2 |
|
707 * @param aConnId Connection ID for media |
|
708 * @param aMediaContext Context of media to search for; either local or |
|
709 * network |
|
710 * @return Found index |
|
711 */ |
|
712 TInt GetMediaIndexL( TConnId aConnId, |
|
713 TDunMediaContext aMediaContext=EDunMediaContextLocal ); |
|
714 |
|
715 /** |
|
716 * Checks initialization and RSubSessionBase() handle |
|
717 * |
|
718 * @since S60 3.2 |
|
719 * @param aConnId Connection ID for media |
|
720 * @return KErrNotReady if not initialized, KErrBadHandle if no handle |
|
721 */ |
|
722 TInt CheckInitAndHandle( TConnId aConnId ); |
|
723 |
|
724 /** |
|
725 * Deletes own internal data |
|
726 * |
|
727 * @since S60 3.2 |
|
728 * @return None |
|
729 */ |
|
730 void DeleteTransporter(); |
|
731 |
|
732 private: // data |
|
733 |
|
734 /** |
|
735 * Pointer to common utility class |
|
736 * Own. |
|
737 */ |
|
738 MDunTransporterUtility* iUtility; |
|
739 |
|
740 /** |
|
741 * Pointer to RComm channel manager class |
|
742 * Own. |
|
743 */ |
|
744 CDunChanMan* iChanMan; |
|
745 |
|
746 /** |
|
747 * Pointer to note handler class |
|
748 * Own. |
|
749 */ |
|
750 CDunNoteHandler* iNoteHandler; |
|
751 |
|
752 /** |
|
753 * Array of abstractions of each "channel" |
|
754 * One TDunChannelData entry contains objects needed for one channel |
|
755 */ |
|
756 RArray<TDunChannelData> iChannelData; |
|
757 |
|
758 /** |
|
759 * Array of service advertisement data for each plugin |
|
760 * One TDunServAdvData entry contains objects needed for one plugin |
|
761 */ |
|
762 RArray<TDunServAdvData> iServAdvData; |
|
763 |
|
764 /** |
|
765 * Callback to call when notification via MDunPluginManager to be made |
|
766 * Not own. |
|
767 */ |
|
768 MDunPluginManager* iPluginManager; |
|
769 |
|
770 /** |
|
771 * Number of channels that are active |
|
772 * Used for updating KPSUidDialupConnStatus Pub&Sub key |
|
773 */ |
|
774 TInt iActiveChannels; |
|
775 |
|
776 /** |
|
777 * Number of wanted maximum channels (can be omitted with 0) |
|
778 * Used for initialization of this class |
|
779 */ |
|
780 TInt iNumOfMaxChannels; |
|
781 |
|
782 /** |
|
783 * Indicates whether this class is initialized or not |
|
784 */ |
|
785 TBool iInitialized; |
|
786 |
|
787 /** |
|
788 * Indicates whether or not it is OK to advertise services |
|
789 */ |
|
790 TBool iAdvertise; |
|
791 |
|
792 /** |
|
793 * Instance of network side abstraction |
|
794 * Own. |
|
795 */ |
|
796 CDunNetDataport* iNetwork; |
|
797 |
|
798 }; |
|
799 |
|
800 #endif // C_CDUNTRANSPORTER_H |