bthci/bthci2/CommandsEvents/interface/Command.h
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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 
       
    23 #ifndef CHCICOMMAND_H
       
    24 #define CHCICOMMAND_H
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <bluetooth/hci/hciopcodes.h>
       
    28 #include <bluetooth/hci/commandbaseextension.h>
       
    29 
       
    30 class CHctlCommandFrame;
       
    31 class THCIEventBase;
       
    32 class CHCICommandBaseExtension;
       
    33 
       
    34 /**
       
    35 This class defines the basis for specific HCI Commands that are to be
       
    36 sent over the HCI.
       
    37 
       
    38 Any class that derives from this class must call the BaseConstructL() function
       
    39 during its NewL(), to ensure that the base class is fully initialised.
       
    40 */
       
    41 NONSHARABLE_CLASS(CHCICommandBase) : public CBase
       
    42 	{
       
    43 public:
       
    44 	IMPORT_C THCIOpcode Opcode() const;
       
    45 	~CHCICommandBase();
       
    46 
       
    47 	IMPORT_C TUint CreditsConsumed() const;
       
    48 	
       
    49 	IMPORT_C TBool ExpectsCommandStatusEvent() const;
       
    50 	IMPORT_C TBool ExpectsCommandCompleteEvent() const;
       
    51 	virtual void Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const;
       
    52 
       
    53 	IMPORT_C void FormatCommand(CHctlCommandFrame& aCommandFrame);
       
    54 	
       
    55 	virtual TInt Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData);
       
    56 
       
    57 protected:
       
    58 	CHCICommandBase(THCIOpcode aOpcode);
       
    59 	void BaseConstructL();
       
    60 	
       
    61 	void SetCreditsConsumed(TUint aConsumedCredits);
       
    62 	void SetExpectsCommandStatusEvent(TBool aExpectsCmdStatus);
       
    63 	void SetExpectsCommandCompleteEvent(TBool aExpectsCmdComplete);
       
    64 
       
    65 private:
       
    66 	virtual void Format(CHctlCommandFrame& aCommandFrame) const = 0;
       
    67 
       
    68 protected:
       
    69 	THCIOpcode iOpcode;
       
    70 	// This pointer declaration was previously reserved. 
       
    71 	CHCICommandBaseExtension* iCommandBaseExtension;
       
    72 
       
    73 private:
       
    74 	TUint iCreditsConsumed;
       
    75 	TBool iExpectsCommandStatusEvent;
       
    76 	TBool iExpectsCommandCompleteEvent;
       
    77 	};
       
    78 
       
    79 #endif // CHCICOMMAND_H