|
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 #ifndef MMFDEVSOUNDCIMUXUTILITY_H |
|
17 #define MMFDEVSOUNDCIMUXUTILITY_H |
|
18 |
|
19 #include <f32file.h> |
|
20 #include <e32math.h> |
|
21 #include <s32mem.h> |
|
22 #include "mmfaudioclientserver.h" |
|
23 #include <mmf/server/mmfdevsoundcustominterface.h> |
|
24 |
|
25 |
|
26 /** |
|
27 * @internalTechnology |
|
28 * @file |
|
29 */ |
|
30 |
|
31 class CMMFDevSoundCIMuxUtility; |
|
32 class TA3FCustomInterfaceCommand; |
|
33 NONSHARABLE_CLASS( CMMFDevSoundCIMuxUtility ) : public CBase, |
|
34 public MMMFDevSoundCustomInterfaceMuxUtility |
|
35 { |
|
36 public: |
|
37 enum TMMFDevSoundCustomCommand |
|
38 { |
|
39 EMMFDevSoundCustomCommandCIOpenSlave, |
|
40 EMMFDevSoundCustomCommandCICloseSlave, |
|
41 EMMFDevSoundCustomCommandCISendSlaveSyncCommand, |
|
42 EMMFDevSoundCustomCommandCISendSlaveSyncCommandResult, |
|
43 EMMFDevSoundCustomCommandCISendSlaveAsyncCommand, |
|
44 EMMFDevSoundCustomCommandCISendSlaveAsyncCommandResult |
|
45 }; |
|
46 |
|
47 /* |
|
48 * internal class used for Asynchronous Custom Command message passing from CI Mux to Demux. |
|
49 */ |
|
50 |
|
51 NONSHARABLE_CLASS(CAsyncCommandCleanup): public CActive |
|
52 { |
|
53 |
|
54 public: |
|
55 |
|
56 static CAsyncCommandCleanup* NewL(CMMFDevSoundCIMuxUtility* aMuxUtility,MMMFDevSoundCustomInterfaceChannel* aCustomChannel); |
|
57 ~CAsyncCommandCleanup(); |
|
58 void AsyncCustomCommand(CMMFDevSoundCIMuxUtility::TMMFDevSoundCustomCommand aType,TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8* aResultBuf); |
|
59 |
|
60 private: |
|
61 void ConstructL(); |
|
62 void RunL(); |
|
63 void DoCancel(); |
|
64 CAsyncCommandCleanup(CMMFDevSoundCIMuxUtility* aMuxUtility,MMMFDevSoundCustomInterfaceChannel* aCustomChannel); |
|
65 |
|
66 public: |
|
67 TPckgBuf<TA3FCustomInterfaceCommand>* iCommandBuffer; |
|
68 |
|
69 private: |
|
70 |
|
71 CMMFDevSoundCIMuxUtility* iMuxUtility; |
|
72 MMMFDevSoundCustomInterfaceChannel* iCustomChannel; |
|
73 TRequestStatus* iClientRequestStatus; |
|
74 }; |
|
75 |
|
76 public: |
|
77 static CMMFDevSoundCIMuxUtility* NewL(MMMFDevSoundCustomInterfaceChannel* aCustomChannel); |
|
78 virtual ~CMMFDevSoundCIMuxUtility(); |
|
79 void ConstructL(); |
|
80 |
|
81 // create a custom interface Mux implementation. |
|
82 MMMFDevSoundCustomInterfaceMuxPlugin* CreateCustomInterfaceMuxL(TUid aInterfaceId); |
|
83 |
|
84 // from MMMFDevSoundCustomInterfaceMux interface. |
|
85 virtual TInt OpenSlave(TUid, const TDesC8& aPackageBuf); |
|
86 virtual void CloseSlave(TInt aHandle); |
|
87 virtual TInt SendSlaveSyncCommand(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf); |
|
88 virtual TInt SendSlaveSyncCommandResult(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf, TDes8& aResultBuf); |
|
89 virtual void SendSlaveAsyncCommand(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf); |
|
90 virtual void SendSlaveAsyncCommandResult(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8& aResultBuf); |
|
91 |
|
92 void RemoveAsyncCommand(CAsyncCommandCleanup* aAsyncCustomCommandCleanup); |
|
93 private: |
|
94 CMMFDevSoundCIMuxUtility(MMMFDevSoundCustomInterfaceChannel* aCustomChannel); |
|
95 // Not owned. |
|
96 MMMFDevSoundCustomInterfaceChannel* iCustomChannel; |
|
97 RPointerArray <CAsyncCommandCleanup> iAsyncCustomCommandCleanup; |
|
98 }; |
|
99 |
|
100 |
|
101 /* |
|
102 * internal class used to pass custom command & custom command type from CI Mux to DeMux. |
|
103 */ |
|
104 class TA3FCustomInterfaceCommand |
|
105 { |
|
106 public: |
|
107 // Custom Interface command (meaning depends on CI in use) |
|
108 TInt iCommand; |
|
109 // Internal slave command type. |
|
110 CMMFDevSoundCIMuxUtility::TMMFDevSoundCustomCommand iType; |
|
111 // CI handle (equates to an offset into array of open CIs for most command types) |
|
112 TInt iHandle; |
|
113 }; |
|
114 |
|
115 |
|
116 #endif |