00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "CGetIndicator.h"
00017
00025 CGetIndicator* CGetIndicator::NewL(MExecAsync* aController)
00026 {
00027 CGetIndicator* self = new(ELeave) CGetIndicator(aController);
00028 CleanupStack::PushL(self);
00029 self->ConstructL();
00030 CleanupStack::Pop(self);
00031 return self;
00032 }
00033
00038 CGetIndicator::~CGetIndicator()
00039 {
00040 Cancel();
00041 }
00042
00047 void CGetIndicator::DoStartRequestL()
00048 {
00049 _LIT(KDummyAnswerPanic, "CGetIndicator Get Method");
00050 __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00051 iRequestNotify = EFalse;
00052
00053
00054 iTelephony->GetIndicator(iStatus, iIndicatorV1Pckg);
00055 SetActive();
00056 }
00057
00064 CGetIndicator::CGetIndicator(MExecAsync* aController)
00065 : CISVAPIAsync(aController, KGetIndicator),
00066 iIndicatorV1Pckg(iIndicatorV1)
00067 {
00068
00069 }
00070
00074 void CGetIndicator::ConstructL()
00075 {
00076
00077 }
00078
00083 void CGetIndicator::RunL()
00084 {
00085
00086 if(iStatus != KErrNone)
00087 {
00088 iConsole->Printf(KError);
00089
00090
00091 iConsole->Printf(_L("%d\n"), iStatus.Int());
00092 }
00093 else
00094 {
00095 if(iIndicatorV1.iCapabilities & CTelephony::KIndChargerConnected)
00096 {
00097
00098 if(iIndicatorV1.iIndicator & CTelephony::KIndChargerConnected)
00099 {
00100
00101 iConsole->Printf(_L("Charger connected\n"));
00102 }
00103 else
00104 {
00105
00106 iConsole->Printf(_L("Charger not connected\n"));
00107 }
00108 }
00109 else
00110 {
00111
00112 iConsole->Printf(_L("Status of charger unknown\n"));
00113 }
00114 if (iRequestNotify)
00115 {
00116 DoRequestNotificationL();
00117 }
00118 else
00119 {
00120 ExampleComplete();
00121 }
00122 }
00123 }
00124
00128 void CGetIndicator::DoRequestNotificationL()
00129 {
00130
00131
00132 _LIT( KNotifyPanic, "CGetIndicator Notify Method" );
00133 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00134 iRequestNotify = ETrue;
00135
00136
00137 iTelephony->NotifyChange( iStatus,
00138 CTelephony::EIndicatorChange,
00139 iIndicatorV1Pckg );
00140 SetActive();
00141 }
00142
00146 void CGetIndicator::DoCancel()
00147 {
00148
00149 iTelephony->CancelAsync(CTelephony::EIndicatorChangeCancel);
00150 }