|
1 /* |
|
2 * Copyright (c) 2007-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: Declares CQueueHandler class which handles VoIP client/server |
|
15 * messaging. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __VOIPQUEUEHANDLER_H |
|
21 #define __VOIPQUEUEHANDLER_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <e32msgqueue.h> |
|
27 #include "VoIPAudioClientServer.h" // for TVoIPMsgBuf |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CVoIPDataBuffer; |
|
31 |
|
32 |
|
33 /** |
|
34 * MQueueHandlerObserver |
|
35 * Responsible for sending callbacks to the VoIP client app |
|
36 */ |
|
37 class MQueueHandlerObserver |
|
38 { |
|
39 public: |
|
40 virtual void FillBuffer(CVoIPDataBuffer* aBuffer) = 0; |
|
41 virtual void EmptyBuffer(CVoIPDataBuffer* aBuffer) = 0; |
|
42 virtual void Event(TInt aEventType, TInt aError) = 0; |
|
43 }; |
|
44 |
|
45 |
|
46 /** |
|
47 * CQueueHandler |
|
48 * |
|
49 */ |
|
50 NONSHARABLE_CLASS(CQueueHandler) : public CActive |
|
51 { |
|
52 public: |
|
53 |
|
54 /** |
|
55 * NewL() |
|
56 * Contructor |
|
57 * |
|
58 */ |
|
59 static CQueueHandler* NewL(MQueueHandlerObserver* aObserver, |
|
60 RMsgQueue<TVoIPMsgBuf>* aMsgQueue, |
|
61 TInt aBufferLen = 0); |
|
62 |
|
63 /** |
|
64 * destructor |
|
65 */ |
|
66 virtual ~CQueueHandler(); |
|
67 |
|
68 /** |
|
69 * Start |
|
70 * Starts listening for events. |
|
71 * |
|
72 */ |
|
73 void Start(); |
|
74 |
|
75 /** |
|
76 * Returns request status. |
|
77 */ |
|
78 TRequestStatus* Status(); |
|
79 |
|
80 private: |
|
81 |
|
82 /** |
|
83 * constructor |
|
84 */ |
|
85 CQueueHandler(RMsgQueue<TVoIPMsgBuf>* aMsgQueue); |
|
86 |
|
87 void ConstructL(MQueueHandlerObserver* aObserver, TInt aBufferLen); |
|
88 |
|
89 // from CActive |
|
90 void DoCancel(); |
|
91 void RunL(); |
|
92 TInt RunError(TInt aError); |
|
93 void DoFillBuffer(TInt aBufLen, TInt aStatus); |
|
94 void DoEmptyBuffer(TInt aBufLen, TInt aStatus); |
|
95 |
|
96 private: // data |
|
97 |
|
98 MQueueHandlerObserver* iObserver; // (not owned) |
|
99 RMsgQueue<TVoIPMsgBuf>* iMsgQueue; |
|
100 |
|
101 RChunk iChunk; |
|
102 TPtr8 iChunkDataPtr; |
|
103 CVoIPDataBuffer* iBuffer; |
|
104 |
|
105 }; |
|
106 |
|
107 |
|
108 #endif // __VOIPQUEUEHANDLER_H |
|
109 |
|
110 |
|
111 // End of File |