|
1 /* |
|
2 * Copyright (c) 2009 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: Telephony Multimedia Service |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TMS_QUEUEHANDLER_H |
|
19 #define TMS_QUEUEHANDLER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <e32msgqueue.h> |
|
24 #include <glib.h> |
|
25 #include "tmsclientserver.h" // for TmsMsgBuf |
|
26 |
|
27 namespace TMS { |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class TMSBuffer; //TMSDataBuffer |
|
31 class TMSGlobalContext; |
|
32 |
|
33 /** |
|
34 * MQueueHandlerObserver class |
|
35 * Responsible for sending callbacks to the TMS client app |
|
36 */ |
|
37 class MQueueHandlerObserver |
|
38 { |
|
39 public: |
|
40 virtual void QueueEvent(TInt aEventType, TInt aError, void* user_data) = 0; |
|
41 }; |
|
42 |
|
43 /** |
|
44 * CQueueHandler class |
|
45 */ |
|
46 NONSHARABLE_CLASS(CQueueHandler) : public CActive |
|
47 { |
|
48 public: |
|
49 |
|
50 /** |
|
51 * NewL() |
|
52 * Contructor |
|
53 * |
|
54 */ |
|
55 static CQueueHandler* NewL(RMsgQueue<TmsMsgBuf>* aMsgQueue, |
|
56 TMSGlobalContext* glblCtx); |
|
57 |
|
58 /** |
|
59 * destructor |
|
60 */ |
|
61 virtual ~CQueueHandler(); |
|
62 |
|
63 /** |
|
64 * Start |
|
65 * Starts listening for events. |
|
66 * |
|
67 */ |
|
68 void Start(); |
|
69 |
|
70 /** |
|
71 * Returns request status. |
|
72 */ |
|
73 TRequestStatus* Status(); |
|
74 |
|
75 TInt AddObserver(MQueueHandlerObserver& obsvr, TInt aClientId); |
|
76 TInt RemoveObserver(MQueueHandlerObserver& obsvr); |
|
77 |
|
78 private: |
|
79 |
|
80 /** |
|
81 * constructor |
|
82 */ |
|
83 CQueueHandler(RMsgQueue<TmsMsgBuf>* aMsgQueue, |
|
84 TMSGlobalContext* glblCtx); |
|
85 |
|
86 void ConstructL(); |
|
87 |
|
88 // from CActive |
|
89 void DoCancel(); |
|
90 void RunL(); |
|
91 TInt RunError(TInt aError); |
|
92 void DoFillBuffer(TInt aBufLen, TInt aStatus, TBool flag, TUint32 key); |
|
93 void DoEmptyBuffer(TInt aBufLen, TInt aStatus, TBool flag, TUint32 key); |
|
94 TInt FindStreamInList(); |
|
95 TInt FindGainEffectInList(); |
|
96 TInt FindVolEffectInList(); |
|
97 TMSStreamState ConvertToStreamState(TInt request); |
|
98 |
|
99 private: |
|
100 // data |
|
101 |
|
102 RPointerArray<MQueueHandlerObserver> iObserversList; // (not owned) |
|
103 MQueueHandlerObserver* iObserver; //not owned |
|
104 RArray<TInt> iClientList; |
|
105 RMsgQueue<TmsMsgBuf>* iMsgQueue; |
|
106 |
|
107 RChunk iChunk; |
|
108 TPtr8 iChunkDataPtr; |
|
109 TMSBuffer* iBuffer; |
|
110 TMSGlobalContext *iTMSGlobalContext; |
|
111 }; |
|
112 |
|
113 } //namespace TMS |
|
114 |
|
115 #endif // TMS_QUEUEHANDLER_H |
|
116 |
|
117 // End of File |