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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IRCTRLCMDOBSERVER_H |
|
20 #define IRCTRLCMDOBSERVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "ircontrolparams.h" |
|
25 |
|
26 class MIRCtrlCmdObserver; |
|
27 class MIRStreamFill; |
|
28 |
|
29 /** |
|
30 * This is the class is implemented to provide completed independence to |
|
31 * mediaengine from client as well as network.It is through this class media |
|
32 * engine interacts with client and network. This also provides additional |
|
33 * features like audio fade in, audio fade out effect. This design is has to |
|
34 * provide flexiblilty to irmediaengine by avoiding any other dll interaction |
|
35 * other than ircommandchannel.dll |
|
36 * |
|
37 * @code |
|
38 * |
|
39 * Observer* observer; //Observer class should be derived from MIRCtrlCmdObserver |
|
40 * StreamFill* stream; //Streamfill class should be derived from MIRStreamFill |
|
41 * CIRCtrlCmdObserver* channel = CIRCtrlCmdObserver::NewL(observer,stream); |
|
42 * //creates instance of ircommandchannel |
|
43 * TIRControlCommmand command = EError; |
|
44 * //senting an error value and is defined in IRControlParams.h |
|
45 * TInt some_integer_value; |
|
46 * TPtr ptrbuffer; |
|
47 * TUint8* ptr = new (ELeave) TUint8[100]; |
|
48 * ptrbuffer.Set(ptr,100,100); |
|
49 * channel->SentRequest(command,some_integer_value); |
|
50 * //sending a command to channel |
|
51 * channel->FilltheBuffer(ptrbuffer); //call for filling the buffer |
|
52 * TInt volume = channel->FetchVolume(); |
|
53 * //gets current volume (which can stored in database) |
|
54 * command = EBufferFadeIn; //calling for a fade in effect |
|
55 * channel->AudioFadeInOut(command,5); |
|
56 * channel->DoAudioFadeOut(); //function for fade out effect |
|
57 * delete channel; |
|
58 * |
|
59 * @endcode |
|
60 * |
|
61 * @lib ircommandchannel.lib |
|
62 * @since S_60 3.0 |
|
63 * |
|
64 */ |
|
65 |
|
66 NONSHARABLE_CLASS(CIRCtrlCmdObserver) : public CBase |
|
67 { |
|
68 public: //member function |
|
69 /** |
|
70 * Function : NewL |
|
71 * Function returns an instance of CIRCtrlCmdObserver |
|
72 * Two phase constructor |
|
73 * @param MIRCtrlCmdObserver observers instance,pointer to MIRStreamFill |
|
74 * @return instance of CIRCtrlCmdObserver |
|
75 */ |
|
76 IMPORT_C static CIRCtrlCmdObserver* NewL(MIRCtrlCmdObserver* aObserver, |
|
77 MIRStreamFill* aStream); |
|
78 |
|
79 /** |
|
80 * Function : NewLC |
|
81 * Function returns an instance of CIRCtrlCmdObserver |
|
82 * Two phase constructor |
|
83 * @param MIRCtrlCmdObserver observers instance,pointer to MIRStreamFill |
|
84 * @return instance of CIRCtrlCmdObserver |
|
85 */ |
|
86 IMPORT_C static CIRCtrlCmdObserver* NewLC(MIRCtrlCmdObserver* aObserver, |
|
87 MIRStreamFill* aStream); |
|
88 |
|
89 /** |
|
90 * Function : ~CIRCtrlCmdObserver |
|
91 * Default destructor calls Cancel function which cancel the active request |
|
92 */ |
|
93 ~CIRCtrlCmdObserver(); |
|
94 |
|
95 /** |
|
96 * Function : SentRequest |
|
97 * Function sends request to handle events represented by |
|
98 * TIRControlCommmand |
|
99 * @param TIRControlCommmand represents what action to be taken |
|
100 * @param aValue represents any integer value if any, like buffering |
|
101 * percentage |
|
102 */ |
|
103 IMPORT_C void SentRequest(TIRControlCommmand aCommand,TInt aValue); |
|
104 |
|
105 /** |
|
106 * Function : FilltheBuffer |
|
107 * Function sends request to fill the buffer |
|
108 * @param buffer to be filled with data |
|
109 */ |
|
110 IMPORT_C void FilltheBuffer(TDes8& aInputBuffer); |
|
111 |
|
112 /** |
|
113 * Function : FetchVolume |
|
114 * Function sends request to get the current volume index |
|
115 * @return volume index |
|
116 */ |
|
117 IMPORT_C TInt FetchVolume(); |
|
118 |
|
119 /** |
|
120 * Function : AudioFadeInOut |
|
121 * Function is called for audio Fade In Fade Out Effects |
|
122 * @param TIRControlCommmand represents what action to be taken Fade |
|
123 * In or Fade Out |
|
124 * @param aValue represents any integer value of cuurent volume level |
|
125 */ |
|
126 IMPORT_C void AudioFadeInOut(TIRControlCommmand& aCommand,TInt aValue); |
|
127 |
|
128 /** |
|
129 * Function : DoAudioFadeOut |
|
130 * Function is used to sent request start audio Fade Out |
|
131 */ |
|
132 IMPORT_C void DoAudioFadeOut(); |
|
133 |
|
134 private: |
|
135 /** |
|
136 * Function : ConstructL |
|
137 * Function does all the initializations |
|
138 * Two phase constructor |
|
139 * @param MIRCtrlCmdObserver observers instance,pointer to MIRStreamFill |
|
140 */ |
|
141 void ConstructL(MIRCtrlCmdObserver* aObserver,MIRStreamFill* aStream); |
|
142 |
|
143 /** |
|
144 * Function : CIRCtrlCmdObserver |
|
145 * Function is the default constructor, sets the CActive priority, |
|
146 * Line status |
|
147 */ |
|
148 CIRCtrlCmdObserver(); |
|
149 |
|
150 /** |
|
151 * Function : StartAudioFadeIn |
|
152 * Function Starts audio Fade In effects |
|
153 * @param take a parameter of CIRCtrlCmdObserver into a TAny pointer |
|
154 * @return KErrNone upon completion |
|
155 */ |
|
156 static TInt StartAudioFadeIn(TAny* aPtr); |
|
157 |
|
158 /** |
|
159 * Function : StartAudioFadeOut |
|
160 * Function Starts audio Fade Out effects |
|
161 * @param take a parameter of CIRCtrlCmdObserver into a TAny pointer |
|
162 * @return KErrNone upon completion |
|
163 */ |
|
164 static TInt StartAudioFadeOut(TAny* aPtr); |
|
165 |
|
166 /** |
|
167 * Function : UpdateVolumeInc |
|
168 * Function does the Fade In effect |
|
169 */ |
|
170 void UpdateVolumeInc(); |
|
171 |
|
172 /** |
|
173 * Function : UpdateVolumeDec |
|
174 * Function does the Fade In effect |
|
175 */ |
|
176 void UpdateVolumeDec(); |
|
177 |
|
178 |
|
179 private: //data members |
|
180 |
|
181 //This is instance of MIRCtrlCmdObserver |
|
182 MIRCtrlCmdObserver* iObserver; |
|
183 |
|
184 //Access to fill data |
|
185 MIRStreamFill* iStream; |
|
186 |
|
187 //Volume timer |
|
188 CPeriodic* iVolumeTimer; |
|
189 |
|
190 //current volume level |
|
191 TInt iVolumeLevel; |
|
192 |
|
193 //actual volume level |
|
194 TInt iPersistentVolume; |
|
195 |
|
196 //instance of the command |
|
197 TIRControlCommmand iCommand; |
|
198 }; |
|
199 |
|
200 #endif//IRCTRLCMDOBSERVER_H |
|
201 |
|