|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Implementation of DSP control custom interface pair |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef DSPCONTROLCI_H |
|
19 #define DSPCONTROLCI_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <mmf/common/mmfipc.h> |
|
23 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
24 #include <mmf/common/mmfipc.h> |
|
25 #endif |
|
26 #include <mmf/server/mmfdevsoundcustominterface.h> |
|
27 #include <mmf/server/mmfdevsoundcustomcommands.h> |
|
28 #include <mmf/server/devsoundstandardcustominterfaces.h> |
|
29 #include <mmf/plugin/mmfdevsoundcustominterface.hrh> |
|
30 |
|
31 /** |
|
32 Enum to represent the method called by this custom interface |
|
33 @internalComponent |
|
34 @prototype |
|
35 @file |
|
36 */ |
|
37 enum TMMFDevSoundCIDspControlCommands |
|
38 { |
|
39 EMMFDevSoundCIDspCtrlGetAudioPlaybackInfo, |
|
40 EMMFDevSoundCIDspCtrlAcceptRecordBuffersInvalidFollowingStop, |
|
41 EMMFDevSoundCIDspCtrlAcceptPlaybackBuffersInvalidFollowingStop |
|
42 }; |
|
43 |
|
44 /** |
|
45 class to hold the paramenters to MmdspcGetAudioPlaybackInfo for message passing |
|
46 @internalComponent |
|
47 @prototype |
|
48 @file |
|
49 */ |
|
50 class TAudioPlaybackInfo |
|
51 { |
|
52 public: |
|
53 TInt64 iSamplesPlayed; |
|
54 TInt64 iSystemTime; |
|
55 TUint iBytesDecoderConsumed; |
|
56 TUint iBytesDecoderDecoded; |
|
57 }; |
|
58 |
|
59 /** |
|
60 Implementation of the DSP control custom interface Mux |
|
61 @internalComponent |
|
62 @prototype |
|
63 @file |
|
64 */ |
|
65 class CMMFDspControlMux : public CBase, |
|
66 public MMMFDevSoundCustomInterfaceMuxPlugin, |
|
67 public MMMFDSPControl |
|
68 { |
|
69 public: |
|
70 |
|
71 // from MMMFDevSoundCustomInterfaceMuxPlugin |
|
72 /** |
|
73 Attempt to open the interface. |
|
74 @param aInterfaceId |
|
75 The UID of the interface to open. |
|
76 @return one of the system wide error codes |
|
77 */ |
|
78 virtual TInt OpenInterface(TUid aInterfaceId); |
|
79 |
|
80 /** |
|
81 Equivalent to destructor. Called to destroy plugin. |
|
82 */ |
|
83 virtual void Release(); |
|
84 |
|
85 /** |
|
86 Pass destructor key. |
|
87 Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() |
|
88 @param aDestructorKey |
|
89 The Uid returned by REComSession::CreateImplementationL() or similar |
|
90 */ |
|
91 virtual void PassDestructorKey(TUid aDestructorKey); |
|
92 |
|
93 /** |
|
94 Complete construction. |
|
95 Pass additional values from the construction phase, used subsequently by the plugin. |
|
96 @param aCustomUtility |
|
97 The custom interface utility used by the plugin to communicate with the remote |
|
98 server side DeMux plugin |
|
99 @leave This method may leave with one of the system-wide error codes. |
|
100 */ |
|
101 virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); |
|
102 |
|
103 /** |
|
104 Return the custom interface |
|
105 @param aInterfaceId |
|
106 The UID of the required custom interface |
|
107 @return the custom interface supported by this plugin |
|
108 */ |
|
109 virtual TAny* CustomInterface(TUid aInterfaceId); |
|
110 |
|
111 /** |
|
112 Instantiate a CI Mux class |
|
113 @return the pointer to the new class, cast to the Mux plugin mixin |
|
114 @leave This method may leave with one of the system-wide error codes. |
|
115 */ |
|
116 static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); |
|
117 |
|
118 // from MMMFDSPControl |
|
119 //@see MMMFDSPControl |
|
120 virtual TInt MmdspcGetAudioPlaybackInfo(TInt64& aSamplesPlayed, |
|
121 TInt64& aSystemTime, |
|
122 TUint& aBytesDecoderConsumed, |
|
123 TUint& aBytesDecoderDecoded); |
|
124 //@see MMMFDSPControl |
|
125 virtual TInt MmdspcAcceptRecordBuffersInvalidFollowingStop(); |
|
126 //@see MMMFDSPControl |
|
127 virtual TInt MmdspcAcceptPlaybackBuffersInvalidFollowingStop(); |
|
128 |
|
129 protected: |
|
130 CMMFDspControlMux(); |
|
131 ~CMMFDspControlMux(); |
|
132 |
|
133 protected: |
|
134 TUid iKey; |
|
135 TInt iRemoteHandle; |
|
136 MMMFDevSoundCustomInterfaceMuxUtility* iUtility; |
|
137 }; |
|
138 |
|
139 |
|
140 /** |
|
141 Implementation of the DSP control custom interface DeMux |
|
142 @internalComponent |
|
143 @prototype |
|
144 @file |
|
145 */ |
|
146 class CMMFDspControlDeMux : public CBase, |
|
147 public MMMFDevSoundCustomInterfaceDeMuxPlugin |
|
148 { |
|
149 public: |
|
150 /** |
|
151 Instantiate a CMMFDspControlDeMux class |
|
152 @return a pointer to the new class cast to the DeMux plugin mixin |
|
153 @leave This method may leave with one of the system-wide error codes. |
|
154 */ |
|
155 static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); |
|
156 |
|
157 /** |
|
158 Attempt to open the interface. |
|
159 @param aInterfaceId |
|
160 The UID of the interface to open. |
|
161 @return a handle to the remote plugin |
|
162 */ |
|
163 virtual TInt OpenInterface(TUid aInterfaceId); |
|
164 |
|
165 /** |
|
166 Equivalent to destructor. Called to destroy plugin. |
|
167 */ |
|
168 virtual void Release(); |
|
169 |
|
170 /** |
|
171 Pass destructor key. |
|
172 Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() |
|
173 @param aDestructorKey |
|
174 The Uid returned by REComSession::CreateImplementationL() or similar |
|
175 */ |
|
176 virtual void PassDestructorKey(TUid aDestructorKey); |
|
177 |
|
178 /** |
|
179 Set the target of the custom interface call |
|
180 @param aTarget |
|
181 The DevSound to call the custom interface on. |
|
182 */ |
|
183 virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); |
|
184 |
|
185 /** |
|
186 Complete construction. |
|
187 @param aUtility |
|
188 The DeMux utility to use |
|
189 @leave This method may leave with one of the system-wide error codes. |
|
190 */ |
|
191 virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); |
|
192 |
|
193 /** |
|
194 Refresh the current custom interface connections |
|
195 @leave This method may leave with one of the system-wide error codes. |
|
196 */ |
|
197 virtual void RefreshL(); |
|
198 |
|
199 // from MMMFDevSoundCustomInterfaceDeMuxPlugin |
|
200 /** |
|
201 Open the slave |
|
202 @param aInterface |
|
203 The UID of the requested interface |
|
204 @param aPackageBuf |
|
205 A package of data that can be supplied for initialisation |
|
206 @return the result of the operation |
|
207 @leave This method may leave with one of the system-wide error codes. |
|
208 */ |
|
209 virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); |
|
210 |
|
211 /** |
|
212 Close the slave |
|
213 @param aHandle |
|
214 The handle of the slave plugin |
|
215 @leave This method may leave with one of the system-wide error codes. |
|
216 */ |
|
217 virtual void DoCloseSlaveL(TInt aHandle); |
|
218 |
|
219 // original RMessage is supplied so that remote DeMux plugin can extract necessary details |
|
220 // using DeMux utility |
|
221 |
|
222 /** |
|
223 Relay the synchronous custom command onto the slave |
|
224 @param aMessage |
|
225 The IPC message to be sent to the slave |
|
226 @return the result of the operation |
|
227 @leave This method may leave with one of the system-wide error codes. |
|
228 */ |
|
229 virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); |
|
230 |
|
231 /** |
|
232 Relay the synchronous custom command onto the slave and obtain a result |
|
233 @param aMessage |
|
234 The IPC message to be sent to the slave |
|
235 @return the result of the operation |
|
236 @leave This method may leave with one of the system-wide error codes. |
|
237 */ |
|
238 virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); |
|
239 |
|
240 /** |
|
241 Relay an asynchronous command onto the slave |
|
242 @param aMessage |
|
243 The IPC message to be sent to the slave |
|
244 @leave This method may leave with one of the system-wide error codes. |
|
245 */ |
|
246 virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); |
|
247 |
|
248 /** |
|
249 Relay an asynchronous command onto the slave and obtain a result |
|
250 @param aMessage |
|
251 The IPC message to be sent to the slave@param aMessage |
|
252 @leave This method may leave with one of the system-wide error codes. |
|
253 */ |
|
254 virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); |
|
255 |
|
256 protected: |
|
257 ~CMMFDspControlDeMux(); |
|
258 CMMFDspControlDeMux(); |
|
259 |
|
260 // from mirror MMMFDSPControl method. |
|
261 TInt DoMmdspcGetAudioPlaybackInfoL(TInt64& aSamplesPlayed, TInt64& aSystemTime, TUint& aB, TUint& aT); |
|
262 TInt DoMmdspcAcceptRecordBuffersInvalidFollowingStopL(); |
|
263 TInt DoMmdspcAcceptPlaybackBuffersInvalidFollowingStopL(); |
|
264 |
|
265 protected: |
|
266 MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; |
|
267 MMMFDevSoundCustomInterfaceTarget* iTarget; |
|
268 TUid iKey; |
|
269 MMMFDSPControl* iInterfaceDspControl; |
|
270 }; |
|
271 |
|
272 #endif |