mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbtransport.cpp
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-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 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #include <ecom/implementationproxy.h>
       
    22 
       
    23 #include "cmtpusbconnection.h"
       
    24 #include "cmtpusbtransport.h"
       
    25 #include "mmtpconnectionmgr.h"
       
    26 #include "mtpusbpanic.h"
       
    27 
       
    28 __FLOG_STMT(_LIT8(KComponent,"UsbTransport");)
       
    29 
       
    30 /**
       
    31 USB MTP device class transport plug-in factory method.
       
    32 @return A pointer to an MTP device class transport plug-in. Ownership IS 
       
    33 transfered.
       
    34 @leave One of the system wide error codes, if a processing failure occurs.
       
    35 */
       
    36 TAny* CMTPUsbTransport::NewL(TAny* aParameter)
       
    37     {
       
    38     if ( aParameter != NULL )
       
    39     	{
       
    40     	User::Leave(KErrArgument);
       
    41     	}
       
    42     CMTPUsbTransport* self = new (ELeave) CMTPUsbTransport;
       
    43     CleanupStack::PushL(self);
       
    44     self->ConstructL();
       
    45     CleanupStack::Pop(self);
       
    46     return self;
       
    47     }
       
    48     
       
    49 /**
       
    50 Destructor.
       
    51 */
       
    52 CMTPUsbTransport::~CMTPUsbTransport()
       
    53     {
       
    54     __FLOG(_L8("~CMTPUsbTransport - Entry"));
       
    55     delete iConnection;
       
    56     __FLOG(_L8("~CMTPUsbTransport - Exit"));
       
    57     __FLOG_CLOSE;
       
    58     }
       
    59     
       
    60 /**
       
    61 This method returns a refrence to CMTPUsbConnection object.
       
    62 @return a reference to CMTPUsbConnection object. 
       
    63 */
       
    64 const CMTPUsbConnection& CMTPUsbTransport::MTPUsbConnection()
       
    65     {
       
    66     return *iConnection;
       
    67     }
       
    68 
       
    69 void CMTPUsbTransport::ModeChanged(TMTPOperationalMode /*aMode*/)
       
    70     {
       
    71     __FLOG(_L8("ModeChanged - Entry"));
       
    72     __FLOG(_L8("ModeChanged - Exit"));
       
    73     }
       
    74     
       
    75 void CMTPUsbTransport::StartL(MMTPConnectionMgr& aConnectionMgr)
       
    76     {
       
    77     __FLOG(_L8("StartL - Entry"));
       
    78     __ASSERT_ALWAYS(!iConnection, Panic(EMTPUsbConnectionAlreadyExist));
       
    79     iConnection = CMTPUsbConnection::NewL(aConnectionMgr);
       
    80     __FLOG(_L8("StartL - Exit"));
       
    81     }
       
    82 
       
    83 void CMTPUsbTransport::Stop(MMTPConnectionMgr& /*aConnectionMgr*/)
       
    84     {
       
    85     __FLOG(_L8("Stop - Entry"));
       
    86     if(iConnection)
       
    87 	    {
       
    88 	    delete iConnection;
       
    89 	    iConnection = NULL;
       
    90 	    }
       
    91     __FLOG(_L8("Stop - Exit")); 
       
    92     }
       
    93 
       
    94 TAny* CMTPUsbTransport::GetExtendedInterface(TUid /*aInterfaceUid*/)
       
    95     {
       
    96     return 0;    
       
    97     }
       
    98 
       
    99 /**
       
   100 Constructor
       
   101 */    
       
   102 CMTPUsbTransport::CMTPUsbTransport()
       
   103     {
       
   104     // Do nothing.
       
   105     }
       
   106     
       
   107 /**
       
   108 Second phase constructor.
       
   109 */
       
   110 void CMTPUsbTransport::ConstructL()
       
   111     {
       
   112     __FLOG_OPEN(KMTPSubsystem, KComponent);
       
   113     __FLOG(_L8("ConstructL - Entry"));
       
   114     __FLOG(_L8("USB MTP Device class plug-in loaded."));    
       
   115     __FLOG(_L8("ConstructL - Exit"));
       
   116     }
       
   117 
       
   118 // Define the implementation UID of MTP USB transport implementation.
       
   119 static const TImplementationProxy ImplementationTable[] =
       
   120     {
       
   121         
       
   122         IMPLEMENTATION_PROXY_ENTRY((0x102827B2), CMTPUsbTransport::NewL)
       
   123         
       
   124     };
       
   125 
       
   126 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   127     {
       
   128     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   129     return ImplementationTable;
       
   130     }
       
   131 
       
   132 // Dummy dll entry point.
       
   133 TBool E32Dll()
       
   134     {
       
   135     return ETrue;
       
   136     }
       
   137