Revision: 201038 RCL_3 PDK_3.0.4
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 13 Oct 2010 15:32:36 +0300
branchRCL_3
changeset 44 7a45d2ea2f56
parent 41 fb2c519f85e0
Revision: 201038 Kit: 201041
localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h
localconnectivityservice/dun/atext/src/DunAtCmdEchoer.cpp
localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp
localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp
localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp
localconnectivityservice/dun/atext/src/DunAtModeListen.cpp
localconnectivityservice/dun/atext/src/DunAtNvramListen.cpp
localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp
localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp
localconnectivityservice/dun/plugins/src/usb/DunUsbConfig.cpp
localconnectivityservice/dun/plugins/src/usb/DunUsbListen.cpp
localconnectivityservice/dun/utils/src/DunDataPusher.cpp
localconnectivityservice/dun/utils/src/DunDataWaiter.cpp
localconnectivityservice/dun/utils/src/DunDownstream.cpp
localconnectivityservice/dun/utils/src/DunNoteHandler.cpp
localconnectivityservice/dun/utils/src/DunSignalCopy.cpp
localconnectivityservice/dun/utils/src/DunSignalNotify.cpp
localconnectivityservice/dun/utils/src/DunSignalWaiter.cpp
localconnectivityservice/dun/utils/src/DunUpstream.cpp
localconnectivityservice/generichid/inc/hidparser.h
localconnectivityservice/generichid/src/hidparser.cpp
localconnectivityservice/headset/src/headset.cpp
localconnectivityservice/obexreceiveservices/bip/src/BIPController.cpp
localconnectivityservice/obexserviceman/utils/src/obexutilslaunchwaiter.cpp
--- a/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h	Wed Oct 13 15:32:36 2010 +0300
@@ -608,7 +608,9 @@
      * @param aEndIndex End index (changes)
      * @return Symbian error code on error, KErrNone otherwise
      */
-    TBool FindSubCommandQuotes( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
+    TBool FindSubCommandQuotes( TChar aCharacter,
+                                TInt aStartIndex,
+                                TInt& aEndIndex );
 
     /**
      * Check if in next subcommand's extended border
@@ -619,7 +621,9 @@
      * @param aEndIndex End index (changes)
      * @return ETrue if in next command's extended border, EFalse otherwise
      */
-    TBool IsExtendedBorder( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
+    TBool IsExtendedBorder( TChar aCharacter,
+                            TInt aStartIndex,
+                            TInt& aEndIndex );
 
     /**
      * Finds subcommand with alphanumeric borders
--- a/localconnectivityservice/dun/atext/src/DunAtCmdEchoer.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdEchoer.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -70,9 +70,9 @@
         FTRACE(FPrint( _L("CDunAtCmdEchoer::SendEchoCharacter() (not ready) complete") ));
         return KErrNotReady;
         }
+    iAtEchoState = EDunStateAtCmdEchoing;
     iStreamCallback->NotifyDataPushRequest( aInput, this );
     iCallback = aCallback;
-    iAtEchoState = EDunStateAtCmdEchoing;
     FTRACE(FPrint( _L("CDunDownstream::SendEchoCharacter() complete" ) ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -53,6 +53,11 @@
  * Refer to test specification if planning to change the heuristic.
  * Note2: Input buffer management (ExtractLineFromInputBuffer()) can be tested
  * with non-line based terminals such as HyperTerminal or Realterm.
+ * Note3: If there is a need to handle commands with random data, the extended
+ * command checking can interfere with the character set of this random data.
+ * Best way to handle this random data is to create a handler for these commands
+ * which skips the valid "not to be parsed" data or use quotes. For these cases
+ * the CDunAtSpecialCmdHandler could be extended.
  */
 
 #include "DunAtCmdHandler.h"
@@ -1162,6 +1167,8 @@
         iDecodeInfo.iCmdsHandled++;
         FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() (handled=%d)"), iDecodeInfo.iCmdsHandled ));
         }
+    FTRACE(FPrint( _L("CDunAtCmdPusher::ExtractNextSubCommand() extracted:") ));
+    FTRACE(FPrintRaw(iParseInfo.iSendBuffer) );
     FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() complete") ));
     return ETrue;
     }
