CMmsCodecClient Class Reference

class CMmsCodecClient : public CActive

This is a class declaration of CMmsCodecClient. It is a part of MMS Engine and it used for adding, fetching and sending multimedia messages from and into the message store in binary format. Also move, replace and some flag modifications provided.

The exported functions may be called in any order EXCEPT CreateNewMessageEntryL() MUST be called BEFORE AddMML(). If this rule is violated the operation may not be continued. The chunked transfer also must be done in order as described below. One message must be complete before another one is transferred.

Chunked transfer added to version 3.2. To support synchronizing large messages without the need of large linear buffer, chunked mode of data transfer has been added to the API

Chunked transfer from phone to PC:

1) Initialize retrieve (InitializeChunkedRetrievingL) 2) get a data chunk (GetNextDataPart) 3) release data chunk (ReleaseData) repeat steps 2 and 3 until all data has been processed

Chunked transfer from PC to phone: The same procedure can be used both for creating new entries or replacing existing entries.

1) Create an entry or specify an entry to be replaced (InitializeChunkedAddingL or InitializeChunkedReplacingL) 2) Give next data chunk until last one has been reached (NextDataPart)

If a chunked transfer to either direction is not totally completed before a new operation starts, the new operation will reset the state of the previous operation and delete possible incomplete entry. The next operation will proceed normally.

Setting the flags: Some information is not transferred inside the binary data in message headers. That's why some data is transferred in flags. The flag info is moved to the codec client in AddMML, ReplaceMML and SetFlags functions. To the caller the info is transferred in RetrieveMML function. The unread flag is starightforward, it is just a boolean which tells if the message has been read or not. The other flags (TUint32) is just like TMsvEntry.iMtmData1 (See mmsconst.h). but only the following bits are used, others are zero: EMmsDrmCorruptedAttachment , if the corrupted DRM attachments has been removed KMmsMessageMobileTerminated , modbile terminated message KMmsMessageEditorOriented , mobile originated message The last two must be set exclusive e.g the may not be set at the same time

Folders: User of this class may only access messages in the standard folders: KMsvGlobalInBoxIndexEntryId = 0x1002 KMsvGlobalOutBoxIndexEntryId=0x1003 KMsvDraftEntryId= 0x1004 KMsvSentEntryId=0x1005

mmscodecclient.lib

Inherits from

Public Member Functions
~CMmsCodecClient()
IMPORT_C voidAddMML(CBufFlat &, TMsvId, TUint32, TBool, TMsvId &, TRequestStatus &)
IMPORT_C TIntCreateNewMessageEntryL(TMsvId, TMsvId &)
IMPORT_C TIntDeleteMM(TMsvId)
IMPORT_C TIntDiskSpaceBelowCriticalLevelL(TInt)
IMPORT_C TIntGetNextDataPart(TPtrC8 &, TBool &)
IMPORT_C voidInitializeChunkedAddingL(TMsvId, TMsvId &, TUint32, TBool)
IMPORT_C voidInitializeChunkedReplacingL(TMsvId, TUint32, TBool)
IMPORT_C voidInitializeChunkedRetrievingL(TMsvId, TMsvId &, TUint32 &, TBool &, TInt &, TRequestStatus &)
IMPORT_C voidMoveMML(TMsvId, TMsvId, TRequestStatus &)
IMPORT_C CMmsCodecClient *NewL(CMsvSession &)
IMPORT_C TIntNextDataPart(TPtrC8 &, TBool)
IMPORT_C TIntReleaseData()
IMPORT_C voidReplaceMML(TMsvId &, CBufFlat &, TUint32, TBool, TRequestStatus &)
IMPORT_C voidRetrieveMML(TMsvId, CBufFlat &, TMsvId &, TUint32 &, TBool &, TRequestStatus &)
IMPORT_C CMsvOperation *SendMML(TMsvId, TRequestStatus &)
IMPORT_C TIntSetFlags(TMsvId, TUint32, TBool)
Protected Member Functions
voidDoCancel()
TInt RunError(TInt)
voidRunL()
Private Member Functions
CMmsCodecClient()
voidConstructL(CMsvSession &)
voidDeleteCurrentEntryL()
voidFinalizeDecodedMML()
voidGenerateRecipientsL(TDes &)
voidGenerateSenderL(TDes &)
TBool ParentOutbox(TMsvId)
voidReleaseRetrievedEntry()
voidResetChunkedMode()
voidRetrieveFlags(TMsvEntry, TUint32 &, TBool &)
voidSetFlagsToTMsvEntry(TMsvEntry &)
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enumTState {
EIdle = 0, EFinalizeDecodedMM, EFinalizeEncodedMM, ESendMM, EEntryCreated, EChunkedRetrieve, EChunkedAdd, EChunkedReplace
}
Inherited Enumerations
CActive:TPriority
Private Attributes
CMsvEntry *iClientEntry
CMmsClientEntry *iClientEntryWrapper
CClientMtmRegistry *iClientMtmRegistry
TRequestStatus *iClientStatus
CMmsDecode *iDecoder
CBufFlat *iEncodeBuffer
CMmsEncode *iEncoder
TMsvId iEntryBeingHandled
TUint32 iFlags
TMsvId iFolder
RFs iFs
TBool iLastChunk
CMmsClientMtm *iMmsClient
CMmsHeaders *iMmsHeaders
TInt16 iMmsVersion
CMsvSession *iMsvSession
TInt iPosition
TState iState
TBool iUnread
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CMmsCodecClient()

