localconnectivityservice/obexserviceman/plugins/src/usb/obexsmusbconnection.cpp
branchRCL_3
changeset 10 a249528449c3
parent 0 c3e98f10fcf4
--- a/localconnectivityservice/obexserviceman/plugins/src/usb/obexsmusbconnection.cpp	Fri Mar 12 15:46:58 2010 +0200
+++ b/localconnectivityservice/obexserviceman/plugins/src/usb/obexsmusbconnection.cpp	Mon Mar 15 12:43:27 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -95,12 +95,11 @@
 //
 void CObexSMUsbConnection::ConstructL()
     {    
-    // Create service controller implementation object
-    iController = CSrcsInterface::NewL(iImplementationInfo->ImplementationUid());
+    // Save service controller implementation UID for deferred initialization
+    iImplUid = iImplementationInfo->ImplementationUid();
+
     FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: CSrcsInterface::NewL\t"));
 
-	iController->SetMediaType( ESrcsMediaUSB );
-
     // parsing opaque_data in iImplementationInfo
     TPtrC8 res_string = iImplementationInfo->OpaqueData();
     
@@ -173,25 +172,14 @@
 	// Try to create OBEX server
 	iServer = CObexServer::NewL(obexUsbProtocolInfo, aObexProtocolPolicy);
     FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: CObexServer::NewL"));
-
-    
-    
-    FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: iServer->Start"));
-
-	FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: SetObexServer\t"));
-	// Try to start server 
-	User::LeaveIfError ( iController->SetObexServer( iServer ));
-	
-
-    // we do not accept Obex passkey for USB transport, so do NOT set callback.
-    // iServer->SetCallBack( *this );
-
     // if there is "local who" field
     if(op_LocalWho.Size())
         {
         User::LeaveIfError ( iServer->SetLocalWho( op_LocalWho ) );
         FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: SetLocalWho"));
-        }      
+        }
+    
+    // The rest of initialization procedure is executed in PostInitialzeL()
     }
 
 // ---------------------------------------------------------
@@ -219,4 +207,17 @@
 	return ETrue;	
 	}     
 
+void CObexSMUsbConnection::PostInitializeL()
+    {
+    FTRACE(FPrint(_L("[SRCS] CObexSMUsbConnection: PostInitializeL(%08X)"), iImplUid.iUid));
+
+    iController = CSrcsInterface::NewL(iImplUid);
+    iController->SetMediaType( ESrcsMediaUSB );
+
+    FLOG(_L("[SRCS] CObexSMUsbConnection::PostInitializeL(): SetObexServer\t"));
+    // Try to start server 
+    User::LeaveIfError ( iController->SetObexServer( iServer ));
+    FLOG( _L( "[SRCS] CObexSMUsbConnection: PostInitializeL() exits\t" ) );
+    }
+
 // End of file