|
1 /* |
|
2 * Copyright (c) 2003-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: The CNssSpeechItemSrsPortal provides the portal to the |
|
15 * SpeechRecognitionUtility object. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "nssvascspeechitemsrsportal.h" |
|
22 #include "rubydebug.h" |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CNssSpeechItemSrsPortal::CNssSpeechItemSrsPortal |
|
26 // C++ default constructor can NOT contain any code, that |
|
27 // might leave. |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 CNssSpeechItemSrsPortal::CNssSpeechItemSrsPortal() |
|
31 { |
|
32 //Initialize data members |
|
33 iState = TNssSpeechItemConstant::EIdle; |
|
34 |
|
35 iEnginePropertySet = EFalse; |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CNssSpeechItemSrsPortal::~CNssSpeechItemSrsPortal |
|
40 // Destructor |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CNssSpeechItemSrsPortal::~CNssSpeechItemSrsPortal() |
|
44 { |
|
45 RUBY_DEBUG0( "CNssSpeechItemSrsPortal::~CNssSpeechItemSrsPortal" ); |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CNssSpeechItemSrsPortal::NewL |
|
50 // Two-phased constructor. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CNssSpeechItemSrsPortal* CNssSpeechItemSrsPortal::NewL() |
|
54 { |
|
55 RUBY_DEBUG0( "CNssSpeechItemSrsPortal::NewL" ); |
|
56 |
|
57 CNssSpeechItemSrsPortal* self = NewLC(); |
|
58 CleanupStack::Pop( self ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CNssSpeechItemSrsPortal::NewLC |
|
64 // Two-phased constructor. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CNssSpeechItemSrsPortal* CNssSpeechItemSrsPortal::NewLC() |
|
68 { |
|
69 CNssSpeechItemSrsPortal* self = new (ELeave) CNssSpeechItemSrsPortal(); |
|
70 CleanupStack::PushL( self ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CNssSpeechItemSrsPortal::SetTerminationState |
|
76 // If there is no registered SpeechItem object, then delete myself, |
|
77 // else set the state to Termination State |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CNssSpeechItemSrsPortal::SetTerminationState() |
|
81 { |
|
82 RUBY_DEBUG0( "CNssSpeechItemSrsPortal::SetTerminationState" ); |
|
83 |
|
84 if ( !iSpeechItemCounter ) |
|
85 { |
|
86 // delete myself |
|
87 delete this; |
|
88 } |
|
89 else |
|
90 { |
|
91 iState = TNssSpeechItemConstant::ETerminate; |
|
92 } |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CNssSpeechItemSrsPortal::Register |
|
97 // Increment the counter for SpeechItem object |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void CNssSpeechItemSrsPortal::Register() |
|
101 { |
|
102 //increment the counter |
|
103 iSpeechItemCounter++; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CNssSpeechItemSrsPortal::Deregister |
|
108 // Decrement the counter for SpeechItem, and check for Termination state |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 void CNssSpeechItemSrsPortal::Deregister() |
|
112 { |
|
113 //decrement the counter |
|
114 iSpeechItemCounter--; |
|
115 |
|
116 if (iState == TNssSpeechItemConstant::ETerminate) |
|
117 { |
|
118 SetTerminationState(); |
|
119 } |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CNssSpeechItemSrsPortal::GetTrainingCapability |
|
124 // Return the Training Capabilities |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 CArrayFixFlat<TNssVasCoreConstant::TNssTrainingCapability>* |
|
128 CNssSpeechItemSrsPortal::GetTrainingCapability() |
|
129 { |
|
130 return NULL; |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CNssSpeechItemSrsPortal::IsEnginePropertySet |
|
135 // Return ETrue or EFalse |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 TBool CNssSpeechItemSrsPortal::IsEnginePropertySet() |
|
139 { |
|
140 return iEnginePropertySet; |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CNssSpeechItemSrsPortal::SetEngineProperty |
|
145 // Set the Engine Property data members |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 void CNssSpeechItemSrsPortal::SetEngineProperty( TInt aModelStorageCapacity, |
|
149 TInt aMaxLoadableModels ) |
|
150 { |
|
151 iModelStorageCapacity = aModelStorageCapacity; |
|
152 iMaxLoadableModels = aMaxLoadableModels; |
|
153 |
|
154 // Set the EnginePropertySet flag |
|
155 iEnginePropertySet = ETrue; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CNssSpeechItemSrsPortal::ModelStorageCapacity |
|
160 // Return the Model Storage capacity |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 TInt CNssSpeechItemSrsPortal::ModelStorageCapacity() |
|
164 { |
|
165 return iModelStorageCapacity; |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CNssSpeechItemSrsPortal::MaxLoadableModels |
|
170 // Return the Maximum Loadable Models |
|
171 // ----------------------------------------------------------------------------- |
|
172 // |
|
173 TInt CNssSpeechItemSrsPortal::MaxLoadableModels() |
|
174 { |
|
175 return iMaxLoadableModels; |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CNssSpeechItemSrsPortal::operator= |
|
180 // Overloaded operator = |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 CNssSpeechItemSrsPortal& CNssSpeechItemSrsPortal::operator=( |
|
184 const CNssSpeechItemSrsPortal& aPortal ) |
|
185 { |
|
186 if ( this != &aPortal ) |
|
187 { |
|
188 iState = aPortal.iState; |
|
189 iSpeechItemCounter = aPortal.iSpeechItemCounter; |
|
190 iEnginePropertySet = aPortal.iEnginePropertySet; |
|
191 iModelStorageCapacity = aPortal.iModelStorageCapacity; |
|
192 iMaxLoadableModels = aPortal.iMaxLoadableModels; |
|
193 } |
|
194 |
|
195 return *this; |
|
196 } |
|
197 |
|
198 // End of file |