@@ -1245,6 +1252,16 @@
 TBool CDunAtCmdHandler::IsExtendedCharacter( TChar aCharacter )
     {
     FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedCharacter()") ));
+    // Extended characters supported by this function (parser understands these)
+    // '+': Universal; mentioned in 3GPP TS 27.007, 3GPP TS 27.005, ITU-T V.250
+    // '&': Mentioned in ITU-T V.250 and in some "de facto" commands
+    // '%': Used by some old Hayes modems, left just in case
+    // '\': Used by some old Hayes modems, left just in case
+    // '*': Used by some old Hayes modems, AT&T and others
+    // '#': Used by some old Hayes modems, left just in case
+    // '$': Used by AT&T and Qualcomm
+    // '^': Used by China Mobile
+    // [please maintain this list here for quick reference]
     if ( aCharacter=='+'  || aCharacter=='&' || aCharacter=='%' ||
          aCharacter=='\\' || aCharacter=='*' || aCharacter=='#' ||
          aCharacter=='$'  || aCharacter=='^' )
@@ -1399,25 +1416,9 @@
         {
         iDecodeInfo.iExtendedIndex = aEndIndex;
         SaveFoundCharDecodeState( aCharacter );
-        FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border normal) complete") ));
+        FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border) complete") ));
         return EFalse;
         }
-    // Now suspect border found so peek the next character after the suspected
-    // extended character. If it is not alphabetical character, return with EFalse.
-    // This case is to detect the cases such as "AT+VTS={*,3000}", where '*' would
-    // be the start of the next command in normal cases.
-    TInt peekIndex = aEndIndex + 1;
-    TInt lineLength = iLineBuffer.Length();
-    if ( peekIndex < lineLength )
-        {
-        TChar nextCharacter = iLineBuffer[peekIndex];
-        if ( !nextCharacter.IsAlpha() )
-            {
-            SaveFoundCharDecodeState( aCharacter );
-            FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border special) complete") ));
-            return EFalse;
-            }
-        }
     aEndIndex--;
     FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (border) complete") ));
     return ETrue;
@@ -1436,7 +1437,8 @@
         // Check the special case when assigning a number with "basic" command
         // and there is no delimiter after it. In this case <Numeric>|<Alpha>
         // border must be detected but only for a "basic" command, not for
-        // extended.
+        // extended. This type of case is in active use in initialization
+        // strings where "ATS7=60L1M1X3" is one example
         if ( iDecodeInfo.iExtendedIndex<0    && iDecodeInfo.iPrevExists &&
              iDecodeInfo.iPrevChar.IsDigit() && aCharacter.IsAlpha() )
             {
--- a/localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -119,13 +119,13 @@
         return KErrGeneral;
         }
     iStatus = KRequestPending;
+    iAtPushState = EDunStateAtCmdPushing;
     iAtCmdExt->HandleCommand( iStatus,
                               aInput,
                               iRecvBuffer,
                               iReplyLeftPckg,
                               iReplyTypePckg );
     SetActive();
-    iAtPushState = EDunStateAtCmdPushing;
     FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() complete") ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -86,9 +86,9 @@
         return KErrNotReady;
         }
     iStatus = KRequestPending;
+    iEcomListenState = EDunStateEcomListening;
     iAtCmdExt->ReceiveEcomPluginChange( iStatus, iPluginUidPckg, iEcomTypePckg );
     SetActive();
-    iEcomListenState = EDunStateEcomListening;
     FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest() complete") ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/atext/src/DunAtModeListen.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtModeListen.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -84,9 +84,9 @@
         return KErrNotReady;
         }
     iStatus = KRequestPending;
