00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "CFlightModeInfo.h"
00017
00024 CFlightModeInfo* CFlightModeInfo::NewL(MExecAsync* aController)
00025 {
00026 CFlightModeInfo* self = new(ELeave) CFlightModeInfo(aController);
00027 CleanupStack::PushL(self);
00028 self->ConstructL();
00029 CleanupStack::Pop(self);
00030 return self;
00031 }
00032
00037 CFlightModeInfo::~CFlightModeInfo()
00038 {
00039 Cancel();
00040 }
00041
00045 void CFlightModeInfo::DoStartRequestL()
00046 {
00047
00048 iTelephony->GetFlightMode(iStatus, iFlightModeV1Pckg);
00049 SetActive();
00050 }
00051
00056 CFlightModeInfo::CFlightModeInfo(MExecAsync* aController)
00057 : CISVAPIAsync(aController, KFlightModeInfo),
00058 iFlightModeV1Pckg(iFlightModeV1)
00059 {
00060
00061 }
00062
00066 void CFlightModeInfo::ConstructL()
00067 {
00068
00069 }
00070
00075 void CFlightModeInfo::RunL()
00076 {
00077 if(iStatus != KErrNone)
00078 {
00079 iConsole->Printf(KError);
00080
00081
00082 iConsole->Printf(_L("%d\n"), iStatus.Int());
00083 }
00084 else
00085 {
00086 if(iRequestNotify)
00087 {
00088 iConsole->ClearScreen();
00089 iConsole->Printf(_L("*~This is a notifcation\n~*"));
00090 }
00091 switch (iFlightModeV1.iFlightModeStatus)
00092 {
00093 case CTelephony::EFlightModeOff:
00094 iConsole->Printf(_L("Flight Status is Off, you can make a call!\n"));
00095 ExampleComplete();
00096 break;
00097 case CTelephony::EFlightModeOn:
00098 iConsole->Printf(_L("Flight Status is On, you can't make a call!\n"));
00099 ExampleNotify();
00100 break;
00101 default:
00102 iConsole->Printf(KError);
00103 }
00104 }
00105 }
00106
00110 void CFlightModeInfo::DoRequestNotificationL()
00111 {
00112
00113
00114
00115 _LIT( KNotifyPanic, "CFlightModeInfo Notify Method" );
00116 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00117 iRequestNotify = ETrue;
00118
00119
00120 iTelephony->NotifyChange( iStatus,
00121 CTelephony::EFlightModeChange,
00122 iFlightModeV1Pckg );
00123 SetActive();
00124 }
00125
00129 void CFlightModeInfo::DoCancel()
00130 {
00131
00132 iTelephony->CancelAsync(CTelephony::EFlightModeChangeCancel);
00133 }
00134