|
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 Wed, 05 Dec 2007 14:43:51 (time stamp) |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #include <bluetooth/hci/setupsynchronousconnectioncommand.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/synchronousconnectioncompleteevent.h> |
|
30 #include <bluetooth/hci/synchronousconnectionchangedevent.h> |
|
31 |
|
32 |
|
33 #ifdef __FLOG_ACTIVE |
|
34 _LIT8(KLogComponent, LOG_COMPONENT_COMMANDSEVENTS_SYMBIAN); |
|
35 #endif |
|
36 |
|
37 #pragma message("Value of iVoiceSetting member is closely related to hardware used. ") |
|
38 #pragma message("Bits: Input Coding, Input Data, Input Sample Size and Linear_PCM_Bit_pos, should be set...") |
|
39 #pragma message("...according to hardware capabilities, and OR-ed to create appropriate iVoiceSetting value.") |
|
40 |
|
41 // Factory methods |
|
42 |
|
43 EXPORT_C CSetupSynchronousConnectionCommand* CSetupSynchronousConnectionCommand::NewL(THCIConnectionHandle aConnectionHandle, TUint32 aTransmitBandwidth, TUint32 aReceiveBandwidth, TUint16 aMaxLatency, TUint16 aVoiceSetting, TUint8 aRetransmissionEffort, TUint16 aPacketType, const TBTDevAddr& aBDADDR) |
|
44 { |
|
45 CSetupSynchronousConnectionCommand* self = new (ELeave) CSetupSynchronousConnectionCommand(aConnectionHandle, aTransmitBandwidth, aReceiveBandwidth, aMaxLatency, aVoiceSetting, aRetransmissionEffort, aPacketType, aBDADDR); |
|
46 CleanupStack::PushL(self); |
|
47 self->CHCICommandBase::BaseConstructL(); |
|
48 CleanupStack::Pop(self); |
|
49 return self; |
|
50 } |
|
51 |
|
52 EXPORT_C CSetupSynchronousConnectionCommand* CSetupSynchronousConnectionCommand::NewL() |
|
53 { |
|
54 CSetupSynchronousConnectionCommand* self = new (ELeave) CSetupSynchronousConnectionCommand(); |
|
55 CleanupStack::PushL(self); |
|
56 self->CHCICommandBase::BaseConstructL(); |
|
57 CleanupStack::Pop(self); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // Constructors |
|
62 |
|
63 CSetupSynchronousConnectionCommand::CSetupSynchronousConnectionCommand(THCIConnectionHandle aConnectionHandle, TUint32 aTransmitBandwidth, TUint32 aReceiveBandwidth, TUint16 aMaxLatency, TUint16 aVoiceSetting, TUint8 aRetransmissionEffort, TUint16 aPacketType, const TBTDevAddr& aBDADDR) |
|
64 : CHCICommandBase(KSetupSynchronousConnectionOpcode) |
|
65 , iConnectionHandle(aConnectionHandle) |
|
66 , iTransmitBandwidth(aTransmitBandwidth) |
|
67 , iReceiveBandwidth(aReceiveBandwidth) |
|
68 , iMaxLatency(aMaxLatency) |
|
69 , iVoiceSetting(aVoiceSetting) |
|
70 , iRetransmissionEffort(aRetransmissionEffort) |
|
71 , iPacketType(aPacketType) |
|
72 , iBDADDR(aBDADDR) |
|
73 { |
|
74 SetExpectsCommandCompleteEvent(EFalse); |
|
75 } |
|
76 |
|
77 CSetupSynchronousConnectionCommand::CSetupSynchronousConnectionCommand() |
|
78 : CHCICommandBase(KSetupSynchronousConnectionOpcode) |
|
79 { |
|
80 SetExpectsCommandCompleteEvent(EFalse); |
|
81 } |
|
82 |
|
83 // Destructor |
|
84 CSetupSynchronousConnectionCommand::~CSetupSynchronousConnectionCommand() |
|
85 { |
|
86 |
|
87 } |
|
88 |
|
89 /*virtual*/ void CSetupSynchronousConnectionCommand::Match(const THCIEventBase& aEvent, TBool& aMatchesCmd, TBool& aConcludesCmd, TBool& aContinueMatching) const |
|
90 { |
|
91 if (aEvent.EventCode() == ESynchronousConnectionCompleteEvent) |
|
92 { |
|
93 TSynchronousConnectionCompleteEvent& event = TSynchronousConnectionCompleteEvent::Cast(aEvent); |
|
94 if (event.BDADDR() == BDADDR()) |
|
95 { |
|
96 aMatchesCmd = ETrue; |
|
97 aConcludesCmd = ETrue; |
|
98 aContinueMatching = EFalse; |
|
99 } |
|
100 } |
|
101 else if (aEvent.EventCode() == ESynchronousConnectionChangedEvent) |
|
102 { |
|
103 aMatchesCmd = ETrue; |
|
104 aConcludesCmd = ETrue; |
|
105 aContinueMatching = EFalse; |
|
106 } |
|
107 // Command Status Event and default Command Complete Event matching |
|
108 // is implemented in the base class. If we haven't matched already |
|
109 // then we should try the default matching. |
|
110 if (!aMatchesCmd) |
|
111 { |
|
112 CHCICommandBase::Match(aEvent, aMatchesCmd, aConcludesCmd, aContinueMatching); |
|
113 } |
|
114 } |
|
115 |
|
116 |
|
117 // Override of pure virtual from CHCICommandBase. This method embodies the knowledge |
|
118 // of how to format the specifics of this command into the HCTL command frame. |
|
119 void CSetupSynchronousConnectionCommand::Format(CHctlCommandFrame& aCommandFrame) const |
|
120 { |
|
121 aCommandFrame.PutConnectionHandle(iConnectionHandle); |
|
122 aCommandFrame.PutBytes32(iTransmitBandwidth, 4); |
|
123 aCommandFrame.PutBytes32(iReceiveBandwidth, 4); |
|
124 aCommandFrame.PutBytes16(iMaxLatency); |
|
125 aCommandFrame.PutBytes16(iVoiceSetting); |
|
126 aCommandFrame.PutByte(iRetransmissionEffort); |
|
127 aCommandFrame.PutBytes16(iPacketType); |
|
128 } |
|
129 |
|
130 // Assign new values to the parameters of this command |
|
131 EXPORT_C void CSetupSynchronousConnectionCommand::Reset(THCIConnectionHandle aConnectionHandle, TUint32 aTransmitBandwidth, TUint32 aReceiveBandwidth, TUint16 aMaxLatency, TUint16 aVoiceSetting, TUint8 aRetransmissionEffort, TUint16 aPacketType, const TBTDevAddr& aBDADDR) |
|
132 { |
|
133 iConnectionHandle = aConnectionHandle; |
|
134 iTransmitBandwidth = aTransmitBandwidth; |
|
135 iReceiveBandwidth = aReceiveBandwidth; |
|
136 iMaxLatency = aMaxLatency; |
|
137 iVoiceSetting = aVoiceSetting; |
|
138 iRetransmissionEffort = aRetransmissionEffort; |
|
139 iPacketType = aPacketType; |
|
140 iBDADDR = aBDADDR; |
|
141 } |
|
142 |
|
143 // Accessor methods for the parameters of the command |
|
144 |
|
145 EXPORT_C THCIConnectionHandle CSetupSynchronousConnectionCommand::ConnectionHandle() const |
|
146 { |
|
147 return iConnectionHandle; |
|
148 } |
|
149 |
|
150 EXPORT_C TUint32 CSetupSynchronousConnectionCommand::TransmitBandwidth() const |
|
151 { |
|
152 return iTransmitBandwidth; |
|
153 } |
|
154 |
|
155 EXPORT_C TUint32 CSetupSynchronousConnectionCommand::ReceiveBandwidth() const |
|
156 { |
|
157 return iReceiveBandwidth; |
|
158 } |
|
159 |
|
160 EXPORT_C TUint16 CSetupSynchronousConnectionCommand::MaxLatency() const |
|
161 { |
|
162 return iMaxLatency; |
|
163 } |
|
164 |
|
165 EXPORT_C TUint16 CSetupSynchronousConnectionCommand::VoiceSetting() const |
|
166 { |
|
167 return iVoiceSetting; |
|
168 } |
|
169 |
|
170 EXPORT_C TUint8 CSetupSynchronousConnectionCommand::RetransmissionEffort() const |
|
171 { |
|
172 return iRetransmissionEffort; |
|
173 } |
|
174 |
|
175 EXPORT_C TUint16 CSetupSynchronousConnectionCommand::PacketType() const |
|
176 { |
|
177 return iPacketType; |
|
178 } |
|
179 |
|
180 EXPORT_C TBTDevAddr CSetupSynchronousConnectionCommand::BDADDR() const |
|
181 { |
|
182 return iBDADDR; |
|
183 } |
|
184 |
|
185 |
|
186 |
|
187 // Extension function. Use this to retrieve any extension interfaces from CSetupSynchronousConnectionCommand |
|
188 // or any class from which it derives. |
|
189 /*virtual*/ TInt CSetupSynchronousConnectionCommand::Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData) |
|
190 { |
|
191 // To add an additional interface implementation specific for this class check the |
|
192 // provided ID and return an appropriate interface. |
|
193 |
|
194 // If a specific interface implementation is not provided - forward the call to the base class. |
|
195 return CHCICommandBase::Extension_(aExtensionId, aInterface, aData); |
|
196 } |
|
197 |