problem in mms

Login to reply to this topic.
Mon, 2007-12-10 07:46
Joined: 2007-11-02
Forum posts: 37

Hi,
I am facing some problems in sending mms.
lOOKING FORWARD FOR SOMEONES ADVICE...........

I get the following errors:----

1.'CMmsClientMtm::CreateAttachment2L(CMsvStore &, RFile &, TDesC8 &, CMsvMimeHeaders &, CMsvAttachment *, unsigned int &)' (non-static)
2. 'CMmsClientMtm::CreateTextAttachmentL(CMsvStore &, unsigned int &, const TDesC16 &, const TDesC16 &, int)' (non-static)
3. function call '[CMmsClientMtm].CreateAttachment2L({lval} CMsvStore, {lval} RFile, {lval} TBufC8<10>, {lval} CMsvMimeHeaders, {lval} CMsvAttachment *, {lval} long)' does not match
4.function call '[CMmsClientMtm].CreateTextAttachmentL({lval} CMsvStore, {lval} long, {lval} const TLitC<44>, {lval} const TLitC<10>, TTrue)' does not match

header files included
-------------------------
#include < e32base.h> // For CActive, link against: euser.lib
#include < e32std.h> // For RTimer, link against: euser.lib
#include < mtclreg.h> // for CClientMtmRegistry
#include < msvuids.h>
#include < mmsclient.h>
#include < mtmdef.h>
#include < mmsconst.h>
#include < MSVIDS.H>
#include < msvstd.h>
#include < bautils.h>
#include < CMsvMimeHeaders.h>
#include < pathinfo.h>
#include "mmsAppUi.h"
#include < msvstore.h>
#include < aknutils.h>
#include < e32cons.h>

library files included
-----------------------
LIBRARY euser.lib
LIBRARY apparc.lib
LIBRARY cone.lib
LIBRARY eikcore.lib
LIBRARY avkon.lib
LIBRARY commonengine.lib
LIBRARY efsrv.lib
LIBRARY estor.lib
LIBRARY aknnotify.lib
LIBRARY hlplch.lib gsmu.lib mmscli.lib msgs.lib mtur.lib platformenv.lib ecom.lib econs.lib imut.lib smcm.lib smss.lib smts.lib imageconversion.lib mmfcontrollerframework.lib mmfstandardcustomcommands.lib

In header file
----------------
CMsvSession* iSession;
CClientMtmRegistry* iReg;
CMmsClientMtm* iMtm;
CMsvSession* iReceiveSession;
CClientMtmRegistry* iReceiveMtmReg;
CBaseMtm* iReceiveMtm;
TBuf<50> state;
CMsvOperation* iOp;

In cpp file
-----------
_LIT(KNumber,"09886010928");
#define KDirPictures PathInfo::ImagesPath()
#define KPhoneRootPath PathInfo::PhoneMemoryRootPath()

_LIT(KFileName, "Snaps.jpg");

In ConstructL()
--------------------
iSession=CMsvSession::OpenAsyncL(*this);

CActiveScheduler::Add( this );

In HandleSessioneventL()
-------------------------
switch(aEvent)
{
case EMsvServerReady:
{
iReg=CClientMtmRegistry::NewL(*iSession);
iMtm=STATIC_CAST(CMmsClientMtm*,iReg->NewMtmL(KUidMsgTypeMultimedia));
}
break;
case EMsvEntriesCreated:
{

}
break;
case EMsvEntriesChanged:
{

}
break;
default:
break;

In message sender
----------------------
iMtm->SwitchCurrentEntryL(KMsvDraftEntryId);
iMtm->CreateMessageL(iMtm->DefaultServiceL());
iMtm->AddAddresseeL(EMsvRecipientCc,KNumber);
_LIT(KSubject,"mms");
iMtm->SetSubjectL(KSubject);
iMtm->SetMessagePriority(EMmsPriorityHigh);
//Save the changes
//iMtm->SaveMessageL();

// Open the entry's store - assume message context set correctly
CMsvStore* store = iMtm->Entry().EditStoreL();
CleanupStack::PushL(store);
// Add the text attachment. _LIT used for demonstration purposes
_LIT(KMMSText, "Thought you'd like to see where I'm staying");
_LIT(KMMSTextFilename, "hello.txt");
TMsvId attachId;
attachId=0;

iMtm->CreateTextAttachmentL(*store, attachId, KMMSText, KMMSTextFilename,ETrue);


TFileName attachmentFile(KPhoneRootPath);
attachmentFile.Append(KDirPictures);
attachmentFile.Append(KFileName);

// Open the attachment file
RFile attachment;

TInt error = attachment.Open(CCoeEnv::Static()->FsSession(), attachmentFile, EFileShareReadersOnly | EFileRead);
//CleanupClosePushL(attachment);

// Check that the attachment file exists.
if(error != KErrNone)
{
_LIT(KFileNotFound, "Attachment file not found!");

attachment.Close();
//CleanupStack::PopAndDestroy(attachment);
CleanupStack::PopAndDestroy(store);
//return EFalse;
}
else
{
// Mime header
CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
CleanupStack::PushL(mimeHeaders);
mimeHeaders->SetSuggestedFilenameL(KFileName);

// Represents a single attachment and information about the attachment
CMsvAttachment* attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
CleanupStack::PushL(attaInfo);

// Mime Type
_LIT8(KMimeType, "image/jpeg");
TBufC8<10> mimeType(KMimeType);

// Attachment file must be in a public folder (e.g. c:\Data\images)
iMtm->CreateAttachment2L(
*store,
attachment,
mimeType,
*mimeHeaders,
attaInfo,
attachId );

CleanupStack::Pop(attaInfo); // attaInfo
CleanupStack::PopAndDestroy(mimeHeaders); // mimeHeaders

// If a SMIL file is attached for presentation layout purposes
// then it should be done here before the
// the changes are committed

// Commit the changes and perform the appropriate cleanup
store->CommitL();
attachment.Close();

//CleanupStack::PopAndDestroy(attachment);
CleanupStack::PopAndDestroy(store);

// Save the changes
iMtm->SaveMessageL();

}
TMsvEntry ent = iMtm->Entry().Entry();
// Set InPreparation to false
ent.SetInPreparation(EFalse);
ent.SetVisible(ETrue); // Mark as visible, so this the message can be seen in Drafts
iMtm->Entry().ChangeL(ent); // Commit changes
//Save the changes
iMtm->SaveMessageL();

iOp = iMtm->SendL(iStatus);

SetActive();

Regards!
Chinmaya Mishra.


Mon, 2007-12-10 10:01
Joined: 2007-11-02
Forum posts: 37
Re: problem in mms

The code compiles by changing the type of attachId from TMsvId to TMsvAttachId .................

For sending the mms, I use->
CMmsClientMtm* iMtm;
CMsvOperation* iOp;
iOp=iMtm->SendL(&iStatus);

Then I have a problem:-
The whole class belongs to active object.

1.Need to implement DoCancel() of active obj.
Inside this, which API to call to cancel outstanding request.

Regards!
Chinmaya Mishra.

  • Login to reply to this topic.