// ---------------------------------------------------------------------------- // CAudioStreamEngine::MaiscBufferCopied( // TInt aError, const TDesC8& aBuffer) // // called when a block of audio data has been read and is available at the // buffer reference *aBuffer. calls to ReadL() will be issued until all blocks // in the audio data buffer (iStreamBuffer) are filled. // ---------------------------------------------------------------------------- void CAudioStreamEngine::MaiscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/) { if (aError!=KErrNone) { _LIT(KMessage,"CAudioStreamEngine::MaiscBufferCopied Recording error: %d"); HBufC16* message = HBufC16::NewLC(KMessage().Length()+10); message->Des().AppendFormat(KMessage,aError); ShowMessage(*message, ETrue); CleanupStack::PopAndDestroy(); // message message = NULL; } if (aError==KErrNone) { // stop recording if at the end of the buffer /*iStreamIdx++; if (iStreamIdx == iFrameCount) { ShowMessage(_L("CAudioStreamEngine::MaiscBufferCopied Recording complete!"), ETrue); iStreamEnd = iStreamIdx - 1; iBufferOK = ETrue; // Playback is complete: // Start the active object that will stop the stream iStop->Start( TCallBack(BackgroundStop, this) ); return; }*/ //while(!_bFreeAccessBuffer); _bAccessBuffer=EFalse; // issue ReadL() for next frame //iAudioBuffer2Send.Append(iAudioBuffer); iAppUi->SendAudioFrame(iAudioBuffer); TRAPD(error, iInputStream->ReadL(iAudioBuffer)); _bAccessBuffer=ETrue; PanicIfError(error); } else if (aError==KErrAbort) { // Recording was aborted, due to call to CMdaAudioInputStream::Stop() // This KErrAbort will occur each time the Stop() method in this class is executed. // Also, MaiscRecordComplete() will be called after exiting this method. iStreamEnd = iStreamIdx - 1; iBufferOK = ETrue; iInputStatus = ENotReady; } else { ShowMessage(_L("CAudioStreamEngine::MaiscBufferCopied Error reading data from input"), ETrue); iInputStatus = ENotReady; } }
void CTestAgendaAddAppt::AddEntriesL( void ) { TInt count=1; if ( !GetIntFromConfig(ConfigSection(), KCount, count) ) count=1; TBuf<KMaxTestExecuteCommandLength> tempStore; TInt year; TInt month; TInt day; TInt hour; TInt minute; TInt duration; TInt alarm; TPtrC ptrAlarmSound; TPtrC ptrMessage; TBuf<KMaxDateStringLength> dateString; _LIT(KDateString,"%*E%*D%X%*N%*Y %1 %2 '%3"); RPointerArray<CCalEntry> array; CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &array)); for (TInt entry=0; entry<count && TestStepResult() == EPass; ) { TTime today; today.HomeTime(); tempStore.Format(KYear(), ++entry); if ( !GetIntFromConfig(ConfigSection(), tempStore, year) ) year=today.DateTime().Year(); tempStore.Format(KMonth(), entry); if ( !GetIntFromConfig(ConfigSection(), tempStore, month) ) month=today.DateTime().Month(); tempStore.Format(KDay(), entry); if ( !GetIntFromConfig(ConfigSection(), tempStore, day) ) day=today.DateTime().Day(); else --day; tempStore.Format(KHour(), entry); if ( !GetIntFromConfig(ConfigSection(), tempStore, hour) ) hour=today.DateTime().Hour(); tempStore.Format(KMinute(), entry); if ( !GetIntFromConfig(ConfigSection(), tempStore, minute) ) minute=0; tempStore.Format(KDuration(), entry); if ( !GetIntFromConfig(ConfigSection(), tempStore, duration) ) duration=30; tempStore.Format(KMessage(), entry); GetStringFromConfig(ConfigSection(), tempStore, ptrMessage); TTime startTime(TDateTime(year, TMonth(month-1+EJanuary), day, hour, minute,0,0)); startTime.FormatL(dateString,KDateString); INFO_PRINTF2(_L("Start date is %S"), &dateString); TTime endTime = startTime + TTimeIntervalMinutes(duration); endTime.FormatL(dateString,KDateString); INFO_PRINTF2(_L("End date is %S"), &dateString); HBufC8* uid = HBufC8::NewLC(255); TPtr8 uidP = uid->Des(); uidP.Append(count); CCalEntry* calEntry = CCalEntry::NewL(CCalEntry::EAppt, uid, CCalEntry::EMethodNone, 0); CleanupStack::Pop(); //uid CleanupStack::PushL(calEntry); TCalTime calStartTime, calEndTime; calStartTime.SetTimeLocalL(startTime); calEndTime.SetTimeLocalL(endTime); calEntry->SetStartAndEndTimeL(calStartTime, calEndTime); tempStore.Format(KAlarm(), entry); if ( GetIntFromConfig(ConfigSection(), tempStore, alarm) ) { TTimeIntervalMinutes currentTime((hour*60) + minute); TTimeIntervalMinutes alarmTime(currentTime.Int()); CCalAlarm* calAlarm = CCalAlarm::NewL(); CleanupStack::PushL(calAlarm); calAlarm->SetTimeOffset(alarmTime); tempStore.Format(KAlarmSound(), entry); if ( GetStringFromConfig(ConfigSection(), tempStore, ptrAlarmSound) ) calAlarm->SetAlarmSoundNameL(ptrAlarmSound); else calAlarm->SetAlarmSoundNameL(_L("Bells")); calEntry->SetAlarmL(calAlarm); CleanupStack::PopAndDestroy(); //calAlarm } //Store in the array array.AppendL(calEntry); CleanupStack::Pop(); //calEntry } INFO_PRINTF1(_L("About to store appointments now")); TInt success(0); TRAPD(storeError, iCalEntryViewBase->StoreL(array, success)); INFO_PRINTF2(_L("Store result is %d"), storeError); if (success != count && storeError == KErrNone) { SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(&array); }