All About Symbian - Nokia (S60) and Sony Ericsson (UIQ) smartphones unwrapped

  #1  
Old 03-01-2005, 10:25 PM
white_dragon white_dragon is offline
Registered User
 
Join Date: Apr 2004
Posts: 66
white_dragon is on a distinguished road
PLEASE HELP , try to hang up an outgoing call

Hi
I found code that can trace a dialing status .
I try to use it in a very simple and primitive way :
I want to hang up the call when status changes to dialing.
what actually happens is that when I dial a number and the app is in the background , I get a message that my app is closed , and the call is made (not hung up).
so the dialing status does activate the RunL() method , but the app falls.

please advise , what should I change or add ?

I put the code below , I think that the most relevant method here is the RunL() ...

Thanks in advance , TE

Code:
CActiveClass* CActiveClass::NewL()
{
	CActiveClass* self = new (ELeave) CActiveClass();
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::Pop(self);
	return self;
}

CActiveClass::CActiveClass()
: CActive(0){}

void CActiveClass::ConstructL()
{
	iEnv = CEikonEnv::Static();
	CActiveScheduler::Add(this); 
	StartObserver();
}

CActiveClass::~CActiveClass()
{
	if (IsActive()) 
	{ 
		Cancel(); 
	} 
	else 
	{ 
		ReleasePhone(); 
	} 
}

void CActiveClass::RunL()
{
	if (iStatus == KErrNone) 
	{ 

		if (iCallStatus == RCall::EStatusHangingUp || iCallStatus == RCall::EStatusIdle || iCallStatus == RCall::EStatusUnknown) 
		{ 
			iCall.Close(); 
		} 
		else if(iCallStatus == RCall::EStatusDialling)
		{ 
			RCall  iCall2; 
			// Try : iCall2.OpenExistingCall(iPhone,iName);
			iCall2.OpenExistingCall(iLine,iName);
			// Try : iCall2.DialCancel ();
			// Try : iCall2.HangUp(iStatus); 
			iCall2.HangUp(); 
		}
		iLine.NotifyStatusChange(iStatus, iCallStatus); 
		SetActive();
	}
}

void CActiveClass::DoCancel()
{
	ReleasePhone(); 
}

void CActiveClass::StartObserver() 
{ 
	Cancel(); 
	if (InitializePhone() == KErrNone) 
	{ 
		iLine.NotifyStatusChange(iStatus, iCallStatus); 
		SetActive(); 
	} 
} 

TInt CActiveClass::InitializePhone() 
{ 
	TInt theError; 
	if (iLineInited) 
	{ 
		return KErrNone; 
	} 
	theError = iTelServer.Connect(); 
	if (theError) 
	{ 
		return theError; 
	} 
	// Find the number of phones available from the tel server 
	TInt numberPhones; 
	theError = iTelServer.EnumeratePhones(numberPhones); 
	if (theError) 
	{ 
		iTelServer.Close(); 
		return theError; 
	} 
	// Check there are available phones 
	if (numberPhones < 1) 
	{ 
		iTelServer.Close(); 
		return KErrNotFound; 
	} 
	// Read the TSY module name 
	theError = iTelServer.GetTsyName(0, iTsyName); 
	if (theError != KErrNone) 
	{ 
		iTelServer.Close(); 
		return theError; 
	} 
	// Load in the phone device driver 
	theError = iTelServer.LoadPhoneModule(iTsyName); 
	if (theError) 
	{ 
		iTelServer.Close(); 
		return theError; 
	} 
	// Get info about the first available phone 
	RTelServer::TPhoneInfo info; 
	theError = iTelServer.GetPhoneInfo(0, info); 
	if (theError) 
	{ 
		iTelServer.UnloadPhoneModule(iTsyName); 
		iTelServer.Close(); 
		return theError; 
	} 
	// Use this info to open a connection to the phone, the phone is identified by its name 
	theError = iPhone.Open(iTelServer, info.iName); 
	if (theError) 
	{ 
		iTelServer.UnloadPhoneModule(iTsyName); 
		iTelServer.Close(); 
		return theError; 
	} 
	// Get info about the first line from the phone 
	RPhone::TLineInfo lineInfo; 
	theError = iPhone.GetLineInfo(0, lineInfo); 
	if (theError) 
	{ 
		iPhone.Close(); 
		iTelServer.UnloadPhoneModule(iTsyName); 
		iTelServer.Close(); 
		return theError; 
	} 
	// Use this to open a line 
	theError = iLine.Open(iPhone, lineInfo.iName); 
	if (theError) 
	{ 
		iPhone.Close(); 
		iTelServer.UnloadPhoneModule(iTsyName); 
		iTelServer.Close(); 
		return theError; 
	} 
	return KErrNone; 
} 

void CActiveClass::ReleasePhone() 
{ 
	iLine.NotifyIncomingCallCancel(); 
	iLine.Close(); 
	iPhone.Close(); 
	iTelServer.UnloadPhoneModule(iTsyName); 
	iTelServer.Close(); 
}

  #2  
