# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268649807 -7200 # Node ID a249528449c3755b1dad6daf8f1059be4b43326f # Parent a2f12998bb04e70d476b2a07d804ee9152571d4e Revision: 201009 Kit: 201010 diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/modematplugin/src/atcopscmd.cpp --- a/localconnectivityservice/modematplugin/src/atcopscmd.cpp Fri Mar 12 15:46:58 2010 +0200 +++ b/localconnectivityservice/modematplugin/src/atcopscmd.cpp Mon Mar 15 12:43:27 2010 +0200 @@ -732,12 +732,21 @@ break; case ESetSystemNetworkBand: case EManuallyRegisterToNetworkAndChooseAccTech: - // Cannot set the access technology, so set it back to EAccTechNotSet. - // This prevents replying to queries with outdated or incorrect acc tech information. - TRACE_INFO( _L("CATCOPSCmd::RunL() couldn't set system network band, so reset access tech.")); - iAccTech = EAccTechNotSet; - // Fall through to default, because these require an error response. - + if(iRegistrationMode == EModeManualAutomatic) + { + // Manual registration failed, try automatic next. + TRACE_INFO( _L("CATCOPSCmd::RunL() registration mode manual automatic, try automatic.")); + AutomaticNetworkRegistration(); + break; + } + else + { + // Cannot set the access technology, so set it back to EAccTechNotSet. + // This prevents replying to queries with outdated or incorrect acc tech information. + TRACE_INFO( _L("CATCOPSCmd::RunL() couldn't set system network band, so reset access tech.")); + iAccTech = EAccTechNotSet; + // Fall through to default, because these require an error response. + } default: // In all other cases send back an error response. TRACE_INFO( _L("CATCOPSCmd::RunL() reply an error.")); diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexsendservices/obexservicebtsend/src/btsssendlisthandler.cpp --- a/localconnectivityservice/obexsendservices/obexservicebtsend/src/btsssendlisthandler.cpp Fri Mar 12 15:46:58 2010 +0200 +++ b/localconnectivityservice/obexsendservices/obexservicebtsend/src/btsssendlisthandler.cpp Mon Mar 15 12:43:27 2010 +0200 @@ -20,7 +20,7 @@ #include #include "BTSSSendListHandler.h" -#include "btserviceparameterlist.h" +#include "BTServiceParameterList.h" #include "BTSendingServiceDebug.h" diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexserviceman/group/bld.inf --- a/localconnectivityservice/obexserviceman/group/bld.inf Fri Mar 12 15:46:58 2010 +0200 +++ b/localconnectivityservice/obexserviceman/group/bld.inf Mon Mar 15 12:43:27 2010 +0200 @@ -33,12 +33,13 @@ ../conf/obexserviceman.confml MW_LAYER_CONFML(obexserviceman.confml) ../conf/obexserviceman_20016BC5.crml MW_LAYER_CRML(obexserviceman_20016BC5.crml) +../obexservicemanserver/inc/obexservicemanprop.h MW_LAYER_PLATFORM_EXPORT_PATH(obexservicemanprop.h) + // Backup registration file backup_registration.xml /epoc32/data/z/private/101f7c87/backup_registration.xml backup_registration.xml /epoc32/release/winscw/udeb/z/private/101f7c87/backup_registration.xml backup_registration.xml /epoc32/release/winscw/urel/z/private/101f7c87/backup_registration.xml -../obexservicemanclient/inc/usbobex.h |../../../inc/usbobex.h ../rom/obex.iby /epoc32/rom/include/obex.iby ../rom/obex.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obex.iby) diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h --- a/localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h Fri Mar 12 15:46:58 2010 +0200 +++ b/localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h 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" @@ -141,12 +141,17 @@ void ServiceArray(CArrayPtr &aTransport, TBool aState); private: - + /** * C++ default constructor. */ CSrcsServiceManager(); + /* + * Perform service controllers post-initialization + */ + void PostInitialize(CArrayPtr &aTransport); + CArrayPtr* iBTConnectionArray; // array of BT Connections CArrayPtr* iUSBConnectionArray; // array of USB Connections CArrayPtr* iIrDAConnectionArray; // array of IrDA Connections @@ -155,6 +160,8 @@ RMessage2 iMessage; TInt iErrorState; TPtrC8 iTransportName; // Service name + TSrcsTransport iTransportType; // Service type + TBool iTransportState; // Service On/Off }; #endif // SRCSSERVICEMANAGER_H diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsTransport.h --- a/localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsTransport.h Fri Mar 12 15:46:58 2010 +0200 +++ b/localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsTransport.h 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" @@ -89,7 +89,17 @@ * false: OBEX service is inactive. */ virtual TBool IsOBEXActive() = 0; - + + /** + * Perform any outstanding initialization tasks. + * + * The transport may decide to implement two-phase initialization to improve performance where needed. + * For instance, USB Transport has to register all service controller's interfaces and complete the message from obex class controller + * as soon as possible to satisfy timing requirements and defer service controller plugin creation to later stage. + * + * @return none. + */ + virtual void PostInitializeL(); protected: diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsTransport.inl --- a/localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsTransport.inl Fri Mar 12 15:46:58 2010 +0200 +++ b/localconnectivityservice/obexserviceman/obexservicemanserver/inc/SrcsTransport.inl 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" @@ -69,3 +69,6 @@ REComSession::ListImplementationsL(KCSrcsTransportUid, resolverParams, aImplInfoArray); } +inline void CSrcsTransport::PostInitializeL() + { + } diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexserviceman/obexservicemanserver/inc/obexservicemanprop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/localconnectivityservice/obexserviceman/obexservicemanserver/inc/obexservicemanprop.h Mon Mar 15 12:43:27 2010 +0200 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 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" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Obex Service Manager P&S keys definitions + * + */ + +#ifndef __OBEXSERVICEMANPROP_H__ +#define __OBEXSERVICEMANPROP_H__ + +#include + +const TUid KUidObexSMCategory = {0x101F7C87}; +const TUint KObexSMPostInitErrorProperty = 1; // Post Initialization Error Code + +#endif diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp --- a/localconnectivityservice/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp Fri Mar 12 15:46:58 2010 +0200 +++ b/localconnectivityservice/obexserviceman/obexservicemanserver/src/SrcsServiceManager.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" @@ -20,6 +20,8 @@ // INCLUDE FILES #include "SrcsServiceManager.h" #include "debug.h" +#include +#include "obexservicemanprop.h" // CONSTANTS @@ -27,6 +29,10 @@ // The granularity of the array used to hold BT, IrDA and USB connnection objects static const TInt KConnectionArrayGranularity = 4; +const TUint32 KObexSMSid = {0x101F7C87}; +static _LIT_SECURITY_POLICY_S0(KObexSMOnlyPolicy,KObexSMSid); +static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); + // ================= MEMBER FUNCTIONS ======================= @@ -46,7 +52,8 @@ // CSrcsServiceManager::~CSrcsServiceManager() { - Cancel(); + Cancel(); + RProperty::Delete(KUidObexSMCategory, KObexSMPostInitErrorProperty); if ( iBTConnectionArray ) { // Cleanup the array @@ -95,6 +102,13 @@ iBTConnectionArray = new(ELeave) CArrayPtrFlat(KConnectionArrayGranularity); iUSBConnectionArray = new(ELeave) CArrayPtrFlat(KConnectionArrayGranularity); iIrDAConnectionArray = new(ELeave) CArrayPtrFlat(KConnectionArrayGranularity); + + TInt err = RProperty::Define(KUidObexSMCategory, KObexSMPostInitErrorProperty, RProperty::EInt, KAllowAllPolicy, KObexSMOnlyPolicy); + if ( err != KErrNone && err != KErrAlreadyExists ) + { + User::LeaveIfError(err); + } + (void)RProperty::Set(KUidObexSMCategory,KObexSMPostInitErrorProperty,KErrNone); } // --------------------------------------------------------- @@ -132,7 +146,9 @@ { FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: DoManageServices")); iObserver=aObserver; - iMessage=aMessage; + iMessage=aMessage; + iTransportType = aTransport; + iTransportState = aState; TRAPD(error,RealDoManageServiceL(aTransport,aState)); if (error != KErrNone) { @@ -152,6 +168,35 @@ { FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL")); iObserver->RequestCompleted(iMessage,iStatus.Int()); + + // If the transport is being turned on, launch post-initialization routine + // for appropriate service controllers array + if (iTransportState) + { + switch(iTransportType) + { + case ESrcsTransportBT: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL(Bluetooth)")); + PostInitialize(*iBTConnectionArray); + break; + case ESrcsTransportUSB: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL(USB)")); + PostInitialize(*iUSBConnectionArray); + break; + case ESrcsTransportIrDA: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL(IrDA)")); + PostInitialize(*iIrDAConnectionArray); + break; + default: + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Transport not supported."))); + break; + } + } + else + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL() - transport is turned off")); + } + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL exit")); } // --------------------------------------------------------- @@ -177,7 +222,7 @@ void CSrcsServiceManager::RealDoManageServiceL(TSrcsTransport aTransport, TBool aState) { FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RealDoManageServiceL")); - + switch(aTransport) { case ESrcsTransportBT: @@ -276,17 +321,52 @@ } // Clean up - infoArrayTranport.ResetAndDestroy(); - infoArrayServiceController.ResetAndDestroy(); - CleanupStack::PopAndDestroy(2); //infoArrayServiceController + infoArrayTranport.ResetAndDestroy(); + infoArrayServiceController.ResetAndDestroy(); + CleanupStack::PopAndDestroy(2); //infoArrayServiceController } } else // turn off service { FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Turn OFF)")); - aTransport.ResetAndDestroy(); + aTransport.ResetAndDestroy(); + // This is a special case for USB transport. Clear errors. + if (iTransportType == ESrcsTransportUSB) + { + (void)RProperty::Set(KUidObexSMCategory,KObexSMPostInitErrorProperty,KErrNone); + } } FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RealDoManageServiceL exit")); - } + } + +// ------------------------------------------------------------------------------------------ +// CSrcsServiceManager +// This function iterates through all detected service controllers for given transport +// and calls post-initialization routines. +// This solution is implemented mainly to satisfy tough timing requirements for USB transport +// ------------------------------------------------------------------------------------------ +// +void CSrcsServiceManager::PostInitialize(CArrayPtr &aTransport) + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitialize()")); + for (TInt i=0; i < aTransport.Count(); ++i) + { + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitilize. Processing Service Controller[%d]"), i)); + TRAPD(err,aTransport[i]->PostInitializeL()); + + // This is a special case for USB transport to notify the USB OBEX class controller about any errors occured + // at Post-Initialization stage. + // Post-initialization is not implemented for Bluetooth and IrDA transports, so there is no need to notify. + if ((err != KErrNone) && (iTransportType == ESrcsTransportUSB)) + { + (void)RProperty::Set(KUidObexSMCategory,KObexSMPostInitErrorProperty,err); + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitialize. Transport[%d]::PostInitializeL() returned %d, exiting..."), i, err)); + break; + } + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitialize() - DONE post initialization")); + } + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitialize() exit")); + } + // End of file diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexserviceman/plugins/inc/usb/obexsmusbconnection.h --- a/localconnectivityservice/obexserviceman/plugins/inc/usb/obexsmusbconnection.h Fri Mar 12 15:46:58 2010 +0200 +++ b/localconnectivityservice/obexserviceman/plugins/inc/usb/obexsmusbconnection.h 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" @@ -55,8 +55,13 @@ * EFalse: OBEX service is inactive. */ TBool IsOBEXActive(); - - + + /** + * Perform any outstanding initialization tasks + * + * @return none. + */ + void PostInitializeL(); private: @@ -96,7 +101,8 @@ private: CObexServer* iServer; // Obex Server CSrcsInterface* iController; // Service Controller callback - CImplementationInformation* iImplementationInfo; // Implementation Info + CImplementationInformation* iImplementationInfo; // Implementation Info + TUid iImplUid; }; #endif // OBEXSMUSBCONNECTION_H diff -r a2f12998bb04 -r a249528449c3 localconnectivityservice/obexserviceman/plugins/src/usb/obexsmusbconnection.cpp --- 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