bthci/bthci2/CommandsEvents/interface/VendorDebugCommand.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Feb 2010 23:56:55 +0200
branchRCL_3
changeset 8 2b6718f05bdb
parent 0 29b1cd4cb562
permissions -rw-r--r--
Revision: 201001 Kit: 201007
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
// All rights reserved.
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
//
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
// Initial Contributors:
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
//
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
// Contributors:
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
//
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
// Description:
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
//
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
/**
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
 @file
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
 @publishedPartner
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
 @released
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
*/
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#ifndef VENDORDEBUGCOMMAND_H
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#define VENDORDEBUGCOMMAND_H
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <bluetooth/hci/command.h>
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
class CHctlCommandFrame;
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
class CVendorDebugCommand;
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
/**
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
 This interface provides the ability to define a custom Match method to match an event with
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
 a vendor debug command.
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
 A class can derive from this interface, implement MvdcmMatch and then register itself via
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
 the CVendorDebugCommand::SetMatcher method.
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
 When the framework calls CVendorDebugCommand::Match it will call MvdcmMatch passing it the 
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
 control of the matching algorithm. 
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
*/
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
class MVendorDebugCommandMatcher
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
	{
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
public:
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
/**
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
	It defines a custom method to match an event to a CVendorDebugCommand
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
	@param aVendorDebugCommand is the command to be matched
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
	@param aEvent is the event to match
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
	@param aMatchesCmd is set to say if the event matches the command or not
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
	@param aConcludesCmd is set to say if the command is concluded by this match or not
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
	@param aContinueMatching is set to say if the framework has to continue the matching process or not 
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
*/
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
	virtual void MvdcmMatch(const CVendorDebugCommand& aVendorDebugCommand, const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const = 0;
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
	};
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
/**
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
This class can be used to represent any Vendor Debug command i.e. any
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
command with an opcode in the Vendor Debug opcode group (i.e. top six
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
bits of the opcode are all ones).
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
The specific opcode within that group is supplied as a parameter to the
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
factory method, and may be changed subsequently using the Reset method.
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
Since the format of the data associated with this command is undefined/vendor-specific,
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
a buffer of 255 bytes is provided for the vendor-specific data, and the accessor
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
method Command gives the user of the class full read-write control of that data.
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
*/
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
NONSHARABLE_CLASS(CVendorDebugCommand) : public CHCICommandBase
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
	{
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
public:	
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
	enum
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
		{
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
		KVendorSpecificCommandMaxSize = 255,
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
		};
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
		
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
public:
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
	IMPORT_C static CVendorDebugCommand* NewL(const TUint16 aOpcode);
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
	IMPORT_C void Reset(const TUint16 aOpcode);
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
	IMPORT_C TDes8& Command();
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
	IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData);
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
	void Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const;
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
	IMPORT_C void SetMatcher(MVendorDebugCommandMatcher* aMatcher);
8
2b6718f05bdb Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    80
	IMPORT_C void SetCreditsConsumed(TUint aConsumedCredits);
2b6718f05bdb Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    81
	IMPORT_C void SetExpectsCommandStatusEvent(TBool aExpectsCmdStatus);
2b6718f05bdb Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    82
	IMPORT_C void SetExpectsCommandCompleteEvent(TBool aExpectsCmdComplete);
2b6718f05bdb Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    83
	IMPORT_C TInt SetExpectsCompletingEvent(TBool aExpectsCompletingEvent);
0
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
	
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
protected:	
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
	IMPORT_C CVendorDebugCommand(const TUint16 opcode);
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
	IMPORT_C void ConstructL();
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
private:
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
	void Format(CHctlCommandFrame& aCommandFrame) const;
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
private:
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
	TBuf8<KVendorSpecificCommandMaxSize> iVendorSpecificData;
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
	MVendorDebugCommandMatcher*	iMatchImpl;
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
	};
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
29b1cd4cb562 Revision: 200951_001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
#endif // VENDORDEBUGCOMMAND_H