diff -r 000000000000 -r 29b1cd4cb562 bthci/hci2implementations/CommandsEvents/symbian/src/commandcompleteevent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bthci/hci2implementations/CommandsEvents/symbian/src/commandcompleteevent.cpp Fri Jan 15 08:13:17 2010 +0200 @@ -0,0 +1,63 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// commandcompletevent.cpp +// +// + +/** + @file +*/ + +#include +#include +#include + +#include "symbiancommandseventsutils.h" + +#ifdef __FLOG_ACTIVE +_LIT8(KLogComponent, LOG_COMPONENT_COMMANDSEVENTS_SYMBIAN); +#endif + +THCICommandCompleteEvent::THCICommandCompleteEvent(TUint8 aParameterTotalLength, + TUint8 aNumHCICommandPackets, THCIOpcode aCommandOpcode, TDes8& aEventData) + : THCIEventBase(ECommandCompleteEvent, aParameterTotalLength, aEventData) + { + PutTUint8(aNumHCICommandPackets, aEventData); // Num_HCI_Command_Packets + PutTUint16(aCommandOpcode, aEventData); // Command_Opcode + // It is the responsibility of the most derived class to set iEventData + // from aEventData after event-specific data has been added in. + } + +THCICommandCompleteEvent::THCICommandCompleteEvent(const TDesC8& aEventData) + : THCIEventBase(aEventData) + { + } + +EXPORT_C TUint8 THCICommandCompleteEvent::NumHCICommandPackets() const + { + //Command credits are 3rd byte (octet) of the iEventData + return(iEventData[2]); + } + +EXPORT_C THCIOpcode THCICommandCompleteEvent::CommandOpcode() const + { + // Command_Opcode is in the 4th and 5th octet of a Command_Complete event + return AsTUint16(3); + } + +EXPORT_C THCICommandCompleteEvent& THCICommandCompleteEvent::Cast(const THCIEventBase& aEvent) + { + __ASSERT_ALWAYS(aEvent.EventCode()==ECommandCompleteEvent, PANIC(KSymbianCommandsEventsPanicCat, EWrongEventCode)); + return *(reinterpret_cast(&const_cast(aEvent))); + }