|
1 /* |
|
2 * Copyright (c) 2004-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: This is the implementation of the client interface for the |
|
15 * TTS custom commands. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "nssttscustomcommands.h" |
|
22 #include "nssttscustomcommandcommon.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // RTtsCustomCommands::RTtsCustomCommands |
|
28 // C++ constructor. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 EXPORT_C RTtsCustomCommands::RTtsCustomCommands( RMMFController& aController) : |
|
32 RMMFCustomCommandsBase( aController, |
|
33 KUidInterfaceTts ) |
|
34 { |
|
35 // Nothing |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // RTtsCustomCommands::AddStyleL |
|
40 // |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C TInt RTtsCustomCommands::AddStyle( const TTtsStyle& aStyle, |
|
44 TTtsStyleID& aID ) |
|
45 { |
|
46 TTtsStylePtrPckg stylePtrPckg = ( TTtsStyle* ) &aStyle; |
|
47 TTtsStyleIDPtrPckg styleIDPtrPckg = &aID; |
|
48 return iController.CustomCommandSync( iDestinationPckg, ETtsAddStyle, |
|
49 stylePtrPckg, styleIDPtrPckg ); |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // RTtsCustomCommands::DeleteStyle |
|
54 // |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C TInt RTtsCustomCommands::DeleteStyle( TTtsStyleID aID ) |
|
58 { |
|
59 TTtsStyleIDPckg styleIDPckg = aID; |
|
60 return iController.CustomCommandSync( iDestinationPckg, ETtsDeleteStyle, |
|
61 styleIDPckg, KNullDesC8 ); |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // RTtsCustomCommands::GetPosition |
|
66 // |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 EXPORT_C TInt RTtsCustomCommands::GetPosition( TInt& aWordIndex ) |
|
70 { |
|
71 TTtsIntPtrPckg intPtrPckg = &aWordIndex; |
|
72 return iController.CustomCommandSync( iDestinationPckg, ETtsGetPosition, |
|
73 intPtrPckg, KNullDesC8 ); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // RTtsCustomCommands::NumberOfStyles |
|
78 // |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 EXPORT_C TInt RTtsCustomCommands::NumberOfStyles( TUint16& aNumber ) |
|
82 { |
|
83 TTtsUintPtrPckg uintPtrPckg = &aNumber; |
|
84 return iController.CustomCommandSync( iDestinationPckg, ETtsNumberOfStyles, |
|
85 uintPtrPckg, KNullDesC8 ); |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // RTtsCustomCommands::OpenParsedTextL |
|
90 // |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C TInt RTtsCustomCommands::OpenParsedText( CTtsParsedText& aText ) |
|
94 { |
|
95 TTtsParsedTextPckg parsedTextPckg( &aText ); |
|
96 return iController.CustomCommandSync( iDestinationPckg, ETtsOpenParsedText, |
|
97 parsedTextPckg, KNullDesC8 ); |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // RTtsCustomCommands::SetPositionL |
|
102 // |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 EXPORT_C TInt RTtsCustomCommands::SetPosition( TInt aWordIndex ) |
|
106 { |
|
107 TTtsIntPckg intPckg = aWordIndex; |
|
108 return iController.CustomCommandSync( iDestinationPckg, ETtsSetPosition, |
|
109 intPckg, KNullDesC8 ); |
|
110 } |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // RTtsCustomCommands::Style |
|
114 // |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 EXPORT_C TInt RTtsCustomCommands::Style( TTtsStyleID aStyleID, |
|
118 TTtsStyle& aStyle ) |
|
119 { |
|
120 TTtsStyleIDPckg styleIDPckg = aStyleID; |
|
121 TTtsStylePtrPckg stylePckg = &aStyle; |
|
122 return iController.CustomCommandSync( iDestinationPckg, ETtsStyleID, |
|
123 styleIDPckg, stylePckg ); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // RTtsCustomCommands::StyleL |
|
128 // |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C TInt RTtsCustomCommands::Style( TUint16 aIndex, TTtsStyle& aStyle ) |
|
132 { |
|
133 TTtsUintPckg uintPckg = aIndex; |
|
134 TTtsStylePtrPckg stylePckg = &aStyle; |
|
135 return iController.CustomCommandSync( iDestinationPckg, ETtsStyleIndex, |
|
136 uintPckg, stylePckg ); |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // RTtsCustomCommands::SetDefaultStyle |
|
141 // |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 EXPORT_C TInt RTtsCustomCommands::SetDefaultStyle( const TTtsStyle& aStyle ) |
|
145 { |
|
146 TTtsStylePtrPckg stylePtrPckg = ( TTtsStyle* ) &aStyle; |
|
147 return iController.CustomCommandSync( iDestinationPckg, ETtsSetDefaultStyle, |
|
148 stylePtrPckg, KNullDesC8 ); |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // RTtsCustomCommands::GetDefaultStyle |
|
153 // |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C TInt RTtsCustomCommands::GetDefaultStyle( TTtsStyle& aStyle ) |
|
157 { |
|
158 TTtsStylePtrPckg stylePtrPckg = &aStyle; |
|
159 return iController.CustomCommandSync( iDestinationPckg, ETtsGetDefaultStyle, |
|
160 stylePtrPckg, KNullDesC8 ); |
|
161 |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // RTtsCustomCommands::SetSpeakingRate |
|
166 // |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 EXPORT_C TInt RTtsCustomCommands::SetSpeakingRate( TInt aRate ) |
|
170 { |
|
171 TTtsIntPckg intPckg = aRate; |
|
172 return iController.CustomCommandSync( iDestinationPckg, ETtsSetSpeakingRate, |
|
173 intPckg, KNullDesC8 ); |
|
174 |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // RTtsCustomCommands::GetSpeakingRate |
|
179 // |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 EXPORT_C TInt RTtsCustomCommands::GetSpeakingRate( TInt& aRate ) |
|
183 { |
|
184 TTtsIntPtrPckg intPtrPckg = &aRate; |
|
185 return iController.CustomCommandSync( iDestinationPckg, ETtsGetSpeakingRate, |
|
186 intPtrPckg, KNullDesC8 ); |
|
187 } |
|
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // RTtsCustomCommands::GetSupportedLanguages |
|
191 // |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 EXPORT_C TInt RTtsCustomCommands::GetSupportedLanguages( RArray<TLanguage>& aLanguages ) |
|
195 { |
|
196 TInt numberOfLanguages( -1 ); |
|
197 |
|
198 TTtsIntPtrPckg intPtrPckg = &numberOfLanguages; |
|
199 TInt error = |
|
200 iController.CustomCommandSync( iDestinationPckg, ETtsSupportedLanguagesCount, |
|
201 intPtrPckg, KNullDesC8 ); |
|
202 TInt i( 0 ); |
|
203 |
|
204 while ( !error && i < numberOfLanguages ) |
|
205 { |
|
206 i++; |
|
207 |
|
208 error = aLanguages.Append( ELangNone ); |
|
209 } |
|
210 |
|
211 if ( error ) |
|
212 { |
|
213 aLanguages.Reset(); |
|
214 } |
|
215 else |
|
216 { |
|
217 TTtsRArrayLanguagePtrPckg rArrayLanguagePtrPckg = &aLanguages; |
|
218 |
|
219 error = iController.CustomCommandSync( iDestinationPckg, |
|
220 ETtsSupportedLanguages, |
|
221 rArrayLanguagePtrPckg, |
|
222 KNullDesC8 ); |
|
223 } |
|
224 |
|
225 return error; |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // RTtsCustomCommands::GetSupportedVoices |
|
230 // |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 EXPORT_C TInt RTtsCustomCommands::GetSupportedVoices( TLanguage aLanguage, |
|
234 RArray<TTtsStyle>& aVoices ) |
|
235 { |
|
236 TInt numberOfVoices( -1 ); |
|
237 |
|
238 TTtsLanguagePckg languagePckg = aLanguage; |
|
239 TTtsIntPtrPckg intPtrPckg = &numberOfVoices; |
|
240 |
|
241 TInt error = |
|
242 iController.CustomCommandSync( iDestinationPckg, ETtsSupportedVoicesCount, |
|
243 languagePckg, intPtrPckg ); |
|
244 |
|
245 TTtsStyle tmp; |
|
246 TInt i( 0 ); |
|
247 |
|
248 while ( !error && i < numberOfVoices ) |
|
249 { |
|
250 i++; |
|
251 |
|
252 error = aVoices.Append( tmp ); |
|
253 } |
|
254 |
|
255 if ( error ) |
|
256 { |
|
257 aVoices.Reset(); |
|
258 } |
|
259 else |
|
260 { |
|
261 TTtsRArrayTtsStylePtrPckg rArrayTtsStylePtrPckg = &aVoices; |
|
262 |
|
263 error = iController.CustomCommandSync( iDestinationPckg, |
|
264 ETtsSupportedVoices, |
|
265 languagePckg, |
|
266 rArrayTtsStylePtrPckg ); |
|
267 } |
|
268 |
|
269 return error; |
|
270 } |
|
271 |
|
272 // End of file |