examples/Telephony/ETel3rdPartyExample/PhoneId/CSubscriberId.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 "CSubscriberId.h"
00018 
00026 CSubscriberId* CSubscriberId::NewL(MExecSync* aController)
00027         {
00028         CSubscriberId* self = new(ELeave) CSubscriberId(aController);
00029         CleanupStack::PushL(self);
00030         self->ConstructL();
00031         CleanupStack::Pop(self);
00032         return self;
00033         }
00034 
00039 CSubscriberId::~CSubscriberId()
00040         {
00041         Cancel();
00042         }
00043 
00048 void CSubscriberId::DoStartRequestL()
00049         {
00050         // Retrieves information about the mobile device's current subscriber
00051         iTelephony->GetSubscriberId(iStatus, iSubscriberIdV1Pckg);
00052         SetActive();
00053         }
00054 
00061 CSubscriberId::CSubscriberId(MExecSync* aController)
00062         : CISVAPISync(aController, KSubscriberId),
00063           iSubscriberIdV1Pckg(iSubscriberIdV1)
00064         {
00065         // Empty method
00066         }
00067 
00071 void CSubscriberId::ConstructL()
00072         {
00073         // Empty method
00074         }
00075 
00080 void CSubscriberId::RunL()
00081         {
00082         if(iStatus != KErrNone)
00083                 {
00084                 iConsole->Printf(KError);
00085                 
00086                 // Print the error status code
00087                 iConsole->Printf(_L("%d\n"), iStatus.Int());
00088                 }
00089         else
00090                 {
00091                 // Print Subscriber Info.
00092                 TBuf<CTelephony::KIMSISize> subscriberId = iSubscriberIdV1.iSubscriberId;
00093                 iConsole->Printf(KSubscriberIdMsg);
00094                 
00095                 // Print the subscriber information about the phone
00096                 iConsole->Printf(subscriberId);
00097                 iConsole->Printf(KNewLine);
00098 
00099                 ExampleComplete();
00100                 }
00101         }
00102 
00106 void CSubscriberId::DoCancel()
00107         {
00108         // Cancels an outstanding asynchronous request.
00109         iTelephony->CancelAsync(CTelephony::EGetSubscriberIdCancel);
00110         }
00111 

Generated by  doxygen 1.6.2