bthci/hci2implementations/CommandsEvents/symbian/src/createaclconnectioncommand.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 Thu, 29 May 2008 15:17:47 (time stamp)
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22 */
       
    23 
       
    24 #include <bluetooth/hci/createaclconnectioncommand.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/connectioncompleteevent.h>
       
    30 
       
    31 
       
    32 #ifdef __FLOG_ACTIVE
       
    33 _LIT8(KLogComponent, LOG_COMPONENT_COMMANDSEVENTS_SYMBIAN);
       
    34 #endif
       
    35 
       
    36 
       
    37 
       
    38 // Factory methods
       
    39 
       
    40 EXPORT_C CCreateACLConnectionCommand* CCreateACLConnectionCommand::NewL(const TBTDevAddr& aBDADDR, TUint16 aPacketType, THCIPageScanRepetitionMode aPageScanRepetitionMode, THCIReservedOctet aReserved, THCIClockOffset aClockOffset, TUint8 aAllowRoleSwitch)
       
    41 	{
       
    42 	CCreateACLConnectionCommand* self = new (ELeave) CCreateACLConnectionCommand(aBDADDR, aPacketType, aPageScanRepetitionMode, aReserved, aClockOffset, aAllowRoleSwitch);
       
    43 	CleanupStack::PushL(self);
       
    44 	self->CHCICommandBase::BaseConstructL();
       
    45 	CleanupStack::Pop(self);
       
    46 	return self;
       
    47 	}
       
    48 
       
    49 EXPORT_C CCreateACLConnectionCommand* CCreateACLConnectionCommand::NewL()
       
    50 	{
       
    51 	CCreateACLConnectionCommand* self = new (ELeave) CCreateACLConnectionCommand();
       
    52 	CleanupStack::PushL(self);
       
    53 	self->CHCICommandBase::BaseConstructL();
       
    54 	CleanupStack::Pop(self);
       
    55 	return self;
       
    56 	}
       
    57 
       
    58 // Constructors
       
    59 
       
    60 CCreateACLConnectionCommand::CCreateACLConnectionCommand(const TBTDevAddr& aBDADDR, TUint16 aPacketType, THCIPageScanRepetitionMode aPageScanRepetitionMode, THCIReservedOctet aReserved, THCIClockOffset aClockOffset, TUint8 aAllowRoleSwitch)
       
    61 	: CHCICommandBase(KCreateACLConnectionOpcode)
       
    62 	, iBDADDR(aBDADDR)
       
    63 	, iPacketType(aPacketType)
       
    64 	, iPageScanRepetitionMode(aPageScanRepetitionMode)
       
    65 	, iReserved(aReserved)
       
    66 	, iClockOffset(aClockOffset)
       
    67 	, iAllowRoleSwitch(aAllowRoleSwitch)
       
    68 	{
       
    69 	SetExpectsCommandCompleteEvent(EFalse);
       
    70 	}
       
    71 
       
    72 CCreateACLConnectionCommand::CCreateACLConnectionCommand()
       
    73 	: CHCICommandBase(KCreateACLConnectionOpcode)
       
    74 	{
       
    75 	SetExpectsCommandCompleteEvent(EFalse);
       
    76 	}
       
    77 
       
    78 // Destructor
       
    79 CCreateACLConnectionCommand::~CCreateACLConnectionCommand()
       
    80 	{
       
    81 	
       
    82 	}	
       
    83 
       
    84 /*virtual*/ void CCreateACLConnectionCommand::Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const
       
    85 	{
       
    86 	if (aEvent.EventCode() == EConnectionCompleteEvent)
       
    87 		{
       
    88 		TConnectionCompleteEvent& event = TConnectionCompleteEvent::Cast(aEvent);
       
    89 		if (event.BDADDR() == BDADDR())
       
    90 			{
       
    91 			aMatchesCmd = ETrue;
       
    92 			aConcludesCmd = ETrue;
       
    93 			aContinueMatching = EFalse;
       
    94 			}
       
    95 		}
       
    96 	// Command Status Event and default Command Complete Event matching
       
    97 	// is implemented in the base class.  If we haven't matched already
       
    98 	// then we should try the default matching.
       
    99 	if (!aMatchesCmd)
       
   100 		{
       
   101 		CHCICommandBase::Match(aEvent, aMatchesCmd, aConcludesCmd, aContinueMatching);
       
   102 		}
       
   103 	}
       
   104 	
       
   105 
       
   106 // Override of pure virtual from CHCICommandBase. This method embodies the knowledge
       
   107 // of how to format the specifics of this command into the HCTL command frame.
       
   108 void CCreateACLConnectionCommand::Format(CHctlCommandFrame& aCommandFrame) const
       
   109 	{
       
   110 	aCommandFrame.PutDevAddr(iBDADDR);
       
   111 	aCommandFrame.PutBytes16(iPacketType);
       
   112 	aCommandFrame.PutByte(iPageScanRepetitionMode);
       
   113 	aCommandFrame.PutByte(iReserved);
       
   114 	aCommandFrame.PutBytes16(iClockOffset);
       
   115 	aCommandFrame.PutByte(iAllowRoleSwitch);
       
   116 	}
       
   117 
       
   118 // Assign new values to the parameters of this command
       
   119 EXPORT_C void CCreateACLConnectionCommand::Reset(const TBTDevAddr& aBDADDR, TUint16 aPacketType, THCIPageScanRepetitionMode aPageScanRepetitionMode, THCIReservedOctet aReserved, THCIClockOffset aClockOffset, TUint8 aAllowRoleSwitch)
       
   120 	{
       
   121 	iBDADDR = aBDADDR;
       
   122 	iPacketType = aPacketType;
       
   123 	iPageScanRepetitionMode = aPageScanRepetitionMode;
       
   124 	iReserved = aReserved;
       
   125 	iClockOffset = aClockOffset;
       
   126 	iAllowRoleSwitch = aAllowRoleSwitch;
       
   127 	}
       
   128 
       
   129 // Accessor methods for the parameters of the command
       
   130 
       
   131 EXPORT_C TBTDevAddr CCreateACLConnectionCommand::BDADDR() const
       
   132 	{
       
   133 	return iBDADDR;
       
   134 	}
       
   135 
       
   136 EXPORT_C TUint16 CCreateACLConnectionCommand::PacketType() const
       
   137 	{
       
   138 	return iPacketType;
       
   139 	}
       
   140 
       
   141 EXPORT_C THCIPageScanRepetitionMode CCreateACLConnectionCommand::PageScanRepetitionMode() const
       
   142 	{
       
   143 	return iPageScanRepetitionMode;
       
   144 	}
       
   145 
       
   146 EXPORT_C THCIReservedOctet CCreateACLConnectionCommand::Reserved() const
       
   147 	{
       
   148 	return iReserved;
       
   149 	}
       
   150 
       
   151 EXPORT_C THCIClockOffset CCreateACLConnectionCommand::ClockOffset() const
       
   152 	{
       
   153 	return iClockOffset;
       
   154 	}
       
   155 
       
   156 EXPORT_C TUint8 CCreateACLConnectionCommand::AllowRoleSwitch() const
       
   157 	{
       
   158 	return iAllowRoleSwitch;
       
   159 	}
       
   160 
       
   161 
       
   162 
       
   163 // Extension function.  Use this to retrieve any extension interfaces from CCreateACLConnectionCommand
       
   164 // or any class from which it derives.
       
   165 /*virtual*/ TInt CCreateACLConnectionCommand::Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData)
       
   166 	{
       
   167 	// To add an additional interface implementation specific for this class check the 
       
   168 	// provided ID and return an appropriate interface.
       
   169 
       
   170 	// If a specific interface implementation is not provided - forward the call to the base class.
       
   171 	return CHCICommandBase::Extension_(aExtensionId, aInterface, aData);
       
   172 	}
       
   173