CMTPTypeFile Class Reference

class CMTPTypeFile : public CActive

Defines the MTP file object data type.

Inherits from

Nested Classes and Structures

Public Member Functions
~CMTPTypeFile ()
IMPORT_C MMTPType * CommitChunkL ( TPtr8 &)
IMPORT_C TBool CommitRequired ()
IMPORT_C RFile & File ()
IMPORT_C TInt FirstReadChunk ( TPtrC8 &)
IMPORT_C TInt FirstWriteChunk ( TPtr8 &)
IMPORT_C TInt64 GetByteSent ()
IMPORT_C CMTPTypeFile * NewL ( RFs &, const TDesC &, TFileMode )
IMPORT_C CMTPTypeFile * NewL ( RFs &, const TDesC &, TFileMode , TInt64 , TInt64 )
IMPORT_C CMTPTypeFile * NewLC ( RFs &, const TDesC &, TFileMode )
IMPORT_C CMTPTypeFile * NewLC ( RFs &, const TDesC &, TFileMode , TInt64 , TInt64 )
IMPORT_C TInt NextReadChunk ( TPtrC8 &)
IMPORT_C TInt NextWriteChunk ( TPtr8 &)
IMPORT_C void SetSizeL ( TUint64 )
IMPORT_C TUint64 Size ()
IMPORT_C TUint Type ()
Protected Member Functions
void DoCancel ()
Private Member Functions
CMTPTypeFile ( RFs &)
void ConstructL (const TDesC &, TFileMode )
void ConstructL (const TDesC &, TFileMode , TInt64 , TInt64 )
void CreateDoubleBufferL ( TInt64 )
TInt RunError ( TInt )
void RunL ()
void ToggleRdWrBuffer ()
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
enum TReadWriteSequenceState { EIdle , EInProgress }
Inherited Enumerations
CActive:TPriority
Private Attributes
RBuf8 iBuffer1
TBool iBuffer1AvailForWrite
RBuf8 iBuffer2
TInt64 iByteSent
TPtr8 iCurrentCommitChunk
TInt64 iCurrentFileSetSize
RFile iFile
TBool iFileOpenForRead
TBool iFileRdWrError
CFileWriter * iFileWriter1
CFileWriter * iFileWriter2
RFs & iFs
TInt64 iOffSet
TUint iReadSequenceState
TInt64 iRemainingDataSize
TInt64 iTargetFileSize
TInt64 iTotalReceivedSize
TUint iWriteSequenceState
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CMTPTypeFile(RFs &)

CMTPTypeFile ( RFs & aFs ) [private]

Parameters

RFs & aFs

~CMTPTypeFile()

IMPORT_C ~CMTPTypeFile ( )

Destructor

Member Functions Documentation

CommitChunkL(TPtr8 &)

IMPORT_C MMTPType * CommitChunkL ( TPtr8 & aChunk )

Parameters

TPtr8 & aChunk

CommitRequired()

IMPORT_C TBool CommitRequired ( ) const

ConstructL(const TDesC &, TFileMode)

void ConstructL ( const TDesC & aName,
TFileMode aMode
) [private]

Parameters

const TDesC & aName
TFileMode aMode

ConstructL(const TDesC &, TFileMode, TInt64, TInt64)

void ConstructL ( const TDesC & aName,
TFileMode aMode,
TInt64 aRequiredSize,
TInt64 aOffSet
) [private]

Parameters

const TDesC & aName
TFileMode aMode
TInt64 aRequiredSize
TInt64 aOffSet

CreateDoubleBufferL(TInt64)

void CreateDoubleBufferL ( TInt64 aFileSize ) [private]

Allocate double buffers to write to/read from file

Parameters

TInt64 aFileSize

DoCancel()

void DoCancel ( ) [protected, virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel() .

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel() .

CActive::Cancel

File()

IMPORT_C RFile & File ( )

Provides a reference to the native file object encapsulate by the MTP file object data type.

FirstReadChunk(TPtrC8 &)

IMPORT_C TInt FirstReadChunk ( TPtrC8 & aChunk ) const

Parameters

TPtrC8 & aChunk

FirstWriteChunk(TPtr8 &)

IMPORT_C TInt FirstWriteChunk ( TPtr8 & aChunk )

Parameters

TPtr8 & aChunk

GetByteSent()

IMPORT_C TInt64 GetByteSent ( )

NewL(RFs &, const TDesC &, TFileMode)

IMPORT_C CMTPTypeFile * NewL ( RFs & aFs,
const TDesC & aFileName,
TFileMode aFileMode
) [static]
MTP file object data type factory method. TFileMode ).
leave
One of the system wide error codes, if a processing failure occurs.
TFileMode

Parameters

