1527 pluginEntry.iUrcOwned = EFalse; |
1527 pluginEntry.iUrcOwned = EFalse; |
1528 iPluginData->AppendL( pluginEntry ); |
1528 iPluginData->AppendL( pluginEntry ); |
1529 aCleanupInfo.iEntryCreated = ETrue; |
1529 aCleanupInfo.iEntryCreated = ETrue; |
1530 aCleanupInfo.iEntryIndex = iPluginData->Count() - 1; |
1530 aCleanupInfo.iEntryIndex = iPluginData->Count() - 1; |
1531 foundIndex = aCleanupInfo.iEntryIndex; |
1531 foundIndex = aCleanupInfo.iEntryIndex; |
1532 foundEntry = &(*iPluginData)[foundIndex]; |
|
1533 } |
1532 } |
1534 // Now foundEntry is either the found entry or a newly added entry. |
1533 // Now foundEntry is either the found entry or a newly added entry. |
1535 // Make the iSupport metadata point to this. |
1534 // Make the iSupport metadata point to this. |
1536 TATExtAtCmdSupport& foundSupport = (*support)[foundPos]; |
1535 TATExtAtCmdSupport& foundSupport = (*support)[foundPos]; |
1537 #if defined( PRJ_OPTIMIZE_FOR_SPEED ) |
1536 #if defined( PRJ_OPTIMIZE_FOR_SPEED ) |
1563 if ( !iPluginData || aEntryIndex<0 || aEntryIndex>=iPluginData->Count() ) |
1562 if ( !iPluginData || aEntryIndex<0 || aEntryIndex>=iPluginData->Count() ) |
1564 { |
1563 { |
1565 TRACE_FUNC_EXIT |
1564 TRACE_FUNC_EXIT |
1566 User::Leave( KErrGeneral ); |
1565 User::Leave( KErrGeneral ); |
1567 } |
1566 } |
|
1567 TBool createdEntries = EFalse; |
1568 if ( !aEntries ) |
1568 if ( !aEntries ) |
1569 { |
1569 { |
1570 aEntries = new (ELeave) CArrayFixFlat<TATExtOneCmdSupport>( KGranularity ); |
1570 aEntries = new (ELeave) CArrayFixFlat<TATExtOneCmdSupport>( KGranularity ); |
|
1571 CleanupDeleteAndNullPushL( aEntries ); // we can't expect the caller to do this as they don't know about it yet |
|
1572 createdEntries = ETrue; |
1571 } |
1573 } |
1572 TATExtOneCmdSupport oneCmdSupport; |
1574 TATExtOneCmdSupport oneCmdSupport; |
1573 oneCmdSupport.iSupportType = aSupportType; |
1575 oneCmdSupport.iSupportType = aSupportType; |
1574 oneCmdSupport.iEntryIndex = aEntryIndex; |
1576 oneCmdSupport.iEntryIndex = aEntryIndex; |
1575 TInt retVal = KErrNotSupported; |
1577 TInt retVal = KErrNotSupported; |
1994 TATExtCompletionInfo& aComplInfo ) |
2001 TATExtCompletionInfo& aComplInfo ) |
1995 { |
2002 { |
1996 TRACE_FUNC_ENTRY |
2003 TRACE_FUNC_ENTRY |
1997 // First extract the base of AT command from aAtCmdFull |
2004 // First extract the base of AT command from aAtCmdFull |
1998 // ('=' and everything after that) |
2005 // ('=' and everything after that) |
1999 TInt newLength = aAtCmdFull.Length(); |
2006 TInt fullLength = aAtCmdFull.Length(); |
|
2007 TInt newLength = fullLength; |
|
2008 TInt findIndex = KErrNotFound; |
2000 TInt foundPos = aAtCmdFull.Locate( '=' ); |
2009 TInt foundPos = aAtCmdFull.Locate( '=' ); |
2001 if ( foundPos >= 2 ) // After "AT" |
2010 TRACE_INFO(( _L8("Base length before = %d"), fullLength )); |
2002 { |
2011 if ( foundPos >= 0 ) |
|
2012 { |
|
2013 findIndex = foundPos - 1; |
2003 newLength = foundPos; |
2014 newLength = foundPos; |
2004 } |
2015 TRACE_INFO(( _L8("Adjust case 1 = %d/%d"), findIndex, newLength )); |
2005 else if ( newLength >= 1 ) |
2016 } |
|
2017 else |
2006 { |
2018 { |
2007 // There was no '=' so check if the last character is '?'. |
2019 // There was no '=' so check if the last character is '?'. |
2008 // If it is then remove it. |
2020 // If it is then remove it. |
2009 if ( aAtCmdFull[newLength-1] == '?' ) |
2021 TInt lastIndex = fullLength - 1; |
2010 { |
2022 if ( aAtCmdFull[lastIndex] == '?' ) |
2011 newLength--; |
2023 { |
2012 } |
2024 findIndex = lastIndex - 1; |
2013 } |
2025 newLength = fullLength - 1; |
|
2026 } |
|
2027 TRACE_INFO(( _L8("Adjust case 2 = %d/%d"), findIndex, newLength )); |
|
2028 } |
|
2029 // Next correct newLength so that it doesn't contain the space(s) |
|
2030 for ( ; findIndex>=0; findIndex--,newLength-- ) |
|
2031 { |
|
2032 TChar character = aAtCmdFull[findIndex]; |
|
2033 if ( !(character.IsSpace()||character==0x00) ) |
|
2034 { |
|
2035 break; |
|
2036 } |
|
2037 } |
|
2038 // The following should tolerate also zero length |
|
2039 TRACE_INFO(( _L8("Base length after = %d"), newLength )); |
2014 HBufC8* baseCmd = HBufC8::NewMaxLC( newLength ); |
2040 HBufC8* baseCmd = HBufC8::NewMaxLC( newLength ); |
2015 TPtr8 baseCmdPtr = baseCmd->Des(); |
2041 TPtr8 baseCmdPtr = baseCmd->Des(); |
2016 baseCmdPtr.Copy( &aAtCmdFull[0], newLength ); |
2042 baseCmdPtr.Copy( &aAtCmdFull[0], newLength ); |
2017 // Now the baseCmd has the base command. Use it to find the support. |
2043 // Now the baseCmd has the base command. Use it to find the support. |
2018 DoCreateAndFindSupportL( *baseCmd, |
2044 DoCreateAndFindSupportL( *baseCmd, |
2043 if ( !support ) |
2069 if ( !support ) |
2044 { |
2070 { |
2045 aComplInfo.iProcessed = EFalse; |
2071 aComplInfo.iProcessed = EFalse; |
2046 aComplInfo.iReplyExpected = ETrue; |
2072 aComplInfo.iReplyExpected = ETrue; |
2047 CreateSelfReplyData( aMessage ); |
2073 CreateSelfReplyData( aMessage ); |
2048 CleanupStack::PopAndDestroy(); |
|
2049 TRACE_FUNC_EXIT |
2074 TRACE_FUNC_EXIT |
2050 return; |
2075 return; |
2051 } |
2076 } |
2052 TATExtEntrySupport entrySupport( aAtCmdFull, aMessage, support ); |
2077 TATExtEntrySupport entrySupport( aAtCmdFull, |
|
2078 const_cast<RMessage2&>(aMessage), |
|
2079 support ); |
2053 TInt i; |
2080 TInt i; |
2054 aComplInfo.iProcessed = EFalse; |
2081 aComplInfo.iProcessed = EFalse; |
2055 TInt count = support->Count(); |
2082 TInt count = support->Count(); |
2056 for ( i=0; i<count; i++ ) |
2083 for ( i=0; i<count; i++ ) |
2057 { |
2084 { |
2139 // If HandleCommand() is implemented synchronously, the command must be |
2166 // If HandleCommand() is implemented synchronously, the command must be |
2140 // saved before executing as CompleteCommandMessage() closes the string |
2167 // saved before executing as CompleteCommandMessage() closes the string |
2141 HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() ); |
2168 HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() ); |
2142 TPtr8 atCmdFullPtr = atCmdFull->Des(); |
2169 TPtr8 atCmdFullPtr = atCmdFull->Des(); |
2143 atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull ); |
2170 atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull ); |
|
2171 // First send the entry to the observers |
|
2172 TATExtEntrySupport handleCommandEntry = aEntrySupport; |
|
2173 aEntrySupport.iStartIndex = aStartIndex; |
|
2174 SendToMultipleObserverL( aEntrySupport, atCmdFull ); |
|
2175 aEntrySupport = handleCommandEntry; |
2144 // Now execute the HandleCommand() |
2176 // Now execute the HandleCommand() |
2145 iCmdData.iReplyExpected = ETrue; // Set before HandleCommandL() |
2177 iCmdData.iReplyExpected = ETrue; // Set before HandleCommandL() |
2146 HandleCommandL( aEntrySupport, ETrue ); |
2178 HandleCommandL( aEntrySupport, ETrue ); |
2147 aEntrySupport.iStartIndex = aStartIndex; |
|
2148 SendToMultipleObserverL( aEntrySupport, atCmdFull ); |
|
2149 CleanupStack::PopAndDestroy( atCmdFull ); |
2179 CleanupStack::PopAndDestroy( atCmdFull ); |
2150 aReplyExpected = ETrue; |
2180 aReplyExpected = ETrue; |
2151 TRACE_FUNC_EXIT |
2181 TRACE_FUNC_EXIT |
2152 return ETrue; |
2182 return ETrue; |
2153 } |
2183 } |
2185 // saved before executing as CompleteCommandMessage() closes the string |
2215 // saved before executing as CompleteCommandMessage() closes the string |
2186 HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() ); |
2216 HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() ); |
2187 TPtr8 atCmdFullPtr = atCmdFull->Des(); |
2217 TPtr8 atCmdFullPtr = atCmdFull->Des(); |
2188 atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull ); |
2218 atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull ); |
2189 // Now execute the HandleCommand() |
2219 // Now execute the HandleCommand() |
|
2220 SendToMultipleObserverL( nextSupport, atCmdFull ); |
2190 HandleCommandL( aEntrySupport, EFalse ); |
2221 HandleCommandL( aEntrySupport, EFalse ); |
2191 SendToMultipleObserverL( nextSupport, atCmdFull ); |
|
2192 CleanupStack::PopAndDestroy( atCmdFull ); |
2222 CleanupStack::PopAndDestroy( atCmdFull ); |
2193 } |
2223 } |
2194 else |
2224 else |
2195 { |
2225 { |
2196 // No entry found; send one with reply request |
2226 // No entry found; send one with reply request |
2725 } |
2756 } |
2726 } |
2757 } |
2727 TRACE_FUNC_EXIT |
2758 TRACE_FUNC_EXIT |
2728 return KErrNone; |
2759 return KErrNone; |
2729 } |
2760 } |
|
2761 |
|
2762 // --------------------------------------------------------------------------- |
|
2763 // Assignment operator for ease of usage |
|
2764 // --------------------------------------------------------------------------- |
|
2765 // |
|
2766 TATExtEntrySupport& TATExtEntrySupport::operator=( TATExtEntrySupport& aEntrySupport ) |
|
2767 { |
|
2768 if ( &aEntrySupport == this ) |
|
2769 { |
|
2770 return aEntrySupport; |
|
2771 } |
|
2772 iAtCmdFull = aEntrySupport.iAtCmdFull; |
|
2773 iMessage = aEntrySupport.iMessage; |
|
2774 iSupport = aEntrySupport.iSupport; |
|
2775 iEntry = aEntrySupport.iEntry; |
|
2776 iStartIndex = aEntrySupport.iStartIndex; |
|
2777 iSupportFound = aEntrySupport.iSupportFound; |
|
2778 return *this; |
|
2779 } |