code is not working in the PHONE.
| Fri, 2005-10-14 06:48 | |
|
Hi,,
/* * ============================================================================ * Name : COutAppUi from OutAppUi.cpp * Part of : out * Created : 9/30/2005 by Shashi * Implementation notes: * Initial content was generated by Series 60 AppWizard. * Version : * * ============================================================================ */ // INCLUDE FILES #include "OutAppUi.h" #include "OutView.h" #include <out.rsg> #include "out.hrh" #include <avkon.hrh> #include <aknappui.h> #include <etel.h> #include <eikmenup.h> // ================= MEMBER FUNCTIONS ======================= // // ---------------------------------------------------------- // COutAppUi::ConstructL() // // ---------------------------------------------------------- // _LIT (KTsyName,"phonetsy.tsy"); void COutAppUi::ConstructL() { BaseConstructL( EAknEnableSkin ); iAppContainer = new (ELeave) COutView; iAppContainer->SetMopParent( this ); iAppContainer->ConstructL( ClientRect() ); AddToStackL( iAppContainer ); } // ---------------------------------------------------- // COutAppUi::~COutAppUi() // Destructor // Frees reserved resources // ---------------------------------------------------- // COutAppUi::~COutAppUi() { if (iAppContainer) { RemoveFromStack( iAppContainer ); delete iAppContainer; } } // ------------------------------------------------------------------------------ // COutAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) // This function is called by the EIKON framework just before it displays // a menu pane. Its default implementation is empty, and by overriding it, // the application can set the state of menu items dynamically according // to the state of application data. // ------------------------------------------------------------------------------ // void COutAppUi::DynInitMenuPaneL( TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) { } // ---------------------------------------------------- // COutAppUi::HandleKeyEventL( // const TKeyEvent& aKeyEvent,TEventCode /*aType*/) // takes care of key event handling // ---------------------------------------------------- // TKeyResponse COutAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) { return EKeyWasNotConsumed; } // ---------------------------------------------------- // COutAppUi::HandleCommandL(TInt aCommand) // takes care of command handling // ---------------------------------------------------- // void COutAppUi::HandleCommandL(TInt aCommand) { switch ( aCommand ) { case EAknSoftkeyBack: case EEikCmdExit: { Exit(); break; } case EoutCmdAppSave: { iEikonEnv->InfoMsg(_L("Save")); break; } case EoutCmdAppCall: { iEikonEnv->InfoMsg(_L("Call")); break; } case EoutCmdAppEdit: { iEikonEnv->InfoMsg(_L("Edit")); break; } case EoutCmdAppDelete: { iEikonEnv->InfoMsg(_L("Delete")); break; } case EoutCmdAppViewNumber: { iEikonEnv->InfoMsg(_L("ViewNumber")); break; } case EoutCmdAppTime: { iEikonEnv->InfoMsg(_L("Time")); break; } case EoutCmdAppDuration: { iEikonEnv->InfoMsg(_L("Duration")); break; } case EoutCmdAppCost: { iEikonEnv->InfoMsg(_L("Cost")); break; } // TODO: Add Your command handling code here default: break; } } void COutAppUi::DialNumberL(const TDesC& aPhoneNumber) { // emulator does not support dialing //#if __WINS__ // NEikonEnvironment::MessageBox (KEmulatorError); //#else //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 //Unload the phone device driver User::LeaveIfError(server.UnloadPhoneModule(KTsyName)); //Close the connection to the tel server and remove it from the cleanup stack CleanupStack::PopAndDestroy(&server); TTimeIntervalSeconds aTime; User::LeaveIfError(call.GetCallDuration(aTime)) ; //#endif } ================================== This code is not working in the phone , but is working in the Emulator... When I used in the PHONE . press " OPTIONS " button , it is not going into the options of the save, call , delete ....options. Any problem in the code..? why it is not working in the PHONE? thanks in advance.. |
|






Forum posts: 123
Forum posts: 140
-see User::LeaveIfError(call.GetCallDuration(aTime)) ;
Paul Todd