+    iModeListenState = EDunStateModeListening;
     iAtCmdExtCommon->ReceiveModeStatusChange( iStatus, iModePckg );
     SetActive();
-    iModeListenState = EDunStateModeListening;
     FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest() complete" )));
     return KErrNone;
     }
@@ -179,4 +179,6 @@
 //
 void CDunAtModeListen::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunAtModeListen::DoCancel()") ));
+    FTRACE(FPrint( _L("CDunAtModeListen::DoCancel() complete") ));
     }
--- a/localconnectivityservice/dun/atext/src/DunAtNvramListen.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtNvramListen.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -91,9 +91,9 @@
         iStarted = ETrue;
         }
     iStatus = KRequestPending;
+    iNvramHandleState = EDunStateNvramListening;
     iAtCmdExtCommon->ReceiveNvramStatusChange( iStatus, iNvramBuffer );
     SetActive();
-    iNvramHandleState = EDunStateNvramListening;
     FTRACE(FPrint( _L("CDunAtNvramListen::IssueRequest() complete") ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -90,9 +90,9 @@
         return KErrNotReady;
         }
     iStatus = KRequestPending;
+    iUrcHandleState = EDunStateAtUrcHandling;
     iAtCmdExt->ReceiveUnsolicitedResult( iStatus, iRecvBuffer, iOwnerUidPckg );
     SetActive();
-    iUrcHandleState = EDunStateAtUrcHandling;
     // Next mark ownership
     if ( !iStarted )
         {
@@ -213,6 +213,8 @@
 //
 void CDunAtUrcHandler::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunAtUrcHandler::DoCancel()") ));
+    FTRACE(FPrint( _L("CDunAtUrcHandler::DoCancel() complete") ));
     }
 
 // ---------------------------------------------------------------------------
--- a/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -142,9 +142,9 @@
         User::Leave( retTemp );
         }
     iStatus = KRequestPending;
+    iListenState = EBtListenStateListening;
     iListenSocket.Accept( iEntity.iBTPort, iStatus );
     SetActive();
-    iListenState = EBtListenStateListening;
 
     FTRACE(FPrint( _L( "CDunBtListen::IssueRequestL() complete") ));
     }
--- a/localconnectivityservice/dun/plugins/src/usb/DunUsbConfig.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/plugins/src/usb/DunUsbConfig.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -117,9 +117,9 @@
         return KErrNotReady;
         }
     iStatus = KRequestPending;
+    iConfigState = EUsbConfigStateWaiting;
     iAcmProperty.Subscribe( iStatus );
     SetActive();
-    iConfigState = EUsbConfigStateWaiting;
     FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest() complete" )));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/plugins/src/usb/DunUsbListen.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/plugins/src/usb/DunUsbListen.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -182,11 +182,11 @@
         }
     iDeviceStatePrev = iDeviceState;
     iStatus = KRequestPending;
+    iListenState = EUsbListenStateListening;
     iUsbServer.DeviceStateNotification( KDunUsbDeviceStateMask,
                                         iDeviceState,
                                         iStatus );
     SetActive();
-    iListenState = EUsbListenStateListening;
     FTRACE(FPrint( _L( "CDunUsbListen::Activate() complete" ) ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/utils/src/DunDataPusher.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunDataPusher.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -194,7 +194,6 @@
         FTRACE(FPrint( _L("CDunDataPusher::SendQueuedData() (ERROR) complete" )));
         return EFalse;
         }
-    iPushState = EDunStateDataPushing;
     FTRACE(FPrint( _L("CDunDataPusher::SendQueuedData() complete (%d)" ), iEventQueue.Count() ));
     return ETrue;
     }
