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