CMmsCodecClient()[private]

C++ default constructor. C++ default constructor can NOT contain any code, that might leave.

~CMmsCodecClient()

~CMmsCodecClient()[virtual]

Destructor.

Member Functions Documentation

AddMML(CBufFlat &, TMsvId, TUint32, TBool, TMsvId &, TRequestStatus &)

IMPORT_C voidAddMML(CBufFlat &aMm,
TMsvIdaFolder,
TUint32aFlags,
TBoolaUnread,
TMsvId &aMmId,
TRequestStatus &aStatus
)

Add a multimedia message. The given multimedia message is stored to the target folder. The flags are set correctly. CreateNewMessageEntryL must be called before this function.

Return values:

Parameters

CBufFlat & aMmthe MM in binary format, which will be added to the messaging store
TMsvId aFolderthe folder in which the MM will be stored
TUint32 aFlagsthe flags of the MM, which go to iMtmData1
TBool aUnreadif the MM is unread or not
TMsvId & aMmIdthe index, which was created for the added MM by the caller.
TRequestStatus & aStatusrequest status of the calling active object

ConstructL(CMsvSession &)

voidConstructL(CMsvSession &aMsvSession)[private]

By default Symbian 2nd phase constructor is private.

Parameters

CMsvSession & aMsvSession

CreateNewMessageEntryL(TMsvId, TMsvId &)

IMPORT_C TIntCreateNewMessageEntryL(TMsvIdaFolder,
TMsvId &aCreatedId
)

Parameters

TMsvId aFolder
TMsvId & aCreatedId

DeleteCurrentEntryL()

voidDeleteCurrentEntryL()[private]

DeleteMM(TMsvId)

IMPORT_C TIntDeleteMM(TMsvIdaMmId)

Delete a multimedia message.

Parameters

TMsvId aMmIdThe index to the MM, which will be deleted

DiskSpaceBelowCriticalLevelL(TInt)

IMPORT_C TIntDiskSpaceBelowCriticalLevelL(TIntaSize)
Check if disk space is below critical level when storing data. This is a wrapper function.
Since
3.0

Parameters

TInt aSize

DoCancel()

voidDoCancel()[protected, virtual]

From CActive

FinalizeDecodedMML()

voidFinalizeDecodedMML()[private]

GenerateRecipientsL(TDes &)

voidGenerateRecipientsL(TDes &aDetails)[private]

Parameters

TDes & aDetails

GenerateSenderL(TDes &)

voidGenerateSenderL(TDes &aDetails)[private]

Parameters

TDes & aDetails

GetNextDataPart(TPtrC8 &, TBool &)

IMPORT_C TIntGetNextDataPart(TPtrC8 &aDataPart,
TBool &aLastDataChunk
)

Obtain a data part from the supplier. The data is guaranteed to survive until a call is made to ReleaseData(). If the component that is receiving the data cannot receive all data in one chunk, data can be given forward in smaller chunks. The data will will remain in the internal buffer of CodecClient until it has been released by calling ReleaseData().

Since
S60 v3.1

Parameters

TPtrC8 & aDataPartPointer to the data that has been encoded into internal buffer The length of the pointer is set to reflect the amount of data.
TBool & aLastDataChunkETrue if this is the last data chunk EFalse if this is not the last data chunk

InitializeChunkedAddingL(TMsvId, TMsvId &, TUint32, TBool)

IMPORT_C voidInitializeChunkedAddingL(TMsvIdaFolder,
TMsvId &aMessageId,
TUint32aFlags,
TBoolaUnread
)

Initialize adding a message in chunked mode. An empty invisible message entry is created into the folder specified.

Since
S60 v3.1

Parameters

TMsvId aFolderThe folder where the message will be added
TMsvId & aMessageIdThe ID of the message that has been created
TUint32 aFlagsThe flags of the MM to be stored in iMtmData1
TBool aUnreadSpecifies if the message is unread or not Leaves with KErrArgument if aFolder is invalid or if called in the middle of some other operation Leaves with some system wide error code if something goes wrong.

