CMTPConnection Class Reference

class CMTPConnection : public CBase

Implements the connection level portion of the MTP communication model and associated transport layer protocol binding. This class Implements the API portion (MMTPConnectionProtocol) of the transport layer API/SPI interface pair by which MTP framework and transport protocol connections (MMTPTransportConnection) interact. A unique CMTPConnection instance is created and bound to each MMTPTransportConnection instance that is loaded.It also implements the data provider layer MTP connection interface (MMTPConnection) which represents the virtual circuit between data provider and the transport layer.

Inherits from

Nested Classes and Structures

Public Member Functions
~CMTPConnection()
TUint ConnectionId()
voidConnectionResumedL(MMTPTransportConnection &)
TBool ConnectionSuspended()
voidDisconnectionNotifyL()
IMPORT_C TIntGetDataReceiveResult()
CMTPConnection *NewLC(TUint, MMTPTransportConnection &)
voidReceiveDataL(MMTPType &, const TMTPTypeRequest &, TRequestStatus &)
voidSendDataL(const MMTPType &, const TMTPTypeRequest &, TRequestStatus &)
voidSendEventL(const TMTPTypeEvent &)
voidSendResponseL(const TMTPTypeResponse &, const TMTPTypeRequest &, TRequestStatus &)
IMPORT_C voidSessionClosedL(TUint32)
TUint SessionCount()
IMPORT_C voidSessionOpenedL(TUint32)
TBool SessionWithMTPIdExists(TUint32)
MMTPSession &SessionWithMTPIdL(TUint32)
TBool SessionWithUniqueIdExists(TUint32)
MMTPSession &SessionWithUniqueIdL(TUint32)
voidTransactionCompleteL(const TMTPTypeRequest &)
TMTPTransactionPhase TransactionPhaseL(TUint32)
Private Member Functions
CMTPConnection(TUint, MMTPTransportConnection &)
TUint ActiveSessions()
voidCloseAllSessions()
voidCloseSession(TUint)
voidCompleteCloseConnection()
voidConstructL()
voidDefineConnStatePropertyL()
voidDequeueEvent(CMTPEventLink *)
voidEnqueueEvent(CMTPEventLink *)
voidInitiateMTPErrorRecoveryL(const TMTPTypeRequest &, TUint16)
voidInitiateTransactionCancelL(TInt)
voidMTPErrorRecoveryComplete()
voidPublishConnState(TMTPConnStateType)
voidReceiveDataCompleteL(TInt, const MMTPType &, const TMTPTypeRequest &)
voidReceivedEventL(const TMTPTypeEvent &)
voidReceivedRequestL(const TMTPTypeRequest &)
voidRemoveEventsForSession(TUint32)
voidSendDataCompleteL(TInt, const MMTPType &, const TMTPTypeRequest &)
voidSendEventCompleteL(TInt, const TMTPTypeEvent &)
voidSendResponseCompleteL(TInt, const TMTPTypeResponse &, const TMTPTypeRequest &)
CMTPSession &SessionL(const TMTPTypeFlatBase &, TInt)
TInt SessionOrder(const TUint32 *, const CMTPSession &)
TInt SessionOrder(const CMTPSession &, const CMTPSession &)
voidSetState(TUint)
TUint State()
voidUnbind(MMTPTransportConnection &)
voidUnrecoverableMTPError()
TBool ValidFrameworkRequest(CMTPSession *, TUint, TRequestStatus *)
voidValidateAndPublishConnState(CMTPSession &, TInt)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
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
enumTStates { EStateUnknown, EStateOpen, EStateErrorRecovery, EStateErrorShutdown, EStateShutdown }
Private Attributes
__FLOG_DECLARATION_MEMBER_MUTABLE
TUint iConnectionId
TInt iDataReceiveResult
TSglQue< CMTPEventLink >iEventQ
TAny *iExtendedInterface
TInt iPendingEventCount
RProperty iProperty
TMTPTypeResponse iResponse
RPointerArray< CMTPSession >iSessions
RMTPFramework iSingletons
TUint iState
MMTPTransportConnection *iTransportConnection

