Hi all,
I am in the midst of developing my first symbian application which solely based on the forum nokia thread about retriving the incoming/outgoing calls .
http://wiki.forum.nokia.com/index.php/TSS000685_-_Retrieving_incoming_and_outgoing_call_numbers
It is jus a simple d60 GUI application which handling an active object CallLogNotifier.
I got kernel panic error when i run it on the emulator .then i trued debugging i got one more error dialog
application closed:!WidgetRegistry ALLOC:36c62aa40 before the kernel get panic.
i can find that the error is based on the code statement
iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, lineStatusPckg );
my source code for both the active object and a simple application view are given..
please give me a solution.
Code://ActiveObject Header file #ifndef CALLLOGNOTIFIER_H_ #define CALLLOGNOTIFIER_H_ #include <Etel3rdParty.h> class MCallLogObserver { public: virtual void NotifyChange(const TBool aCallType,const TDesC& aRemoteCaller) = 0; }; class CCallLogNotifier : public CActive { public: static CCallLogNotifier* NewL(MCallLogObserver* aObserver); static CCallLogNotifier* NewLC(MCallLogObserver* aObserver); void ConstructL(void); ~CCallLogNotifier(); protected: void DoCancel(); void RunL(); private: CCallLogNotifier(MCallLogObserver* aObserver); void GetCallLog(); private: MCallLogObserver* iObserver; CTelephony* iTelephony; CTelephony::TCallStatusV1 iLineStatus; CTelephony::TCallStatus iLastInformedLineStatus; }; #endif /* CALLLOGNOTIFIER_H_ */ //ActiveObject Source file #include "CallLogNotifier.h" CCallLogNotifier* CCallLogNotifier::NewL(MCallLogObserver* aObserver) { CCallLogNotifier* self = NewLC(aObserver); CleanupStack::Pop(self); return self; } CCallLogNotifier* CCallLogNotifier::NewLC(MCallLogObserver* aObserver) { CCallLogNotifier* self = new (ELeave) CCallLogNotifier(aObserver); CleanupStack::PushL(self); self->ConstructL(); return self; } void CCallLogNotifier::ConstructL(void) { CActiveScheduler::Add(this); iLineStatus.iStatus = CTelephony::EStatusUnknown; iLastInformedLineStatus = CTelephony::EStatusUnknown; CTelephony::TCallStatusV1Pckg lineStatusPckg( iLineStatus ); iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, lineStatusPckg ); SetActive(); } void CCallLogNotifier::DoCancel(void) { iTelephony->CancelAsync(CTelephony::EVoiceLineStatusChangeCancel); } void CCallLogNotifier::RunL(void) { if( iLineStatus.iStatus == CTelephony::EStatusDialling ) { GetCallLog(); } if(iLineStatus.iStatus == CTelephony::EStatusRinging) { if(iLastInformedLineStatus != CTelephony::EStatusDialling) { GetCallLog(); } } iLastInformedLineStatus = iLineStatus.iStatus; } void CCallLogNotifier::GetCallLog() { CTelephony::TCallInfoV1 callInfoV1; CTelephony::TCallInfoV1Pckg callInfoV1Pckg( callInfoV1 ); CTelephony::TCallSelectionV1 callSelectionV1; CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 ); CTelephony::TRemotePartyInfoV1 remotePartyInfoV1; CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoV1Pckg( remotePartyInfoV1 ); callSelectionV1.iLine = CTelephony::EVoiceLine; callSelectionV1.iSelect = CTelephony::EInProgressCall; iTelephony->GetCallInfo( callSelectionV1Pckg, callInfoV1Pckg, remotePartyInfoV1Pckg ); if( remotePartyInfoV1.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable ) { if( remotePartyInfoV1.iRemoteNumber.iTelNumber.Length() > 0 ) { iObserver->NotifyChange(1,remotePartyInfoV1.iRemoteNumber.iTelNumber); // Incoming call number can be read from // remotePartyInfoV1.iRemoteNumber.iTelNumber; } } if( callInfoV1.iDialledParty.iTelNumber.Length() > 0 ) { iObserver->NotifyChange(1,callInfoV1.iDialledParty.iTelNumber); // Outgoing call number can be read from // callInfoV1.iDialledParty.iTelNumber; } } CCallLogNotifier::CCallLogNotifier(MCallLogObserver* aObserver) :CActive(0),iObserver(aObserver) { } CCallLogNotifier::~CCallLogNotifier() { Cancel(); delete iTelephony; } //Application View Class header #ifndef __CALLLOGONLINEAPPVIEW_h__ #define __CALLLOGONLINEAPPVIEW_h__ // INCLUDES #include <coecntrl.h> #include "CallLogNotifier.h" // CLASS DECLARATION class CCallLogOnlineAppView : public CCoeControl,public MCallLogObserver { public: static CCallLogOnlineAppView* NewL(const TRect& aRect); static CCallLogOnlineAppView* NewLC(const TRect& aRect); virtual ~CCallLogOnlineAppView(); public: void Draw(const TRect& aRect) const; virtual void SizeChanged(); virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); virtual void NotifyChange(const TBool aCallType,const TDesC& aRemoteCaller); private: void ConstructL(const TRect& aRect); CCallLogOnlineAppView(); TBool iCallType; HBufC* iRemoteCaller; CCallLogNotifier* iCallLogNotifier; }; #endif // __CALLLOGONLINEAPPVIEW_h__ // End of File //Application View Source header #include <coemain.h> #include "CallLogOnlineAppView.h" CCallLogOnlineAppView* CCallLogOnlineAppView::NewL(const TRect& aRect) { CCallLogOnlineAppView* self = CCallLogOnlineAppView::NewLC(aRect); CleanupStack::Pop(self); return self; } CCallLogOnlineAppView* CCallLogOnlineAppView::NewLC(const TRect& aRect) { CCallLogOnlineAppView* self = new (ELeave) CCallLogOnlineAppView; CleanupStack::PushL(self); self->ConstructL(aRect); return self; } void CCallLogOnlineAppView::ConstructL(const TRect& aRect) { CreateWindowL(); SetRect(aRect); iCallLogNotifier=CCallLogNotifier::NewL(this); ActivateL(); } CCallLogOnlineAppView::CCallLogOnlineAppView() { } CCallLogOnlineAppView::~CCallLogOnlineAppView() { default implementaion } void CCallLogOnlineAppView::Draw(const TRect& /*aRect*/) const { default implementation. } void CCallLogOnlineAppView::SizeChanged() { DrawNow(); } void CCallLogOnlineAppView::HandlePointerEventL( const TPointerEvent& aPointerEvent) { } void CCallLogOnlineAppView::NotifyChange(const TBool aCallType,const TDesC& aRemoteCaller) { iCallType=aCallType; iRemoteCaller = HBufC::NewL(aRemoteCaller.Length()+ 19); if(iCallType) iRemoteCaller->Des().Copy(_L("Incoming Call From:")); else iRemoteCaller->Des().Copy(_L("Outgoing Call To :")); iRemoteCaller->Des().Append(aRemoteCaller); //DrawNow(); } // End of File



