00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "CFlightModeInfo.h"
00018
00026 CFlightModeInfo* CFlightModeInfo::NewL(MExecAsync* aController)
00027 {
00028 CFlightModeInfo* self = new(ELeave) CFlightModeInfo(aController);
00029 CleanupStack::PushL(self);
00030 self->ConstructL();
00031 CleanupStack::Pop(self);
00032 return self;
00033 }
00034
00039 CFlightModeInfo::~CFlightModeInfo()
00040 {
00041 Cancel();
00042 }
00043
00047 void CFlightModeInfo::DoStartRequestL()
00048 {
00049 iRequestNotify = EFalse;
00050
00051
00052 iTelephony->GetFlightMode(iStatus, iFlightModeV1Pckg);
00053 SetActive();
00054 }
00055
00062 CFlightModeInfo::CFlightModeInfo(MExecAsync* aController)
00063 : CISVAPIAsync(aController, KFlightModeInfo),
00064 iFlightModeV1Pckg(iFlightModeV1)
00065 {
00066
00067 }
00068
00072 void CFlightModeInfo::ConstructL()
00073 {
00074
00075 }
00076
00080 void CFlightModeInfo::RunL()
00081 {
00082 if(iStatus != KErrNone)
00083 {
00084 iConsole->Printf(KError);
00085
00086
00087 iConsole->Printf(_L("%d\n"), iStatus.Int());
00088 }
00089 else
00090 {
00091 if (iRequestNotify)
00092 {
00093 iConsole->Printf(_L("~*THIS IS A NOTIFICATION*~\n"));
00094 }
00095 switch (iFlightModeV1.iFlightModeStatus)
00096 {
00097 case CTelephony::EFlightModeOff:
00098 iConsole->Printf(_L("Flight Status is Off, you can make a call!\n"));
00099 ExampleComplete();
00100 break;
00101 case CTelephony::EFlightModeOn:
00102 iConsole->Printf(_L("Flight Status is On, you can't make a call!\n"));
00103 ExampleNotify();
00104 break;
00105 default:
00106 iConsole->Printf(KError);
00107 }
00108 }
00109 }
00110
00114 void CFlightModeInfo::DoRequestNotificationL()
00115 {
00116
00117
00118 _LIT( KNotifyPanic, "CFlightModeInfo Notify Method" );
00119 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00120 iRequestNotify = ETrue;
00121
00122
00123 iTelephony->NotifyChange( iStatus,
00124 CTelephony::EFlightModeChange,
00125 iFlightModeV1Pckg );
00126 SetActive();
00127 }
00128
00132 void CFlightModeInfo::DoCancel()
00133 {
00134
00135 iTelephony->CancelAsync(CTelephony::EFlightModeChangeCancel);
00136 }