00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "CGetIndicator.h"
00032
00040 CGetIndicator* CGetIndicator::NewL(MExecAsync* aController)
00041 {
00042 CGetIndicator* self = new(ELeave) CGetIndicator(aController);
00043 CleanupStack::PushL(self);
00044 self->ConstructL();
00045 CleanupStack::Pop(self);
00046 return self;
00047 }
00048
00053 CGetIndicator::~CGetIndicator()
00054 {
00055 Cancel();
00056 }
00057
00062 void CGetIndicator::DoStartRequestL()
00063 {
00064 _LIT(KDummyAnswerPanic, "CGetIndicator Get Method");
00065 __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00066 iRequestNotify = EFalse;
00067
00068
00069 iTelephony->GetIndicator(iStatus, iIndicatorV1Pckg);
00070 SetActive();
00071 }
00072
00079 CGetIndicator::CGetIndicator(MExecAsync* aController)
00080 : CISVAPIAsync(aController, KGetIndicator),
00081 iIndicatorV1Pckg(iIndicatorV1)
00082 {
00083
00084 }
00085
00089 void CGetIndicator::ConstructL()
00090 {
00091
00092 }
00093
00098 void CGetIndicator::RunL()
00099 {
00100
00101 if(iStatus != KErrNone)
00102 {
00103 iConsole->Printf(KError);
00104
00105
00106 iConsole->Printf(_L("%d\n"), iStatus.Int());
00107 }
00108 else
00109 {
00110 if(iIndicatorV1.iCapabilities & CTelephony::KIndChargerConnected)
00111 {
00112
00113 if(iIndicatorV1.iIndicator & CTelephony::KIndChargerConnected)
00114 {
00115
00116 iConsole->Printf(_L("Charger connected\n"));
00117 }
00118 else
00119 {
00120
00121 iConsole->Printf(_L("Charger not connected\n"));
00122 }
00123 }
00124 else
00125 {
00126
00127 iConsole->Printf(_L("Status of charger unknown\n"));
00128 }
00129 if (iRequestNotify)
00130 {
00131 DoRequestNotificationL();
00132 }
00133 else
00134 {
00135 ExampleComplete();
00136 }
00137 }
00138 }
00139
00143 void CGetIndicator::DoRequestNotificationL()
00144 {
00145
00146
00147 _LIT( KNotifyPanic, "CGetIndicator Notify Method" );
00148 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00149 iRequestNotify = ETrue;
00150
00151
00152 iTelephony->NotifyChange( iStatus,
00153 CTelephony::EIndicatorChange,
00154 iIndicatorV1Pckg );
00155 SetActive();
00156 }
00157
00161 void CGetIndicator::DoCancel()
00162 {
00163
00164 iTelephony->CancelAsync(CTelephony::EIndicatorChangeCancel);
00165 }