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 #include "CCurrentNetworkName.h" 00017 00025 CCurrentNetworkName* CCurrentNetworkName::NewL(MExecAsync* aController) 00026 { 00027 CCurrentNetworkName* self = new(ELeave) CCurrentNetworkName(aController); 00028 CleanupStack::PushL(self); 00029 self->ConstructL(); 00030 CleanupStack::Pop(self); 00031 return self; 00032 } 00033 00038 CCurrentNetworkName::~CCurrentNetworkName() 00039 { 00040 Cancel(); 00041 } 00042 00047 void CCurrentNetworkName::DoStartRequestL() 00048 { 00049 _LIT( KNotifyPanic, "CCurrentNetworkName Get Method" ); 00050 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 )); 00051 iRequestNotify = EFalse; 00052 00053 // Retrieves ICC-stored information about the (preferred) name of the currently registered mobile network. 00054 iTelephony->GetCurrentNetworkName(iStatus, iCurrentNetworkNameV1Pckg); 00055 SetActive(); 00056 } 00057 00064 CCurrentNetworkName::CCurrentNetworkName(MExecAsync* aController) 00065 : CISVAPIAsync(aController, KNetworkName), 00066 iCurrentNetworkNameV1Pckg(iCurrentNetworkNameV1) 00067 { 00068 // Empty method 00069 } 00070 00074 void CCurrentNetworkName::ConstructL() 00075 { 00076 // Empty method 00077 } 00078 00083 void CCurrentNetworkName::RunL() 00084 { 00085 if(iStatus != KErrNone) 00086 { 00087 iConsole->Printf(KError); 00088 00089 // Print the error status code 00090 iConsole->Printf(_L("%d\n"), iStatus.Int()); 00091 } 00092 else 00093 { 00094 // Print the console message if there is no error 00095 iConsole->Printf(KNetworkNameMsg); 00096 iConsole->Printf(iCurrentNetworkNameV1.iNetworkName); 00097 iConsole->Printf(KNewLine); 00098 ExampleComplete(); 00099 } 00100 } 00101 00105 void CCurrentNetworkName::DoCancel() 00106 { 00107 // Cancels an outstanding asynchronous request. 00108 iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkNameCancel); 00109 } 00110
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.