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