Scheduler???

Login to reply to this topic.
Mon, 2006-05-15 12:11
Joined: 2006-03-28
Forum posts: 29
Hello friends,
I am developing one .exe on 8.0a.
Here i have developed .exe from application wizard which resulted in some predefined functions having ActiveScheduler.

Now my application wants to send sms.

I have included sms.h and sms.cpp in my .exe which contains Activescheduler too.

Now when i execute the exe from 6600, it gives me following errror:

e32user-cbase 44
Please help me out.
Kiran.

Mon, 2006-05-15 12:29
Joined: 2005-10-10
Forum posts: 37
Re: Scheduler???
Hey kiran,

Are you doing the process right?Huh As far as EXE's are concerned, You are needed to install the Active Scheduler manually... The other APP based applications take Active scheduler functionailties from their respective EIKON and other base classes....

An exe requires you to do CActiveScheduler::Install();

And if you're having two active schedulers, check out the invocation of the second active scheduler in the SMS class....


The Cruise is on...

Mon, 2006-05-15 12:39
Joined: 2006-03-28
Forum posts: 29
Re: Scheduler???
Hi dear,
thanks for yr quick reply.
Actually my EXE already contains:

CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
CleanupStack::PushL(scheduler);
CActiveScheduler::Install(scheduler);


Now as i m including sms class, it also contains:
CSmsHandler::CSmsHandler()
: CActive( CActive::EPriorityStandard )
{
    CActiveScheduler::Add( this );
}


Finally when i call my SendMsg() from EXE,
It results into E32User-CBase 44 error.
Mon, 2006-05-15 12:57
Joined: 2005-03-30
Forum posts: 206
Re: Scheduler???
don't forget to start active scheduller CActiveScheduler::Start(), and stop it when no longer need it.


guda

Tue, 2006-05-16 14:02
Joined: 2006-03-28
Forum posts: 29
Re: Scheduler???
My .exe contains following code:

MyExe.h
-----------
#include <e32base.h>
#include "SMSHandler.h"

//  Function Prototypes

GLDEF_C TInt E32Main();

   void SendMsg();
   CSmsHandler* iSmsHandler;
------------------------------------------------------


MyExe.cpp
--------------
//  Global Variables

LOCAL_D CConsoleBase* console;  // write all messages to this


//  Local Functions

LOCAL_C void MainL(const TDesC& aArgs)
    {
    //
    // add your program code here, example code below
    //
   iSmsHandler = CSmsHandler::NewL();

   SendMsg();
//    console->Write(_L("Hello, world!\n"));
//    console->Printf(_L("Command line args: \"%S\"\n"), &aArgs);
    }


LOCAL_C void DoStartL()
    {

//    Create active scheduler (to run active objects)
    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    CleanupStack::PushL(scheduler);
    CActiveScheduler::Install(scheduler);
   
    // Call main function with command line
    TBuf<256> cmdLine;
    RProcess().CommandLine(cmdLine);
    MainL(cmdLine);
//   delete iSmsHandler;
    // 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)
        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;
   //delete iSmsHandler;
    __UHEAP_MARKEND;
    return KErrNone;
    }

void SendMsg()
{
   console->Write(_L("UNSuccessful!\n"));
   TBuf<128> SMSText,PhoneNumber;
   SMSText.Copy(_L("Hello Buddy"));
   PhoneNumber.Copy(_L("9887548754"));

   iSmsHandler->SendL( PhoneNumber, SMSText);
}
--------------------------------------------------------


Now
SmsHandler.cpp
---------------------
CSmsHandler::CSmsHandler()
: CActive( CActive::EPriorityStandard )
    {
    CActiveScheduler::Add( this );
    iNextUnread = 0;            // index of next unread message in iSelection
    }

// -----------------------------------------------------------------------------
// CSmsHandler::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CSmsHandler::ConstructL()
    {
    // Session to message server is opened asynchronously.
    iSession = CMsvSession::OpenAsyncL( *this );

    // Entry selection for all received messages.
    iSelection = new ( ELeave ) CMsvEntrySelection();
    }

// -----------------------------------------------------------------------------
// CSmsHandler::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CSmsHandler* CSmsHandler::NewL( )
    {
    CSmsHandler* self = NewLC( );
    CleanupStack::Pop( self );
    return self;
    }

// -----------------------------------------------------------------------------
// CSmsHandler::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CSmsHandler* CSmsHandler::NewLC()
    {
    CSmsHandler* self = new ( ELeave ) CSmsHandler();
    CleanupStack::PushL( self );
    self->ConstructL();
    return self;
    }
.............etc.
--------------------------------------------------------

Now when i call my exe from phone, it gives me following error:
E32USER-CBase 44


Please help me out, it already took my many days.

Thanks,
Kiran.
Tue, 2006-05-16 14:40
Joined: 2005-03-30
Forum posts: 206
Re: Scheduler???
u are not starting u're active scheduller... and u are using active objects.. for them to be scheduller they  need an installed and started active scheduller.

guda

Tue, 2006-05-16 14:40
Joined: 2004-05-24
Forum posts: 982
Re: Scheduler???
E32USER-CBase 44 is raised by Start(), Stop() and Add() member functions of an active scheduler.
Now...you have to check if your application logic is the corect one. For example:
- check for example you don't start the as before instaliing it
- you're not adding active objects to active scheduler before having an as installed (it's probably this one in your case)

Just check and be confident when your application is doing the folowing things:

- install as
- create ao and raise async reqests
- add ao to as
- start as
- async requests complete and the according run method been called
- stop as

pirosl

Wed, 2006-05-17 09:26
Joined: 2006-03-28
Forum posts: 29
Re: Scheduler???
Hello friends,
thanks for yr warm n quick reply.

Anyways i did everything as suggested by u but it's not working anyhow.

My application runs perfect but when i convert it into exe it creates problem for me.

So please suggest me some clues by which i can call my application at boot time.

with regards,
Kiran.
Wed, 2006-05-17 09:31
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: Scheduler???
Quote from: kiran10182
...
So please suggest me some clues by which i can call my application at boot time.

Writing a recognizer: The EZBoot recognizer source code

Wed, 2006-05-17 10:17
Joined: 2004-05-24
Forum posts: 982
Re: Scheduler???
Quote from: kiran10182
....

My application runs perfect but when i convert it into exe it creates problem for me.

...

In your case the difference between app and exe is that for app the active scheduler is installed there for you and in exe you must install the active scheduler.

pirosl

Wed, 2006-05-17 10:42
Joined: 2006-03-28
Forum posts: 29
Re: Scheduler???
Hello dear,
I installed Acyive Scheduler as u said in yr previous reply but it didn't work.
Finally i came up with solution of launching my application(not exe) at start time.

I used autostart n starter by Mika.
It resulted positively.
I can see my application opened after booting.

Now i want to call my own MyFunc() automatically.
Is there any way to call my own function at boot time as soon as my application get opened?

Thanks,
Kiran.
  • Login to reply to this topic.