bthci/bthci2/CommandsEvents/interface/VendorDebugCommand.h
changeset 0 29b1cd4cb562
child 8 2b6718f05bdb
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 #ifndef VENDORDEBUGCOMMAND_H
       
    23 #define VENDORDEBUGCOMMAND_H
       
    24 
       
    25 #include <bluetooth/hci/command.h>
       
    26 
       
    27 class CHctlCommandFrame;
       
    28 class CVendorDebugCommand;
       
    29 
       
    30 /**
       
    31  This interface provides the ability to define a custom Match method to match an event with
       
    32  a vendor debug command.
       
    33  A class can derive from this interface, implement MvdcmMatch and then register itself via
       
    34  the CVendorDebugCommand::SetMatcher method.
       
    35  When the framework calls CVendorDebugCommand::Match it will call MvdcmMatch passing it the 
       
    36  control of the matching algorithm. 
       
    37 */
       
    38 class MVendorDebugCommandMatcher
       
    39 	{
       
    40 public:
       
    41 /**
       
    42 	It defines a custom method to match an event to a CVendorDebugCommand
       
    43 	@param aVendorDebugCommand is the command to be matched
       
    44 	@param aEvent is the event to match
       
    45 	@param aMatchesCmd is set to say if the event matches the command or not
       
    46 	@param aConcludesCmd is set to say if the command is concluded by this match or not
       
    47 	@param aContinueMatching is set to say if the framework has to continue the matching process or not 
       
    48 */
       
    49 	virtual void MvdcmMatch(const CVendorDebugCommand& aVendorDebugCommand, const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const = 0;
       
    50 	};
       
    51 
       
    52 /**
       
    53 This class can be used to represent any Vendor Debug command i.e. any
       
    54 command with an opcode in the Vendor Debug opcode group (i.e. top six
       
    55 bits of the opcode are all ones).
       
    56 
       
    57 The specific opcode within that group is supplied as a parameter to the
       
    58 factory method, and may be changed subsequently using the Reset method.
       
    59 
       
    60 Since the format of the data associated with this command is undefined/vendor-specific,
       
    61 a buffer of 255 bytes is provided for the vendor-specific data, and the accessor
       
    62 method Command gives the user of the class full read-write control of that data.
       
    63 */
       
    64 
       
    65 NONSHARABLE_CLASS(CVendorDebugCommand) : public CHCICommandBase
       
    66 	{
       
    67 public:	
       
    68 	enum
       
    69 		{
       
    70 		KVendorSpecificCommandMaxSize = 255,
       
    71 		};
       
    72 		
       
    73 public:
       
    74 	IMPORT_C static CVendorDebugCommand* NewL(const TUint16 aOpcode);
       
    75 	IMPORT_C void Reset(const TUint16 aOpcode);
       
    76 	IMPORT_C TDes8& Command();
       
    77 	IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData);
       
    78 	void Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const;
       
    79 	IMPORT_C void SetMatcher(MVendorDebugCommandMatcher* aMatcher);
       
    80 	
       
    81 protected:	
       
    82 	IMPORT_C CVendorDebugCommand(const TUint16 opcode);
       
    83 	IMPORT_C void ConstructL();
       
    84 	IMPORT_C void SetCreditsConsumed(TUint aConsumedCredits);
       
    85 	IMPORT_C void SetExpectsCommandStatusEvent(TBool aExpectsCmdStatus);
       
    86 	IMPORT_C void SetExpectsCommandCompleteEvent(TBool aExpectsCmdComplete);
       
    87 	IMPORT_C TInt SetExpectsCompletingEvent(TBool aExpectsCompletingEvent);
       
    88 
       
    89 private:
       
    90 	void Format(CHctlCommandFrame& aCommandFrame) const;
       
    91 
       
    92 private:
       
    93 	TBuf8<KVendorSpecificCommandMaxSize> iVendorSpecificData;
       
    94 	MVendorDebugCommandMatcher*	iMatchImpl;
       
    95 	};
       
    96 
       
    97 #endif // VENDORDEBUGCOMMAND_H