localconnectivityservice/obexreceiveservices/bip/src/BIPImageHandler.cpp
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of CBIPImageHandler class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #define __OBEX_USER_DEFINED_HEADERS__
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "BIPImageHandler.h"
       
    23 #include <obexheaders.h>
       
    24 
       
    25 const TInt KImageHandleWidth=7;
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 
       
    29 // ---------------------------------------------------------
       
    30 // AddImageHandleHeaderL()
       
    31 // ---------------------------------------------------------
       
    32 //
       
    33 void CBIPImageHandler::AddImageHandleHeaderL( CObexServer* aObexServer )
       
    34     {
       
    35     TRACE_FUNC_ENTRY    
       
    36     
       
    37     CObexHeaderSet* currentHeaders = CObexHeaderSet::NewL();
       
    38     CleanupStack::PushL( currentHeaders );  // 1. push
       
    39         
       
    40     CObexHeader* header = CObexHeader::NewL();
       
    41     CleanupStack::PushL( header ); //2. push
       
    42 
       
    43     TBuf16<KImageHandleWidth> imageHandle;
       
    44     iImageHandleValue++;
       
    45     imageHandle.AppendNumFixedWidth( iImageHandleValue, EDecimal, KImageHandleWidth ); 
       
    46     header->SetUnicodeL( 0x30, imageHandle );
       
    47 
       
    48     User::LeaveIfError( currentHeaders->AddHeader( header ) );
       
    49     
       
    50     CleanupStack::Pop( header); 
       
    51     if( aObexServer )
       
    52         {
       
    53         TRACE_INFO( _L( "[MtmUiServerBip] CBIPImageHandler: SetPutFinalResponseHeaders \t" ) );
       
    54         User::LeaveIfError( aObexServer->SetPutFinalResponseHeaders( currentHeaders ) );
       
    55         CleanupStack::Pop( currentHeaders);     
       
    56         }
       
    57     else
       
    58         {
       
    59         CleanupStack::PopAndDestroy(currentHeaders);    
       
    60         }
       
    61     
       
    62     TRACE_FUNC_ENTRY    
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------
       
    66 // CBIPImageHandler()
       
    67 // ---------------------------------------------------------
       
    68 //
       
    69 CBIPImageHandler::CBIPImageHandler()
       
    70     {
       
    71     }
       
    72 
       
    73 // ---------------------------------------------------------
       
    74 // ~CBIPImageHandler()
       
    75 // ---------------------------------------------------------
       
    76 //
       
    77 CBIPImageHandler::~CBIPImageHandler()
       
    78     {
       
    79     TRACE_FUNC_ENTRY    
       
    80     }
       
    81 // ---------------------------------------------------------
       
    82 // ConstructL()
       
    83 // ---------------------------------------------------------
       
    84 //
       
    85 void CBIPImageHandler::ConstructL()
       
    86     {
       
    87     TRACE_FUNC
       
    88     iImageHandleValue = 0;
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // NewL
       
    93 // Two-phased constructor.
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 CBIPImageHandler* CBIPImageHandler::NewL()
       
    97     {
       
    98     TRACE_FUNC_ENTRY
       
    99     CBIPImageHandler* self = new ( ELeave ) CBIPImageHandler();
       
   100     CleanupStack::PushL( self );
       
   101     self->ConstructL();
       
   102     CleanupStack::Pop(self);
       
   103     return( self );
       
   104     }
       
   105 
       
   106 //  End of File