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 iRequestNotify = EFalse;
00048
00049
00050 iTelephony->GetFlightMode(iStatus, iFlightModeV1Pckg);
00051 SetActive();
00052 }
00053
00060 CFlightModeInfo::CFlightModeInfo(MExecAsync* aController)
00061 : CISVAPIAsync(aController, KFlightModeInfo)
00062 , iFlightModeV1Pckg(iFlightModeV1)
00063 {
00064
00065 }
00066
00070 void CFlightModeInfo::ConstructL()
00071 {
00072
00073 }
00074
00078 void CFlightModeInfo::RunL()
00079 {
00080 if(iStatus != KErrNone)
00081 {
00082 iConsole->Printf(KError);
00083
00084
00085 iConsole->Printf(_L("%d\n"), iStatus.Int());
00086 }
00087 else
00088 {
00089
00090
00091 CTelephony::TFlightModeV1 FlightMode = iFlightModeV1;
00092 CTelephony::TFlightModeStatus aFlightModeStatus = FlightMode.iFlightModeStatus;
00093 if (iRequestNotify)
00094 {
00095 iConsole->ClearScreen();
00096 iConsole->Printf(_L("~*THIS IS A NOTIFICATION*~\n"));
00097 }
00098 switch (aFlightModeStatus)
00099 {
00100 case CTelephony::EFlightModeOff:
00101 iConsole->Printf(_L("Flight Status is Off, Signal Strength can be Monitored!\n"));
00102 ExampleComplete();
00103 break;
00104 case CTelephony::EFlightModeOn:
00105 iConsole->Printf(_L("Flight Status is On, Signal Strength cannot be Monitored!\n"));
00106 RequestNotificationL();
00107 ExampleNotify();
00108 break;
00109 default:
00110 iConsole->Printf(KError);
00111 }
00112 }
00113 }
00114
00118 void CFlightModeInfo::DoRequestNotificationL()
00119 {
00120
00121
00122 _LIT( KNotifyPanic, "CFlightModeInfo Notify Method" );
00123 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00124 iRequestNotify = ETrue;
00125
00126
00127 iTelephony->NotifyChange(iStatus,
00128 CTelephony::EFlightModeChange,
00129 iFlightModeV1Pckg );
00130 SetActive();
00131 }
00132
00136 void CFlightModeInfo::DoCancel()
00137 {
00138
00139 iTelephony->CancelAsync(CTelephony::EFlightModeChangeCancel);
00140 }