bluetooth/btstack/secman/secmanhci.cpp
branchRCL_3
changeset 22 9f17f914e828
parent 0 29b1cd4cb562
equal deleted inserted replaced
18:f8503e232b0c 22:9f17f914e828
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   116 	LOG_FUNC
   116 	LOG_FUNC
   117 	__ASSERT_DEBUG(iCommandQueue, PANIC(KBTSecPanic, EBTSecCommandQueueNotAvailable));
   117 	__ASSERT_DEBUG(iCommandQueue, PANIC(KBTSecPanic, EBTSecCommandQueueNotAvailable));
   118 	return *iCommandQueue;
   118 	return *iCommandQueue;
   119 	}
   119 	}
   120 
   120 
   121 void CSecManCommandController::WriteSimplePairingModeL(TUint8 aSimplePairingMode)
       
   122 	{
       
   123 	LOG_FUNC
       
   124 	// Ownership of cmd transfered
       
   125 	CWriteSimplePairingModeCommand* cmd = CWriteSimplePairingModeCommand::NewL(aSimplePairingMode);
       
   126 	CommandQueue().MhcqAddCommandL(cmd, *this);
       
   127 	}
       
   128 
       
   129 void CSecManCommandController::WriteSimplePairingDebugModeL(TUint8 aSimplePairingDebugMode)
   121 void CSecManCommandController::WriteSimplePairingDebugModeL(TUint8 aSimplePairingDebugMode)
   130 	{
   122 	{
   131 	LOG_FUNC
   123 	LOG_FUNC
   132 	// Ownership of cmd transfered
   124 	// Ownership of cmd transfered
   133 	CWriteSimplePairingDebugModeCommand* cmd = CWriteSimplePairingDebugModeCommand::NewL(aSimplePairingDebugMode);
   125 	CWriteSimplePairingDebugModeCommand* cmd = CWriteSimplePairingDebugModeCommand::NewL(aSimplePairingDebugMode);
   205 	{
   197 	{
   206 	LOG_FUNC
   198 	LOG_FUNC
   207 	switch(aEvent.EventCode())
   199 	switch(aEvent.EventCode())
   208 		{
   200 		{
   209 	case ECommandCompleteEvent:
   201 	case ECommandCompleteEvent:
   210 		{
       
   211 		CommandCompleteEvent(aEvent);
   202 		CommandCompleteEvent(aEvent);
   212 		break;
   203 		break;
   213 		}
       
   214 		
   204 		
   215 	case ECommandStatusEvent:
   205 	case ECommandStatusEvent:
   216 		CommandStatusEvent(aEvent);
   206 		CommandStatusEvent(aEvent);
   217 		break;
   207 		break;
   218 		
   208 		
   312 	const THCICommandCompleteEvent& completeEvent = THCICommandCompleteEvent::Cast(aEvent);
   302 	const THCICommandCompleteEvent& completeEvent = THCICommandCompleteEvent::Cast(aEvent);
   313 	THCIOpcode opcode = completeEvent.CommandOpcode();
   303 	THCIOpcode opcode = completeEvent.CommandOpcode();
   314 	THCIErrorCode hciErr = aEvent.ErrorCode();
   304 	THCIErrorCode hciErr = aEvent.ErrorCode();
   315 	
   305 	
   316 	switch (opcode)
   306 	switch (opcode)
   317 		{
   307 		{	
   318 	case KWriteSimplePairingModeOpcode:
       
   319 		WriteSimplePairingModeOpcode(completeEvent);
       
   320 		break;
       
   321 		
       
   322 	case KRemoteOOBDataRequestReplyOpcode:
   308 	case KRemoteOOBDataRequestReplyOpcode:
   323 		RemoteOOBDataRequestReplyOpcode(completeEvent);
   309 		RemoteOOBDataRequestReplyOpcode(completeEvent);
   324 		break;
   310 		break;
   325 		
   311 		
   326 	case KRemoteOOBDataRequestNegativeReplyOpcode:
   312 	case KRemoteOOBDataRequestNegativeReplyOpcode:
   362 	const TCommandStatusEvent& commandStatusEvent = TCommandStatusEvent::Cast(aEvent);
   348 	const TCommandStatusEvent& commandStatusEvent = TCommandStatusEvent::Cast(aEvent);
   363 	THCIOpcode opcode = commandStatusEvent.CommandOpcode();
   349 	THCIOpcode opcode = commandStatusEvent.CommandOpcode();
   364 	THCIErrorCode hciErr = commandStatusEvent.ErrorCode();
   350 	THCIErrorCode hciErr = commandStatusEvent.ErrorCode();
   365 	}
   351 	}
   366 
   352 
   367 void CSecManCommandController::WriteSimplePairingModeOpcode(const THCICommandCompleteEvent& aCompleteEvent)
       
   368 	{
       
   369 	LOG_FUNC
       
   370 	if(aCompleteEvent.ErrorCode() == EOK)
       
   371 		{
       
   372 		iSecMan.SetLocalSimplePairingMode(ETrue);
       
   373 		}
       
   374 	// if we got an error then we make the reasonable assumption that the local controller is not
       
   375 	// capable of secure simple pairing.
       
   376 	}
       
   377 
       
   378 void CSecManCommandController::RemoteOOBDataRequestReplyOpcode(const THCICommandCompleteEvent& aCompleteEvent)
   353 void CSecManCommandController::RemoteOOBDataRequestReplyOpcode(const THCICommandCompleteEvent& aCompleteEvent)
   379 	{
   354 	{
   380 	LOG_FUNC
   355 	LOG_FUNC
   381 	const TRemoteOOBDataRequestReplyCompleteEvent& event = TRemoteOOBDataRequestReplyCompleteEvent::Cast(aCompleteEvent);
   356 	const TRemoteOOBDataRequestReplyCompleteEvent& event = TRemoteOOBDataRequestReplyCompleteEvent::Cast(aCompleteEvent);
   382 	iSecMan.RemoteOOBDataRequestComplete(event.BDADDR());
   357 	iSecMan.RemoteOOBDataRequestComplete(event.BDADDR());