bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpoutgoingcommandhandler.cpp
branchRCL_3
changeset 14 2f88a7d66f50
parent 0 f63038272f30
equal deleted inserted replaced
12:b23265fb36da 14:2f88a7d66f50
    43 @param aRouter	A CRcpRouter to use for communication with remote devices.
    43 @param aRouter	A CRcpRouter to use for communication with remote devices.
    44 @param aTimer	CDeltaTimer to use for queuing timed events.
    44 @param aTimer	CDeltaTimer to use for queuing timed events.
    45 @return A fully constructed CRcpOutgoingCommandHandler.
    45 @return A fully constructed CRcpOutgoingCommandHandler.
    46 @leave System wide error codes.
    46 @leave System wide error codes.
    47 */
    47 */
    48 CRcpOutgoingCommandHandler* CRcpOutgoingCommandHandler::NewL(CRemConBearerAvrcp& aBearer, 
    48 CRcpOutgoingCommandHandler* CRcpOutgoingCommandHandler::NewL(MRemConControlCommandInterface& aCommandInterface, 
    49 	MRemConBearerObserver& aObserver,
    49 	MRemConBearerObserver& aObserver,
    50 	CRcpRouter& aRouter,
    50 	CRcpRouter& aRouter,
    51 	CDeltaTimer& aTimer)
    51 	CDeltaTimer& aTimer)
    52 	{
    52 	{
    53 	LOG_STATIC_FUNC
    53 	LOG_STATIC_FUNC
    54 	CRcpOutgoingCommandHandler* handler = new(ELeave)CRcpOutgoingCommandHandler(aBearer, aObserver, aRouter, aTimer);
    54 	CRcpOutgoingCommandHandler* handler = new(ELeave)CRcpOutgoingCommandHandler(aCommandInterface, aObserver, aRouter, aTimer);
    55 	return handler;
    55 	return handler;
    56 	}
    56 	}
    57 
    57 
    58 /** Constructor.
    58 /** Constructor.
    59 
    59 
    62 @param aRouter	A CRcpRouter to use for communication with remote devices.
    62 @param aRouter	A CRcpRouter to use for communication with remote devices.
    63 @param aTimer	CDeltaTimer to use for queuing timed events.
    63 @param aTimer	CDeltaTimer to use for queuing timed events.
    64 @return A partially constructed CRcpIncomingCommandHandler.
    64 @return A partially constructed CRcpIncomingCommandHandler.
    65 @leave System wide error codes.
    65 @leave System wide error codes.
    66 */		
    66 */		
    67 CRcpOutgoingCommandHandler::CRcpOutgoingCommandHandler(CRemConBearerAvrcp& aBearer, 
    67 CRcpOutgoingCommandHandler::CRcpOutgoingCommandHandler(MRemConControlCommandInterface& aCommandInterface, 
    68 	MRemConBearerObserver& aObserver,
    68 	MRemConBearerObserver& aObserver,
    69 	CRcpRouter& aRouter,
    69 	CRcpRouter& aRouter,
    70 	CDeltaTimer& aTimer) : iCommandQueue(_FOFF(CControlCommand, iHandlingLink)),
    70 	CDeltaTimer& aTimer) : iCommandQueue(_FOFF(CControlCommand, iHandlingLink)),
    71 	iNotifyCommandQueue(_FOFF(CControlCommand, iHandlingLink)),
    71 	iNotifyCommandQueue(_FOFF(CControlCommand, iHandlingLink)),
    72 	iBearer(aBearer), iObserver(aObserver), iRouter(aRouter), iTimer(aTimer)
    72 	iCommandInterface(aCommandInterface), iObserver(aObserver), iRouter(aRouter), iTimer(aTimer)
    73 	{
    73 	{
    74 	LOG_FUNC
    74 	LOG_FUNC
    75 	}
    75 	}
    76 
    76 
    77 /** Destructor.
    77 /** Destructor.
   279 			err = aCommand->ParseIncomingResponse(iObserver, aCommand->Frame());
   279 			err = aCommand->ParseIncomingResponse(iObserver, aCommand->Frame());
   280 			}
   280 			}
   281 		
   281 		
   282 		if ( aNotify )
   282 		if ( aNotify )
   283 		    {//This is a notify command
   283 		    {//This is a notify command
   284 		    iBearer.MrccciNewNotifyResponse(*aCommand);
   284 		    iCommandInterface.MrccciNewNotifyResponse(*aCommand);
   285 		    }
   285 		    }
   286 		else
   286 		else
   287 			{
   287 			{
   288 			iBearer.MrccciNewResponse(*aCommand);
   288 			iCommandInterface.MrccciNewResponse(*aCommand);
   289 			}
   289 			}
   290 		}
   290 		}
   291 
   291 
   292 	TBool doDeque = ETrue;
   292 	TBool doDeque = ETrue;
   293 	if ( (!aIpidBitSet) && (err == KErrNone) && (aNotify) && (aFrame->Type() == AVC::EInterim))
   293 	if ( (!aIpidBitSet) && (err == KErrNone) && (aNotify) && (aFrame->Type() == AVC::EInterim))
   329 		CControlCommand* command = FindInQueue(iNotifyCommandQueue, aCommand.TransactionLabel());
   329 		CControlCommand* command = FindInQueue(iNotifyCommandQueue, aCommand.TransactionLabel());
   330 		
   330 		
   331 		if(command)
   331 		if(command)
   332 			{
   332 			{
   333 			command->SetNotifyVolumeChangeResult(command->Frame());
   333 			command->SetNotifyVolumeChangeResult(command->Frame());
   334 			iBearer.MrccciNewNotifyResponse(*command);
   334 			iCommandInterface.MrccciNewNotifyResponse(*command);
   335 			}
   335 			}
   336 		else
   336 		else
   337 			{
   337 			{
   338 			command = FindInQueue(iCommandQueue, aCommand.TransactionLabel());
   338 			command = FindInQueue(iCommandQueue, aCommand.TransactionLabel());
   339 			
   339 			
   351 						command->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue);
   351 						command->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue);
   352 						}
   352 						}
   353 					}
   353 					}
   354 				}
   354 				}
   355 			
   355 			
   356 			iBearer.MrccciNewResponse(*command);
   356 			iCommandInterface.MrccciNewResponse(*command);
   357 			}
   357 			}
   358 		
   358 		
   359 		command->iHandlingLink.Deque();
   359 		command->iHandlingLink.Deque();
   360 		command->DecrementUsers();
   360 		command->DecrementUsers();
   361 		}
   361 		}
   576 			else
   576 			else
   577 				{
   577 				{
   578 				aCommand.SetCoreButtonAction(ERemConCoreApiButtonRelease, ETrue);
   578 				aCommand.SetCoreButtonAction(ERemConCoreApiButtonRelease, ETrue);
   579 				}
   579 				}
   580 
   580 
   581 			iBearer.MrccciNewResponse(aCommand);
   581 			iCommandInterface.MrccciNewResponse(aCommand);
   582            }
   582            }
   583 		}	
   583 		}	
   584 	}
   584 	}
   585 	
   585 	
   586 /** Generate a command to the remote.
   586 /** Generate a command to the remote.