Old 06-01-2005, 10:22 PM
white_dragon white_dragon is offline
Registered User
 
Join Date: Apr 2004
Posts: 66
white_dragon is on a distinguished road
I now use the lineInfo.iNameOfLastCallAdded retrieved with iLine.GetInfo ,
still the call doesnt HangUp - actually nothing happens after I initiate a phone call.

I'm sure that I get to the if(iCallStatus == RCall::EStatusDialling) block .

I did many changes and tests but nothing stopped the call , also tried the DialCancel method ...

Thanks for your help , TE


Code:
void CActiveClass::RunL()
{
	if (iStatus == KErrNone) 
	{ 

		if (iCallStatus == RCall::EStatusHangingUp || iCallStatus == RCall::EStatusIdle || iCallStatus == RCall::EStatusUnknown) 
		{ 
			iCall.Close(); 
		} 
		else if(iCallStatus == RCall::EStatusDialling)
		{ 
			RCall iCall; 
			RLine::TLineInfo lineInfo; 
			iLine.GetInfo(lineInfo); 
			TInt aResult = User::LeaveIfError(iCall.OpenExistingCall(iLine, lineInfo.iNameOfLastCallAdded));
			iCall.HangUp();
		}
		iLine.NotifyStatusChange(iStatus, iCallStatus); 
		SetActive();
	}
}

CActiveClass* CActiveClass::NewL()
	{
	CActiveClass* self = new (ELeave) CActiveClass();
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::Pop(self);
	return self;
	}

CActiveClass::CActiveClass()
: CActive(0)
{
	iLineInited = EFalse; 
	iCallActive = EFalse; 
}

void CActiveClass::ConstructL()
{
	User::LeaveIfError(iTimer.CreateLocal());
	TRequestStatus aStatus;
	iEnv = CEikonEnv::Static();
	CActiveScheduler::Add(this); 
	StartObserver();
}

void CActiveClass::StartObserver() 
{ 
	Cancel(); 
	if (InitializePhone() == KErrNone) 
	{ 
		iLine.NotifyStatusChange(iStatus, iCallStatus); 
		SetActive(); 
	} 
} 

TInt CActiveClass::InitializePhone() 
{ 
	TInt theError; 
	if (iLineInited) 
	{ 
		return KErrNone; 
	} 
	theError = iTelServer.Connect(); 
	
	// Find the number of phones available from the tel server 
	TInt numberPhones; 
	theError = iTelServer.EnumeratePhones(numberPhones); 

	// Read the TSY module name 
	theError = iTelServer.GetTsyName(0, iTsyName); 
	
	// Load in the phone device driver 
	theError = iTelServer.LoadPhoneModule(iTsyName); 
	
	// Get info about the first available phone 
	RTelServer::TPhoneInfo info; 
	theError = iTelServer.GetPhoneInfo(0, info); 
	
	// Use this info to open a connection to the phone, the phone is identified by its name 
	theError = iPhone.Open(iTelServer, info.iName); 
	
	RPhone::TLineInfo lineInfo; 
	theError = iPhone.GetLineInfo(0, lineInfo);
	
	theError = iLine.Open(iPhone, lineInfo.iName); 
	
	iLineInited = ETrue; 
	return KErrNone; 
}

  #3  
Old 11-01-2005, 10:36 PM
white_dragon white_dragon is offline
Registered User
 
Join Date: Apr 2004
Posts: 66
white_dragon is on a distinguished road
could this be related to the ownership of the call ?
I checked and the ownership's status is not owned ...
does it metter ?
can this be the reason that I can't hang up the Call ?

Thanks a lot , TE
Ads

  #4  
Old 11-01-2005, 10:37 PM
white_dragon white_dragon is offline
Registered User
 
Join Date: Apr 2004
Posts: 66
white_dragon is on a distinguished road
by the way , this code works on the P900 !!!
the problem occur on the Nokia 6600 ...

  #5  
Old 14-01-2005, 02:33 PM
white_dragon white_dragon is offline
Registered User
 
Join Date: Apr 2004
Posts: 66
white_dragon is on a distinguished road
Update :
the HangUp works on the Nokia 6600 but only when I replace the EStatusDialling to EStatusConnected .
that means that the hang up occures only when the destination phone answers the outgoing call which is not good for my needs .(maybe its good for a broken heart guy who wants to call his ex girlfriend and hang up immediatly :-))

its like the hang up is not supported at the StatusDialling ...

Any ideas ?
 

Bookmarks

Tags
hang, outgoing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help on install theme into my 6600? and why all the call time is mess up /? hammenm5 Nokia 6600 and 6620 2 15-04-2004 11:48 PM
Call summery durring call? sdf Nokia 3650, 3660, and 3620 6 24-07-2003 09:53 AM



All times are GMT. The time now is 10:35 PM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright Notes || Contact Us || Privacy Policy