Constructor & Destructor Documentation

CMTPConnection(TUint, MMTPTransportConnection &)

CMTPConnection(TUintaConnectionId,
MMTPTransportConnection &aTransportConnection
)[private]

Constructor.

Parameters

TUint aConnectionId
MMTPTransportConnection & aTransportConnection

~CMTPConnection()

~CMTPConnection()

Destructor.

Member Functions Documentation

ActiveSessions()

TUint ActiveSessions()const [private]

Provides a count of the number of sessions with transactions in-progress.

CloseAllSessions()

voidCloseAllSessions()[private]

Closes all sessions which have been opened on the connection.

CloseSession(TUint)

voidCloseSession(TUintaIdx)[private]

Closes the sessions with the specified session index.

Parameters

TUint aIdxThe session index.

CompleteCloseConnection()

voidCompleteCloseConnection()[private]

ConnectionId()

TUint ConnectionId()const

ConnectionResumedL(MMTPTransportConnection &)

voidConnectionResumedL(MMTPTransportConnection &aTransportConnection)

Parameters

MMTPTransportConnection & aTransportConnection

ConnectionSuspended()

TBool ConnectionSuspended()

ConstructL()

voidConstructL()[private]
Second phase constructor.
leave
One of the system wide error code, if a processing failure occurs.

DefineConnStatePropertyL()

voidDefineConnStatePropertyL()[private]

This method define and attach the property for publishing connection state events.

DequeueEvent(CMTPEventLink *)

voidDequeueEvent(CMTPEventLink *aLink)[private]

Parameters

CMTPEventLink * aLink

DisconnectionNotifyL()

voidDisconnectionNotifyL()

EnqueueEvent(CMTPEventLink *)

voidEnqueueEvent(CMTPEventLink *aLink)[private]

Parameters

CMTPEventLink * aLink

GetDataReceiveResult()

IMPORT_C TIntGetDataReceiveResult()const

Get the data receive result.

InitiateMTPErrorRecoveryL(const TMTPTypeRequest &, TUint16)

voidInitiateMTPErrorRecoveryL(const TMTPTypeRequest &aRequest,
TUint16aResponseCode
)[private]
Initiates an MTP connection level protocol error recovery sequence. This sequence is invoked when a recoverable protocol error is detected that cannot be processed above the connection layer, e.g. when a request is made on a non-existant SessionID, or an out-of-sequence TransactionID is detected. An appropriate MTP response dataset is formed and sent to the MTP initiator. The error recovery sequence is concluded by MTPErrorRecoveryComplete when the connection transport layer signals SendResponseComplete to the MTP connection protocol layer.
leave
One of the system wide error codes, if a processing failure occurs.
MTPErrorRecoveryComplete

Parameters

const TMTPTypeRequest & aRequestThe MTP request dataset of the erroneous MTP transaction.
TUint16 aResponseCodeThe MTP response datacode to be returned to the MTP initiator.

InitiateTransactionCancelL(TInt)

voidInitiateTransactionCancelL(TIntaSessionIdx)[private]
Signals the MTP connection transport to terminate any in-progress data phase processing on the specified session.
leave
One of the system wide error codes, if a processing failure occurs.

Parameters

TInt aSessionIdx

MTPErrorRecoveryComplete()

voidMTPErrorRecoveryComplete()[private]

Concludes an MTP connection level protocol error recovery sequence. InitiateMTPErrorRecoveryL

NewLC(TUint, MMTPTransportConnection &)

CMTPConnection *NewLC(TUintaConnectionId,
MMTPTransportConnection &aTransportConnection
)[static]
CMTPConnection factory method. A pointer to the new CMTPConnection instance is placed on the cleanup stack.
leave
One of the system wide error codes if a processing failure occurs.

Parameters

TUint aConnectionIdThe unique identifier assigned to this connection by the MTP framework.
MMTPTransportConnection & aTransportConnectionThe MTP transport layer connection interface to which the CMTPConnection will bind.

