atext/server/src/atextmetadata.cpp
branchRCL_3
changeset 56 015fa7494bd2
parent 44 e9b924a62a66
equal deleted inserted replaced
49:10183c6d2913 56:015fa7494bd2
  1994     TATExtCompletionInfo& aComplInfo )
  1994     TATExtCompletionInfo& aComplInfo )
  1995     {
  1995     {
  1996     TRACE_FUNC_ENTRY
  1996     TRACE_FUNC_ENTRY
  1997     // First extract the base of AT command from aAtCmdFull
  1997     // First extract the base of AT command from aAtCmdFull
  1998     // ('=' and everything after that)
  1998     // ('=' and everything after that)
  1999     TInt newLength = aAtCmdFull.Length();
  1999     TInt fullLength = aAtCmdFull.Length();
       
  2000     TInt newLength = fullLength;
       
  2001     TInt findIndex = KErrNotFound;
  2000     TInt foundPos = aAtCmdFull.Locate( '=' );
  2002     TInt foundPos = aAtCmdFull.Locate( '=' );
       
  2003     TRACE_INFO(( _L8("Base length before = %d"), fullLength ));
  2001     if ( foundPos >= 2 )  // After "AT"
  2004     if ( foundPos >= 2 )  // After "AT"
  2002         {
  2005         {
       
  2006         findIndex = foundPos - 1;
  2003         newLength = foundPos;
  2007         newLength = foundPos;
  2004         }
  2008         }
  2005     else if ( newLength >= 1 )
  2009     else if ( fullLength >= 3 )  // At least "AT?"
  2006         {
  2010         {
  2007         // There was no '=' so check if the last character is '?'.
  2011         // There was no '=' so check if the last character is '?'.
  2008         // If it is then remove it.
  2012         // If it is then remove it.
  2009         if ( aAtCmdFull[newLength-1] == '?' )
  2013         TInt lastIndex = fullLength - 1;
  2010             {
  2014         if ( aAtCmdFull[lastIndex] == '?' )
  2011             newLength--;
  2015             {
  2012             }
  2016             findIndex = lastIndex - 1;
  2013         }
  2017             newLength = fullLength - 1;
       
  2018             }
       
  2019         }
       
  2020     // Next correct newLength so that it doesn't contain the space(s)
       
  2021     for ( ; findIndex>=2; findIndex--,newLength-- )
       
  2022         {
       
  2023         TChar character = aAtCmdFull[findIndex];
       
  2024         if ( !(character.IsSpace()||character==0x00) )
       
  2025             {
       
  2026             break;
       
  2027             }
       
  2028         }
       
  2029     TRACE_INFO(( _L8("Base length after = %d"), newLength ));
  2014     HBufC8* baseCmd = HBufC8::NewMaxLC( newLength );
  2030     HBufC8* baseCmd = HBufC8::NewMaxLC( newLength );
  2015     TPtr8 baseCmdPtr = baseCmd->Des();
  2031     TPtr8 baseCmdPtr = baseCmd->Des();
  2016     baseCmdPtr.Copy( &aAtCmdFull[0], newLength );
  2032     baseCmdPtr.Copy( &aAtCmdFull[0], newLength );
  2017     // Now the baseCmd has the base command. Use it to find the support.
  2033     // Now the baseCmd has the base command. Use it to find the support.
  2018     DoCreateAndFindSupportL( *baseCmd,
  2034     DoCreateAndFindSupportL( *baseCmd,