examples/Telephony/ETel3rdPartyExample/OutgoingCalls/COperatorName.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 "COperatorName.h"
00018 
00026 COperatorName* COperatorName::NewL(MExecAsync* aController)
00027         {
00028         COperatorName* self = new(ELeave) COperatorName(aController);
00029         CleanupStack::PushL(self);
00030         self->ConstructL();
00031         CleanupStack::Pop(self);
00032         return self;
00033         }
00034 
00039 COperatorName::~COperatorName()
00040         {
00041         Cancel();
00042         }
00043 
00048 void COperatorName::DoStartRequestL()
00049         {
00050         _LIT(KDummyAnswerPanic, "COperatorName Get Method");
00051         __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00052         iRequestNotify = EFalse;
00053         
00054         // Retrieve ICC stored information about the currently registered mobile network
00055         iTelephony->GetOperatorName(iStatus, iOperatorNameV1Pckg);
00056         SetActive();
00057         }
00058 
00065 COperatorName::COperatorName(MExecAsync* aController)
00066         : CISVAPIAsync(aController, KOperatorName),
00067           iOperatorNameV1Pckg(iOperatorNameV1)
00068         {
00069         // Empty method
00070         }
00071 
00075 void COperatorName::ConstructL()
00076         {
00077         // Empty method
00078         }
00079 
00084 void COperatorName::RunL()
00085         {
00086         if(iStatus != KErrNone)
00087                 {
00088                 iConsole->Printf(KError);
00089                 
00090                 // Print the error status code
00091                 iConsole->Printf(_L("%d\n"), iStatus.Int());
00092                 }
00093         else
00094                 {
00095                 // Print the output to console if there is no error
00096                 iConsole->Printf(KOperatorNameMsg);
00097                 iConsole->Printf(iOperatorNameV1.iOperatorName);
00098                 iConsole->Printf(KNewLine);
00099                 ExampleComplete();
00100                 }
00101         }
00102 
00106 void COperatorName::DoCancel()
00107         {
00108         // Cancels an outstanding asynchronous request
00109         iTelephony->CancelAsync(CTelephony::EGetOperatorNameCancel);
00110         }
00111 

Generated by  doxygen 1.6.2