bthci/hci2implementations/CommandsEvents/symbian/src/iocapabilityrequestreplycommand.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This file was generated automatically from the template commandsource.tmpl
       
    15 // on Mon, 02 Jun 2008 11:36:14 (time stamp)
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22 */
       
    23 
       
    24 #include <bluetooth/hci/iocapabilityrequestreplycommand.h>
       
    25 #include <bluetooth/hci/event.h>
       
    26 #include <bluetooth/hci/commandcompleteevent.h>
       
    27 #include <bluetooth/hci/hciframe.h>
       
    28 #include <bluetooth/hci/hciopcodes.h>
       
    29 #include <bluetooth/hci/iocapabilityresponseevent.h>
       
    30 #include <bluetooth/hci/remoteoobdatarequestevent.h>
       
    31 
       
    32 
       
    33 #ifdef __FLOG_ACTIVE
       
    34 _LIT8(KLogComponent, LOG_COMPONENT_COMMANDSEVENTS_SYMBIAN);
       
    35 #endif
       
    36 
       
    37 
       
    38 
       
    39 // Factory methods
       
    40 
       
    41 EXPORT_C CIOCapabilityRequestReplyCommand* CIOCapabilityRequestReplyCommand::NewL(const TBTDevAddr& aBDADDR, TUint8 aIOCapability, TUint8 aOOBDataPresent, TUint8 aAuthenticationRequirements)
       
    42 	{
       
    43 	CIOCapabilityRequestReplyCommand* self = new (ELeave) CIOCapabilityRequestReplyCommand(aBDADDR, aIOCapability, aOOBDataPresent, aAuthenticationRequirements);
       
    44 	CleanupStack::PushL(self);
       
    45 	self->CHCICommandBase::BaseConstructL();
       
    46 	CleanupStack::Pop(self);
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 EXPORT_C CIOCapabilityRequestReplyCommand* CIOCapabilityRequestReplyCommand::NewL()
       
    51 	{
       
    52 	CIOCapabilityRequestReplyCommand* self = new (ELeave) CIOCapabilityRequestReplyCommand();
       
    53 	CleanupStack::PushL(self);
       
    54 	self->CHCICommandBase::BaseConstructL();
       
    55 	CleanupStack::Pop(self);
       
    56 	return self;
       
    57 	}
       
    58 
       
    59 // Constructors
       
    60 
       
    61 CIOCapabilityRequestReplyCommand::CIOCapabilityRequestReplyCommand(const TBTDevAddr& aBDADDR, TUint8 aIOCapability, TUint8 aOOBDataPresent, TUint8 aAuthenticationRequirements)
       
    62 	: CHCICommandBase(KIOCapabilityRequestReplyOpcode)
       
    63 	, iBDADDR(aBDADDR)
       
    64 	, iIOCapability(aIOCapability)
       
    65 	, iOOBDataPresent(aOOBDataPresent)
       
    66 	, iAuthenticationRequirements(aAuthenticationRequirements)
       
    67 	{
       
    68 	SetExpectsCommandStatusEvent(EFalse);
       
    69 	}
       
    70 
       
    71 CIOCapabilityRequestReplyCommand::CIOCapabilityRequestReplyCommand()
       
    72 	: CHCICommandBase(KIOCapabilityRequestReplyOpcode)
       
    73 	{
       
    74 	SetExpectsCommandStatusEvent(EFalse);
       
    75 	}
       
    76 
       
    77 // Destructor
       
    78 CIOCapabilityRequestReplyCommand::~CIOCapabilityRequestReplyCommand()
       
    79 	{
       
    80 	
       
    81 	}	
       
    82 
       
    83 /*virtual*/ void CIOCapabilityRequestReplyCommand::Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const
       
    84 	{
       
    85 	if (aEvent.EventCode() == EIOCapabilityResponseEvent)
       
    86 		{
       
    87 		aMatchesCmd = ETrue;
       
    88 		aConcludesCmd = EFalse;
       
    89 		aContinueMatching = EFalse;
       
    90 		}
       
    91 	else if (aEvent.EventCode() == ERemoteOOBDataRequestEvent)
       
    92 		{
       
    93 		aMatchesCmd = ETrue;
       
    94 		aConcludesCmd = EFalse;
       
    95 		aContinueMatching = EFalse;
       
    96 		}
       
    97 	// Command Status Event and default Command Complete Event matching
       
    98 	// is implemented in the base class.  If we haven't matched already
       
    99 	// then we should try the default matching.
       
   100 	if (!aMatchesCmd)
       
   101 		{
       
   102 		CHCICommandBase::Match(aEvent, aMatchesCmd, aConcludesCmd, aContinueMatching);
       
   103 		}
       
   104 	}
       
   105 	
       
   106 
       
   107 // Override of pure virtual from CHCICommandBase. This method embodies the knowledge
       
   108 // of how to format the specifics of this command into the HCTL command frame.
       
   109 void CIOCapabilityRequestReplyCommand::Format(CHctlCommandFrame& aCommandFrame) const
       
   110 	{
       
   111 	aCommandFrame.PutDevAddr(iBDADDR);
       
   112 	aCommandFrame.PutByte(iIOCapability);
       
   113 	aCommandFrame.PutByte(iOOBDataPresent);
       
   114 	aCommandFrame.PutByte(iAuthenticationRequirements);
       
   115 	}
       
   116 
       
   117 // Assign new values to the parameters of this command
       
   118 EXPORT_C void CIOCapabilityRequestReplyCommand::Reset(const TBTDevAddr& aBDADDR, TUint8 aIOCapability, TUint8 aOOBDataPresent, TUint8 aAuthenticationRequirements)
       
   119 	{
       
   120 	iBDADDR = aBDADDR;
       
   121 	iIOCapability = aIOCapability;
       
   122 	iOOBDataPresent = aOOBDataPresent;
       
   123 	iAuthenticationRequirements = aAuthenticationRequirements;
       
   124 	}
       
   125 
       
   126 // Accessor methods for the parameters of the command
       
   127 
       
   128 EXPORT_C TBTDevAddr CIOCapabilityRequestReplyCommand::BDADDR() const
       
   129 	{
       
   130 	return iBDADDR;
       
   131 	}
       
   132 
       
   133 EXPORT_C TUint8 CIOCapabilityRequestReplyCommand::IOCapability() const
       
   134 	{
       
   135 	return iIOCapability;
       
   136 	}
       
   137 
       
   138 EXPORT_C TUint8 CIOCapabilityRequestReplyCommand::OOBDataPresent() const
       
   139 	{
       
   140 	return iOOBDataPresent;
       
   141 	}
       
   142 
       
   143 EXPORT_C TUint8 CIOCapabilityRequestReplyCommand::AuthenticationRequirements() const
       
   144 	{
       
   145 	return iAuthenticationRequirements;
       
   146 	}
       
   147 
       
   148 
       
   149 
       
   150 // Extension function.  Use this to retrieve any extension interfaces from CIOCapabilityRequestReplyCommand
       
   151 // or any class from which it derives.
       
   152 /*virtual*/ TInt CIOCapabilityRequestReplyCommand::Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData)
       
   153 	{
       
   154 	// To add an additional interface implementation specific for this class check the 
       
   155 	// provided ID and return an appropriate interface.
       
   156 
       
   157 	// If a specific interface implementation is not provided - forward the call to the base class.
       
   158 	return CHCICommandBase::Extension_(aExtensionId, aInterface, aData);
       
   159 	}
       
   160