bthci/hci2implementations/CommandsEvents/symbian/src/flowspecificationcommand.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:50 (time stamp)
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22 */
       
    23 
       
    24 #include <bluetooth/hci/flowspecificationcommand.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/flowspecificationcompleteevent.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 CFlowSpecificationCommand* CFlowSpecificationCommand::NewL(THCIConnectionHandle aConnectionHandle, TUint8 aFlags, TUint8 aFlowDirection, TUint8 aServiceType, TUint32 aTokenRate, TUint32 aTokenBucketSize, TUint32 aPeakBandwidth, TUint32 aAccessLatency)
       
    41 	{
       
    42 	CFlowSpecificationCommand* self = new (ELeave) CFlowSpecificationCommand(aConnectionHandle, aFlags, aFlowDirection, aServiceType, aTokenRate, aTokenBucketSize, aPeakBandwidth, aAccessLatency);
       
    43 	CleanupStack::PushL(self);
       
    44 	self->CHCICommandBase::BaseConstructL();
       
    45 	CleanupStack::Pop(self);
       
    46 	return self;
       
    47 	}
       
    48 
       
    49 EXPORT_C CFlowSpecificationCommand* CFlowSpecificationCommand::NewL()
       
    50 	{
       
    51 	CFlowSpecificationCommand* self = new (ELeave) CFlowSpecificationCommand();
       
    52 	CleanupStack::PushL(self);
       
    53 	self->CHCICommandBase::BaseConstructL();
       
    54 	CleanupStack::Pop(self);
       
    55 	return self;
       
    56 	}
       
    57 
       
    58 // Constructors
       
    59 
       
    60 CFlowSpecificationCommand::CFlowSpecificationCommand(THCIConnectionHandle aConnectionHandle, TUint8 aFlags, TUint8 aFlowDirection, TUint8 aServiceType, TUint32 aTokenRate, TUint32 aTokenBucketSize, TUint32 aPeakBandwidth, TUint32 aAccessLatency)
       
    61 	: CHCICommandBase(KFlowSpecificationOpcode)
       
    62 	, iConnectionHandle(aConnectionHandle)
       
    63 	, iFlags(aFlags)
       
    64 	, iFlowDirection(aFlowDirection)
       
    65 	, iServiceType(aServiceType)
       
    66 	, iTokenRate(aTokenRate)
       
    67 	, iTokenBucketSize(aTokenBucketSize)
       
    68 	, iPeakBandwidth(aPeakBandwidth)
       
    69 	, iAccessLatency(aAccessLatency)
       
    70 	{
       
    71 	SetExpectsCommandCompleteEvent(EFalse);
       
    72 	}
       
    73 
       
    74 CFlowSpecificationCommand::CFlowSpecificationCommand()
       
    75 	: CHCICommandBase(KFlowSpecificationOpcode)
       
    76 	{
       
    77 	SetExpectsCommandCompleteEvent(EFalse);
       
    78 	}
       
    79 
       
    80 // Destructor
       
    81 CFlowSpecificationCommand::~CFlowSpecificationCommand()
       
    82 	{
       
    83 	
       
    84 	}	
       
    85 
       
    86 /*virtual*/ void CFlowSpecificationCommand::Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const
       
    87 	{
       
    88 	if (aEvent.EventCode() == EFlowSpecificationCompleteEvent)
       
    89 		{
       
    90 		aMatchesCmd = ETrue;
       
    91 		aConcludesCmd = ETrue;
       
    92 		aContinueMatching = EFalse;
       
    93 		}
       
    94 	// Command Status Event and default Command Complete Event matching
       
    95 	// is implemented in the base class.  If we haven't matched already
       
    96 	// then we should try the default matching.
       
    97 	if (!aMatchesCmd)
       
    98 		{
       
    99 		CHCICommandBase::Match(aEvent, aMatchesCmd, aConcludesCmd, aContinueMatching);
       
   100 		}
       
   101 	}
       
   102 	
       
   103 
       
   104 // Override of pure virtual from CHCICommandBase. This method embodies the knowledge
       
   105 // of how to format the specifics of this command into the HCTL command frame.
       
   106 void CFlowSpecificationCommand::Format(CHctlCommandFrame& aCommandFrame) const
       
   107 	{
       
   108 	aCommandFrame.PutConnectionHandle(iConnectionHandle);
       
   109 	aCommandFrame.PutByte(iFlags);
       
   110 	aCommandFrame.PutByte(iFlowDirection);
       
   111 	aCommandFrame.PutByte(iServiceType);
       
   112 	aCommandFrame.PutBytes32(iTokenRate, 4);
       
   113 	aCommandFrame.PutBytes32(iTokenBucketSize, 4);
       
   114 	aCommandFrame.PutBytes32(iPeakBandwidth, 4);
       
   115 	aCommandFrame.PutBytes32(iAccessLatency, 4);
       
   116 	}
       
   117 
       
   118 // Assign new values to the parameters of this command
       
   119 EXPORT_C void CFlowSpecificationCommand::Reset(THCIConnectionHandle aConnectionHandle, TUint8 aFlags, TUint8 aFlowDirection, TUint8 aServiceType, TUint32 aTokenRate, TUint32 aTokenBucketSize, TUint32 aPeakBandwidth, TUint32 aAccessLatency)
       
   120 	{
       
   121 	iConnectionHandle = aConnectionHandle;
       
   122 	iFlags = aFlags;
       
   123 	iFlowDirection = aFlowDirection;
       
   124 	iServiceType = aServiceType;
       
   125 	iTokenRate = aTokenRate;
       
   126 	iTokenBucketSize = aTokenBucketSize;
       
   127 	iPeakBandwidth = aPeakBandwidth;
       
   128 	iAccessLatency = aAccessLatency;
       
   129 	}
       
   130 
       
   131 // Accessor methods for the parameters of the command
       
   132 
       
   133 EXPORT_C THCIConnectionHandle CFlowSpecificationCommand::ConnectionHandle() const
       
   134 	{
       
   135 	return iConnectionHandle;
       
   136 	}
       
   137 
       
   138 EXPORT_C TUint8 CFlowSpecificationCommand::Flags() const
       
   139 	{
       
   140 	return iFlags;
       
   141 	}
       
   142 
       
   143 EXPORT_C TUint8 CFlowSpecificationCommand::FlowDirection() const
       
   144 	{
       
   145 	return iFlowDirection;
       
   146 	}
       
   147 
       
   148 EXPORT_C TUint8 CFlowSpecificationCommand::ServiceType() const
       
   149 	{
       
   150 	return iServiceType;
       
   151 	}
       
   152 
       
   153 EXPORT_C TUint32 CFlowSpecificationCommand::TokenRate() const
       
   154 	{
       
   155 	return iTokenRate;
       
   156 	}
       
   157 
       
   158 EXPORT_C TUint32 CFlowSpecificationCommand::TokenBucketSize() const
       
   159 	{
       
   160 	return iTokenBucketSize;
       
   161 	}
       
   162 
       
   163 EXPORT_C TUint32 CFlowSpecificationCommand::PeakBandwidth() const
       
   164 	{
       
   165 	return iPeakBandwidth;
       
   166 	}
       
   167 
       
   168 EXPORT_C TUint32 CFlowSpecificationCommand::AccessLatency() const
       
   169 	{
       
   170 	return iAccessLatency;
       
   171 	}
       
   172 
       
   173 
       
   174 
       
   175 // Extension function.  Use this to retrieve any extension interfaces from CFlowSpecificationCommand
       
   176 // or any class from which it derives.
       
   177 /*virtual*/ TInt CFlowSpecificationCommand::Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData)
       
   178 	{
       
   179 	// To add an additional interface implementation specific for this class check the 
       
   180 	// provided ID and return an appropriate interface.
       
   181 
       
   182 	// If a specific interface implementation is not provided - forward the call to the base class.
       
   183 	return CHCICommandBase::Extension_(aExtensionId, aInterface, aData);
       
   184 	}
       
   185