@@ -338,21 +337,24 @@
     if ( iComm )
         {
         iStatus = KRequestPending;
+        iPushState = EDunStateDataPushing;
         iComm->Write( iStatus, *dataToPush );
-        FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested (buffer=0x%08X)" ), dataToPush ));
+        SetActive();
+        FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested for %d bytes... (buffer=0x%08X)" ), dataToPush->Length(), dataToPush ));
         }
     else if ( iSocket )
         {
         iStatus = KRequestPending;
+        iPushState = EDunStateDataPushing;
         iSocket->Send( *dataToPush, 0, iStatus );
-        FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RSocket Send() requested (buffer=0x%08X)" ), dataToPush ));
+        SetActive();
+        FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RSocket Send() requested for %d bytes... (buffer=0x%08X)" ), dataToPush->Length(), dataToPush ));
         }
     else
         {
         FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() (ERROR) complete" )));
         return KErrGeneral;
         }
-    SetActive();
     FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() complete" )));
     return KErrNone;
     }
@@ -412,6 +414,7 @@
         }  // if ( !stop )
     else  // stop -> tear down connection
         {
+        iPushState = EDunStateIdle;
         TDunConnectionReason connReason;
         connReason.iReasonType = EDunReasonTypeRW;
         connReason.iContext = EDunMediaContextLocal;
--- a/localconnectivityservice/dun/utils/src/DunDataWaiter.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunDataWaiter.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -134,11 +134,11 @@
         FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() (iComm) not initialized!" ) ));
         return KErrGeneral;
         }
+    iComm->ResetBuffers();
     iStatus = KRequestPending;
-    iComm->ResetBuffers();
+    iDataWaiterState = EDunStateDataWaiting;
     iComm->NotifyDataAvailable( iStatus );
     SetActive();
-    iDataWaiterState = EDunStateDataWaiting;
     FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() complete" )));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/utils/src/DunDownstream.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunDownstream.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -222,6 +222,7 @@
         iPushData.iDataPusher->StopOneEvent( iBufferPtr );
         }
     iTransferState = EDunStateIdle;
+    iOperationType = EDunOperationTypeUndefined;
     FTRACE(FPrint( _L("CDunDownstream::Stop() complete" )));
     return KErrNone;
     }
@@ -298,11 +299,13 @@
         {
         case EDunReaderDownstream:
             iStatus = KRequestPending;
+            iTransferState = EDunStateTransferring;
             iNetwork->ReadOneOrMore( iStatus, *iBufferPtr );
             SetActive();
             FTRACE(FPrint( _L("CDunDownstream::IssueRequest() RComm ReadOneOrMore() requested" ) ));
             break;
         case EDunWriterDownstream:
+            iTransferState = EDunStateTransferring;
             AddToQueueAndSend( iBufferPtr, this );
             break;
         default:
@@ -310,8 +313,6 @@
             return KErrGeneral;
         }
 
-    iTransferState = EDunStateTransferring;
-
     FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d) complete" ), iDirection));
     return KErrNone;
     }
@@ -374,6 +375,8 @@
 //
 void CDunDownstream::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunDownstream::DoCancel()" )));
+    FTRACE(FPrint( _L("CDunDownstream::DoCancel() complete" )));
     }
 
 // ---------------------------------------------------------------------------
@@ -407,8 +410,6 @@
         FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (continue) complete" )));
         return;
         }
