1 /* |
|
2 * Copyright (c) 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 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: Packet sink where no-one gets the streaming* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCRNULLSINK_H |
|
21 #define CCRNULLSINK_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "CCRPacketSinkBase.h" |
|
25 #include "CCRPacketBuffer.h" |
|
26 #include "MCRTimerObserver.h" |
|
27 #include <e32base.h> |
|
28 |
|
29 // CONSTANTS |
|
30 // None |
|
31 |
|
32 // MACROS |
|
33 // None |
|
34 |
|
35 // DATA TYPES |
|
36 // None |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class CCRConnection; |
|
40 class RSocketServ; |
|
41 class CCRStreamingSession; |
|
42 class CCRTimer; |
|
43 class MCRConnectionObserver; |
|
44 |
|
45 // CLASS DECLARATION |
|
46 |
|
47 /** |
|
48 * Packet sink that does not forward packets. Good for testing. |
|
49 * |
|
50 * @lib CommonRecordingEngine.lib |
|
51 * @since Series 60 3.0 |
|
52 */ |
|
53 class CCRNullSink : public CCRPacketSinkBase, |
|
54 public MCRTimerObserver |
|
55 { |
|
56 |
|
57 public: // Constructors and destructors |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * @return CCRNullSink pointer. |
|
62 */ |
|
63 static CCRNullSink* NewL( CCRStreamingSession::TCRSinkId aSinkId, |
|
64 CCRStreamingSession& aOwningSession ); |
|
65 |
|
66 /** |
|
67 * Destructor |
|
68 */ |
|
69 virtual ~CCRNullSink(); |
|
70 |
|
71 public: // Public methods, testing purpose |
|
72 /** |
|
73 * Register a test observer to receive streaming information |
|
74 * @param aObserver pointer to observer |
|
75 */ |
|
76 void RegisterConnectionObs( MCRConnectionObserver* aObserver ); |
|
77 |
|
78 /** |
|
79 * Method that source uses to communicate its status. |
|
80 * @since Series 60 3.0 |
|
81 * @param aNewState is the new state of the source. |
|
82 * @return none. |
|
83 */ |
|
84 virtual void StatusChanged( MCRPacketSource::TCRPacketSourceState aNewState ); |
|
85 |
|
86 protected: // Constructors and destructors |
|
87 |
|
88 /** |
|
89 * By default default constructor is private |
|
90 * @param aSinkId that this class needs to use when reporting progress back to owner |
|
91 * @param aOwningSession is the streaming session that owns this instance |
|
92 */ |
|
93 CCRNullSink( CCRStreamingSession::TCRSinkId aSinkId, |
|
94 CCRStreamingSession& aOwningSession ); |
|
95 |
|
96 /** |
|
97 * Second phase of 2-phased construction |
|
98 */ |
|
99 void ConstructL(); |
|
100 |
|
101 private: // Methods from base classes |
|
102 |
|
103 /** |
|
104 * From CCRPacketSinkBase. |
|
105 * Connects the given buffer with this sink. |
|
106 * @since Series 60 3.0 |
|
107 * @param aBuffer is the buffer to connect with. |
|
108 * @return none. |
|
109 */ |
|
110 void SetBuffer( CCRPacketBuffer* aBuffer ); |
|
111 |
|
112 /** |
|
113 * From CCRPacketSinkBase. |
|
114 * Method for setting the sdp in use. |
|
115 * @since Series 60 3.0 |
|
116 * @param aSdp is the new sdp. |
|
117 * @return none. |
|
118 */ |
|
119 void SetSdpL( const TDesC8& aSdp ); |
|
120 |
|
121 /** |
|
122 * From CCRPacketSinkBase. |
|
123 * Adds packet to the sink. |
|
124 * @since Series 60 3.0 |
|
125 * @return none. |
|
126 */ |
|
127 void NewPacketAvailable(); |
|
128 |
|
129 /** |
|
130 * From MCRTimerObserver. |
|
131 * The function to be called when a timeout occurs. |
|
132 * @since Series 60 3.0 |
|
133 * @param aTimer a pointer to timer. |
|
134 * @return none. |
|
135 */ |
|
136 void TimerExpired( CCRTimer* aTimer ); |
|
137 |
|
138 private: // Data |
|
139 |
|
140 /** |
|
141 * SDP in use. |
|
142 */ |
|
143 HBufC8* iSdp; |
|
144 |
|
145 /** |
|
146 * Flow control timer. |
|
147 */ |
|
148 CCRTimer* iFlowTimer; |
|
149 |
|
150 /** |
|
151 * when TBool in iPacketPendingInBuffer is ETrue it means that the buffer |
|
152 * in iBuffer having same array index as said TBool has a packet. |
|
153 * waiting to be sent to rop |
|
154 */ |
|
155 TBool iPacketPendingInBuffer; |
|
156 |
|
157 /** |
|
158 * Test client observer |
|
159 */ |
|
160 MCRConnectionObserver* iObserver; |
|
161 }; |
|
162 |
|
163 #endif // CCRNULLSINK_H |
|
164 |
|
165 // End of File |
|