×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 32
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    Exclamation The Consept Of HandleSessionEvent()

    hi all,
    i have an question about the HandleSessionEventL() method
    when i read the documentation and the MMsvSessionObserver documentation i still don't know who is responsible for calling this function,
    in othe words in this active object that should be listining to the message inboxe and take some actions when an MMS recieve
    THEN RETURN TO THE LISTNING MODE
    the class header file is :



    #ifndef RECIEVE_H_
    #define RECIEVE_H_

    #include <e32base.h>
    #include <msvapi.h> // MMsvSessionObserver
    #include <msvids.h>
    #include <msventry.h>
    #include <e32cmn.h>
    #include <mmsconst.h>
    #include <e32std.h>

    class Recieve : public CActive, public MMsvSessionObserver
    {
    public:
    CMsvSession* iSession;
    CMsvEntry *iMsvEntry;
    TMsvId iNewMessageId;
    virtual ~Recieve();
    void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*);
    void ProcessMMS();
    static Recieve* NewL();
    static Recieve* NewLC();
    protected:
    void ConstructL();
    Recieve();
    protected:
    virtual void RunL(); // Inherited from CActive
    virtual void DoCancel();
    virtual TInt RunError(TInt aError);
    };

    #endif /*RECIEVE_H_*/


    and teh CPP of it :


    #include "Recieve.h"


    Recieve::Recieve()
    : CActive(EPriorityStandard) { CActiveScheduler::Add(this); };
    Recieve* Recieve::NewLC()
    {
    Recieve* me = new (ELeave) Recieve(); // First phase construction
    CleanupStack::PushL(me);
    me->ConstructL(); // Second phase construction
    return (me);
    };
    Recieve* Recieve::NewL()
    {
    Recieve* me = Recieve::NewLC();
    CleanupStack::Pop(me);
    return (me);
    };
    void Recieve::ConstructL()
    {
    // Create CMsvSession asynchronously
    iSession = CMsvSession::OpenAsyncL(*this);
    };
    void Recieve::ProcessMMS(){};
    void Recieve::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3)
    {
    switch (aEvent)
    {
    case EMsvEntriesCreated:
    break;
    case EMsvEntriesChanged:

    //reading the SMS here into a rich text object , after its entry has been finally created
    if (*(static_cast<TMsvId*>(aArg2)) == KMsvGlobalInBoxIndexEntryId)
    {
    CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);
    if (iNewMessageId == entries->At(0))
    {
    // Set entry context to the new message
    iMsvEntry=iSession->GetEntryL(iNewMessageId);
    if(iMsvEntry->Entry().iMtm == KUidMsgTypeMultimedia)
    ProcessMMS();
    iSession->RemoveEntry(iNewMessageId);
    }

    }
    break;


    default:
    // do nothing
    break;
    }
    };

    void Recieve::RunL()
    {
    User::LeaveIfError(iStatus.Int());
    SetActive();
    };
    void Recieve:: DoCancel()
    {
    iSession->CloseMessageServer();
    };
    TInt Recieve::RunError(TInt aError)
    {return(1);};
    Recieve::~Recieve()
    {
    iSession->CloseMessageServer();
    Cancel();
    };





    So please if any One could till me the Consept of the HandleSessionEventL() should i in the main of the project declare an object of this Class and call HandleSessionEventL()
    or what to do ?
    forgive my long thread but i ;m trying to make clear of my question
    thnx in advance
    bye.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: The Consept Of HandleSessionEvent()

    basically when you call: iSession = CMsvSession::OpenAsyncL(*this);

    you are giving reference to your class by supplying the *this to the constructor, so the underlying API will then call the function mentioned when any events that it is reporting happens.

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    Re: The Consept Of HandleSessionEvent()

    hi all,
    i can't express my thankful and grateful to you symbianyucca for your quick reply but i really want to know
    if i want to make an program that will run on the mobile and:
    1-monitor the inboxe of the messages
    2-when an message arrives it will handle it
    3=when finish it will return to the monitor state.

    and so on i will use my class that i have sent my question is:
    is my class could do this?
    if so:
    what to write in the E32Main() function to make this active object working to minotor the inbox for example : declare an object of it : Revieve* Reci=Recieve:: NewL();
    if so should i call the HandleSessionEventL()
    Reci->HandleSessionEventL();
    or just declare the object only?
    or iam totally wrong and it done another way?
    thnx in advance.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: The Consept Of HandleSessionEvent()

    just have a look into any SMS exmaple and how the HandleSessionEventL is implemented, and you do not need to call HandleSessionEventL, it will be called by system. So just check the exmaples and try it out in a real device.

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    Re: The Consept Of HandleSessionEvent()

    hi symbianyucca,
    Sorry but i have read the SMS Exaple 2 but it has alot of details that i suggest i don't need, also it is an DLL example i'm not familear with it ,i can't find even the implementation of the E32DLL();

    all i need to tell me if my class can do what i mention before , and what to write in the E32Main() to run my program write way
    thnx alot
    and sorry for disturbing.

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: The Consept Of HandleSessionEvent()

    Sorry not reading your question fully. Anyway as far as I can see calling:
    Revieve* Reci=Recieve:: NewL();
    Should be enough, since it also constructs the CMsvSession, which should indeed cause the HandleSessionEventL() to be called when new events happen.

  7. #7
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    Re: The Consept Of HandleSessionEvent()

    thank u very much for your quick reply and for your help symbianyucca i will try it

  8. #8
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    Re: The Consept Of HandleSessionEvent()

    Sorrry again symbianyucca,
    i have run my program after including the Recieve.h thut i have sent it and in the
    TIntE32Mail():
    {
    Recieve* Re=Recieve:: NewL();
    return(1);
    }


    when running it it gives me a panic message on the emulator i don't know why? the panic message is:
    Acall to User:: Panic() has Ocurred,indecating aprogramming fault in the running application
    program Pro.exe::Main
    Error E32USER-CBase :44



    could any one help me on that
    thnx in advance

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: The Consept Of HandleSessionEvent()

    I guess it happened in
    Code:
    TInt E32Main()
    So this is the entry point of .exe files, and there you have no Cleanup Stack (nor Active Scheduler) initialized. You can check Examples\Basics\HelloWorld for creating a minimal console executable. Note that its E32Main method is actually located in Examples\Basics\CommonFramework\CommonFramework.h

  10. #10
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    Unhappy Re: The Consept Of HandleSessionEvent()

    hi all,
    you have told me wizard_hu_ that i must initialize acleanUpStack in the E32Main like the hellow world example and (Active Schedular
    must i initialize an active schedular in the E32Main also i have one in the implementantation of the active object?

    if not i have written this source file after including the CommonFrameWork.h in my project:



    #include "Recieve.h"
    #include <e32base.h>
    #include <e32std.h>
    #include <e32cons.h> // Console
    #include "CommonFramework.h"


    LOCAL_C void doExampleL()
    {
    Recieve* Re=Recieve::NewL();
    };

    but when running it the emulator appears and close immediately without completing opening
    i donot know why!!, could any body tell me why?

    Could any body just copy paste my program and try it in his PC to insure that there is no thing wrong in my PC?

    thnx in advance
    bye for now

  11. #11
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Smile Re: The Consept Of HandleSessionEvent()

    I think you should check this Wiki article for once.

    * Sending-Receiving SMS through an Exe (Server)

    Kiran.
    Nokia Developer Wiki Moderation team

  12. #12
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    Unhappy Re: The Consept Of HandleSessionEvent()

    hi kiran10182,
    thnx for quick reply
    i have read the example and write my cpp file as it ofcours with including my class and initialize my active object
    but there is an error when compiling this line:

    RProcess().CommandLine(cmnLine);
    told me that :

    Severity and Description Path Resource Location Creation Time Id
    undefined identifier 'CommandLine' OmSaid2/src OmSaid2.cpp line 39 1205635545218 1786



    Could u till me what's wrong
    i have includid the libraries that written in the example
    i'm using SDK 3rd Edition fp1
    thnx in advance
    Last edited by mhmd_ward; 2008-03-16 at 02:48.

  13. #13
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: The Consept Of HandleSessionEvent()

    Quote Originally Posted by mhmd_ward View Post
    RProcess().CommandLine(cmnLine);
    told me that :

    Severity and Description Path Resource Location Creation Time Id
    undefined identifier 'CommandLine' OmSaid2/src
    Try simple calling:
    Code:
    MainL()
    instead of
    Code:
    // Call main function with command line
    TBuf<256> cmdLine;
    RProcess().CommandLine(cmdLine);
    MainL(cmdLine);
    You need to modify the example as per your needs. Means, change the definition, declaration and calling pattern of MainL().

    Kiran.
    Nokia Developer Wiki Moderation team

  14. #14
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    Exclamation Re: The Consept Of HandleSessionEvent()

    hi all,
    yes kiran10182 i have modified the MainL() not to take cmdLine ,
    but when runing the program the emulator displayes that message



    Application closed:
    Stand by mode
    viewSrv11


    what does that mean

    bye the way i'm using Carbid.C++ v1.2 and S60 Sdk 3rd Edition EP1

    Could any body till me waht's wrong?
    thnx in advance
    bye

  15. #15
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: The Consept Of HandleSessionEvent()

    Quote Originally Posted by mhmd_ward View Post
    hi all,
    yes kiran10182 i have modified the MainL() not to take cmdLine ,
    but when runing the program the emulator displayes that message



    Application closed:
    Stand by mode
    viewSrv11


    what does that mean

    bye the way i'm using Carbid.C++ v1.2 and S60 Sdk 3rd Edition EP1

    Could any body till me waht's wrong?
    thnx in advance
    bye
    Check it on real device.

    Kiran.
    Nokia Developer Wiki Moderation team

Similar Threads

  1. Problem with SMS HandleSessionEvent
    By kallele in forum Symbian Networking & Messaging (Closed)
    Replies: 6
    Last Post: 2003-11-25, 14:37
  2. Problem with MMS HandleSessionEvent
    By ostache in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2003-06-11, 09:23

Posting Permissions

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