|
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 @internalComponent |
|
19 */ |
|
20 |
|
21 #include <bluetooth/hci/vendordebugcommand.h> |
|
22 #include "symbiancommandseventsutils.h" |
|
23 #include <bluetooth/hci/hciframe.h> |
|
24 #include <bluetooth/hci/commandbaseextension.h> |
|
25 |
|
26 #ifdef __FLOG_ACTIVE |
|
27 _LIT8(KLogComponent, LOG_COMPONENT_COMMANDSEVENTS_SYMBIAN); |
|
28 #endif |
|
29 |
|
30 EXPORT_C CVendorDebugCommand* CVendorDebugCommand::NewL(TUint16 aOpcode) |
|
31 { |
|
32 CVendorDebugCommand* self = new(ELeave) CVendorDebugCommand(aOpcode); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 EXPORT_C CVendorDebugCommand::CVendorDebugCommand(TUint16 aOpcode) |
|
40 : CHCICommandBase(aOpcode) |
|
41 { |
|
42 __ASSERT_DEBUG((aOpcode & KOGFMask) == KVendorDebugOGF, PANIC(KSymbianCommandsEventsPanicCat, EInvalidVendorDebugCommandOpcode)); |
|
43 } |
|
44 |
|
45 EXPORT_C void CVendorDebugCommand::ConstructL() |
|
46 { |
|
47 CHCICommandBase::BaseConstructL(); |
|
48 } |
|
49 |
|
50 void CVendorDebugCommand::Format(CHctlCommandFrame& aCommandFrame) const |
|
51 { |
|
52 aCommandFrame.PutString(iVendorSpecificData); |
|
53 } |
|
54 |
|
55 EXPORT_C void CVendorDebugCommand::Reset(TUint16 aOpcode) |
|
56 { |
|
57 __ASSERT_DEBUG((aOpcode & KOGFMask) == KVendorDebugOGF, PANIC(KSymbianCommandsEventsPanicCat, EInvalidVendorDebugCommandOpcode)); |
|
58 iOpcode = aOpcode; |
|
59 iVendorSpecificData.Zero(); |
|
60 } |
|
61 |
|
62 EXPORT_C TDes8& CVendorDebugCommand::Command() |
|
63 { |
|
64 return iVendorSpecificData; |
|
65 } |
|
66 |
|
67 EXPORT_C void CVendorDebugCommand::SetCreditsConsumed(TUint aConsumedCredits) |
|
68 { |
|
69 CHCICommandBase::SetCreditsConsumed(aConsumedCredits); |
|
70 } |
|
71 |
|
72 EXPORT_C void CVendorDebugCommand::SetExpectsCommandStatusEvent(TBool aExpectsCmdStatus) |
|
73 { |
|
74 return CHCICommandBase::SetExpectsCommandStatusEvent(aExpectsCmdStatus); |
|
75 } |
|
76 |
|
77 EXPORT_C void CVendorDebugCommand::SetExpectsCommandCompleteEvent(TBool aExpectsCmdComplete) |
|
78 { |
|
79 return CHCICommandBase::SetExpectsCommandCompleteEvent(aExpectsCmdComplete); |
|
80 } |
|
81 |
|
82 EXPORT_C TInt CVendorDebugCommand::SetExpectsCompletingEvent(TBool aExpectsCompletingEvent) |
|
83 { |
|
84 TInt err = KErrNone; |
|
85 |
|
86 if(CHCICommandBase::iCommandBaseExtension->CompletingEventQueryHelper()) |
|
87 { |
|
88 CHCICommandBase::iCommandBaseExtension->CompletingEventQueryHelper()->SetExpectsCompletingEvent(aExpectsCompletingEvent); |
|
89 } |
|
90 else |
|
91 { |
|
92 CHCICompletingEventQueryHelper* completingEventQueryHelper = NULL; |
|
93 TRAP(err, completingEventQueryHelper = CHCICompletingEventQueryHelper::NewL(aExpectsCompletingEvent)); |
|
94 if(err == KErrNone) |
|
95 { |
|
96 CHCICommandBase::iCommandBaseExtension->SetCompletingEventQueryHelper(completingEventQueryHelper); |
|
97 } |
|
98 } |
|
99 return err; |
|
100 } |
|
101 |
|
102 /*virtual*/ EXPORT_C TInt CVendorDebugCommand::Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData) |
|
103 { |
|
104 return CHCICommandBase::Extension_(aExtensionId, aInterface, aData); |
|
105 } |
|
106 |
|
107 void CVendorDebugCommand::Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const |
|
108 { |
|
109 if (iMatchImpl) |
|
110 { |
|
111 iMatchImpl->MvdcmMatch(*this, aEvent, aMatchesCmd, aConcludesCmd, aContinueMatching); |
|
112 } |
|
113 else |
|
114 { |
|
115 CHCICommandBase::Match(aEvent, aMatchesCmd, aConcludesCmd, aContinueMatching); |
|
116 } |
|
117 } |
|
118 |
|
119 EXPORT_C void CVendorDebugCommand::SetMatcher(MVendorDebugCommandMatcher* aMatcher) |
|
120 { |
|
121 iMatchImpl = aMatcher; |
|
122 } |
|
123 |