commsfwutils/commsbufs/src/commsbufasyncrequest.cpp
changeset 0 dfb7c4ff071f
child 29 9644881fedd0
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 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 //
       
    15 
       
    16 #include "es_commsbuf_internal.h"
       
    17 #include <comms-infras/commsbufpondop.h>
       
    18 #include "commsbufasyncreqinternal.h"
       
    19 
       
    20 EXPORT_C RCommsBufAsyncRequest::RCommsBufAsyncRequest()
       
    21 : iAsyncReqImpl(NULL)
       
    22 /**
       
    23 The constructor 
       
    24 */
       
    25 	{
       
    26 	}
       
    27 
       
    28 EXPORT_C RCommsBufAsyncRequest::RCommsBufAsyncRequest(CCommsBufAsyncRequest* aImpl)
       
    29 : iAsyncReqImpl(aImpl)
       
    30     {
       
    31     }
       
    32 
       
    33 EXPORT_C RCommsBufAsyncRequest::~RCommsBufAsyncRequest()
       
    34 /**
       
    35 The destructor
       
    36 */
       
    37 	{
       
    38 	}
       
    39 
       
    40 EXPORT_C TInt RCommsBufAsyncRequest::Open(TCommsBufAllocator& aAllocator)
       
    41     {
       
    42     if(iAsyncReqImpl == NULL)
       
    43         {
       
    44         iAsyncReqImpl = new CCommsBufAsyncRequest(aAllocator);
       
    45         }
       
    46     return (iAsyncReqImpl == NULL) ? KErrNoMemory : KErrNone; 
       
    47     }
       
    48 
       
    49 EXPORT_C void RCommsBufAsyncRequest::Close()
       
    50     {
       
    51     delete iAsyncReqImpl;
       
    52     iAsyncReqImpl = NULL;
       
    53     }
       
    54 
       
    55 
       
    56 EXPORT_C void RCommsBufAsyncRequest::Alloc(RCommsBufChain& aChain, TInt aSize, TRequestStatus& aStatus)	
       
    57 /**
       
    58 Allocate a RCommsBuf chain asynhronously. 
       
    59 
       
    60 @param 	aChain 			The chain
       
    61 @param 	aLength			The length of the chain
       
    62 @param 	aStatus			The request status
       
    63 @param	aAllocator		The handle to the allocator
       
    64 */
       
    65 	{
       
    66 	RCommsBufAsyncRequest::Alloc(aChain, aSize, 0, KMaxTInt, aStatus);	
       
    67 	}
       
    68 
       
    69 EXPORT_C void RCommsBufAsyncRequest::Alloc(RCommsBufChain& aChain, TInt aSize, TInt aMinSize, TInt aMaxSize, TRequestStatus& aStatus)   
       
    70 /**
       
    71 Allocate a RCommsBuf chain asynhronously. 
       
    72 
       
    73 @param  aChain          The chain
       
    74 @param  aLength         The length of the chain
       
    75 @param  aStatus         The request status
       
    76 @param  aAllocator      The handle to the allocator
       
    77 */
       
    78     {
       
    79     iAsyncReqImpl->Alloc(aChain, aSize, aMinSize, aMaxSize, aStatus);
       
    80     }
       
    81 
       
    82 
       
    83 EXPORT_C void RCommsBufAsyncRequest::Cancel()
       
    84 /**
       
    85 Cancel the asynchronous request
       
    86 */
       
    87 	{
       
    88 	iAsyncReqImpl->Cancel();
       
    89 	}
       
    90 
       
    91 EXPORT_C void RCommsBufAsyncRequest::Complete(TInt aCode)
       
    92 /**
       
    93 Complete the request.
       
    94 
       
    95 @param	aCode	The request completion code
       
    96 */
       
    97 	{
       
    98 	iAsyncReqImpl->Complete(aCode);
       
    99 	}