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
Protected Member Functions | |
---|---|
void | DoCancel () |
TInt | RunError ( TInt ) |
void | RunL () |
Private Member Functions | |
---|---|
CMmsCodecClient () | |
void | ConstructL ( CMsvSession &) |
void | DeleteCurrentEntryL () |
void | FinalizeDecodedMML () |
void | GenerateRecipientsL ( TDes &) |
void | GenerateSenderL ( TDes &) |
TBool | ParentOutbox ( TMsvId ) |
void | ReleaseRetrievedEntry () |
void | ResetChunkedMode () |
void | RetrieveFlags ( TMsvEntry , TUint32 &, TBool &) |
void | SetFlagsToTMsvEntry ( TMsvEntry &) |
Private Member Enumerations | |
---|---|
enum |
TState
{
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 |
CMmsCodecClient | ( | ) | [private] |
C++ default constructor. C++ default constructor can NOT contain any code, that might leave.
IMPORT_C void | AddMML | ( | CBufFlat & | aMm, |
TMsvId | aFolder, | |||
TUint32 | aFlags, | |||
TBool | aUnread, | |||
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:
CBufFlat & aMm | the MM in binary format, which will be added to the messaging store |
TMsvId aFolder | the folder in which the MM will be stored |
TUint32 aFlags | the flags of the MM, which go to iMtmData1 |
TBool aUnread | if the MM is unread or not |
TMsvId & aMmId | the index, which was created for the added MM by the caller. |
TRequestStatus & aStatus | request status of the calling active object |
void | ConstructL | ( | CMsvSession & | aMsvSession | ) | [private] |
By default Symbian 2nd phase constructor is private.
CMsvSession & aMsvSession |
IMPORT_C TInt | CreateNewMessageEntryL | ( | TMsvId | aFolder, |
TMsvId & | aCreatedId | |||
) |
IMPORT_C TInt | DeleteMM | ( | TMsvId | aMmId | ) |
Delete a multimedia message.
TMsvId aMmId | The index to the MM, which will be deleted |
IMPORT_C TInt | DiskSpaceBelowCriticalLevelL | ( | TInt | aSize | ) |
TInt aSize |
void | GenerateRecipientsL | ( | TDes & | aDetails | ) | [private] |
TDes & aDetails |
void | GenerateSenderL | ( | TDes & | aDetails | ) | [private] |
TDes & aDetails |
IMPORT_C TInt | GetNextDataPart | ( | 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() .
IMPORT_C void | InitializeChunkedAddingL | ( | TMsvId | aFolder, |
TMsvId & | aMessageId, | |||
TUint32 | aFlags, | |||
TBool | aUnread | |||
) |
Initialize adding a message in chunked mode. An empty invisible message entry is created into the folder specified.
TMsvId aFolder | The folder where the message will be added |
TMsvId & aMessageId | The ID of the message that has been created |
TUint32 aFlags | The flags of the MM to be stored in iMtmData1 |
TBool aUnread | Specifies 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. |
IMPORT_C void | InitializeChunkedReplacingL | ( | TMsvId | aMessageId, |
TUint32 | aFlags, | |||
TBool | aUnread | |||
) |
Initialize replacing a message in chunked mode. The present content of the message entry is deleted. The data is added by calling NextDataPart()
TMsvId aMessageId | The ID of the message that will be replaced |
TUint32 aFlags | The flags of the MM to be stored in iMtmData1 |
TBool aUnread | Specifies 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. |
IMPORT_C void | InitializeChunkedRetrievingL | ( | TMsvId | aMessageId, |
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()
TMsvId aMessageId | Id of the message to be retrieved |
TMsvId & aFolder | The folder where the message is stored |
TUint32 & aFlags | The flags of the message, from the iMtmData1 |
TBool & aUnread | If the message is unread or not |
TInt & aOverallDataSize | The 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 & aStatus | request 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. |
IMPORT_C void | MoveMML | ( | TMsvId | aMmId, |
TMsvId | aParentId, | |||
TRequestStatus & | aStatus | |||
) |
TMsvId aMmId | the id to the moved MM |
TMsvId aParentId | New folder |
TRequestStatus & aStatus |
IMPORT_C CMmsCodecClient * | NewL | ( | CMsvSession & | aMsvSession | ) | [static] |
Two-phased constructor.
CMsvSession & aMsvSession | Message Server Session handle |
IMPORT_C TInt | NextDataPart | ( | TPtrC8 & | aDataPart, |
TBool | aLastDataChunk | |||
) |
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.
IMPORT_C TInt | ReleaseData | ( | ) |
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.
IMPORT_C void | ReplaceMML | ( | TMsvId & | aMmId, |
CBufFlat & | aMm, | |||
TUint32 | aFlags, | |||
TBool | aUnread, | |||
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.
TMsvId & aMmId | the index to the replaceable MM |
CBufFlat & aMm | The new MMS |
TUint32 aFlags | the flags of the MM, which go to iMtmData1 |
TBool aUnread | if the MM is unread or not |
TRequestStatus & aStatus | request status of the calling active object |
void | RetrieveFlags | ( | TMsvEntry | aEntry, |
TUint32 & | aFlags, | |||
TBool & | aUnread | |||
) | [private] |
IMPORT_C void | RetrieveMML | ( | TMsvId | aMmId, |
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.
TMsvId aMmId | Index to the MM, which will be retrieved |
CBufFlat & aMM | |
TMsvId & aFolder | The folder, in which the message is stored. |
TUint32 & aFlags | the flags of the MM, from the iMtmData1 |
TBool & aUnread | if the MM is unread or not |
TRequestStatus & aStatus | request status of the calling active object |
TInt | RunError | ( | TInt | aError | ) | [protected, virtual] |
From CActive .
TInt aError |
IMPORT_C CMsvOperation * | SendMML | ( | TMsvId | aMmId, |
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.
TMsvId aMmId | Index to the MM, which will be sent. |
TRequestStatus & aStatus | request status of the calling active object |
IMPORT_C TInt | SetFlags | ( | TMsvId | aMmId, |
TUint32 | aFlags, | |||
TBool | aUnread | |||
) |
This function sets flags of the MM. Note that it is not allowed to change the flags, if the MM is in outbox.
void | SetFlagsToTMsvEntry | ( | TMsvEntry & | aEntry | ) | [private] |
TMsvEntry & aEntry |
EIdle = 0 | |
EFinalizeDecodedMM | |
EFinalizeEncodedMM | |
ESendMM | |
EEntryCreated | |
EChunkedRetrieve | |
EChunkedAdd | |
EChunkedReplace |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.