CObexServerSendOperation Class Reference
class CObexServerSendOperation : public CActive
|
class
CObexServerSendOperation
Obex Server Send Operation:
Base class for Send operations using Obex protocol.
Implements a state machine with the following states: Initialise-->Connect-->ConnectAttemptComplete-->SendObject-->(SendNextObject-->)SendComplete-->MovedToSent-->Disconnected
The pure virtual function
InitialiseObexClientL()
must be overridden in the base class to initialise the iObexClient member to use the desired Obex transport mechanism (e.g. infrared, Bluetooth).
In order to allow asynchronous transport initialisations (for example BT's SDP Query) implementations of this function must set iAsyncInit and provide a mechanism to complete a request. See the bluetooth server mtm code for implementation details.
Constructor & Destructor Documentation
CObexServerSendOperation(TUid, CMsvServerEntry &, TInt, TInt, TRequestStatus &)
Parameters
TUid
aMsgTypeUid
|
UID of message type
|
CMsvServerEntry
& aSendObj
|
Reference to the object to send.
|
TInt
aConnectTimeoutMicroSeconds
|
Timeout period for Connect operation in microseconds.
|
TInt
aPutTimeoutMicroSeconds
|
|
TRequestStatus
& aObserverRequestStatus
|
TRequestStatus of owning active object.
|
CObexServerSendOperation(TUid, CMsvServerEntry &, TInt, TInt, TRequestStatus &, TBool)
Parameters
TUid
aMsgTypeUid
|
UID of message type
|
CMsvServerEntry
& aSendObj
|
Reference to the object to send.
|
TInt
aConnectTimeoutMicroSeconds
|
Timeout period for Connect operation in microseconds.
|
TInt
aPutTimeoutMicroSeconds
|
|
TRequestStatus
& aObserverRequestStatus
|
TRequestStatus of owning active object.
|
TBool
aLastSendAttempt
|
TBool flag to check for second send attempt and also for sending headers. EFalse sends full headers, ETrue only sends name and size
|
~CObexServerSendOperation()
IMPORT_C
|
~CObexServerSendOperation
|
(
|
)
|
[virtual]
|
Destructor.
Cancel()
s, deletes owned objects and Close()s the connection to the FileServer.
Member Functions Documentation
ActivateRunLWithError(TInt)
void
|
ActivateRunLWithError
|
(
|
TInt
|
aError
|
)
|
[private]
|
Cancels the current operation, then reactivates with the given error code.
Parameters
TInt
aError
|
Error code to be passed to CompleteSelf.
|
BuildSpecificConstructL()
void
|
BuildSpecificConstructL
|
(
|
)
|
[private]
|
Normal second phase constructor.
BuildSpecificDestructor()
void
|
BuildSpecificDestructor
|
(
|
)
|
[private]
|
Destructor.
Cancel()
s, deletes owned objects and Close()s the connection to the FileServer.
CheckStatusOfLastObject(TInt, TObexMtmProgress::TSendState)
Checks the last object was sent correctly, and tries to action appropriate error feedback if not. Only to be called from ESendObject/ESendNextObject or ESendComplete states.
CleanupAfterMovedToSent()
void
|
CleanupAfterMovedToSent
|
(
|
)
|
[private]
|
Restores after the message has been moved to the inbox, and marks the message as visible.
CompleteObserverL()
void
|
CompleteObserverL
|
(
|
)
|
[private]
|
Complete the observer, reporting any error via the progress. THIS METHOD MUST BE CALLED ONCE ONLY.
CompleteSelf(TInt)
void
|
CompleteSelf
|
(
|
TInt
|
aError
|
)
|
[private]
|
This causes this active object's request to complete which means
RunL()
will be called again if we are active (immediately if there are no higher priority active objects in the active scheduler).
Parameters
TInt
aError
|
Error to be passed forward to the next step of the state machine
|
CompletingObserver(TInt)
IMPORT_C
TBool
|
CompletingObserver
|
(
|
TInt
|
aErrorCode
|
)
|
[protected, virtual]
|
Tells the derived class that the base class is about to complete the observer. This is the first thing called when CompleteObserver is called. Since the behaviour of CompleteObserver is to clean up the message that it was trying to send, this calls gives the derived class an opportunity to either stop this deletion or recover any information synchronously from the message. If the derived class has no need to use this functionality, the default implementation allows deletion. This is the default implementation that allows the server mtm to continue normally. Tells the derived class that the base class is about to complete the observer. This is the first thing called when CompleteObserverL is called. Since the behaviour of CompleteObserverL is to clean up the message that it was trying to send, this calls gives the derived class an opportunity to either stop this deletion or recover any information synchronously from the message. If the derived class has no need to use this functionality, the default implementation allows deletion.
Parameters
TInt
aErrorCode
|
The last error code encountered during operation
|
ConstructL(const TDesC *)
IMPORT_C void
|
ConstructL
|
(
|
const
TDesC
*
|
aConnectPassword
|
)
|
[protected]
|
Second phase constructor. Sets up connection to the FileServer, initialises attachments or filename list then starts sending process by initialising.
-
leave
-
Leaves if insufficient memory.
-
leave
-
Leaves if cannot connect to FileServer.
Parameters
const
TDesC
* aConnectPassword
|
Pointer to the password to be used for authentication.
|
DoCancel()
IMPORT_C void
|
DoCancel
|
(
|
)
|
[protected, virtual]
|
Cancels the current operation, deletes the client and
Cancel()
s the timeout timer. Only completes the observer (by a call to CompleteObserver) if an external entity (i.e. the owner) has called
Cancel()
. Otherwise the observer is not completed.
Cancels the current operation, deletes the client and
Cancel()
s the timeout timer. Only completes the observer (by a call to CompleteObserverL) if an external entity (i.e. the owner) has called
Cancel()
. Otherwise the observer is not completed.
ExplicitCancel()
void
|
ExplicitCancel
|
(
|
)
|
[private]
|
Cancel any pending obex operation without completing the observer.
FileSession()
RFs
&
|
FileSession
|
(
|
)
|
[private]
|
Returns a reference to the file session (
RFs
) of the message
GetUserPasswordL(const TDesC &)
IMPORT_C void
|
GetUserPasswordL
|
(
|
const
TDesC
&
|
aUserID
|
)
|
[private, virtual]
|
Called by the Obex Client when authentication is requested to pass the password back. If the password is invalid, this call should succeed but the send operation as a whole will inevitably fail.
-
leave
-
KErrXXX system wide error codes. Shouldn't leave just because the password is invalid.
Called by the Obex Client when authentication is requested to pass the password back. If the password is invalid, this call should succeed but the send operation as a whole will inevitably fail.
-
leave
-
KErrXXX system wide error codes. Shouldn't leave just because the password is invalid.
-
leave
-
KErrIrObexConnectChallRejected, if password is found empty.
InitialiseAttachmentL(CMsvServerEntry &, TInt)
Load an attachment into the obex sending buffer, and create a new Obex object of name
TMsvEntry::iDetails
.
-
leave
-
KErrXXX system wide error codes
Parameters
CMsvServerEntry
& aParent
|
Reference to CMsvServerEntry to be sent.
|
TInt
aWhichAttachment
|
Zero-based index of attachment to send.
|
InitialiseObexClientL()
void
|
InitialiseObexClientL
|
(
|
)
|
[pure virtual]
|
LoadFileIntoObjectL(const TDesC &, const TDesC &, const TDesC8 &)
void
|
LoadFileIntoObjectL
|
(
|
const
TDesC
&
|
aFileName,
|
|
const
TDesC
&
|
aObexName,
|
|
const
TDesC8
&
|
aMimeType
|
|
)
|
[private]
|
MoveToSentAndSetActiveL()
void
|
MoveToSentAndSetActiveL
|
(
|
)
|
[private]
|
Moves the newly sent message to the global sent items folder, and sets active ready for its completion.
-
leave
-
KErrXXX system wide error codes
PostConnectOperations()
IMPORT_C void
|
PostConnectOperations
|
(
|
)
|
[virtual]
|
Operations to perform after attempting a connection. As multiple connection attempts can be made, it is necessary for this routine to ensure it can handle being called multiple times. May be overridden. Default implementation is blank.
PostSendOperations()
IMPORT_C void
|
PostSendOperations
|
(
|
)
|
[virtual]
|
Operations to perform after attempting to send a set of objects. May be overridden. Default implementation is blank.
PreConnectOperations()
IMPORT_C void
|
PreConnectOperations
|
(
|
)
|
[virtual]
|
Operations to perform before attempting a connection. As multiple connection attempts can be made, it is necessary for this routine to ensure it can handle being called multiple times. May be overridden. Default implementation is blank.
PreSendOperations()
IMPORT_C void
|
PreSendOperations
|
(
|
)
|
[virtual]
|
Operations to perform before attempting to send a set of objects. May be overridden. Default implementation is blank.
PrepareCurrentObjectAndSetStateL()
TInt
|
PrepareCurrentObjectAndSetStateL
|
(
|
)
|
[private]
|
Loads the next object to be sent, whether an attachment or a file in the file list.
-
leave
-
KErrXXX system wide error codes
ProgressL()
IMPORT_C const
TDesC8
&
|
ProgressL
|
(
|
)
|
|
Returns current progress information.
-
leave
-
KErrXXX system wide error codes
RealRunL()
void
|
RealRunL
|
(
|
)
|
[private]
|
Implementation of the send operation state machine. Progresses as: Initialise-->Connect-->ConnectAttemptComplete-->SendObject-->(SendNextObject-->)SendComplete-->Disconnected The SendNextObject state is repeated for each attachment in excess of one. Also handles UserCancelled and SendError states by CompleteObserver()ing with appropriate error codes. Leaves will be passed back to RunL and handled there.
-
leave
-
KErrXXX system wide error codes
RunL()
IMPORT_C void
|
RunL
|
(
|
)
|
[private, virtual]
|
SecondPhaseObexClientInitL()
IMPORT_C void
|
SecondPhaseObexClientInitL
|
(
|
)
|
[virtual]
|
This is not required to do anything in the base implementation.
SynchronousEntryDelete()
TInt
|
SynchronousEntryDelete
|
(
|
)
|
[private]
|
Delete the outbox entry as operation has 'completed'. Will be invisible&InPreparation anyway (MS delete will delete it the next time it starts).
TimeOut()
Called when the current operation times out. Causes the current operation to be cancelled, then reactivates with the appropriate error code (KErrIrObexClientNoDevicesFound or KErrIrObexClientPutPeerAborted).
Member Data Documentation
TInt
iAttachmentEntryCount
TInt
|
iAttachmentEntryCount
|
[private]
|
TBool
iCancelWithoutCompleting
TBool
|
iCancelWithoutCompleting
|
[private]
|
HBufC * iConnectPassword
HBufC
*
|
iConnectPassword
|
[private]
|
const TInt iConnectTimeout
const
TInt
|
iConnectTimeout
|
[private]
|
TBool
iLastSendAttempt
TBool
|
iLastSendAttempt
|
[protected]
|
CMsvEntrySelection * iMoveEntrySelection
CMsvOperation * iMoveOperation
CMsvServerEntry & iMsvSendParent
const TUid iMtm
const
TUid
|
iMtm
|
[private]
|
TInt
iNextAttachment
TInt
|
iNextAttachment
|
[private]
|
CObexClient * iObexClient
CObexFileObject * iObexObject
TRequestStatus & iObserverRequestStatus
TPckgBuf< TObexMtmProgress > iProgressPckg
const TInt iPutTimeout
const
TInt
|
iPutTimeout
|
[private]
|
TObexMtmProgress::TSendState
iSendState
CObexSendOpTimeout * iTimeoutTimer
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.