examples/Telephony/ETel3rdPartyExample/AutoDTMFDialler/CSendDTMF.cpp

00001 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 
00017 #include "CSendDTMF.h"
00018 
00026 CSendDTMF* CSendDTMF::NewL(MExecAsync* aController)
00027         {
00028         CSendDTMF* self = new(ELeave) CSendDTMF(aController);
00029         CleanupStack::PushL(self);
00030         self->ConstructL();
00031         CleanupStack::Pop(self);
00032         return self;
00033         }
00034 
00038 CSendDTMF::~CSendDTMF()
00039         {
00040         Cancel();
00041         }
00042 
00048 void CSendDTMF::DoStartRequestL(const TDesC& aNumber)
00049         {
00050         if (aNumber.Length() == 1)
00051                 {
00052                 iSingleTone = ETrue;
00053                 }
00054         else
00055                 {
00056                 iSingleTone = EFalse;
00057                 }
00058         
00059         // Transmits DTMF tones across all the currently active voice calls.
00060         iTelephony->SendDTMFTones(iStatus, aNumber);
00061         SetActive();
00062         }
00063 
00070 CSendDTMF::CSendDTMF(MExecAsync* aController)
00071         : CISVAPIAsync(aController, KSendDTMF)
00072         {
00073         // Empty method
00074         }
00075 
00079 void CSendDTMF::ConstructL()
00080         {
00081         iSingleTone = EFalse;
00082         }
00083 
00087 void CSendDTMF::RunL()
00088         {
00089         if(iStatus != KErrNone)
00090                 {
00091                 iConsole->Printf(KError);
00092                 
00093                 // Print error status code
00094                 iConsole->Printf(_L("%d\n"), iStatus.Int());
00095                 }
00096         else
00097                 {
00098                 if (iSingleTone)
00099                         {
00100                         iConsole->Printf(_L("Beep\n"));
00101                         ExampleNotify();
00102                         }
00103                 else
00104                         {
00105                         iConsole->Printf(_L("Beeps\n"));
00106                         ExampleComplete();
00107                         }
00108                 }
00109         }
00110 
00114 void CSendDTMF::DoCancel()
00115         {
00116         // Cancels an outstanding asynchronous request.
00117         iTelephony->CancelAsync(CTelephony::ESendDTMFTonesCancel);
00118         }

Generated by  doxygen 1.6.2