-    iTransferState = EDunStateIdle;
-    iOperationType = EDunOperationTypeUndefined;
     if ( !iPushData.iDataPusher )
         {
         FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (iPushData.iDataPusher not initialized!) complete" )));
@@ -423,7 +424,8 @@
     FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (find event)" )));
     if ( foundIndex >= 0 )
         {
-        // Restart the reading from Dataport only if in data mode
+        iTransferState = EDunStateIdle;
+        iOperationType = EDunOperationTypeUndefined;
         FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (issue request)" )));
         if ( iPushData.iDataMode )
             {
@@ -443,9 +445,10 @@
     {
     FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart()" )));
     iPushData.iDataMode = EFalse;
-    // Now the data mode has ended.
-    // If read operation then cancel it.
-    if ( iOperationType == EDunOperationTypeRead )
+    // Now the data mode has ended. If read operation then cancel it.
+    // Check for iTransferState here to minimize logging
+    if ( iTransferState==EDunStateTransferring &&
+         iOperationType==EDunOperationTypeRead )
         {
         Stop( EFalse );
         }
@@ -461,8 +464,14 @@
     {
     FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd()" )));
     iPushData.iDataMode = ETrue;
-    // Command mode ends here so start reading from Dataport
-    iOperationType = EDunOperationTypeRead;
-    IssueRequest();
+    // Command mode ends here so start reading from Dataport only if generic
+    // transferring state is EDunStateIdle. This is a reduced form of having
+    // read pending -> reissue not needed OR write pending -> reissue not needed
+    // (NotifyDataPushComplete() will reissue).
+    if ( iTransferState == EDunStateIdle )
+        {
+        iOperationType = EDunOperationTypeRead;  // just in case
+        IssueRequest();
+        }
     FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd() complete" )));
     }
--- a/localconnectivityservice/dun/utils/src/DunNoteHandler.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunNoteHandler.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -92,7 +92,6 @@
         return retTrap;
         }
     SetActive();
-    iNoteState = EDunStateUiNoting;
     FTRACE(FPrint( _L("CDunNoteHandler::IssueRequest() complete") ));
     return KErrNone;
     }
@@ -176,6 +175,7 @@
     note->SetSecondaryDisplayData( sdData );  // ownership transferred
     // Start to show note
     iStatus = KRequestPending;
+    iNoteState = EDunStateUiNoting;
     note->ShowConfirmationQueryL( iStatus,
                                   *unicodeString,
                                   R_AVKON_SOFTKEYS_OK_EMPTY,
--- a/localconnectivityservice/dun/utils/src/DunSignalCopy.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunSignalCopy.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -192,9 +192,9 @@
         {
         FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() start waiting for change..." ) ));
         iStatus = KRequestPending;
+        iSignalCopyState = EDunStateSignalCopy;
         comm->NotifySignalChange( iStatus, iSignals, iListenSignals );
         SetActive();
-        iSignalCopyState = EDunStateSignalCopy;
         }
     FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() complete" )));
     return KErrNone;
--- a/localconnectivityservice/dun/utils/src/DunSignalNotify.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunSignalNotify.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -165,9 +165,9 @@
         {
         FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() start waiting for change..." ) ));
         iStatus = KRequestPending;
+        iSignalNotifyState = EDunStateSignalNotify;
         iNetwork->NotifySignalChange( iStatus, iSignals, iListenSignals );
         SetActive();
-        iSignalNotifyState = EDunStateSignalNotify;
         }
     FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() complete" )));
     return KErrNone;
@@ -382,4 +382,6 @@
 //
 void CDunSignalNotify::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunSignalNotify::DoCancel()" ) ));
+    FTRACE(FPrint( _L("CDunSignalNotify::DoCancel() complete" ) ));
     }
--- a/localconnectivityservice/dun/utils/src/DunSignalWaiter.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunSignalWaiter.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -141,9 +141,9 @@
         return KErrGeneral;
         }
     iStatus = KRequestPending;
+    iSignalWaiterState = EDunStateSignalWaiting;
     iComm->NotifySignalChange( iStatus, iSignals, KSignalDCEInputs );
     SetActive();
-    iSignalWaiterState = EDunStateSignalWaiting;
     FTRACE(FPrint( _L("CDunSignalWaiter::IssueRequest() complete" )));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/utils/src/DunUpstream.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunUpstream.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -121,6 +121,12 @@
         FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() (trapped!) complete" ) ));
         return retTrap;
         }
