void CLogBatteryImpl::ConstructL() { CALLSTACKITEM_N(_CL("CLogBatteryImpl"), _CL("ConstructL")); Mlog_base_impl::ConstructL(); iEvent.iData()=&iValue; iEvent.iData.SetOwnsValue(EFalse); #ifndef __WINS__ CActiveScheduler::Add(this); #ifndef __S60V2__ Phone().BatteryInfoNotification(iStatus, iBatteryInfo); #else RTelServer::TPhoneInfo info; User::LeaveIfError( TelServer().GetPhoneInfo( 0, info ) ); User::LeaveIfError( iPhone.Open( TelServer(), info.iName ) ); iPhone.NotifyBatteryInfoChange(iStatus, iBatteryInfo); #endif #endif SetActive(); }
void CLogBatteryImpl::CheckedRunL() { CALLSTACKITEM_N(_CL("CLogBatteryImpl"), _CL("CheckedRunL")); if (iStatus.Int()==KErrNone) { iValue.iLevel=iBatteryInfo.iChargeLevel; iValue.iState=iBatteryInfo.iStatus; } else { iErrorCount++; if (iErrorCount>5) User::Leave(iStatus.Int()); get_value(); } iEvent.iStamp()=GetTime(); post_new_value(iEvent); #ifndef __S60V2__ Phone().BatteryInfoNotification(iStatus, iBatteryInfo); #else iPhone.NotifyBatteryInfoChange(iStatus, iBatteryInfo); #endif SetActive(); }