CImCaf Class Reference
class CImCaf : public CBase
|
Content Access Framework (CAF) Wrapper class. Provides encapsulation of the CAF functionality required by email MTMs. The in source documentation refers to a CAF session. The following pseudocode clarifies the concept of a CAF session.
BEGIN
WHILE processing email MIME sections
Receive MIME header Content-Type
Pass to CAF with RegisterL(Content-Type)
IF Registered()
Add MIME header metadata to CImCaf class using AddToMetaDataL(metadata)
ENDIF
Detect start of MIME data section
If CAF Registered()
//BEGIN CAF session
PrepareProcessingL()
Create file handle for attachment write
GetSuggestedAttachmentFileName(filename)
StartProcessing(filename,filepath,file handle)
WriteData() // Undecoded 1-N buffers in state machine
Detect end of MIME data section
WriteDataComplete()
EndProcessingL()
//END CAF Session
ELSE
Default behaviour
ENDIF
ENDWHILE
END
Constructor & Destructor Documentation
CImCaf(RFs &)
IMPORT_C
|
CImCaf
|
(
|
RFs
&
|
aFs
|
)
|
|
Construct with callers file session handle. c'tor
~CImCaf()
IMPORT_C
|
~CImCaf
|
(
|
)
|
[virtual]
|
Member Functions Documentation
AddToMetaDataL(const TDesC8 &)
IMPORT_C void
|
AddToMetaDataL
|
(
|
const
TDesC8
&
|
aMimeLine
|
)
|
|
Add Mime header metadata to CAF class in preparation for
PrepareProcessingL()
Parses a complete unfolded mime header line to extract fields and values Format expected: Fieldxxx: Valuexxx;ParamField=ParamValue If line does not contain "X-" or "Content-" then the method returns without adding data to the class.
-
panic
-
imut 36
Parameters
const
TDesC8
& aMimeLine
|
- Mime header data line minus CRLF
|
AddToMetaDataL(const TDesC8 &, const TDesC8 &)
IMPORT_C void
|
AddToMetaDataL
|
(
|
const
TDesC8
&
|
aField,
|
|
const
TDesC8
&
|
aData
|
|
)
|
|
Add Mime header metadata to CAF class in preparation for
PrepareProcessingL()
Metadata comprises a field and data pair. For example: aField - "X-Oma-Drm-Separate-Delivery" aData - "12" If field does not contain "X-" or "Content-" then the method returns without adding them to the class.
-
panic
-
imut 36
Parameters
const
TDesC8
& aField
|
- Mime header field
|
const
TDesC8
& aData
|
- Mime field's corresponding data
|
Deregister()
IMPORT_C void
|
Deregister
|
(
|
)
|
|
Free resources allocated during CAF session
-
Pre-condition
-
RegisterL()
must be called prior to this call.
-
panic
-
imut 36
EndProcessingL()
IMPORT_C void
|
EndProcessingL
|
(
|
)
|
|
Terminate CAF session. Check the attachments under the attachment entry and see if there are any rights receipts. Set the mime type to a unique CAF one if there are.
-
panic
-
imut 36
-
Pre-condition
-
iServerEntry set to the attachment entry which owns the attachment
GetSuggestedAttachmentFileName(TDes &)
IMPORT_C
TInt
|
GetSuggestedAttachmentFileName
|
(
|
TDes
&
|
aFileName
|
)
|
const
|
Parameters
TDes
& aFileName
|
Descriptor for writing CAF agent suggested filename.
|
NewFileL()
void
|
NewFileL
|
(
|
)
|
[private]
|
PrepareProcessingL()
IMPORT_C void
|
PrepareProcessingL
|
(
|
)
|
|
Prepare the CImCAF class for a CAF session.
-
Pre-condition
-
RegisterL()
must be called prior to this call and success checked with a
Registered()
call.
-
panic
-
imut 36
Processing()
IMPORT_C
TBool
|
Processing
|
(
|
)
|
const
|
Retrieve processing status for the CAF session.
RegisterL(const TDesC8 &)
IMPORT_C void
|
RegisterL
|
(
|
const
TDesC8
&
|
aMimeLine
|
)
|
|
Attempt to register a mime content-type with a CAF agent. Success can be checked by a subsequent call to
Registered()
.
-
panic
-
imut 36
Parameters
const
TDesC8
& aMimeLine
|
MIME Content-Type for possible interest by a CAF agent. For example - application/vnd.oma.drm.rights+xml
|
Registered()
IMPORT_C
TBool
|
Registered
|
(
|
)
|
const
|
StartProcessing(const TDesC &, const TDesC &, CMsvServerEntry &, RFile &)
IMPORT_C void
|
StartProcessing
|
(
|
const
TDesC
&
|
aDefaultAttachmentFileName,
|
|
const
TDesC
&
|
aAttachmentFilePath,
|
|
CMsvServerEntry
&
|
aServerEntry,
|
|
RFile
&
|
aStartFile
|
|
)
|
|
Set the CAF class variables required to Start the CAF write session.
-
Pre-condition
-
PrepareProcessingL()
must be called prior to this call
-
aServerEntry aServerEntry is set to the attachment entry id and remains set there for the duration of the CAF session
-
panic
-
imut 36
Parameters
const
TDesC
& aDefaultAttachmentFileName
|
Localised default attachment name.
|
const
TDesC
& aAttachmentFilePath
|
If CAF agent requires extra files, this is the folder/attachment entry path.
|
CMsvServerEntry
& aServerEntry
|
Pointer to the message store attachment entry for the CAF session.
|
RFile
& aStartFile
|
An open File handle for attachment write. Caller can close following this call.
|
WriteData(const TDesC8 &)
Write a buffer of data to the CAF Agent.
-
Pre-condition
-
StartProcessingL() must be called prior to this call
-
Post-condition
-
Generates 0-N receipt files under the current message attachment entry.
-
panic
-
imut 36
Parameters
const
TDesC8
& aData
|
Data to write to the CAF agent.
|
WriteDataCompleteL()
void
|
WriteDataCompleteL
|
(
|
)
|
[private]
|
Member Data Documentation
RFile
iAttachmentFile
RFile
|
iAttachmentFile
|
[private]
|
If open, handle is used for the next attachment file required by CAF. Initialised by
StartProcessing()
TBuf< KMaxPath > iAttachmentFilePath
HBufC8 * iContentType
HBufC8
*
|
iContentType
|
[private]
|
Store for the MIME Content-type
TPtrC
iDefaultAttachmentFileName
TPtrC
|
iDefaultAttachmentFileName
|
[private]
|
RFs & iFsSession
RFs
&
|
iFsSession
|
[private]
|
Reference to instantiators file server session
CImportFile * iImportFile
A CAF class instance. Initialised prior to data write
CMetaDataArray * iMetaData
A CAF class instance. Stores MIME header attribute/value pairs. Appended by AddToMetaData()
CMsvServerEntry * iServerEntry
Points to the Attachment Entry in use for the current CAF session.Initialised by
StartProcessing()
CSupplier * iSupplier
A CAF class instance. Used to register Content-type with CAF
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.