+    // Note: the order of the added callbacks is important. When a mode change
+    // occurs, it is best to do the most important stuff with the first callback
+    // object and after this cleanups with the second. Example: Data mode start
+    // should stop command handling; first callback stops command handling,
+    // second callback stops multiplexer (doing this differently could cause the
+    // multiplexer to re-activate).
     atCmdHandler->AddCmdModeCallback( aCallbackUp );
     atCmdHandler->AddCmdModeCallback( aCallbackDown );
     iParseData.iDataMode = EFalse;
@@ -189,6 +195,7 @@
         }
     Cancel();
     iTransferState = EDunStateIdle;
+    iOperationType = EDunOperationTypeUndefined;
     // Notify parent about inactivity
     if ( iActivityData.iActivityCallback && iActivityData.iNotified )
         {
@@ -279,13 +286,17 @@
             if ( iComm )
                 {
                 iStatus = KRequestPending;
+                iTransferState = EDunStateTransferring;
                 iComm->ReadOneOrMore( iStatus, *iBufferPtr );
+                SetActive();
                 FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RComm ReadOneOrMore() requested" ) ));
                 }
             else if ( iSocket )
                 {
                 iStatus = KRequestPending;
+                iTransferState = EDunStateTransferring;
                 iSocket->RecvOneOrMore( *iBufferPtr, 0, iStatus, iReadLengthSocket );
+                SetActive();
                 FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RSocket RecvOneOrMore() requested" ) ));
                 }
             else
@@ -296,7 +307,9 @@
             break;
         case EDunWriterUpstream:
             iStatus = KRequestPending;
+            iTransferState = EDunStateTransferring;
             iNetwork->Write( iStatus, *iBufferPtr );
+            SetActive();
             FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RComm Write() requested" ) ));
             break;
         default:
@@ -304,9 +317,6 @@
             return KErrGeneral;
         }
 
-    SetActive();
-    iTransferState = EDunStateTransferring;
-
     FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (Dir=%d) complete" ), iDirection));
     return KErrNone;
     }
@@ -440,6 +450,8 @@
 //
 void CDunUpstream::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunUpstream::DoCancel()" )));
+    FTRACE(FPrint( _L("CDunUpstream::DoCancel() complete" )));
     }
 
 // ---------------------------------------------------------------------------
@@ -450,6 +462,11 @@
 void CDunUpstream::NotifyParserNeedsMoreData()
     {
     FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData()" )));
+    if ( iOperationType != EDunOperationTypeRead )
+        {
+        FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData() (not ready) complete" )));
+        return;
+        }
     IssueRequest();  // iOperationType must be read here (don't set)
     FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData() complete" )));
     }
@@ -550,15 +567,12 @@
     iParseData.iDataMode = ETrue;
     // Stop processing (mandatory).
     // This will stop any possibly pending operations of
-    // CDunAtCmdHandler and CDunAtUrcHandler. CDunDownstream will take care of
-    // clearing (and stopping) non-callback write queues.
+    // CDunAtCmdHandler and CDunAtUrcHandler(s). CDunDownstream will take care
+    // of clearing (and stopping) non-callback write queues.
     StopAtCmdHandling();
-    // The follow is needed because stopping the AT command handling here
-    // prevents the subsequent AT command handling notification to reach the
-    // NotifyAtCmdHandlingEnd() in this class (the notification starts from
-    // CDunAtCmdPusher's SetToIdleAndNotifyEnd()).
-    // So here we have to do the block "if ( aStartIndex < 0 )" in function
-    // NotifyAtCmdHandlingEnd().
+    // The following is needed here because stopping the AT command handling
+    // causes CDunAtCmdHandler not to call NotifyParserNeedsMoreData().
+    // In command mode iOperationType is always EDunOperationTypeRead.
     IssueRequest();
     FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeEnd() complete" )));
     }
@@ -571,6 +585,7 @@
 void CDunUpstream::NotifyEchoComplete()
     {
     FTRACE(FPrint( _L("CDunUpstream::NotifyEchoComplete()" )));
+    // iOperationType is always EDunOperationTypeRead here
     IssueRequest();
     FTRACE(FPrint( _L("CDunUpstream::NotifyEchoComplete() complete" )));
     }