InitializeChunkedReplacingL(TMsvId, TUint32, TBool)

IMPORT_C voidInitializeChunkedReplacingL(TMsvIdaMessageId,
TUint32aFlags,
TBoolaUnread
)

Initialize replacing a message in chunked mode. The present content of the message entry is deleted. The data is added by calling NextDataPart()

Since
S60 v3.1

Parameters

TMsvId aMessageIdThe ID of the message that will be replaced
TUint32 aFlagsThe flags of the MM to be stored in iMtmData1
TBool aUnreadSpecifies if the message is unread or not Leaves with KErrArgument if aFolder is invalid or if called in the middle of some other operation. Leaves with some system wide error code if something goes wrong.

InitializeChunkedRetrievingL(TMsvId, TMsvId &, TUint32 &, TBool &, TInt &, TRequestStatus &)

IMPORT_C voidInitializeChunkedRetrievingL(TMsvIdaMessageId,
TMsvId &aFolder,
TUint32 &aFlags,
TBool &aUnread,
TInt &aOverallDataSize,
TRequestStatus &aStatus
)

Initialize retrieving a message in chunked mode. Data will be obtained by repeatedly calling GetNextDataPart() and ReleaseData(). Function encodes the first data part into its internal buffer ready to be fetched by calling GetNextDataPart()

Since
S60 v3.1

Parameters

TMsvId aMessageIdId of the message to be retrieved
TMsvId & aFolderThe folder where the message is stored
TUint32 & aFlagsThe flags of the message, from the iMtmData1
TBool & aUnreadIf the message is unread or not
TInt & aOverallDataSizeThe total size of the encoded data if the size can be determined. -1 means the size could not be determined, and the return value of GetNextDataPart() function should be used to determine when the last data part has been reached. The buffer will be smaller than the total data size except in the case of small messages that may fit in the buffer in one chunk.
TRequestStatus & aStatusrequest status of the calling active object Leaves with some system wide error code or completes with error if something goes wrong. If the function leaves, the caller must not set itself active as it was not set pending and will not be completed.

MoveMML(TMsvId, TMsvId, TRequestStatus &)

IMPORT_C voidMoveMML(TMsvIdaMmId,
TMsvIdaParentId,
TRequestStatus &aStatus
)
A multimedia message is moved from a standard folder to another. Moving to outbox is not allowed.
Since
3.0

Parameters

TMsvId aMmIdthe id to the moved MM
TMsvId aParentIdNew folder
TRequestStatus & aStatus

NewL(CMsvSession &)

IMPORT_C CMmsCodecClient *NewL(CMsvSession &aMsvSession)[static]

Two-phased constructor.

Parameters

CMsvSession & aMsvSessionMessage Server Session handle

NextDataPart(TPtrC8 &, TBool)

IMPORT_C TIntNextDataPart(TPtrC8 &aDataPart,
TBoolaLastDataChunk
)

Gives the next data part to be decoded. Decoding is synchronous. When the code returns, data can be released. MMS Decode may not be able to handle incomplete headers. MMS Codec Client will take care of buffering the incoming data and saving possible uncoded data in a flat buffer the same way CMmsTransaction does. The data should be provided in chunks that are small enough to be copied to an internal buffer without fear of running out of memory. HTTP stack provides data in chunks that are less than 10 kB. A similar size would be recommended but there is no absolute requirement as to the size of the data chunk. A compromise between performance and memory consumption may be used to determine an appropriate buffer size.

Since
S60 v3.1

Parameters

TPtrC8 & aDataPartthe data to be decoded.
TBool aLastDataChunk

ParentOutbox(TMsvId)

TBool ParentOutbox(TMsvIdaMmId)[private]

Parameters

TMsvId aMmId

ReleaseData()

IMPORT_C TIntReleaseData()

Release the current data part being held at the data supplier. This call indicates to the supplier that the part is no longer needed, and another one can be provided. When this funtion is called, the next data part will be encoded into the buffer. When this function returns, a new data part can be fetched with GetNextDataPart. This function must always be called after the data obtained by GetNextDataPart() call has been processed. This function must also be called after last data chunk has been processed so that the state of the data supplier can be reset.

Since
S60 v3.1

ReleaseRetrievedEntry()

voidReleaseRetrievedEntry()[private]

ReplaceMML(TMsvId &, CBufFlat &, TUint32, TBool, TRequestStatus &)

IMPORT_C voidReplaceMML(TMsvId &aMmId,
CBufFlat &aMm,
TUint32aFlags,
TBoolaUnread,
TRequestStatus &aStatus
)

