bthci/hci2implementations/CommandsEvents/symbian/src/hostnumberofcompletedpacketscommand.cpp
changeset 0 29b1cd4cb562
child 16 9f17f914e828
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:49 (time stamp)
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22 */
       
    23 
       
    24 #include <bluetooth/hci/hostnumberofcompletedpacketscommand.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 
       
    30 
       
    31 #ifdef __FLOG_ACTIVE
       
    32 _LIT8(KLogComponent, LOG_COMPONENT_COMMANDSEVENTS_SYMBIAN);
       
    33 #endif
       
    34 
       
    35 
       
    36 
       
    37 // Factory methods
       
    38 
       
    39 EXPORT_C CHostNumberOfCompletedPacketsCommand* CHostNumberOfCompletedPacketsCommand::NewL(TUint8 aNumberOfHandles, const RArray< THCIConnectionHandle >& aConnectionHandle, const RArray< THCINumOfCompletedPackets >& aHostNumOfCompletedPackets)
       
    40 	{
       
    41 	CHostNumberOfCompletedPacketsCommand* self = new (ELeave) CHostNumberOfCompletedPacketsCommand(aNumberOfHandles, aConnectionHandle, aHostNumOfCompletedPackets);
       
    42 	CleanupStack::PushL(self);
       
    43 	self->CHCICommandBase::BaseConstructL();
       
    44 	CleanupStack::Pop(self);
       
    45 	return self;
       
    46 	}
       
    47 
       
    48 EXPORT_C CHostNumberOfCompletedPacketsCommand* CHostNumberOfCompletedPacketsCommand::NewL()
       
    49 	{
       
    50 	CHostNumberOfCompletedPacketsCommand* self = new (ELeave) CHostNumberOfCompletedPacketsCommand();
       
    51 	CleanupStack::PushL(self);
       
    52 	self->CHCICommandBase::BaseConstructL();
       
    53 	CleanupStack::Pop(self);
       
    54 	return self;
       
    55 	}
       
    56 
       
    57 // Constructors
       
    58 
       
    59 CHostNumberOfCompletedPacketsCommand::CHostNumberOfCompletedPacketsCommand(TUint8 aNumberOfHandles, const RArray< THCIConnectionHandle >& aConnectionHandle, const RArray< THCINumOfCompletedPackets >& aHostNumOfCompletedPackets)
       
    60 	: CHCICommandBase(KHostNumberOfCompletedPacketsOpcode)
       
    61 	, iNumberOfHandles(aNumberOfHandles)
       
    62 	, iConnectionHandle(aConnectionHandle)
       
    63 	, iHostNumOfCompletedPackets(aHostNumOfCompletedPackets)
       
    64 	{
       
    65 	SetCreditsConsumed(0);
       
    66 	SetExpectsCommandStatusEvent(EFalse);
       
    67 	SetExpectsCommandCompleteEvent(EFalse);
       
    68 	}
       
    69 
       
    70 CHostNumberOfCompletedPacketsCommand::CHostNumberOfCompletedPacketsCommand()
       
    71 	: CHCICommandBase(KHostNumberOfCompletedPacketsOpcode)
       
    72 	{
       
    73 	SetCreditsConsumed(0);
       
    74 	SetExpectsCommandStatusEvent(EFalse);
       
    75 	SetExpectsCommandCompleteEvent(EFalse);
       
    76 	}
       
    77 
       
    78 // Destructor
       
    79 CHostNumberOfCompletedPacketsCommand::~CHostNumberOfCompletedPacketsCommand()
       
    80 	{
       
    81 	iConnectionHandle.Close();
       
    82 	iHostNumOfCompletedPackets.Close();
       
    83 	}	
       
    84 
       
    85 
       
    86 
       
    87 // Override of pure virtual from CHCICommandBase. This method embodies the knowledge
       
    88 // of how to format the specifics of this command into the HCTL command frame.
       
    89 void CHostNumberOfCompletedPacketsCommand::Format(CHctlCommandFrame& aCommandFrame) const
       
    90 	{
       
    91 	aCommandFrame.PutByte(iNumberOfHandles);
       
    92 	for(int i=0;i<iNumberOfHandles;++i)
       
    93 		{
       
    94 		aCommandFrame.PutConnectionHandle(iConnectionHandle[i]);
       
    95 		aCommandFrame.PutBytes16(iHostNumOfCompletedPackets[i]);
       
    96 		}
       
    97 	}
       
    98 
       
    99 // Assign new values to the parameters of this command
       
   100 EXPORT_C void CHostNumberOfCompletedPacketsCommand::Reset(TUint8 aNumberOfHandles, const RArray< THCIConnectionHandle >& aConnectionHandle, const RArray< THCINumOfCompletedPackets >& aHostNumOfCompletedPackets)
       
   101 	{
       
   102 	iNumberOfHandles = aNumberOfHandles;
       
   103 	iConnectionHandle = aConnectionHandle;
       
   104 	iHostNumOfCompletedPackets = aHostNumOfCompletedPackets;
       
   105 	}
       
   106 
       
   107 // Accessor methods for the parameters of the command
       
   108 
       
   109 EXPORT_C TUint8 CHostNumberOfCompletedPacketsCommand::NumberOfHandles() const
       
   110 	{
       
   111 	return iNumberOfHandles;
       
   112 	}
       
   113 
       
   114 EXPORT_C THCIConnectionHandle CHostNumberOfCompletedPacketsCommand::ConnectionHandle(TInt aIndex) const
       
   115 	{
       
   116 	return iConnectionHandle[aIndex];
       
   117 	}
       
   118 
       
   119 EXPORT_C THCINumOfCompletedPackets CHostNumberOfCompletedPacketsCommand::HostNumOfCompletedPackets(TInt aIndex) const
       
   120 	{
       
   121 	return iHostNumOfCompletedPackets[aIndex];
       
   122 	}
       
   123 
       
   124 
       
   125 
       
   126 // Extension function.  Use this to retrieve any extension interfaces from CHostNumberOfCompletedPacketsCommand
       
   127 // or any class from which it derives.
       
   128 /*virtual*/ TInt CHostNumberOfCompletedPacketsCommand::Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData)
       
   129 	{
       
   130 	// To add an additional interface implementation specific for this class check the 
       
   131 	// provided ID and return an appropriate interface.
       
   132 
       
   133 	// If a specific interface implementation is not provided - forward the call to the base class.
       
   134 	return CHCICommandBase::Extension_(aExtensionId, aInterface, aData);
       
   135 	}
       
   136