|
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: Abstract socket sender |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_CNCMSENDER_H |
|
22 #define C_CNCMSENDER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "ncmconnectionmultiplexer.hrh" |
|
27 |
|
28 class MNcmReceiverSenderObserver; |
|
29 class MNcmSenderObserver; |
|
30 class RSocket; |
|
31 class CNcmSendItem; |
|
32 |
|
33 /** |
|
34 * Abstract socket sender |
|
35 * |
|
36 * @lib connectionmux.lib |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 NONSHARABLE_CLASS( CNcmSender ) : public CActive |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Destructor |
|
46 */ |
|
47 virtual ~CNcmSender(); |
|
48 |
|
49 /** |
|
50 * Send action which forwards real sending operation to DoSend() |
|
51 * |
|
52 * @since S60 v3.2 |
|
53 * @param aMessage Message to be send. It will be copied |
|
54 * to iBuffer. |
|
55 * @param aSenderObserver Sender observer for this sending request |
|
56 */ |
|
57 void Send( const TDesC8& aMessage, MNcmSenderObserver* aSenderObserver ); |
|
58 |
|
59 /** |
|
60 * Cancels the specified message send processes. |
|
61 * |
|
62 * @since S60 v3.2 |
|
63 * @param aSenderObserver Observer |
|
64 * @return void |
|
65 */ |
|
66 void CancelMessageSendL( const MNcmSenderObserver* aSenderObserver ); |
|
67 |
|
68 /** |
|
69 * The real send action which should write iBuffer to iSocket |
|
70 * |
|
71 * @since S60 v3.2 |
|
72 */ |
|
73 virtual void DoSend() = 0; |
|
74 |
|
75 /** |
|
76 * Activate sending. |
|
77 * |
|
78 * @since S60 v3.2 |
|
79 * @return void |
|
80 */ |
|
81 void Activate() const; |
|
82 |
|
83 /** |
|
84 * Deactivate sending. |
|
85 * |
|
86 * @since S60 v3.2 |
|
87 * @return void |
|
88 */ |
|
89 void Deactivate(); |
|
90 |
|
91 protected: |
|
92 |
|
93 CNcmSender( RSocket& aSocket, |
|
94 MNcmReceiverSenderObserver& aObserver ); |
|
95 |
|
96 // from base class CActive |
|
97 |
|
98 void RunL(); |
|
99 |
|
100 void DoCancel(); |
|
101 |
|
102 protected: // data |
|
103 |
|
104 /** |
|
105 * Socket where to send (MUST be connected!) |
|
106 */ |
|
107 RSocket& iSocket; |
|
108 |
|
109 /** |
|
110 * Destination observer. |
|
111 */ |
|
112 MNcmReceiverSenderObserver& iObserver; |
|
113 |
|
114 /** |
|
115 * Notify type |
|
116 */ |
|
117 TMultiplexerConnectionNotifyType iNotify; |
|
118 |
|
119 /** |
|
120 * Send item array. |
|
121 * Holds packets in array if socket is busy. |
|
122 * Own. |
|
123 */ |
|
124 RPointerArray<CNcmSendItem> iSendItemArray; |
|
125 }; |
|
126 |
|
127 |
|
128 #endif // C_CNCMSENDER_H |