00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "CSignalInfo.h"
00017
00025 CSignalInfo* CSignalInfo::NewL(MExecAsync* aController)
00026 {
00027 CSignalInfo* self = new(ELeave) CSignalInfo(aController);
00028 CleanupStack::PushL(self);
00029 self->ConstructL();
00030 CleanupStack::Pop(self);
00031 return self;
00032 }
00033
00038 CSignalInfo::~CSignalInfo()
00039 {
00040 Cancel();
00041 }
00042
00046 void CSignalInfo::DoStartRequestL()
00047 {
00048 _LIT(KDummyAnswerPanic, "CSignalInfo Get Method");
00049 __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00050 iRequestNotify = EFalse;
00051
00052
00053 iTelephony->GetSignalStrength(iStatus, iSignalStrengthV1Pckg);
00054 SetActive();
00055 }
00056
00063 CSignalInfo::CSignalInfo(MExecAsync* aController)
00064 : CISVAPIAsync(aController, KSignalInfo),
00065 iSignalStrengthV1Pckg(iSignalStrengthV1)
00066 {
00067
00068 }
00069
00073 void CSignalInfo::ConstructL()
00074 {
00075
00076 }
00077
00082 void CSignalInfo::RunL()
00083 {
00084 if(iStatus != KErrNone)
00085 {
00086 iConsole->Printf(KError);
00087
00088
00089 iConsole->Printf(_L("%d\n"), iStatus.Int());
00090 }
00091 else
00092 {
00093 TInt32 strength = iSignalStrengthV1.iSignalStrength;
00094 TInt8 bars = iSignalStrengthV1.iBar;
00095 if (iRequestNotify)
00096 {
00097 iConsole->ClearScreen();
00098 iConsole->Printf(_L("~*THIS IS A NOTIFICATION*~\n"));
00099 }
00100 iConsole->Printf(KSignalStrengthMsg);
00101 iConsole->Printf(_L("There are %d bars!\n"), bars);
00102 iConsole->Printf(_L("Signal Strength is %d!\n"), strength);
00103 if (iRequestNotify)
00104 {
00105 DoRequestNotificationL();
00106 }
00107 else
00108 {
00109 ExampleComplete();
00110 }
00111 }
00112 }
00113
00117 void CSignalInfo::DoRequestNotificationL()
00118 {
00119
00120
00121 _LIT( KNotifyPanic, "CSignalInfo Notify Method" );
00122 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00123 iRequestNotify = ETrue;
00124
00125
00126 iTelephony->NotifyChange( iStatus,
00127 CTelephony::ESignalStrengthChange,
00128 iSignalStrengthV1Pckg );
00129 SetActive();
00130 }
00131
00135 void CSignalInfo::DoCancel()
00136 {
00137
00138 iTelephony->CancelAsync(CTelephony::ESignalStrengthChangeCancel);
00139 }