Just copying the classes here :
The main class:
The telephony class:Code:/* ============================================================================ Name : testcon.cpp Author : Copyright : Your copyright notice Description : Exe source file ============================================================================ */ // Include Files #include "testcon.h" #include <e32base.h> #include <e32std.h> #include <e32cons.h> // Console #include "testac.h" // Constants _LIT(KTextConsoleTitle, "Console"); _LIT(KTextFailed, " failed, leave code = %d"); _LIT(KTextPressAnyKey, " [press any key]\n"); // Global Variables LOCAL_D CConsoleBase* console; // write all messages to this Ctestac* c ; CTelephony*itele; // Local Functions LOCAL_C void MainL() { // // add your program code here, example code below // console->Write(_L("Hello, world!\n")); //TRAPD(createError1, c= new(ELeave) Ctestac(itele)); TRAPD(createError1,c = Ctestac::NewL()); if(createError1) { console-> Write(_L("an error create\n")); console->Getch(); } } LOCAL_C void DoStartL() { // Create active scheduler (to run active objects) CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); CleanupStack::PushL(scheduler); CActiveScheduler::Install(scheduler); MainL(); // Delete active scheduler CleanupStack::PopAndDestroy(scheduler); } // Global Functions GLDEF_C TInt E32Main() { // Create cleanup stack __UHEAP_MARK; CTrapCleanup* cleanup = CTrapCleanup::New(); // Create output console TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize( KConsFullScreen, KConsFullScreen))); if (createError) { delete cleanup; return createError; } // Run application code inside TRAP harness, wait keypress when terminated TRAPD(mainError, DoStartL()); if (mainError) console->Printf(KTextFailed, mainError); console->Printf(KTextPressAnyKey); console->Getch(); delete console; delete cleanup; __UHEAP_MARKEND; console->Getch(); return KErrNone; }
.hCode:/* ============================================================================ Name : testac.cpp Author : Version : 1.0 Copyright : Your copyright notice Description : Ctestac implementation ============================================================================ */ #include "etel3rdparty.h" #include "testac.h" Ctestac::Ctestac() : CActive(EPriorityStandard) // Standard priority { } Ctestac* Ctestac::NewLC() { Ctestac* self = new (ELeave) Ctestac(); CleanupStack::PushL(self); self->ConstructL(); return self; } Ctestac* Ctestac::NewL() { Ctestac* self = Ctestac::NewLC(); CleanupStack::Pop(); // self; return self; } void Ctestac::ConstructL() { iTelephony = CTelephony::NewL(); CActiveScheduler::Add(this); // Add to scheduler } Ctestac::~Ctestac() { Cancel(); // Cancel any request, if outstanding // Delete instance variables if any } void Ctestac::DoCancel() { } void Ctestac::StartL() { //your implementation } void Ctestac::RunL() { //your implementation } TInt Ctestac::RunError(TInt aError) { return aError; }
Code:/* ============================================================================ Name : testac.h Author : Version : 1.0 Copyright : Your copyright notice Description : Ctestac declaration ============================================================================ */ #ifndef TESTAC_H #define TESTAC_H #include <e32base.h> // For CActive, link against: euser.lib #include <e32std.h> // For RTimer, link against: euser.lib #include "etel3rdparty.h" class Ctestac : public CActive { public: // Cancel and destroy ~Ctestac(); // Two-phased constructor. static Ctestac* NewL(); // Two-phased constructor. static Ctestac* NewLC(); public: // New functions // Function for making the initial request void StartL(); Ctestac(); private: // C++ constructor // Second-phase constructor void ConstructL(); private: CTelephony* iTelephony; CTelephony::TCallId iCallId; private: // From CActive // Handle completion void RunL(); // How to cancel me void DoCancel(); // Override to handle leaves from RunL(). Default implementation causes // the active scheduler to panic. TInt RunError(TInt aError); private: enum TtestacState { EUninitialized, // Uninitialized EInitialized, // Initalized EError // Error condition }; private: TInt iState; // State of the active object }; #endif // TESTAC_H



