messagingappbase/obexmtms/irmtm/irserver/source/sendopn.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // $Workfile: sendopn.cpp $
       
    15 // $Author: Stevep $
       
    16 // $Revision: 8 $
       
    17 // $Date: 25/03/02 9:25 $
       
    18 // 
       
    19 //
       
    20 
       
    21 //class includes
       
    22 #include "sendopn.h"
       
    23 
       
    24 //system includes
       
    25 #include <msvids.h>
       
    26 #include <ircmtm.h> //KUidMsgTypeIr
       
    27 
       
    28 //user includes
       
    29 #include "irmsgtypeuid.h" //KUidMsgTypeIr
       
    30 
       
    31 
       
    32 
       
    33 CIrServerSendOperation* CIrServerSendOperation::NewL
       
    34                                                 (CMsvServerEntry& aSendObj,	const TObexIrProtocolInfo& aIrProtocolInfo,
       
    35                                                  TInt aConnectTimeoutMicroSeconds, TInt aPutTimeoutMicroseconds, 
       
    36                                                  const TDesC* aConnectPassword, TRequestStatus& aObserverRequestStatus,
       
    37                                                  TBool aLastSendAttempt)
       
    38 /**
       
    39  * Second phase constructor.
       
    40  *
       
    41  * @param aSendObj Reference to the object to send.
       
    42  * @param aIrProtocolInfo Protocol info to initialise the CObexCleint
       
    43  * @param aConnectTimeoutMicroSeconds Timeout period for Connect operation in microseconds.
       
    44  * @param aPutTimeoutMicroseconds Timeout period for Put operation in microseconds.
       
    45  * @param aConnectPassword Pointer to the password for Bluetooth validation.
       
    46  * @param aObserverRequestStatus Canonical TRequestStatus for control of active object.
       
    47  * @param aLastSendAttempt TBool flag to check for the second send attempt and also control header sending.  EFalse sends full headers, ETrue sends only name and size.
       
    48  * @leave Leaves if insufficient memory.
       
    49  */
       
    50 	{
       
    51 	CIrServerSendOperation* self=new(ELeave) CIrServerSendOperation
       
    52 	                                         (aSendObj, aIrProtocolInfo, aConnectTimeoutMicroSeconds,
       
    53 	                                          aPutTimeoutMicroseconds, aObserverRequestStatus, aLastSendAttempt);
       
    54 	CleanupStack::PushL(self);
       
    55 	self->ConstructL(aConnectPassword);
       
    56 	CleanupStack::Pop(); //self
       
    57 	return self;
       
    58 	}
       
    59 
       
    60 CIrServerSendOperation::CIrServerSendOperation(CMsvServerEntry& aSendObj, const TObexIrProtocolInfo& aIrProtocolInfo,
       
    61                                                TInt aConnectTimeoutMicroSeconds, TInt aPutTimeoutMicroSeconds,
       
    62                                                TRequestStatus& aObserverRequestStatus, TBool aLastSendAttempt)
       
    63 	:CObexServerSendOperation(KUidMsgTypeIrUID, aSendObj, aConnectTimeoutMicroSeconds, aPutTimeoutMicroSeconds,
       
    64 	                          aObserverRequestStatus,aLastSendAttempt),
       
    65 		iIrProtocolInfo(aIrProtocolInfo)	//default bitwise copy constructor should suffice
       
    66 /**
       
    67  * Constructor.
       
    68  *
       
    69  * @param aSendObj Reference to the object to send.
       
    70  * @param aIrProtocolInfo Protocol info to initialise the CObexCleint
       
    71  * @param aConnectTimeoutMicroSeconds Timeout period for Connect operation in microseconds.
       
    72  * @param aPutTimeoutMicroseconds Timeout period for Put operation in microseconds.
       
    73  * @param aConnectPassword Pointer to the password for Bluetooth validation.
       
    74  * @param aObserverRequestStatus Canonical TRequestStatus for control of active object.
       
    75  * @param aLastSendAttempt TBool flag to check for the second send attempt and also control header sending.  EFalse sends full headers, ETrue sends only name and
       
    76  */
       
    77 	{
       
    78 	}
       
    79 
       
    80 void CIrServerSendOperation::InitialiseObexClientL()
       
    81 /**
       
    82  * Initialises the Obex client to use Bluetooth as the transport mechanism with the parameters as specified in the
       
    83  * constructor.
       
    84  *
       
    85  * @leave KErrXXX system wide error codes
       
    86  */
       
    87 
       
    88 	{
       
    89 	// Initialise Obex client object.
       
    90 	iObexClient = CObexClient::NewL(iIrProtocolInfo);
       
    91 	}
       
    92 
       
    93 TBool CIrServerSendOperation::CompletingObserver(TInt aErrorCode)
       
    94 	{
       
    95 	// Check if the send operation has completed successfully or 
       
    96     // user cancelled the request or if it is the second send attempt . 
       
    97     // If so , we will not be attempting a retry.
       
    98     if((aErrorCode == KErrNone) || (aErrorCode == KErrCancel ) || (iLastSendAttempt))
       
    99 		{
       
   100 		return ETrue;
       
   101 		}
       
   102 	return EFalse;
       
   103 	}
       
   104