|
1 /* |
|
2 * Copyright (c) 2006 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: Project file for EnhancedMediaClient Utility |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "StreamControlCustomCommands.h" |
|
20 #include "StreamControlCustomCommandsParser.h" |
|
21 |
|
22 // Client class to access state change event functionality. |
|
23 EXPORT_C RStreamControlCustomCommands::RStreamControlCustomCommands( RMMFController& aController ) |
|
24 : RMMFCustomCommandsBase(aController, KUidIFStreamControlCustomCommands) |
|
25 { |
|
26 } |
|
27 |
|
28 EXPORT_C TInt RStreamControlCustomCommands::EnableEvents(TBool aEnable) |
|
29 { |
|
30 TPckgBuf<TBool> configPackage(aEnable); |
|
31 return iController.CustomCommandSync(iDestinationPckg, |
|
32 EEnableEvents, |
|
33 configPackage, |
|
34 KNullDesC8); |
|
35 } |
|
36 |
|
37 EXPORT_C TInt RStreamControlCustomCommands::GetSeekingSupported(TBool& aSupported) |
|
38 { |
|
39 TPckgBuf<TBool> configPackage; |
|
40 TInt status = iController.CustomCommandSync(iDestinationPckg, |
|
41 EGetSeekingSupported, |
|
42 KNullDesC8, |
|
43 KNullDesC8, |
|
44 configPackage); |
|
45 if (status == KErrNone) |
|
46 { |
|
47 aSupported = configPackage(); |
|
48 } |
|
49 return status; |
|
50 } |
|
51 |
|
52 EXPORT_C TInt RStreamControlCustomCommands::GetRandomSeekingSupported(TBool& aSupported) |
|
53 { |
|
54 TPckgBuf<TBool> configPackage; |
|
55 TInt status = iController.CustomCommandSync(iDestinationPckg, |
|
56 EGetRandomSeekingSupported, |
|
57 KNullDesC8, |
|
58 KNullDesC8, |
|
59 configPackage); |
|
60 if (status == KErrNone) |
|
61 { |
|
62 aSupported = configPackage(); |
|
63 } |
|
64 return status; |
|
65 } |
|
66 |
|
67 // Custom command parser class to be used by controller plugins wishing to |
|
68 // support state change event. The controller plugin should create an object |
|
69 // of this type and add it to the list of custom command parsers in the |
|
70 // controller framework. |
|
71 EXPORT_C CStreamControlCustomCommandParser* CStreamControlCustomCommandParser::NewL( |
|
72 MStreamControlCustomCommandImplementor& aImplementor ) |
|
73 { |
|
74 return new (ELeave) CStreamControlCustomCommandParser(aImplementor); |
|
75 } |
|
76 |
|
77 EXPORT_C CStreamControlCustomCommandParser::~CStreamControlCustomCommandParser() |
|
78 { |
|
79 } |
|
80 |
|
81 CStreamControlCustomCommandParser::CStreamControlCustomCommandParser( |
|
82 MStreamControlCustomCommandImplementor& aImplementor ) |
|
83 : CMMFCustomCommandParserBase( KUidIFStreamControlCustomCommands ), |
|
84 iImplementor( aImplementor ) |
|
85 { |
|
86 } |
|
87 |
|
88 // Handles a request from the client. Called by the controller framework. |
|
89 void CStreamControlCustomCommandParser::HandleRequest( TMMFMessage& aMessage ) |
|
90 { |
|
91 TInt status = KErrNotSupported; |
|
92 if ( aMessage.Destination().InterfaceId() == KUidIFStreamControlCustomCommands ) |
|
93 { |
|
94 status = DoHandleRequest( aMessage ); |
|
95 } |
|
96 aMessage.Complete(status); |
|
97 } |
|
98 |
|
99 // Internal request handling methods. |
|
100 TInt CStreamControlCustomCommandParser::DoHandleRequest( TMMFMessage& aMessage ) |
|
101 { |
|
102 TInt status = KErrNotSupported; |
|
103 switch (aMessage.Function()) |
|
104 { |
|
105 case EEnableEvents: |
|
106 status = DoEnableEvents(aMessage); |
|
107 break; |
|
108 case EGetSeekingSupported: |
|
109 status = DoGetSeekingSupported(aMessage); |
|
110 break; |
|
111 case EGetRandomSeekingSupported: |
|
112 status = DoGetRandomSeekingSupported(aMessage); |
|
113 break; |
|
114 default: |
|
115 break; |
|
116 } |
|
117 return status; |
|
118 } |
|
119 |
|
120 TInt CStreamControlCustomCommandParser::DoEnableEvents(TMMFMessage& aMessage) |
|
121 { |
|
122 TInt status; |
|
123 TPckgBuf<TBool> pckg; |
|
124 TRAPD(err, aMessage.ReadData1FromClientL(pckg)); |
|
125 if(!err) |
|
126 { |
|
127 status = iImplementor.MscEnableEvents(pckg()); |
|
128 } |
|
129 else |
|
130 status = err; |
|
131 |
|
132 return status; |
|
133 } |
|
134 |
|
135 TInt CStreamControlCustomCommandParser::DoGetSeekingSupported(TMMFMessage& aMessage) |
|
136 { |
|
137 TInt status; |
|
138 TBool supported; |
|
139 status = iImplementor.MscGetSeekingSupported(supported); |
|
140 TPckgBuf<TBool> pckg(supported); |
|
141 TRAPD(err, aMessage.WriteDataToClientL(pckg)); |
|
142 if(err) |
|
143 { |
|
144 status = err; |
|
145 } |
|
146 return status; |
|
147 } |
|
148 |
|
149 TInt CStreamControlCustomCommandParser::DoGetRandomSeekingSupported(TMMFMessage& aMessage) |
|
150 { |
|
151 TInt status; |
|
152 TBool supported; |
|
153 status = iImplementor.MscGetRandomSeekingSupported(supported); |
|
154 TPckgBuf<TBool> pckg(supported); |
|
155 TRAPD(err, aMessage.WriteDataToClientL(pckg)); |
|
156 if(err) |
|
157 { |
|
158 status = err; |
|
159 } |
|
160 return status; |
|
161 } |
|
162 |
|
163 |
|
164 // End of file |