btobexprofiles/obexserviceman/obexservicemanclient/src/usbclientwrapper.cpp
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  Wrapper class for usb client
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "usbclientwrapper.h"
       
    21 #include "debug.h"
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // Constructor
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 CUSBClientWrapper::CUSBClientWrapper()
       
    31     {    
       
    32     TRACE_FUNC              
       
    33     }
       
    34 
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // ConstructL
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 void CUSBClientWrapper::ConstructL()
       
    41     {    
       
    42     TRACE_FUNC
       
    43     }
       
    44 
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // NewL
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CUSBClientWrapper* CUSBClientWrapper::NewL()
       
    51     {
       
    52     CUSBClientWrapper* self = new (ELeave) CUSBClientWrapper();
       
    53     CleanupStack::PushL(self);
       
    54     self->ConstructL();
       
    55     CleanupStack::Pop( self );    
       
    56     return self;
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // destructor
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CUSBClientWrapper::~CUSBClientWrapper()
       
    64     {
       
    65     TRACE_FUNC_ENTRY          
       
    66     if( iServer.Handle() )
       
    67         {                 
       
    68         iServer.Close();       
       
    69         }    
       
    70     TRACE_FUNC_EXIT        
       
    71     }
       
    72     
       
    73 // ---------------------------------------------------------------------------
       
    74 // ManageUSBServices
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void  CUSBClientWrapper::ManageUSBServices(TBool aUSBStatus, 
       
    78                                            TRequestStatus &aStatus)
       
    79     {
       
    80     TRACE_FUNC_ENTRY        
       
    81     TInt err = KErrNone;         
       
    82     TRequestStatus* status = &aStatus;
       
    83     aStatus = KRequestPending;    
       
    84     if( !iServer.Handle() )
       
    85     	{    	
       
    86        	err = iServer.Connect();              	       	
       
    87     	}    
       
    88     if( err != KErrNone )
       
    89         {                
       
    90         User::RequestComplete( status, err );            
       
    91         return;
       
    92         }       
       
    93     err=iServer.ManageServices( ELocodBearerUSB, aUSBStatus, aStatus );        
       
    94     if ( err != KErrNone )
       
    95         {
       
    96         User::RequestComplete( status, err );
       
    97         }    
       
    98     TRACE_FUNC_EXIT        
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CancelManageUSBServices
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 void  CUSBClientWrapper::CancelManageUSBServices()
       
   106     {
       
   107     if ( iServer.Handle() )
       
   108         {
       
   109         iServer.CancelRequest();     
       
   110         }        
       
   111     }
       
   112