Hi
I had made a DialNumberL function which makes a call and after the calls end , i want the control to return back to my app. Can u guide my way through.
//Create a connection to the tel server
RTelServer server;
CleanupClosePushL(server);
User::LeaveIfError(server.Connect());
//Load in the phone device driver
User::LeaveIfError(server.LoadPhoneModule(KTsyName));
//Find the number of phones available from the tel server
TInt numberPhones;
User::LeaveIfError(server.EnumeratePhones(numberPhones));
//Check there are available phones
if (numberPhones < 1)
{
User::Leave(KErrNotFound);
}
//Get info about the first available phone
RTelServer::TPhoneInfo info;
User::LeaveIfError(server.GetPhoneInfo(0, info));
//Use this info to open a connection to the phone, the phone is identified by its name
RPhone phone;
CleanupClosePushL(phone);
User::LeaveIfError(phone.Open(server, info.iName));
//Get info about the first line from the phone
RPhone::TLineInfo lineInfo;
User::LeaveIfError(phone.GetLineInfo(0, lineInfo));
//Use this to open a line
RLine line;
CleanupClosePushL(line);
User::LeaveIfError(line.Open(phone, lineInfo.iName));
//Open a new call on this line
TBuf <100> newCallName;
RCall call;
CleanupClosePushL(call);
User::LeaveIfError(call.OpenNewCall(line, newCallName));
//newCallName will now contain the name of the call
User::LeaveIfError(call.Dial(aPhoneNumber));
//Close the phone, line and call connections and remove them from the cleanup stack
//NOTE: This does not hang up the call
CleanupStack::PopAndDestroy(3);//phone, line, call
TApaTask task(CEikonEnv::Static()->WsSession());
task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
task.BringToForeground();
//Unload the phone device driver
//User::LeaveIfError(server.UnloadPhoneModule(KTsyName));
TInt k=0;
k=server.UnloadPhoneModule(KTsyName);
if( k!= KErrNone )
{
TApaTask task(CEikonEnv::Static()->WsSession());
task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
task.BringToForeground();
}
//Close the connection to the tel server and remove it from the cleanup stack
CleanupStack::PopAndDestroy(&server);
you should wrap the whole thing into a active object and then when the call is established, you just start notifier that will call your RunL back when the call status changes, then you'll just acta ccordingly there.
// Connect to the telephony server and load the TSY.
server = new (ELeave) RTelServer;
User::LeaveIfError(server->Connect());
User::LeaveIfError(server->LoadPhoneModule(KTsyName));
// Get the details for the first (and only) phone.
User::LeaveIfError(server->GetPhoneInfo(0, info));
// Open the phone.
RPhone phone;
CleanupClosePushL(phone);
User::LeaveIfError(phone.Open(*server, info.iName));
// Get the information for the voice line, line 0.
User::LeaveIfError(phone.GetLineInfo(0, lineInfo));
// Open the line. iName will now be "VoiceLine1".
RLine line;
CleanupClosePushL(line);
User::LeaveIfError(line.Open(phone, lineInfo.iName));
// Open a new phone call.
call = new (ELeave) RCall;
I think you dont have too much idea of how the active objects work, so I would suggest you to go to www.symbian.com and locate the paper written by Mr. Martin Tasker, it explains the main features and usage of active objects quite nicely.
yucca
How to intiate the active class from container
2004-06-15, 12:31#5
// Connect to the telephony server and load the TSY.
server = new (ELeave) RTelServer;
User::LeaveIfError(server->Connect());
User::LeaveIfError(server->LoadPhoneModule(KTsyName));
// Get the details for the first (and only) phone.
User::LeaveIfError(server->GetPhoneInfo(0, info));
// Open the phone.
RPhone phone;
CleanupClosePushL(phone);
User::LeaveIfError(phone.Open(*server, info.iName));
// Get the information for the voice line, line 0.
User::LeaveIfError(phone.GetLineInfo(0, lineInfo));
// Open the line. iName will now be "VoiceLine1".
RLine line;
CleanupClosePushL(line);
User::LeaveIfError(line.Open(phone, lineInfo.iName));
// Open a new phone call.
call = new (ELeave) RCall;
User::LeaveIfError(call->OpenNewCall(line, newCallName));
//TRAPD(error,call->Dial(*iNumber));
TRAPD(error,call->Dial(iStatus,*iNumber)); //call dial with status
SetActive();
CleanupStack::PopAndDestroy(2);//phone, line
if(server)
User::LeaveIfError(server->UnloadPhoneModule(KTsyName));
delete call;
call = NULL;
delete server;
server = NULL;
// SetActive();
}
first tell me that whether now i m doing right, and secondly i want to know that, i f want to make a call when some event occur on my listbox in container class. So how can i intiate the active class from my container class on some event.
looks a lot better now already, anyway for monitoring the phone call (for example for hang-up) you could use NotifyStatusChange()-fucntion of the RCall after the call have dialed.
for observing events in other components, you should always check the sdk docs & headers for function that is used for setting a observer. For example listbox has SetListBoxObserver()-function. Then check the observer interface definitions and implement the required functions in your container (observer) class.
yucca
Intiate the active class from container
2004-06-16, 06:23#7
Hi Yucca,
I had no problem in trapping the event in listbox , i m trapping the event of listbox and opening different views.
But now my problem is, I m not able to intiate the code written in my active class, that is CActiveDial class which i had given in my previous post .
From my container class, i m not able to call any function of this CActiveDial class.
Please guide me, I know i m troubling u a lot.
Thanks
can't really understand the problem. could you be a bit more specific and explain a bit moe of why you are not able to call any function defined in your active object ?
What happens ? and when (compiling, running etc ) ?
I am creating the object of the CActiveDial class in my contructor of container class and then calling the DialNumber() function when i trapped the event of my listbox in OfferKeyEventL() function but at compile time it gives error, no default contructor available ,i dont know where i m doing wrong.
Hi Yucca,
this question is not related to my previous post,
I had installed a sis file on my device , while my app runs on device it creates to file on C drive, which i uses while my app is running. Now i want that when i unistall my app , i want to delete those two file also from my device.
Can u plaese guide me , how to acheive that.