0
|
1 |
// Copyright (c) 2005-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 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@publishedPartner
|
|
18 |
@released
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#ifndef MMFDEVSOUNDCUSTOMINTERFACE_H
|
|
23 |
#define MMFDEVSOUNDCUSTOMINTERFACE_H
|
|
24 |
|
|
25 |
// forward reference
|
|
26 |
class MMMFDevSoundCustomInterfaceMuxPlugin;
|
|
27 |
class MMMFDevSoundCustomInterfaceDeMuxPlugin;
|
|
28 |
|
|
29 |
/**
|
|
30 |
* structure to hold command, handle pair
|
|
31 |
*/
|
|
32 |
class TMMFDevSoundCustomInterfaceCommand
|
|
33 |
{
|
|
34 |
public:
|
|
35 |
TInt iCommand;
|
|
36 |
TInt iHandle;
|
|
37 |
};
|
|
38 |
|
|
39 |
typedef TPckgBuf<TMMFDevSoundCustomInterfaceCommand> TMMFDevSoundCustomInterfaceCommandPackage;
|
|
40 |
|
|
41 |
/**
|
|
42 |
* structure to hold custom interface data
|
|
43 |
*/
|
|
44 |
class TMMFDevSoundCustomInterfaceData
|
|
45 |
{
|
|
46 |
public:
|
|
47 |
TUid iId;
|
|
48 |
TInt iHandle;
|
|
49 |
MMMFDevSoundCustomInterfaceMuxPlugin* iInterface;
|
|
50 |
};
|
|
51 |
|
|
52 |
/**
|
|
53 |
* structure to hold custom interface data on server side
|
|
54 |
*/
|
|
55 |
class TMMFDevSoundCustomInterfaceDeMuxData
|
|
56 |
{
|
|
57 |
public:
|
|
58 |
TUid iId;
|
|
59 |
MMMFDevSoundCustomInterfaceDeMuxPlugin* iInterface;
|
|
60 |
};
|
|
61 |
|
|
62 |
|
|
63 |
/**
|
|
64 |
* mixin for custom command pipeline used by utility to reroute commands
|
|
65 |
*/
|
|
66 |
class MMMFDevSoundCustomInterfaceChannel
|
|
67 |
{
|
|
68 |
public:
|
|
69 |
/**
|
|
70 |
Implements a synchronous custom command
|
|
71 |
@param aUid
|
|
72 |
The UID of the custom command
|
|
73 |
@param aParam1
|
|
74 |
A buffer of data to be supplied to the receiver
|
|
75 |
@param aParam2
|
|
76 |
A buffer of data to be supplied to the receiver
|
|
77 |
@param aOutParam
|
|
78 |
A buffer that will be written into by the receiver
|
|
79 |
and returned to the client
|
|
80 |
@return the result of the custom command
|
|
81 |
*/
|
|
82 |
virtual TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) = 0;
|
|
83 |
|
|
84 |
/**
|
|
85 |
Implements an asynchronous custom command
|
|
86 |
@param aUid
|
|
87 |
The UID of the custom command
|
|
88 |
@param aStatus
|
|
89 |
The request status of the active object that
|
|
90 |
will be called upon the completion of the request
|
|
91 |
@param aParam1
|
|
92 |
A buffer of data to be supplied to the receiver
|
|
93 |
@param aParam2
|
|
94 |
A buffer of data to be supplied to the receiver
|
|
95 |
@param aOutParam
|
|
96 |
A buffer that will be written into by the receiver
|
|
97 |
and returned to the client
|
|
98 |
*/
|
|
99 |
virtual void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) = 0;
|
|
100 |
};
|
|
101 |
|
|
102 |
|
|
103 |
/**
|
|
104 |
* custom interface API mixin
|
|
105 |
*/
|
|
106 |
class MMMFDevSoundCustomInterfaceTarget
|
|
107 |
{
|
|
108 |
public:
|
|
109 |
/**
|
|
110 |
Obtain a custom interface
|
|
111 |
@param aInterfaceId
|
|
112 |
The UID of the required custom interface
|
|
113 |
@return a pointer to the custom interface
|
|
114 |
*/
|
|
115 |
virtual TAny* CustomInterface(TUid aInterfaceId) = 0;
|
|
116 |
};
|
|
117 |
|
|
118 |
|
|
119 |
/**
|
|
120 |
* the custom interface MUX Mixin class implemented by the mux utility
|
|
121 |
*/
|
|
122 |
class MMMFDevSoundCustomInterfaceMuxUtility
|
|
123 |
{
|
|
124 |
public:
|
|
125 |
/**
|
|
126 |
Attempt to open the slave plugin
|
|
127 |
@param aInterface
|
|
128 |
The UID of the requested slave
|
|
129 |
@param aPackageBuf
|
|
130 |
A buffer that can be used to supply initialisation data
|
|
131 |
@return one of the system-wide error codes
|
|
132 |
*/
|
|
133 |
virtual TInt OpenSlave(TUid aInterface, const TDesC8& aPackageBuf) = 0;
|
|
134 |
|
|
135 |
/**
|
|
136 |
Close the slave plugin
|
|
137 |
@param aHandle
|
|
138 |
The handle of the slave to close
|
|
139 |
*/
|
|
140 |
virtual void CloseSlave(TInt aHandle) = 0;
|
|
141 |
|
|
142 |
/**
|
|
143 |
Send a synchronous command to the slave
|
|
144 |
@param aHandle
|
|
145 |
The handle of the remote slave plugin
|
|
146 |
@param aCommand
|
|
147 |
The command to send to the slave
|
|
148 |
@param aPackageBuf
|
|
149 |
Buffer of data to send to slave
|
|
150 |
@return the return code from the command
|
|
151 |
*/
|
|
152 |
virtual TInt SendSlaveSyncCommand(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf) = 0;
|
|
153 |
|
|
154 |
/**
|
|
155 |
Send a synchronous command to the slave and obtain a result
|
|
156 |
@param aHandle
|
|
157 |
The handle of the remote slave plugin
|
|
158 |
@param aCommand
|
|
159 |
The command to send to the slave
|
|
160 |
@param aPackageBuf
|
|
161 |
Buffer of data to send to slave
|
|
162 |
@param aResultBuf
|
|
163 |
Buffer to contain the result from the destination.
|
|
164 |
This must be large enough to contain the result.
|
|
165 |
@return the return code from the command
|
|
166 |
*/
|
|
167 |
virtual TInt SendSlaveSyncCommandResult(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf, TDes8& aResultBuf) = 0;
|
|
168 |
|
|
169 |
/**
|
|
170 |
Send an asychronous command to the slave
|
|
171 |
@param aComPackage
|
|
172 |
A package containing the handle of the remote slave and
|
|
173 |
the command to be sent
|
|
174 |
@see TMMFDevSoundCustomInterfaceCommandPackage
|
|
175 |
@param aStatus
|
|
176 |
The request status of the active object that will called
|
|
177 |
upon the completion of the request
|
|
178 |
@param aPackageBuf
|
|
179 |
Buffer of data to send to slave
|
|
180 |
*/
|
|
181 |
virtual void SendSlaveAsyncCommand(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf) = 0;
|
|
182 |
|
|
183 |
/**
|
|
184 |
Send an asychronous command to the slave and obtain a result
|
|
185 |
@param aComPackage
|
|
186 |
A package containing the handle of the remote slave and
|
|
187 |
the command to be sent
|
|
188 |
@see TMMFDevSoundCustomInterfaceCommandPackage
|
|
189 |
@param aStatus
|
|
190 |
The request status of the active object that will be called
|
|
191 |
upon the completion of the request
|
|
192 |
@param aPackageBuf
|
|
193 |
Buffer of data to send to slave
|
|
194 |
@param aResultBuf
|
|
195 |
Buffer to contain the result from the destination.
|
|
196 |
This must be large enough to contain the result.
|
|
197 |
*/
|
|
198 |
virtual void SendSlaveAsyncCommandResult(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8& aResultBuf) = 0;
|
|
199 |
};
|
|
200 |
|
|
201 |
|
|
202 |
/**
|
|
203 |
* mixin implemented by Mux plugin itself
|
|
204 |
*/
|
|
205 |
class MMMFDevSoundCustomInterfaceMuxPlugin
|
|
206 |
{
|
|
207 |
public:
|
|
208 |
/**
|
|
209 |
Attempt to open the interface.
|
|
210 |
@param aInterfaceId
|
|
211 |
The UID of the required interface
|
|
212 |
@return one of the system wide error codes
|
|
213 |
*/
|
|
214 |
virtual TInt OpenInterface(TUid aInterfaceId) = 0;
|
|
215 |
|
|
216 |
/**
|
|
217 |
Equivalent to destructor. Called to destroy plugin.
|
|
218 |
*/
|
|
219 |
virtual void Release() = 0;
|
|
220 |
/**
|
|
221 |
Pass destructor key.
|
|
222 |
Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
|
|
223 |
@param aDestructorKey
|
|
224 |
The Uid returned by REComSession::CreateImplementationL() or similar
|
|
225 |
*/
|
|
226 |
virtual void PassDestructorKey(TUid aDestructorKey) = 0;
|
|
227 |
|
|
228 |
/**
|
|
229 |
Complete construction.
|
|
230 |
Pass additional values from the construction phase, used subsequently by the plugin.
|
|
231 |
@param aCustomUtility
|
|
232 |
The custom interface utility used by the plugin to communicate with the remote
|
|
233 |
server side DeMux plugin
|
|
234 |
*/
|
|
235 |
virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) = 0;
|
|
236 |
|
|
237 |
/**
|
|
238 |
Return the custom interface
|
|
239 |
@param aInterfaceId
|
|
240 |
The id of the required custom interface
|
|
241 |
@return the custom interface supported by this plugin
|
|
242 |
*/
|
|
243 |
virtual TAny* CustomInterface(TUid aInterfaceId) = 0;
|
|
244 |
};
|
|
245 |
|
|
246 |
|
|
247 |
/**
|
|
248 |
* the custom interface DEMUX Mixin class implemented by the DeMux interface
|
|
249 |
* this is likely to be the DevSound server implementation
|
|
250 |
*/
|
|
251 |
class MMMFDevSoundCustomInterfaceDeMuxInterface
|
|
252 |
{
|
|
253 |
public:
|
|
254 |
/**
|
|
255 |
Open the slave
|
|
256 |
@param aInterface
|
|
257 |
The UID of the requested interface
|
|
258 |
@param aPackageBuf
|
|
259 |
A package of data that can be supplied for initialisation
|
|
260 |
@return the result of the operation
|
|
261 |
*/
|
|
262 |
virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf) = 0;
|
|
263 |
|
|
264 |
/**
|
|
265 |
Close the slave
|
|
266 |
@param aHandle
|
|
267 |
The handle of the slave plugin
|
|
268 |
*/
|
|
269 |
virtual void DoCloseSlaveL(TInt aHandle) = 0;
|
|
270 |
|
|
271 |
// original RMessage is supplied so that remote demux plugin can extract necessary details
|
|
272 |
// using DeMux utility
|
|
273 |
|
|
274 |
/**
|
|
275 |
Relay the synchronous custom command onto the slave
|
|
276 |
@param aMessage
|
|
277 |
The IPC message to be sent to the slave
|
|
278 |
@return the result of the operation
|
|
279 |
*/
|
|
280 |
virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) = 0;
|
|
281 |
|
|
282 |
/**
|
|
283 |
Relay the synchronous custom command onto the slave and obtain a result
|
|
284 |
@param aMessage
|
|
285 |
The IPC message to be sent to the slave
|
|
286 |
@return the result of the operation
|
|
287 |
*/
|
|
288 |
virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) = 0;
|
|
289 |
|
|
290 |
/**
|
|
291 |
Relay an asynchronous command onto the slave
|
|
292 |
@param aMessage
|
|
293 |
The IPC message to be sent to the slave
|
|
294 |
*/
|
|
295 |
virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage) = 0;
|
|
296 |
|
|
297 |
/**
|
|
298 |
Relay an asynchronous command onto the slave and obtain a result
|
|
299 |
@param aMessage
|
|
300 |
The IPC message to be sent to the slave@param aMessage
|
|
301 |
*/
|
|
302 |
virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage) = 0;
|
|
303 |
};
|
|
304 |
|
|
305 |
|
|
306 |
/**
|
|
307 |
* message data structure for demux utility
|
|
308 |
*/
|
|
309 |
class TMMFDevSoundCIMessageData
|
|
310 |
{
|
|
311 |
public:
|
|
312 |
TInt iCommand;
|
|
313 |
TInt iHandle;
|
|
314 |
};
|
|
315 |
|
|
316 |
|
|
317 |
/**
|
|
318 |
* mixin class implemented by the demux utility
|
|
319 |
*/
|
|
320 |
class MMMFDevSoundCustomInterfaceDeMuxUtility
|
|
321 |
{
|
|
322 |
public:
|
|
323 |
/**
|
|
324 |
Get all settings at once into a client supplied package
|
|
325 |
@param aMessage
|
|
326 |
The IPC message
|
|
327 |
@param aData
|
|
328 |
Structure containing the command and handle
|
|
329 |
@see TMMFDevSoundCIMessageData
|
|
330 |
*/
|
|
331 |
virtual void GetSyncMessageDataL(const RMmfIpcMessage& aMessage, TMMFDevSoundCIMessageData& aData) = 0;
|
|
332 |
|
|
333 |
/**
|
|
334 |
Get all settings at once into a client supplied package
|
|
335 |
from an asynchronous message
|
|
336 |
@param aMessage
|
|
337 |
The IPC message
|
|
338 |
@param aData
|
|
339 |
Structure containing the command and handle
|
|
340 |
@see TMMFDevSoundCIMessageData
|
|
341 |
*/
|
|
342 |
virtual void GetAsyncMessageDataL(const RMmfIpcMessage& aMessage, TMMFDevSoundCIMessageData& aData) = 0;
|
|
343 |
|
|
344 |
/**
|
|
345 |
Obtain the input descriptor length from the message
|
|
346 |
@param aMessage
|
|
347 |
The IPC message
|
|
348 |
@return the length of the input descriptor in the message
|
|
349 |
*/
|
|
350 |
virtual TInt InputDesLength(const RMmfIpcMessage& aMessage) = 0;
|
|
351 |
|
|
352 |
/**
|
|
353 |
Read the data from the input descriptor into the supplied buffer
|
|
354 |
@param aMessage
|
|
355 |
The IPC message
|
|
356 |
@param aBufToFill
|
|
357 |
The descriptor to copy the data from the input message into
|
|
358 |
*/
|
|
359 |
virtual void ReadFromInputDesL(const RMmfIpcMessage& aMessage, TDes8* aBufToFill) = 0;
|
|
360 |
|
|
361 |
/**
|
|
362 |
Write the supplied buffer into the output buffer in the IPC message
|
|
363 |
@param aMessage
|
|
364 |
The IPC message
|
|
365 |
@param aBufToWrite
|
|
366 |
The buffer to write to the output buffer in the supplied IPC message
|
|
367 |
*/
|
|
368 |
virtual void WriteToOutputDesL(const RMmfIpcMessage& aMessage, TDesC8& aBufToWrite) = 0;
|
|
369 |
|
|
370 |
/**
|
|
371 |
Complete the supplied IPC message with the supplied error code
|
|
372 |
@param aMessage
|
|
373 |
The IPC message
|
|
374 |
@param aError
|
|
375 |
One of the system wide error codes to complete the message with
|
|
376 |
*/
|
|
377 |
virtual void CompleteMessage(const RMmfIpcMessage& aMessage, TInt aError) = 0;
|
|
378 |
};
|
|
379 |
|
|
380 |
|
|
381 |
/**
|
|
382 |
* mixin implemented by DeMux plugin itself
|
|
383 |
*/
|
|
384 |
class MMMFDevSoundCustomInterfaceDeMuxPlugin : public MMMFDevSoundCustomInterfaceDeMuxInterface
|
|
385 |
{
|
|
386 |
public:
|
|
387 |
/**
|
|
388 |
Attempt to open the interface.
|
|
389 |
@param aInterfaceId
|
|
390 |
The UID of the required interface
|
|
391 |
@return a handle to the remote plugin
|
|
392 |
*/
|
|
393 |
virtual TInt OpenInterface(TUid aInterfaceId) = 0;
|
|
394 |
|
|
395 |
/**
|
|
396 |
Equivalent to destructor. Called to destroy plugin.
|
|
397 |
*/
|
|
398 |
virtual void Release() = 0;
|
|
399 |
/**
|
|
400 |
Pass destructor key.
|
|
401 |
Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation()
|
|
402 |
@param aDestructorKey
|
|
403 |
The Uid returned by REComSession::CreateImplementationL() or similar
|
|
404 |
*/
|
|
405 |
virtual void PassDestructorKey(TUid aDestructorKey) = 0;
|
|
406 |
|
|
407 |
/**
|
|
408 |
Complete construction.
|
|
409 |
Set the target of the custom interface call
|
|
410 |
@param aDevSoundServer
|
|
411 |
The DevSound to call the custom interface on.
|
|
412 |
*/
|
|
413 |
virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) = 0;
|
|
414 |
|
|
415 |
/**
|
|
416 |
Complete construction.
|
|
417 |
@param aUtility
|
|
418 |
A pointer to the DeMux utility to use
|
|
419 |
*/
|
|
420 |
virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility) = 0;
|
|
421 |
|
|
422 |
/**
|
|
423 |
Refresh the interfaces if circumstances / other areas of DevSound have changed
|
|
424 |
*/
|
|
425 |
virtual void RefreshL() = 0;
|
|
426 |
};
|
|
427 |
|
|
428 |
|
|
429 |
|
|
430 |
#endif
|