hello
i wrote a simple application just to get started with symbian programming
(i am newbe:redface: )
i just used a simple hello world application and some code available in symbian api documentation about CTelephony.
my code compiles but i get a runtime error KERN-EXEC 3.
here is my code ......could anyone help me make it work?
#ifndef __COMMONFRAMEWORK_H__
#define __COMMONFRAMEWORK_H__
// Include Files
#include <e32base.h>
#include <Etel3rdParty.h>
#include <e32cons.h>
// Function Prototypes
GLDEF_C TInt E32Main();
class CClientApp : public CActive
{
private:
CTelephony* iTelephony;
CTelephony::TPhoneIdV1 iPhoneIdV1;
CTelephony::TPhoneIdV1Pckg iPhoneIdV1Pckg;
public:
CClientApp(CTelephony* aTelephony);
void SomeFunctionL();
void SetactiveL();
private:
/*
These are the pure virtual methods from CActive that
MUST be implemented by all active objects
*/
void RunL();
void DoCancel();
};
/////////////////////////////////////////////////////////////////////////
CClientApp::CClientApp(CTelephony* aTelephony):CActive(EPriorityStandard),iTelephony(iTelephony),iPhoneIdV1Pckg(iPhoneIdV1)
{
CActiveScheduler::Add(this);
}
///////////////////////////////////////////////////////////////////////////
void CClientApp::SomeFunctionL()
{
//iStatus=KRequestPending;
iTelephony->GetPhoneId(iStatus, iPhoneIdV1Pckg);
SetActive();
}
/////////////////////////////////////////////////////////////////////////////////
void CClientApp::RunL()
{
if(iStatus==KErrNone)
{
TBuf<CTelephony::KPhoneManufacturerIdSize> manufacturer = iPhoneIdV1.iManufacturer;
TBuf<CTelephony::KPhoneModelIdSize> model = iPhoneIdV1.iModel;
TBuf<CTelephony::KPhoneSerialNumberSize> serialNumber = iPhoneIdV1.iSerialNumber;
}
}
//////////////////////////////////////////////////////////////////////////////////
void CClientApp:😃oCancel()
{
iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
}
///////////////////////////////////////////////////////////////////////////////////
#endif __COMMONFRAMEWORK_H__
// Include Files
#include "CommonFramework.h"
#include <e32base.h>
#include <e32std.h>
#include <e32cons.h> // Console
// Constants
_LIT(KTextConsoleTitle, "Console\n"😉;
_LIT(KTextFailed, " failed, leave code = %d\n"😉;
_LIT(KTextPressAnyKey, " [press any key]\n"😉;
_LIT(KErrorCode5, "%d"😉;
// Global Variables
LOCAL_D CConsoleBase* console; // write all messages to this
// Local Functions
//+++++++++++++++++++++++++++++++ MainL() ++++++++++++++++++++++++++++++++++++++++
LOCAL_C void MainL()
{
//
// add your program code here, example code below
//
console->Write(_L("Hello, world!\n"😉);
}
//+++++++++++++++++++++++++++++++++ DoStartL() +++++++++++++++++++++++++++++++++++++++
LOCAL_C void DoStartL()
{
// Create active scheduler (to run active objects)
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
CleanupStack::PushL(scheduler);
CActiveScheduler::Install(scheduler);
console->Write(_L("Hello, world!\n"😉);
CTelephony* aTelephony;
CClientApp client(aTelephony);
TRAPD(seriuserror,client.SomeFunctionL());
if(seriuserror!=KErrNone)
{
User::LeaveIfError(seriuserror);
console->Printf(KErrorCode5,seriuserror);
}
CActiveScheduler::Start();
MainL();
// Delete active scheduler
CleanupStack::PopAndDestroy(scheduler);
}
//+++++++++++++++++++++++++++++++ E32Main() ++++++++++++++++++++++++++++++++++++++++++++++++++
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)
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;
return KErrNone;
}
Any help is appriciated