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.





