diff -r ccb4f6b3db21 -r 8cb079868133 accessoryservices/accessoryserver/src/Server/AccSrvSettingsHandler.cpp --- a/accessoryservices/accessoryserver/src/Server/AccSrvSettingsHandler.cpp Tue Aug 31 16:29:05 2010 +0300 +++ b/accessoryservices/accessoryserver/src/Server/AccSrvSettingsHandler.cpp Wed Sep 01 12:34:26 2010 +0100 @@ -73,12 +73,10 @@ // ----------------------------------------------------------------------------- // CAccSrvSettingsHandler::CAccSrvSettingsHandler( CAccSrvConnectionController* aConCtrl, - CAccSrvServerModel& aModel, - CAccPolAccessoryPolicy* aPolicy ) + CAccSrvServerModel& aModel ) : iConCtrl( aConCtrl ), iModel( aModel ), - iLightsOn( EAccSettingsLightsNotSet ), - iPolicy( aPolicy ) + iLightsOn( EAccSettingsLightsNotSet ) { COM_TRACE_( "[AccFW:AccServer] CAccSrvSettingsHandler::CAccSrvSettingsHandler()" ); @@ -124,15 +122,13 @@ // CAccSrvSettingsHandler* CAccSrvSettingsHandler::NewL( CAccSrvConnectionController* aConCtrl, - CAccSrvServerModel& aModel, - CAccPolAccessoryPolicy* aPolicy ) + CAccSrvServerModel& aModel ) { COM_TRACE_( "[AccFW:AccServer] CAccSrvSettingsHandler::NewL()" ); CAccSrvSettingsHandler* self = new( ELeave ) CAccSrvSettingsHandler( aConCtrl, - aModel, - aPolicy ); + aModel ); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); @@ -268,7 +264,7 @@ l.Val( temp ); settings = static_cast< TUint32 >( temp ); - CleanupStack::PopAndDestroy ( &session ); + CleanupStack::PopAndDestroy ( &session ); CleanupStack::PopAndDestroy ( buf ); COM_TRACE_1( "[AccFW:AccServer] CAccSrvSettingsHandler::GetSupportedHWDevicesL() - return %d", settings ); @@ -290,8 +286,7 @@ // Valid settings TUint32 settings = ResolveNewSettingsL( aSettings, aEnable, aForce ); - TUint32 iOldDeviceType = iModel.DeviceType(); - + // Update model iModel.SetDeviceType( settings ); @@ -302,99 +297,6 @@ delete repository; repository = NULL; - //Check default selection. The newly set device-type after the model update. - TInt defaultSelection( iModel.DeviceType() ); - TInt iReplyValue = KASNoDevice; - TAccPolGenericID iGenericID; - - // get the last connected wired accessory - if(iModel.GetLastConnectedWiredAccessory(iGenericID)) - { - // Device Type Supplied - if( iGenericID.DeviceTypeCaps(KDTHeadset) ) - { - // This is a Headset - if( iPolicy->IsCapabilityDefinedL(iGenericID, KAccIntegratedAudioInput) ) - { - if(KASTTY == defaultSelection) - { - iReplyValue = defaultSelection; - } - else - { - iReplyValue = KASHeadset; - } - } - // This is a Headphone - else - { - if(KASMusicStand == defaultSelection) - { - iReplyValue = defaultSelection; - } - else - { - iReplyValue = KASHeadphones; - } - } - } - else if( iGenericID.DeviceTypeCaps(KDTTTY) ) - { - if( iPolicy->IsCapabilityDefinedL(iGenericID, KAccIntegratedAudioInput) ) - { - if(KASHeadset == defaultSelection) - { - iReplyValue = defaultSelection; - } - else - { - iReplyValue = KASTTY; - } - } - } - else if( iGenericID.DeviceTypeCaps(KDTOffice) ) - { - if(KASHeadphones == defaultSelection) - { - iReplyValue = defaultSelection; - } - else - { - iReplyValue = KASMusicStand; - } - } - // Device Type Not Supplied - else if( iGenericID.DeviceTypeCaps() == KASNoDevice ) - { - iReplyValue = defaultSelection; - } - - if( (KASNoDevice != iReplyValue) && (iReplyValue != iOldDeviceType) ) - { - //update generic id - iPolicy->UpdateGenericIDL( iGenericID, iReplyValue); - // Update the "iConnectionArray" of CAccSrvServerModel, - // to reflect the update on generic-id done earlier. - TAccPolGenericID oldGenericId; - iModel.FindWithUniqueIDL( iGenericID.UniqueID(), oldGenericId ); - - iConCtrl->HandleConnectionUpdateValidationL( - iGenericID, oldGenericId, this, KErrNone ); - - TASYCommandParamRecord asyCommandParamRecord; - asyCommandParamRecord.iCmdValue = 0;//Not used in update command - asyCommandParamRecord.iGenericID = iGenericID; - - //Send request to ASY Proxy Handler - COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionHandler::RunL() - Send update request"); - TInt trId = iConCtrl->HandleASYCommsL( ECmdAccessoryUpdated, - asyCommandParamRecord ); - - iConCtrl->HandleAccessoryModeChangedL(); - - } - } - COM_TRACE_( "[AccFW:AccServer] CAccSrvSettingsHandler::SetHWDeviceSettingsL() - return" ); }