I have created an application using the following piece of code at one of the discussion boards
while running it one the emulator the application simply doesn't open.Code:#ifndef TELEPHONY_H_ #define TELEPHONY_H_ #include <e32base.h> #include <Etel3rdParty.h> class CNotifyExample : public CActive { public: // Constructor/Destructor CNotifyExample( CTelephony* aTelephony ); // Request voice line status change notification void RequestNotification(); void GetNumber(); private: /* These are the pure virtual methods from CActive that MUST be implemented by all active objects */ void RunL(); void DoCancel(); private: /* A reference to a CTelephony, obtained with CTelephony::NewL() or NewLC() */ CTelephony* iTelephony; /* When the voice line status changes (and hence the asynchronous operation completes) the new voice line status is written into iLineStatus. Until this point, iLineStatus is not valid. If you change this class to get notification of other events, then change this class. CTelephony::TNotificationEvent lists the classes associated with each event. */ CTelephony::TCallStatusV1 iLineStatus; CTelephony::TCallStatusV1Pckg iLineStatusPckg; CTelephony::TCallStatus iLastInformedLineStatus; }; //------------------------------------------------------------------------ #include <e32base.h> #include <Etel3rdParty.h> #include <f32file.h> #include "TelephonyClasses.h" /* Default constructor. Pass it a reference to a CTelephony, created with CTelephony::NewL() or NewLC() */ void LogNew(const TDesC& aDes) { RFs aFs; aFs.Connect(); RFile aFile; TBuf<32> aFileName = _L("C:\\"); aFileName.Append(aDes); aFileName.Append(_L(".txt")); aFile.Create(aFs,aFileName,EFileWrite); aFile.Close(); aFs.Close(); } CNotifyExample::CNotifyExample( CTelephony* aTelephony ) : CActive( EPriorityStandard ), iTelephony( aTelephony ), iLineStatusPckg( iLineStatus ) { CActiveScheduler::Add(this); //default constructor iLineStatus.iStatus = CTelephony::EStatusUnknown; iLastInformedLineStatus = CTelephony::EStatusUnknown; } /* This method requests notification by calling CTelephony::NotifyChange() to initialise an asynchronous operation. Then it immediately calls CActive::SetActive to start the operation. The operation completes when the notification event occurs. In this case, we tell CTelephony to wait for the CTelephony::EVoiceLineStatusChange notification event, hence the event occurs when the voice line status changes. For other events, change the notification event in the call to CTelephony::NotifyChange(). The CTelephony::TNotificationEvent description all the notification events. It also list the information class to pass to CTelephony::NotifyChange(). The TCallStatus class is associated with CTelephony::EVoiceLineStatusChange. */ void CNotifyExample::RequestNotification() { /* Panic if this object is already performing an asynchronous operation */ _LIT( KNotifyExamplePanic, "CNotifyExample" ); __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyExamplePanic, 1 )); Cancel(); iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, iLineStatusPckg ); SetActive(); } /* The active object's RunL method is called when the asynchronous event completes. In this case, RunL is called when the voice line status changes. When this occurs, the new voice line status is written to the iLineStatus. iLineStatus was passed to CTelephony::NotifyChange() when the asynchronous operation was started. This is where you put your code to respond to your chosen notification event. In all active objects, iStatus indicates whether the asynchronous operation succeeded, failed, or is still in progress. KErrNone indicates success, and hence the value in iStatus is valid. */ void CNotifyExample::RunL() { //if( iStatus==KErrNone ) { /* Insert code to respond to the change of voice line status here. A typical use to answer a call if the voice line status is 'ringing' (EStatusRinging) Remember that you must implement a RunError() method if your code in RunL can leave. */ //if( iLineStatus.iStatus == CTelephony::EStatusRinging ) ; // Answer call by calling 'AnswerIncomingCall()' if(iLineStatus.iStatus == CTelephony::EStatusIdle) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusUnknown) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusDialling) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusReconnectPending) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusHold) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusTransferring) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusTransferAlerting) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusRinging) { if(iLastInformedLineStatus != CTelephony::EStatusDialling) GetNumber(); } if(iLineStatus.iStatus == CTelephony::EStatusAnswering) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusConnecting) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusConnected) GetNumber(); if(iLineStatus.iStatus == CTelephony::EStatusDisconnecting) GetNumber(); iLastInformedLineStatus = iLineStatus.iStatus; /* Request the next notification */ iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, iLineStatusPckg ); SetActive(); } } /* Like all active objects, you must supply a DoCancel() method to cancel the asynchronous operation. This must cancel a CTelephony notification operation with CTelephony::CancelAsync. Give the method the appropriate 'cancellation event' from those in 'TCancellationRequest' In this case, we are cancelling the "voice line status Change" event, and so we need to supply the EVoiceLineStatusChange cancellation code. If you change this class to respond to a different notification event, remember to change the call to CTelephony::CancelAsync. */ void CNotifyExample:oCancel() { iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel ); } void CNotifyExample::GetNumber() { 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 ); TBuf<64> remoteNumber; if(remotePartyInfoV1.iRemoteIdStatus==CTelephony::ERemoteIdentityAvailable) { // remotePartyInfoV1.iRemoteIdStatus==CTelephony::ERemoteIdentityAvailable .....never comes true and the // execution never reaches here remoteNumber.Copy(remotePartyInfoV1.iRemoteNumber.iTelNumber); } else { // We always come here and the length of remotePartyInfoV1.iRemoteNumber.iTelNumber is always 0 remoteNumber.Copy(remotePartyInfoV1.iRemoteNumber.iTelNumber); } if(remotePartyInfoV1.iRemoteNumber.iTelNumber.Length() > 0) { LogNew(_L("A")); LogNew(remotePartyInfoV1.iRemoteNumber.iTelNumber); } else LogNew(_L("B")); if(callInfoV1.iDialledParty.iTelNumber.Length() > 0) { LogNew(_L("C")); LogNew(callInfoV1.iDialledParty.iTelNumber); } else LogNew(_L("D")); } And this is how i use this class in HelloWorldBasic example void CHelloWorldBasicAppUi::ConstructL() { // Initialise app UI with standard value. BaseConstructL(CAknAppUi::EAknEnableSkin); // Create view object iAppView = CHelloWorldBasicAppView::NewL( ClientRect() ); iTelephony = CTelephony::NewL(); iNotifyExample = new (ELeave) CNotifyExample(iTelephony); iNotifyExample->RequestNotification(); }
also while creating a .sis file to test on the device,
i get the following error:
test_gcce.pkg(19) : error: file I/O fault.
what am i doing wrong??![]()