A multimedia message is replaced. First the attachments of the original message is destroyed. Then the new message is stored to the same entry. Flags are set as defined. If the message is in the Outbox, it is not allowed to be replaced.

Parameters

TMsvId & aMmIdthe index to the replaceable MM
CBufFlat & aMmThe new MMS
TUint32 aFlagsthe flags of the MM, which go to iMtmData1
TBool aUnreadif the MM is unread or not
TRequestStatus & aStatusrequest status of the calling active object

ResetChunkedMode()

voidResetChunkedMode()[private]

RetrieveFlags(TMsvEntry, TUint32 &, TBool &)

voidRetrieveFlags(TMsvEntryaEntry,
TUint32 &aFlags,
TBool &aUnread
)[private]

Parameters

TMsvEntry aEntry
TUint32 & aFlags
TBool & aUnread

RetrieveMML(TMsvId, CBufFlat &, TMsvId &, TUint32 &, TBool &, TRequestStatus &)

IMPORT_C voidRetrieveMML(TMsvIdaMmId,
CBufFlat &aMM,
TMsvId &aFolder,
TUint32 &aFlags,
TBool &aUnread,
TRequestStatus &aStatus
)

Retrieves a multimedia message. This function provides an MM in the binary format, the folder where the MM is stored and its flags.

Parameters

TMsvId aMmIdIndex to the MM, which will be retrieved
CBufFlat & aMM
TMsvId & aFolderThe folder, in which the message is stored.
TUint32 & aFlagsthe flags of the MM, from the iMtmData1
TBool & aUnreadif the MM is unread or not
TRequestStatus & aStatusrequest status of the calling active object

RunError(TInt)

TInt RunError(TIntaError)[protected, virtual]

From CActive.

Parameters

TInt aError

RunL()

voidRunL()[protected, virtual]

From CActive.

SendMML(TMsvId, TRequestStatus &)

IMPORT_C CMsvOperation *SendMML(TMsvIdaMmId,
TRequestStatus &aStatus
)

Sends the specified MM.The message is moved to the Outbox before sending. The caller of the method should not delete CMsvOperation, which is returned from the function until aStatus has completed. If CMsvOperation is destroyed too early, the sending is canceled.

Parameters

TMsvId aMmIdIndex to the MM, which will be sent.
TRequestStatus & aStatusrequest status of the calling active object

SetFlags(TMsvId, TUint32, TBool)

IMPORT_C TIntSetFlags(TMsvIdaMmId,
TUint32aFlags,
TBoolaUnread
)

This function sets flags of the MM. Note that it is not allowed to change the flags, if the MM is in outbox.

Parameters

TMsvId aMmIdIndex to the MM
TUint32 aFlagsthe flags of the MM, which go to iMtmData1
TBool aUnreadif the MM is unread or not

SetFlagsToTMsvEntry(TMsvEntry &)

voidSetFlagsToTMsvEntry(TMsvEntry &aEntry)[private]

Parameters

TMsvEntry & aEntry

Member Enumerations Documentation

Enum TState

Enumerators

EIdle = 0
EFinalizeDecodedMM
EFinalizeEncodedMM
ESendMM
EEntryCreated
EChunkedRetrieve
EChunkedAdd
EChunkedReplace

Member Data Documentation

CMsvEntry * iClientEntry

CMsvEntry *iClientEntry[private]

CMmsClientEntry * iClientEntryWrapper

CMmsClientEntry *iClientEntryWrapper[private]

CClientMtmRegistry * iClientMtmRegistry

CClientMtmRegistry *iClientMtmRegistry[private]

TRequestStatus * iClientStatus

TRequestStatus *iClientStatus[private]

CMmsDecode * iDecoder

CMmsDecode *iDecoder[private]

CBufFlat * iEncodeBuffer

CBufFlat *iEncodeBuffer[private]

CMmsEncode * iEncoder

CMmsEncode *iEncoder[private]

TMsvId iEntryBeingHandled

TMsvId iEntryBeingHandled[private]

TUint32 iFlags

TUint32 iFlags[private]

TMsvId iFolder

TMsvId iFolder[private]

RFs iFs

RFs iFs[private]

TBool iLastChunk

TBool iLastChunk[private]

CMmsClientMtm * iMmsClient

CMmsClientMtm *iMmsClient[private]

CMmsHeaders * iMmsHeaders

CMmsHeaders *iMmsHeaders[private]

TInt16 iMmsVersion

TInt16 iMmsVersion[private]

CMsvSession * iMsvSession

CMsvSession *iMsvSession[private]

TInt iPosition

TInt iPosition[private]

TState iState

TState iState[private]

TBool iUnread

TBool iUnread[private]