PublishConnState(TMTPConnStateType)

voidPublishConnState(TMTPConnStateTypeaConnState)[private]

This method is to publish various connection state.

Parameters

TMTPConnStateType aConnState

ReceiveDataCompleteL(TInt, const MMTPType &, const TMTPTypeRequest &)

voidReceiveDataCompleteL(TIntaErr,
const MMTPType &aData,
const TMTPTypeRequest &aRequest
)[private]

Parameters

TInt aErr
const MMTPType & aData
const TMTPTypeRequest & aRequest

ReceiveDataL(MMTPType &, const TMTPTypeRequest &, TRequestStatus &)

voidReceiveDataL(MMTPType &aData,
const TMTPTypeRequest &aRequest,
TRequestStatus &aStatus
)
Initiates MTP transaction data phase processing for initiator-to-responder data flows. This method should only be invoked when the MTP transaction phase state is ERequestPhase. This is an asynchronous method.
leave
KErrNotFound If the MTP request dataset specifies an invalid SessionID.
panic
CMTPConnection 0 If an asynchronous request is already pending on the connection.
panic
CMTPConnection 2 If the MTP transaction phase is invalid.

Parameters

MMTPType & aDataThe MTP data object sink.
const TMTPTypeRequest & aRequestThe MTP request dataset of the active MTP transaction.
TRequestStatus & aStatusThe status used to return asynchronous completion information regarding the request.

ReceivedEventL(const TMTPTypeEvent &)

voidReceivedEventL(const TMTPTypeEvent &aEvent)[private]

Parameters

const TMTPTypeEvent & aEvent

ReceivedRequestL(const TMTPTypeRequest &)

voidReceivedRequestL(const TMTPTypeRequest &aRequest)[private]

Parameters

const TMTPTypeRequest & aRequest

RemoveEventsForSession(TUint32)

voidRemoveEventsForSession(TUint32aMTPId)[private]

Parameters

TUint32 aMTPId

SendDataCompleteL(TInt, const MMTPType &, const TMTPTypeRequest &)

voidSendDataCompleteL(TIntaErr,
const MMTPType &aData,
const TMTPTypeRequest &aRequest
)[private]

Parameters

TInt aErr
const MMTPType & aData
const TMTPTypeRequest & aRequest

SendDataL(const MMTPType &, const TMTPTypeRequest &, TRequestStatus &)

voidSendDataL(const MMTPType &aData,
const TMTPTypeRequest &aRequest,
TRequestStatus &aStatus
)
Initiates MTP transaction data phase processing for responder-to-initiator data flows. This method should only be invoked when the MTP transaction phase state is ERequestPhase. This is an asynchronous method.
leave
KErrNotFound If the MTP request dataset specifies an invalid SessionID.
panic
CMTPConnection 0 If an asynchronous request is already pending on the connection.
panic
CMTPConnection 2 If the MTP transaction phase is invalid.

Parameters

const MMTPType & aDataThe MTP data object source.
const TMTPTypeRequest & aRequestThe MTP request dataset of the active MTP transaction.
TRequestStatus & aStatusThe status used to return asynchronous completion information regarding the request.

SendEventCompleteL(TInt, const TMTPTypeEvent &)

voidSendEventCompleteL(TIntaErr,
const TMTPTypeEvent &aEvent
)[private]

Parameters

TInt aErr
const TMTPTypeEvent & aEvent

SendEventL(const TMTPTypeEvent &)

voidSendEventL(const TMTPTypeEvent &aEvent)
Sends an MTP event dataset.
leave
KErrNotFound If the MTP event dataset specifies an invalid SessionID.

Parameters

const TMTPTypeEvent & aEventThe MTP event dataset source.

SendResponseCompleteL(TInt, const TMTPTypeResponse &, const TMTPTypeRequest &)

voidSendResponseCompleteL(TIntaErr,
const TMTPTypeResponse &aResponse,
const TMTPTypeRequest &aRequest
)[private]

Parameters

