101 |
101 |
102 // --------------------------------------------------------------------------- |
102 // --------------------------------------------------------------------------- |
103 // Starts AT command handling |
103 // Starts AT command handling |
104 // --------------------------------------------------------------------------- |
104 // --------------------------------------------------------------------------- |
105 // |
105 // |
106 TInt CDunAtCmdPusher::IssueRequest( TDesC8& aCommand ) |
106 TInt CDunAtCmdPusher::IssueRequest( TDesC8& aCommand, TBool aNormalMode ) |
107 { |
107 { |
108 FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest()") )); |
108 FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest()") )); |
109 FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() send ATEXT:") )); |
109 FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() send ATEXT:") )); |
110 FTRACE(FPrintRaw(aCommand) ); |
110 FTRACE(FPrintRaw(aCommand) ); |
111 if ( iAtPushState != EDunStateIdle ) |
111 if ( iAtPushState!=EDunStateIdle && aNormalMode ) |
112 { |
112 { |
113 FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (not ready) complete") )); |
113 FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (not ready) complete") )); |
114 return KErrNotReady; |
114 return KErrNotReady; |
115 } |
115 } |
116 iStatus = KRequestPending; |
116 iStatus = KRequestPending; |
184 FTRACE(FPrint( _L("CDunAtCmdPusher::SetEndOfCmdLine()") )); |
184 FTRACE(FPrint( _L("CDunAtCmdPusher::SetEndOfCmdLine()") )); |
185 iNoErrorReceived = EFalse; |
185 iNoErrorReceived = EFalse; |
186 iLastOkPush = EFalse; |
186 iLastOkPush = EFalse; |
187 iCmdAbort = EFalse; |
187 iCmdAbort = EFalse; |
188 iStop = EFalse; |
188 iStop = EFalse; |
|
189 iEditorMode = EFalse; |
189 FTRACE(FPrint( _L("CDunAtCmdPusher::SetEndOfCmdLine() complete") )); |
190 FTRACE(FPrint( _L("CDunAtCmdPusher::SetEndOfCmdLine() complete") )); |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------------------------- |
|
194 // Gets the editor mode status |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 TBool CDunAtCmdPusher::EditorMode() |
|
198 { |
|
199 FTRACE(FPrint( _L("CDunAtCmdPusher::EditorMode()") )); |
|
200 FTRACE(FPrint( _L("CDunAtCmdPusher::EditorMode() complete") )); |
|
201 return iEditorMode; |
190 } |
202 } |
191 |
203 |
192 // --------------------------------------------------------------------------- |
204 // --------------------------------------------------------------------------- |
193 // CDunAtCmdPusher::CDunAtCmdPusher |
205 // CDunAtCmdPusher::CDunAtCmdPusher |
194 // --------------------------------------------------------------------------- |
206 // --------------------------------------------------------------------------- |
301 iDownstream->NotifyDataPushRequest( sendBuffer, this ); |
313 iDownstream->NotifyDataPushRequest( sendBuffer, this ); |
302 FTRACE(FPrint( _L("CDunAtCmdPusher::SendReplyData() complete") )); |
314 FTRACE(FPrint( _L("CDunAtCmdPusher::SendReplyData() complete") )); |
303 } |
315 } |
304 |
316 |
305 // --------------------------------------------------------------------------- |
317 // --------------------------------------------------------------------------- |
|
318 // Manages change in reply type to EReplyTypeOther |
|
319 // --------------------------------------------------------------------------- |
|
320 // |
|
321 void CDunAtCmdPusher::ManageReplyTypeChangeToOther() |
|
322 { |
|
323 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToOther()") )); |
|
324 iNoErrorReceived = ETrue; |
|
325 SendReplyData(); |
|
326 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToOther() complete") )); |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------------------------- |
|
330 // Manages change in reply type to EReplyTypeOk |
|
331 // --------------------------------------------------------------------------- |
|
332 // |
|
333 void CDunAtCmdPusher::ManageReplyTypeChangeToOk() |
|
334 { |
|
335 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToOk()") )); |
|
336 // Skip the "OK" replies if not last. Only push the "OK" reply at the end. |
|
337 // iStop changes it so that the we have to send the "OK" immediately and |
|
338 // only stop with NotifyDataPushComplete() |
|
339 TBool found = iCallback->NotifyNextCommandPeekRequest(); |
|
340 if ( !found || iStop ) |
|
341 { |
|
342 SendReplyData(); |
|
343 } |
|
344 else |
|
345 { |
|
346 iNoErrorReceived = ETrue; |
|
347 SetToIdleAndNotifyEnd( KErrNone ); |
|
348 } |
|
349 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToOk() complete") )); |
|
350 } |
|
351 |
|
352 // --------------------------------------------------------------------------- |
|
353 // Manages change in reply type to EReplyTypeError |
|
354 // --------------------------------------------------------------------------- |
|
355 // |
|
356 void CDunAtCmdPusher::ManageReplyTypeChangeToError() |
|
357 { |
|
358 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToError()") )); |
|
359 if ( iNoErrorReceived ) |
|
360 { |
|
361 iAtCmdExt->ReportExternalHandleCommandError(); |
|
362 } |
|
363 SendReplyData(); |
|
364 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToError() complete") )); |
|
365 } |
|
366 |
|
367 // --------------------------------------------------------------------------- |
|
368 // Manages change in reply type to EReplyTypeEditor |
|
369 // --------------------------------------------------------------------------- |
|
370 // |
|
371 void CDunAtCmdPusher::ManageReplyTypeChangeToEditor() |
|
372 { |
|
373 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToEditor()") )); |
|
374 if ( !iEditorMode ) |
|
375 { |
|
376 // First change to editor mode: manage it as EReplyTypeOther (prompt) |
|
377 iEditorMode = ETrue; |
|
378 ManageReplyTypeChangeToOther(); |
|
379 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToEditor() (editor) complete") )); |
|
380 return; |
|
381 } |
|
382 // The same reply to editor mode as before: no reply, only notification for |
|
383 // echo/forwarding purposes |
|
384 iCallback->NotifyEditorModeReply(); |
|
385 // Do nothing after notifying. The next ForwardEditorModeInput() triggers |
|
386 // the next call of this function. |
|
387 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToEditor() complete") )); |
|
388 } |
|
389 |
|
390 // --------------------------------------------------------------------------- |
306 // Manages change in reply type |
391 // Manages change in reply type |
307 // --------------------------------------------------------------------------- |
392 // --------------------------------------------------------------------------- |
308 // |
393 // |
309 void CDunAtCmdPusher::ManageReplyTypeChange() |
394 void CDunAtCmdPusher::ManageReplyTypeChange() |
310 { |
395 { |
312 switch ( iReplyType ) |
397 switch ( iReplyType ) |
313 { |
398 { |
314 case EReplyTypeOther: |
399 case EReplyTypeOther: |
315 { |
400 { |
316 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeOther") )); |
401 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeOther") )); |
317 iNoErrorReceived = ETrue; |
402 iEditorMode = EFalse; |
318 SendReplyData(); |
403 ManageReplyTypeChangeToOther(); |
319 } |
404 } |
320 break; |
405 break; |
321 case EReplyTypeOk: |
406 case EReplyTypeOk: |
322 { |
407 { |
323 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeOk") )); |
408 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeOk") )); |
324 // Skip the "OK" replies if not last. Only push the "OK" reply at the end. |
409 iEditorMode = EFalse; |
325 // iStop changes it so that the we have to send the "OK" immediately and |
410 ManageReplyTypeChangeToOk(); |
326 // only stop with NotifyDataPushComplete() |
|
327 TBool found = iCallback->NotifyNextCommandPeekRequest(); |
|
328 if ( !found || iStop ) |
|
329 { |
|
330 SendReplyData(); |
|
331 } |
|
332 else |
|
333 { |
|
334 iNoErrorReceived = ETrue; |
|
335 SetToIdleAndNotifyEnd( KErrNone ); |
|
336 } |
|
337 } |
411 } |
338 break; |
412 break; |
339 case EReplyTypeError: |
413 case EReplyTypeError: |
340 { |
414 { |
341 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeError") )); |
415 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeError") )); |
342 if ( iNoErrorReceived ) |
416 iEditorMode = EFalse; |
343 { |
417 ManageReplyTypeChangeToError(); |
344 iAtCmdExt->ReportExternalHandleCommandError(); |
|
345 } |
|
346 SendReplyData(); |
|
347 } |
418 } |
|
419 break; |
|
420 case EReplyTypeEditor: |
|
421 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeEditor") )); |
|
422 ManageReplyTypeChangeToEditor(); |
348 break; |
423 break; |
349 default: |
424 default: |
350 { |
425 { |
351 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeUndefined") )); |
426 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeUndefined") )); |
|
427 iEditorMode = EFalse; |
352 SetToIdleAndNotifyEnd( KErrNone ); |
428 SetToIdleAndNotifyEnd( KErrNone ); |
353 } |
429 } |
354 break; |
430 break; |
355 } |
431 } |
356 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() complete") )); |
432 FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() complete") )); |