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