RFs & aFs The handle of an active file server session.
const TDesC & aFileName The name of the file. Any path components (i.e. drive letter or directory), which are not specified, are taken from the session path.
TFileMode aFileMode The mode in which the file is opened (

NewL(RFs &, const TDesC &, TFileMode, TInt64, TInt64)

IMPORT_C CMTPTypeFile * NewL ( RFs & aFs,
const TDesC & aFileName,
TFileMode aFileMode,
TInt64 aRequiredSize,
TInt64 aOffSet = 0
) [static]

Parameters

RFs & aFs
const TDesC & aFileName
TFileMode aFileMode
TInt64 aRequiredSize
TInt64 aOffSet = 0

NewLC(RFs &, const TDesC &, TFileMode)

IMPORT_C CMTPTypeFile * NewLC ( RFs & aFs,
const TDesC & aFileName,
TFileMode aFileMode
) [static]
MTP file object data type factory method. A pointer to the MTP file object data type is placed on the cleanup stack. TFileMode ).
leave
One of the system wide error codes, if a processing failure occurs.
TFileMode

Parameters

RFs & aFs The handle of an active file server session.
const TDesC & aFileName The name of the file. Any path components (i.e. drive letter or directory), which are not specified, are taken from the session path.
TFileMode aFileMode The mode in which the file is opened (

NewLC(RFs &, const TDesC &, TFileMode, TInt64, TInt64)

IMPORT_C CMTPTypeFile * NewLC ( RFs & aFs,
const TDesC & aFileName,
TFileMode aFileMode,
TInt64 aRequiredSize,
TInt64 aOffSet = 0
) [static]

Parameters

RFs & aFs
const TDesC & aFileName
TFileMode aFileMode
TInt64 aRequiredSize
TInt64 aOffSet = 0

NextReadChunk(TPtrC8 &)

IMPORT_C TInt NextReadChunk ( TPtrC8 & aChunk ) const

Parameters

TPtrC8 & aChunk

NextWriteChunk(TPtr8 &)

IMPORT_C TInt NextWriteChunk ( TPtr8 & aChunk )

Parameters

TPtr8 & aChunk

RunError(TInt)

TInt RunError ( TInt aError ) [private, virtual]

Parameters

TInt aError

RunL()

void RunL ( ) [private, virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD

SetSizeL(TUint64)

IMPORT_C void SetSizeL ( TUint64 aSize )
Sets the size of the file, this function must be called in case of file writting/receiving. related resouce will be allocated in this function to prepare to receive the incoming data.
leave
One of the system wide error codes, if a processing failure occurs.

Parameters

TUint64 aSize The new size of the file (in bytes).

Size()

IMPORT_C TUint64 Size ( ) const

ToggleRdWrBuffer()

void ToggleRdWrBuffer ( ) [private]

Type()

IMPORT_C TUint Type ( ) const

Member Enumerations Documentation

Enum TReadWriteSequenceState

The read and write data stream states.

Enumerators

EIdle

Data stream is inactive.

EInProgress

Data stream is in progress.

Member Data Documentation

RBuf8 iBuffer1

RBuf8 iBuffer1 [private]

The intermediate data buffer. Note that this is declared mutable to allow state updates while processing a read data stream.

TBool iBuffer1AvailForWrite

TBool iBuffer1AvailForWrite [private]

The flag indicate if this buffer is avaiable for writting data into, if true, it is ready for USB-SIC to write file data into it, if false, it already contains file data, and is waiting for writting the file data into file system. The two buffer must be used in strict sequence, if both buffer is available, the buffer1 must be firstly used by USB driver.

RBuf8 iBuffer2

RBuf8 iBuffer2 [private]

The intermediate data buffer. Note that this is declared mutable to allow state updates while processing a read data stream. Used for double-buffering, the 2 buffers(buffer1 and buffer2) will be switched between reading data from USB to buffer and writting data from Buffer into File System.

TInt64 iByteSent

TInt64 iByteSent [private]

TPtr8 iCurrentCommitChunk

TPtr8 iCurrentCommitChunk [private]

TInt64 iCurrentFileSetSize

TInt64 iCurrentFileSetSize [private]

RFile iFile

RFile iFile [private]

The data file. Note that this is declared mutable to allow state updates while processing a read data stream.

TBool iFileOpenForRead

TBool iFileOpenForRead [private]

TBool iFileRdWrError

TBool iFileRdWrError [private]

CFileWriter * iFileWriter1

CFileWriter * iFileWriter1 [private]

CFileWriter * iFileWriter2

CFileWriter * iFileWriter2 [private]

RFs & iFs

RFs & iFs [private]

TInt64 iOffSet

TInt64 iOffSet [private]

TUint iReadSequenceState

TUint iReadSequenceState [private]

The read data stream state variable. Note that this is declared mutable to allow state updates while processing a read data stream.

TInt64 iRemainingDataSize

TInt64 iRemainingDataSize [private]

TInt64 iTargetFileSize

TInt64 iTargetFileSize [private]

TInt64 iTotalReceivedSize

TInt64 iTotalReceivedSize [private]

TUint iWriteSequenceState

TUint iWriteSequenceState [private]

The write data stream state variable.