×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    123

    SMS receive in deamon?

    Hi again :P
    A few time ago i created application that receive SMS. It work great. But now, I have to do same but in deamon application, that run in background. So I created a new *.h and *.cpp file(in new project of course).
    That file extends MMsvSessionObserver and override
    HandleSessionEventL(TMsvSessionEvent aEvent, TAny *aArg1, TAny *aArg2, TAny *aArg3)

    In E32Main I wrote:

    Code:
    GLDEF_C TInt E32Main()
        {
        __UHEAP_MARK;
        CTrapCleanup* cleanup = CTrapCleanup::New();    
        DoStartL();
        delete deamonEngine;
        delete cleanup;
        __UHEAP_MARKEND;
        return KErrNone;
        }
    In DoStartL() I create Scheduler

    Code:
    LOCAL_C void DoStartL()
        {
        // Create active scheduler (to run active objects)
        CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    //    CleanupStack::PushL(scheduler);//it crash my app 
        CActiveScheduler::Install(scheduler);
        MainL();
    
        // Delete active scheduler
        CleanupStack::PopAndDestroy(scheduler);
        }
    In MainL i created object to receive SMS

    Code:
    LOCAL_C void MainL()
        {
        TInt err;
        TRAP(err, deamonEngine = CDeamonEngine::NewL());
        while(true)
            {
            User::After(500);
            }
        }
    CDeamonEngine extends MMsvSessionObserver.
    How to pause main thread, but don`t invoke CDeamonEngine? If I don`t use while, program will end, and if I use While, my applicatin don`t receive SMS. Have I to use ActiveObject, or create new Thread?

    And other question, can i check is my Deamon is running? Not necessarily in Symbian. maybe I can check in by phone application?

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,347

    Re: SMS receive in deamon?

    Long time ago, I created a Wiki article for this which may benefit you: Sending-Receiving SMS through an Exe (Server)

    EDIT: You need to start active sheduler. See the following piece of code.

    Code:
    LOCAL_C void DoStartL()
        {
        // Create active scheduler (to run active objects)
        CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    //    CleanupStack::PushL(scheduler);//it crash my app 
        CActiveScheduler::Install(scheduler);
        MainL();
    
        CActiveScheduler::Start();
        // Delete active scheduler
        CleanupStack::PopAndDestroy(scheduler);
        }
    Nokia Developer Wiki Moderation team

Similar Threads

  1. Receive Sms in j2me
    By xypnoss in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2009-07-28, 07:36
  2. How to receive concatenated SMS
    By mrhuman1984 in forum General Messaging
    Replies: 0
    Last Post: 2009-01-28, 01:59
  3. How I receive SMS delivery report in Java?
    By miroska in forum Mobile Java General
    Replies: 3
    Last Post: 2006-03-21, 16:57
  4. How I receive SMS delivery report in Java?
    By miroska in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-03-20, 14:36
  5. Replies: 9
    Last Post: 2004-03-24, 07:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×