--- a/localconnectivityservice/generichid/inc/hidparser.h	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/generichid/inc/hidparser.h	Wed Oct 13 15:32:36 2010 +0300
@@ -29,6 +29,7 @@
  */
 enum THidParserError
     {
+    ENoError                        =0,	
     // General:
     //
     EUnknownItem                    = 0xbf00,
--- a/localconnectivityservice/generichid/src/hidparser.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/generichid/src/hidparser.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -1268,11 +1268,11 @@
 TInt CParser::HandleGlobalReportCount( const TItem& aItem )
     {
     TRACE_INFO((_L("Global report count %d\n"), aItem.Data()));
-    TInt retVal = 0;
+    TInt retVal = ENoError;
     iGlobal.iCount = aItem.Data();
     if (aItem.Data() == 0)
         {
-        retVal = EZeroReportCount;
+        TRACE_INFO((_L("Global report count zero\n")));	     
         }
     iItemsDefined |= EReportCount;
 
--- a/localconnectivityservice/headset/src/headset.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/headset/src/headset.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -162,7 +162,14 @@
 TInt CHidHeadsetDriver::DataIn( CHidTransport::THidChannelType aChannel,
         const TDesC8& aPayload )
     {
+    // validate input data
+    if (0 >= aPayload.Length())
+        {
+        return KErrArgument;
+        }
+
     TInt retVal = KErrNone;
+    
     switch ( aChannel )
         {
         case CHidTransport::EHidChannelInt:
--- a/localconnectivityservice/obexreceiveservices/bip/src/BIPController.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/obexreceiveservices/bip/src/BIPController.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -293,22 +293,8 @@
     
     if (iBTObject)
         {
-        if(iBTTransferState == ETransferPutDiskError)
-            {
-            return KErrDiskFull;
-            }
-        
-        if(iBTObject->Name().Length() > KMaxFileName)
-            {
-            TRACE_INFO( _L( "[oppreceiveservice] COPPController: PutPacketIndication truncating name of file being received\t" ) );
-            TRAPD(err, iBTObject->SetNameL(iBTObject->Name().Left(KMaxFileName)));
-            if(err != KErrNone)
-                {
-                return KErrAccessDenied;
-                }
-            }     
+        iTotalSizeByte = iBTObject->Length();     // get size of receiving file
         iReceivingFileName = iBTObject->Name();   // get name of receiving file
-        iTotalSizeByte = iBTObject->Length();     // get size of receiving file                       
         
         // Check that capacity is suitable as soon as possible
         if(!iLengthHeaderReceived && iTotalSizeByte > 0)
@@ -326,8 +312,14 @@
                 return KErrDiskFull;
                 }
             }
-        
-        
+        if(iBTObject->Name().Length() > KMaxFileName)
+            {
+            return KErrAccessDenied;
+            }
+        if(iBTTransferState == ETransferPutDiskError)
+            {
+            return KErrDiskFull;
+            }
         // successfully received put packet if we reached here
         iBTTransferState = ETransferPut;
         
--- a/localconnectivityservice/obexserviceman/utils/src/obexutilslaunchwaiter.cpp	Tue Sep 14 22:59:42 2010 +0300
+++ b/localconnectivityservice/obexserviceman/utils/src/obexutilslaunchwaiter.cpp	Wed Oct 13 15:32:36 2010 +0300
@@ -147,7 +147,7 @@
                     TRAP (error, TObexUtilsUiLayer::LaunchFileManagerL( filePath, 
                                                                         sortMethod, 
                                                                         ETrue )); // ETrue -> launch file manager in embedded mode.                    
-										isCompleteSelf = ETrue; 
+					isCompleteSelf = ETrue; 
                     }  // KErrNotSupported
                                         
                 }