inline uint_t ToInt(const String& str) { if (str.empty()) { return 0; } else if (IsValidDigits(str)) { return boost::lexical_cast<uint_t>(str); } else { return ~uint_t(0); } }
// --------------------------------------------------------------------------- // CDTMFPayloadFormatWrite::SendDTMFTonesL // Starts to send DTMF string incrementally until the string is sent. // --------------------------------------------------------------------------- // void CDTMFPayloadFormatWrite::SendDTMFTonesL( const TDesC8& aTones ) { DP_DTMF_WRITE( _L("CDTMFPayloadFormatWrite::SendDTMFTonesL") ); TInt digitCount( aTones.Length() ); __ASSERT_ALWAYS( digitCount != 0, User::Leave( KErrArgument ) ); __ASSERT_ALWAYS( IsValidDigits( aTones ), User::Leave( KErrArgument ) ); __ASSERT_ALWAYS( !iSendTimer->IsActive(), User::Leave( KErrNotReady ) ); iSendingMode = EModeAutomatic; iSendBuffer.Reset(); for ( TInt i = 0; i < digitCount; i++ ) { // in automatic mode default durations for tones are used TSendBufferElement element( aTones[i], 0 ); iSendBuffer.AppendL( element ); } iSinkBuffer->Data().FillZ( KDTMFDefaultPayloadSize ); iStateMachine->ChangeStateTo( EStateEncodeNextDigit ); }