TInt aErr
const TMTPTypeResponse & aResponse
const TMTPTypeRequest & aRequest

SendResponseL(const TMTPTypeResponse &, const TMTPTypeRequest &, TRequestStatus &)

voidSendResponseL(const TMTPTypeResponse &aResponse,
const TMTPTypeRequest &aRequest,
TRequestStatus &aStatus
)
Initiates MTP transaction response phase processing. This method should only be invoked when the MTP transaction phase state is either ERequestPhase, or EResponsePhase. This is an asynchronous method.
leave
KErrNotFound If the MTP response dataset specifies an invalid SessionID.
leave
KErrArgument If the MTP response dataset does not match the specified request dataset.
panic
CMTPConnection 0 If an asynchronous request is already pending on the connection.
panic
CMTPConnection 2 If the MTP transaction phase is invalid.

Parameters

const TMTPTypeResponse & aResponseThe MTP response dataset source.
const TMTPTypeRequest & aRequestThe MTP request dataset of the active MTP transaction.
TRequestStatus & aStatusThe status used to return asynchronous completion information regarding the request.

SessionClosedL(TUint32)

IMPORT_C voidSessionClosedL(TUint32aSessionMTPId)
Deletes the session object assigned to the specified session and notifies all loaded data providers.
leave
KErrNotFound, if a session with the specified SessionMTPId is not found.
leave
One of the system wide error codes, if a general processing failure occurs.

Parameters

TUint32 aSessionMTPIdThe session identifier assigned by the MTP connection initiator.

SessionCount()

TUint SessionCount()const

SessionL(const TMTPTypeFlatBase &, TInt)

CMTPSession &SessionL(const TMTPTypeFlatBase &aDataset,
TIntaSessionIdElementNo
)const [private]
Provides a reference to the session with the MTP connection assigned identifier specified in the supplied MTP dataset.
leave
KErrNotFound If the specified session identifier is not currently active on the connection.

Parameters

const TMTPTypeFlatBase & aDatasetThe MTP dataset.
TInt aSessionIdElementNoThe element number in the MTP dataset of the MTP connection assigned identifier.

SessionOpenedL(TUint32)

IMPORT_C voidSessionOpenedL(TUint32aSessionMTPId)
Creates a new session object for the specified session and notifies all loaded data providers. The session is known by two identifiers: 1. SessionMTPId - Assigned by the MTP connection initiator and unique only to the MTP connection on which the session was opened. In a multiple- connection configuration this identifier may not uniquely identify the session. 2. SessionUniqueId - Assigned by the MTP daemon and guaranteed to uniquely identify the session in a multiple-connection configuration. Currently the MTP daemon does not support multiple-connection configuration and both identifiers are assigned the same value.
leave
KErrAlreadyExists, if a session with the specified SessionMTPId is already open.
leave
One of the system wide error codes, if a general processing failure occurs.

Parameters

TUint32 aSessionMTPIdThe session identifier assigned by the MTP connection initiator.

SessionOrder(const TUint32 *, const CMTPSession &)

TInt SessionOrder(const TUint32 *aL,
const CMTPSession &aR
)[private, static]

Implements an order relation for CMTPSession objects based on relative MTP connection assigned session IDs.

Parameters

const TUint32 * aLThe first MTP connection assigned session ID.
const CMTPSession & aRThe second object.

SessionOrder(const CMTPSession &, const CMTPSession &)

TInt SessionOrder(const CMTPSession &aL,
const CMTPSession &aR
)[private, static]

Implements a TLinearOrder relation for CMTPSession objects based on relative MTP connection assigned session IDs.

Parameters

const CMTPSession & aLThe first object.
const CMTPSession & aRThe second object.

SessionWithMTPIdExists(TUint32)

TBool SessionWithMTPIdExists(TUint32aMTPId)const

Parameters

TUint32 aMTPId

SessionWithMTPIdL(TUint32)

MMTPSession &SessionWithMTPIdL(TUint32aMTPId)const

Parameters

TUint32 aMTPId

SessionWithUniqueIdExists(TUint32)

