47 _LIT8( KMaxWaitTime, "MaxWaitTime" ); |
47 _LIT8( KMaxWaitTime, "MaxWaitTime" ); |
48 _LIT8( KStartUpDelay, "StartUpDelay" ); |
48 _LIT8( KStartUpDelay, "StartUpDelay" ); |
49 _LIT8( KEnableHtiWatchDog, "EnableHtiWatchDog" ); |
49 _LIT8( KEnableHtiWatchDog, "EnableHtiWatchDog" ); |
50 _LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" ); |
50 _LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" ); |
51 _LIT8( KShowErrorDialogs, "ShowErrorDialogs" ); |
51 _LIT8( KShowErrorDialogs, "ShowErrorDialogs" ); |
|
52 _LIT8( KReconnectDelay, "ReconnectDelay"); |
52 |
53 |
53 const static TInt KDefaultMaxWaitTime = 90; // seconds |
54 const static TInt KDefaultMaxWaitTime = 90; // seconds |
54 const static TInt KDefaultStartUpDelay = 5; // seconds |
55 const static TInt KDefaultStartUpDelay = 5; // seconds |
55 const static TInt KHtiDefaultPriority = 3; |
56 const static TInt KHtiDefaultPriority = 3; |
56 const static TInt KHtiWatchDogEnabledDefault = 0; |
57 const static TInt KHtiWatchDogEnabledDefault = 0; |
57 const static TInt KHtiConsoleEnabledDefault = 0; |
58 const static TInt KHtiConsoleEnabledDefault = 0; |
58 const static TInt KHtiAutoStartEnabledDefault = 0; |
59 const static TInt KHtiAutoStartEnabledDefault = 1; |
59 const static TInt KHtiShowErrorDialogsDefault = 1; |
60 const static TInt KHtiShowErrorDialogsDefault = 1; |
|
61 const static TInt KHtiReconnectDelay = 0; |
60 |
62 |
61 // MACROS |
63 // MACROS |
62 |
64 |
63 // LOCAL CONSTANTS AND MACROS |
65 // LOCAL CONSTANTS AND MACROS |
64 |
66 |
99 TInt priority = KHtiDefaultPriority; |
101 TInt priority = KHtiDefaultPriority; |
100 TInt enableHtiWatchDog = KHtiWatchDogEnabledDefault; |
102 TInt enableHtiWatchDog = KHtiWatchDogEnabledDefault; |
101 TInt showConsole = KHtiConsoleEnabledDefault; |
103 TInt showConsole = KHtiConsoleEnabledDefault; |
102 TInt enableHtiAutoStart = KHtiAutoStartEnabledDefault; |
104 TInt enableHtiAutoStart = KHtiAutoStartEnabledDefault; |
103 TInt showErrorDialogs = KHtiShowErrorDialogsDefault; |
105 TInt showErrorDialogs = KHtiShowErrorDialogsDefault; |
|
106 TInt reconnectDelay = KHtiReconnectDelay; |
104 |
107 |
105 TRAPD( err, iCfg = CHtiCfg::NewL() ); |
108 TRAPD( err, iCfg = CHtiCfg::NewL() ); |
106 if ( err == KErrNone ) |
109 if ( err == KErrNone ) |
107 { |
110 { |
108 HTI_LOG_TEXT( "CHtiCfg constructed" ); |
111 HTI_LOG_TEXT( "CHtiCfg constructed" ); |
210 if ( paramErr != KErrNone ) |
213 if ( paramErr != KErrNone ) |
211 { |
214 { |
212 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
215 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
213 HTI_LOG_DES( KShowErrorDialogs ); |
216 HTI_LOG_DES( KShowErrorDialogs ); |
214 } |
217 } |
215 |
218 |
|
219 TRAP( paramErr, reconnectDelay = iCfg->GetParameterIntL( KReconnectDelay ) ); |
|
220 if ( paramErr != KErrNone ) |
|
221 { |
|
222 HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); |
|
223 HTI_LOG_DES( KReconnectDelay ); |
|
224 } |
|
225 |
216 if ( !IsStartAcceptedL( enableHtiAutoStart ) ) |
226 if ( !IsStartAcceptedL( enableHtiAutoStart ) ) |
217 { |
227 { |
218 User::Leave( KErrAbort ); |
228 User::Leave( KErrAbort ); |
219 } |
229 } |
220 |
230 |
221 WaitNormalState( maxWaitTime, startUpDelay ); |
231 WaitNormalState( maxWaitTime, startUpDelay ); |
222 iDispatcher = CHtiDispatcher::NewL( commPlugin, maxMsgSize, |
232 iDispatcher = CHtiDispatcher::NewL( commPlugin, maxMsgSize, |
223 maxQueueSize, showConsole != 0, showErrorDialogs != 0 ); |
233 maxQueueSize, reconnectDelay, showConsole != 0, showErrorDialogs != 0 ); |
224 } |
234 } |
225 } |
235 } |
226 |
236 |
227 |
237 |
228 // cfg file was not found or it could not be opened |
238 // cfg file was not found or it could not be opened |
237 |
247 |
238 WaitNormalState( KDefaultMaxWaitTime, KDefaultStartUpDelay ); |
248 WaitNormalState( KDefaultMaxWaitTime, KDefaultStartUpDelay ); |
239 |
249 |
240 //create with default values |
250 //create with default values |
241 iDispatcher = CHtiDispatcher::NewL( |
251 iDispatcher = CHtiDispatcher::NewL( |
242 KNullDesC8, 0, 0, showConsole != 0, showErrorDialogs != 0 ); |
252 KNullDesC8, 0, 0, 0, showConsole != 0, showErrorDialogs != 0 ); |
243 } |
253 } |
244 |
254 |
245 HTI_LOG_FORMAT( "Priority setting = %d", priority ); |
255 HTI_LOG_FORMAT( "Priority setting = %d", priority ); |
246 // Set HTI priority |
256 // Set HTI priority |
247 switch ( priority ) |
257 switch ( priority ) |