bthci/hci2implementations/CommandsEvents/symbian/src/acceptsynchronousconnectionrequestcommand.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:51 (time stamp)
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22 */
       
    23 
       
    24 #include <bluetooth/hci/acceptsynchronousconnectionrequestcommand.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/synchronousconnectioncompleteevent.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 CAcceptSynchronousConnectionRequestCommand* CAcceptSynchronousConnectionRequestCommand::NewL(const TBTDevAddr& aBDADDR, TUint32 aTransmitBandwidth, TUint32 aReceiveBandwidth, TUint16 aMaxLatency, TUint16 aContentFormat, TUint8 aRetransmissionEffort, TUint16 aPacketType)
       
    41 	{
       
    42 	CAcceptSynchronousConnectionRequestCommand* self = new (ELeave) CAcceptSynchronousConnectionRequestCommand(aBDADDR, aTransmitBandwidth, aReceiveBandwidth, aMaxLatency, aContentFormat, aRetransmissionEffort, aPacketType);
       
    43 	CleanupStack::PushL(self);
       
    44 	self->CHCICommandBase::BaseConstructL();
       
    45 	CleanupStack::Pop(self);
       
    46 	return self;
       
    47 	}
       
    48 
       
    49 EXPORT_C CAcceptSynchronousConnectionRequestCommand* CAcceptSynchronousConnectionRequestCommand::NewL()
       
    50 	{
       
    51 	CAcceptSynchronousConnectionRequestCommand* self = new (ELeave) CAcceptSynchronousConnectionRequestCommand();
       
    52 	CleanupStack::PushL(self);
       
    53 	self->CHCICommandBase::BaseConstructL();
       
    54 	CleanupStack::Pop(self);
       
    55 	return self;
       
    56 	}
       
    57 
       
    58 // Constructors
       
    59 
       
    60 CAcceptSynchronousConnectionRequestCommand::CAcceptSynchronousConnectionRequestCommand(const TBTDevAddr& aBDADDR, TUint32 aTransmitBandwidth, TUint32 aReceiveBandwidth, TUint16 aMaxLatency, TUint16 aContentFormat, TUint8 aRetransmissionEffort, TUint16 aPacketType)
       
    61 	: CHCICommandBase(KAcceptSynchronousConnectionRequestOpcode)
       
    62 	, iBDADDR(aBDADDR)
       
    63 	, iTransmitBandwidth(aTransmitBandwidth)
       
    64 	, iReceiveBandwidth(aReceiveBandwidth)
       
    65 	, iMaxLatency(aMaxLatency)
       
    66 	, iContentFormat(aContentFormat)
       
    67 	, iRetransmissionEffort(aRetransmissionEffort)
       
    68 	, iPacketType(aPacketType)
       
    69 	{
       
    70 	SetExpectsCommandCompleteEvent(EFalse);
       
    71 	}
       
    72 
       
    73 CAcceptSynchronousConnectionRequestCommand::CAcceptSynchronousConnectionRequestCommand()
       
    74 	: CHCICommandBase(KAcceptSynchronousConnectionRequestOpcode)
       
    75 	{
       
    76 	SetExpectsCommandCompleteEvent(EFalse);
       
    77 	}
       
    78 
       
    79 // Destructor
       
    80 CAcceptSynchronousConnectionRequestCommand::~CAcceptSynchronousConnectionRequestCommand()
       
    81 	{
       
    82 	
       
    83 	}	
       
    84 
       
    85 /*virtual*/ void CAcceptSynchronousConnectionRequestCommand::Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const
       
    86 	{
       
    87 	if (aEvent.EventCode() == ESynchronousConnectionCompleteEvent)
       
    88 		{
       
    89 		TSynchronousConnectionCompleteEvent& event = TSynchronousConnectionCompleteEvent::Cast(aEvent);
       
    90 		if (event.BDADDR() == BDADDR())
       
    91 			{
       
    92 			aMatchesCmd = ETrue;
       
    93 			aConcludesCmd = ETrue;
       
    94 			aContinueMatching = EFalse;
       
    95 			}
       
    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 CAcceptSynchronousConnectionRequestCommand::Format(CHctlCommandFrame& aCommandFrame) const
       
   110 	{
       
   111 	aCommandFrame.PutDevAddr(iBDADDR);
       
   112 	aCommandFrame.PutBytes32(iTransmitBandwidth, 4);
       
   113 	aCommandFrame.PutBytes32(iReceiveBandwidth, 4);
       
   114 	aCommandFrame.PutBytes16(iMaxLatency);
       
   115 	aCommandFrame.PutBytes16(iContentFormat);
       
   116 	aCommandFrame.PutByte(iRetransmissionEffort);
       
   117 	aCommandFrame.PutBytes16(iPacketType);
       
   118 	}
       
   119 
       
   120 // Assign new values to the parameters of this command
       
   121 EXPORT_C void CAcceptSynchronousConnectionRequestCommand::Reset(const TBTDevAddr& aBDADDR, TUint32 aTransmitBandwidth, TUint32 aReceiveBandwidth, TUint16 aMaxLatency, TUint16 aContentFormat, TUint8 aRetransmissionEffort, TUint16 aPacketType)
       
   122 	{
       
   123 	iBDADDR = aBDADDR;
       
   124 	iTransmitBandwidth = aTransmitBandwidth;
       
   125 	iReceiveBandwidth = aReceiveBandwidth;
       
   126 	iMaxLatency = aMaxLatency;
       
   127 	iContentFormat = aContentFormat;
       
   128 	iRetransmissionEffort = aRetransmissionEffort;
       
   129 	iPacketType = aPacketType;
       
   130 	}
       
   131 
       
   132 // Accessor methods for the parameters of the command
       
   133 
       
   134 EXPORT_C TBTDevAddr CAcceptSynchronousConnectionRequestCommand::BDADDR() const
       
   135 	{
       
   136 	return iBDADDR;
       
   137 	}
       
   138 
       
   139 EXPORT_C TUint32 CAcceptSynchronousConnectionRequestCommand::TransmitBandwidth() const
       
   140 	{
       
   141 	return iTransmitBandwidth;
       
   142 	}
       
   143 
       
   144 EXPORT_C TUint32 CAcceptSynchronousConnectionRequestCommand::ReceiveBandwidth() const
       
   145 	{
       
   146 	return iReceiveBandwidth;
       
   147 	}
       
   148 
       
   149 EXPORT_C TUint16 CAcceptSynchronousConnectionRequestCommand::MaxLatency() const
       
   150 	{
       
   151 	return iMaxLatency;
       
   152 	}
       
   153 
       
   154 EXPORT_C TUint16 CAcceptSynchronousConnectionRequestCommand::ContentFormat() const
       
   155 	{
       
   156 	return iContentFormat;
       
   157 	}
       
   158 
       
   159 EXPORT_C TUint8 CAcceptSynchronousConnectionRequestCommand::RetransmissionEffort() const
       
   160 	{
       
   161 	return iRetransmissionEffort;
       
   162 	}
       
   163 
       
   164 EXPORT_C TUint16 CAcceptSynchronousConnectionRequestCommand::PacketType() const
       
   165 	{
       
   166 	return iPacketType;
       
   167 	}
       
   168 
       
   169 
       
   170 
       
   171 // Extension function.  Use this to retrieve any extension interfaces from CAcceptSynchronousConnectionRequestCommand
       
   172 // or any class from which it derives.
       
   173 /*virtual*/ TInt CAcceptSynchronousConnectionRequestCommand::Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData)
       
   174 	{
       
   175 	// To add an additional interface implementation specific for this class check the 
       
   176 	// provided ID and return an appropriate interface.
       
   177 
       
   178 	// If a specific interface implementation is not provided - forward the call to the base class.
       
   179 	return CHCICommandBase::Extension_(aExtensionId, aInterface, aData);
       
   180 	}
       
   181