TBool SessionWithUniqueIdExists(TUint32aUniqueId)const

Parameters

TUint32 aUniqueId

SessionWithUniqueIdL(TUint32)

MMTPSession &SessionWithUniqueIdL(TUint32aUniqueId)const

Parameters

TUint32 aUniqueId

SetState(TUint)

voidSetState(TUintaState)[private]

Sets the MTP connection state variable.

Parameters

TUint aStateThe new MTP connection state value.

State()

TUint State()const [private]

Provide the current MTP connection state.

TransactionCompleteL(const TMTPTypeRequest &)

voidTransactionCompleteL(const TMTPTypeRequest &aRequest)
Signals the completion of the current transaction processing sequence. This method should only be invoked when the MTP transaction phase state is ECompletingPhase.
leave
KErrNotFound If the MTP request dataset specifies an invalid SessionID.
panic
CMTPConnection 2 If the MTP transaction phase is invalid.

Parameters

const TMTPTypeRequest & aRequestThe MTP request dataset of the completed MTP transaction.

TransactionPhaseL(TUint32)

TMTPTransactionPhase TransactionPhaseL(TUint32aMTPSessionId)const

Parameters

TUint32 aMTPSessionId

Unbind(MMTPTransportConnection &)

voidUnbind(MMTPTransportConnection &aConnection)[private]

Parameters

MMTPTransportConnection & aConnection

UnrecoverableMTPError()

voidUnrecoverableMTPError()[private]

Forces the immediate shutdown of the MTP connection. This is invoked when a protocol error is detected that cannot be recovered from, e.g. if an attempt is detected to initiate an MTP transaction before a previous transaction has concluded.

ValidFrameworkRequest(CMTPSession *, TUint, TRequestStatus *)

TBool ValidFrameworkRequest(CMTPSession *aSession,
TUintaValidStates,
TRequestStatus *aStatus
)[private]
Performs common validation processing for requests initiated from the data provider framework layer. The following validation checks are performed. 1. Attempt to initiate concurrent asynchronous requests to the same connection. This will result in a panic. 2. Attempt to initiate a request that is invalid for the current transaction phase. This will result in a panic. 3. Attempt to initiate a request when the connection is in an unrecoverable error shutdown mode. This will result in the immediate cancellation of the request.
panic
CMTPConnection 0 If an asynchronous request is already pending on the connection.
panic
CMTPConnection 2 If the MTP transaction phase is invalid.

Parameters

CMTPSession * aSession
TUint aValidStates
TRequestStatus * aStatus

ValidateAndPublishConnState(CMTPSession &, TInt)

voidValidateAndPublishConnState(CMTPSession &aSession,
TIntaState
)[private]

This method is used to publish the events based on the TransactionPhase.

Parameters

CMTPSession & aSession
TInt aState

Member Enumerations Documentation

Enum TStates

Enumerators

EStateUnknown
EStateOpen
EStateErrorRecovery
EStateErrorShutdown
EStateShutdown

Member Data Documentation

__FLOG_DECLARATION_MEMBER_MUTABLE

__FLOG_DECLARATION_MEMBER_MUTABLE[private]

FLOGGER debug trace member variable.

TUint iConnectionId

TUint iConnectionId[private]

TInt iDataReceiveResult

TInt iDataReceiveResult[private]

TSglQue< CMTPEventLink > iEventQ

TSglQue< CMTPEventLink >iEventQ[private]

TAny * iExtendedInterface

TAny *iExtendedInterface[private]

TInt iPendingEventCount

TInt iPendingEventCount[private]

RProperty iProperty

RProperty iProperty[private]

TMTPTypeResponse iResponse

TMTPTypeResponse iResponse[private]

RPointerArray< CMTPSession > iSessions

RPointerArray< CMTPSession >iSessions[private]

RMTPFramework iSingletons

RMTPFramework iSingletons[private]

TUint iState

TUint iState[private]

MMTPTransportConnection * iTransportConnection

MMTPTransportConnection *iTransportConnection[private]