|
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 // Interface to the HCI Facade, which hides the HCI level |
|
15 // of the stack |
|
16 // |
|
17 // |
|
18 |
|
19 #ifndef HCIFACADE_H |
|
20 #define HCIFACADE_H |
|
21 |
|
22 #include "secman.h" |
|
23 #include "linkmgr.h" |
|
24 #include "notification.h" |
|
25 #include "physicallinksmanager.h" |
|
26 |
|
27 #include <btmanclient.h> |
|
28 #include <es_mbuf.h> |
|
29 #include <bluetooth/hardresetinitiator.h> |
|
30 #include <bluetooth/hcicommandqueueclient.h> |
|
31 #include <bluetooth/hcicmdqcontroller.h> |
|
32 #include <bluetooth/hcicommandqueue.h> |
|
33 #include <bluetooth/physicallinksstate.h> |
|
34 #include <bluetooth/hci/controllerstateobserver.h> |
|
35 #include <bluetooth/hci/controllerinitialisationobserver.h> |
|
36 #include <bluetooth/hci/corehciplugin.h> |
|
37 #include <bluetooth/hci/corehci.h> |
|
38 #include <bluetooth/hci/hctlinterface.h> |
|
39 #include <bluetooth/hci/controllerinitialisationinterface.h> |
|
40 #include <bluetooth/hci/hcidataframer.h> |
|
41 #include <bluetooth/hci/hcidataeventobserver.h> |
|
42 #include <bluetooth/hci/hcidataobserver.h> |
|
43 #include <bluetooth/hci/hcicommandallocator.h> |
|
44 #include <bluetooth/hci/basebandpacketconsts.h> |
|
45 #include <bluetooth/hci/hciutil.h> |
|
46 #include <bluetooth/hci/hciclientusage.h> |
|
47 |
|
48 class CACLDataQController; |
|
49 class CHCICommandItem; |
|
50 class CHCIDirectAccessSAPsManager; |
|
51 class CHCICmdQController; |
|
52 |
|
53 // low power mode constants - these are the stack preferred values |
|
54 // but an HCI can ignore the parameter given by the stack and format |
|
55 // a command with different values if it wishes |
|
56 // this would allow for values that the local Controller prefers |
|
57 static const TBasebandTime KBTParkModeBeaconMaxInterval = 0x1000; |
|
58 static const TBasebandTime KBTParkModeBeaconMinInterval = 0x0400; |
|
59 |
|
60 static const TBasebandTime KBTHoldModeMaxInterval = 0x4000; |
|
61 static const TBasebandTime KBTHoldModeMinInterval = 0x040; |
|
62 |
|
63 static const TBasebandTime KBTSniffModeMaxInterval = 0x0540; |
|
64 static const TBasebandTime KBTSniffModeMinInterval = 0x0320; |
|
65 static const TBasebandTime KBTSniffModeAttempt = 0x0008; |
|
66 static const TBasebandTime KBTSniffModeTimeout = 0x0004; |
|
67 |
|
68 static const TUint32 KNoEDReSCOPacketMask = 0x3C0; |
|
69 |
|
70 static const TUint8 KRemoteExtendedFeaturesPage1 = 1; |
|
71 |
|
72 // voice settings - see above: the HCI can modify this value as it sees fit |
|
73 // but at least the stack gives it a chance by calling HCI in InitL |
|
74 static const TUint16 KBTVoiceSetting = 0x0000; |
|
75 |
|
76 // max latency settings for eSCO connection |
|
77 static const TUint16 KeSCOMaxLatencyDontCare = 0xffff; |
|
78 |
|
79 NONSHARABLE_CLASS(TBasebandPolicy) : private TBasebandPolicyParams |
|
80 { |
|
81 public: |
|
82 inline void InitialPolicy(const TBasebandPolicyParams& aParams); |
|
83 TInt TryToChangePolicy(const TBasebandPolicyParams& aNewParams); |
|
84 inline TBasebandPageTimePolicy PageTimePolicy() const; |
|
85 |
|
86 static const TBasebandTime KPageTimeoutR0; |
|
87 static const TBasebandTime KPageTimeoutR1; |
|
88 static const TBasebandTime KPageTimeoutR2; |
|
89 |
|
90 static const TReal KBestEffortTimeMultiplier; |
|
91 static const TReal KQuickTimeMultiplier; |
|
92 |
|
93 private: |
|
94 }; |
|
95 |
|
96 #ifdef HOSTCONTROLLER_TO_HOST_FLOW_CONTROL |
|
97 NONSHARABLE_CLASS(CHostMBufPool) : public CActive |
|
98 { |
|
99 NONSHARABLE_CLASS(TPoolBuffer) |
|
100 { |
|
101 public: |
|
102 RMBufChain iMBufChain; |
|
103 TInt iCurrentHandle; //NB THCIConnHandle is TUint16, |
|
104 //we use -1 to indicate no handle |
|
105 TSglQueLink iLink; |
|
106 }; |
|
107 public: |
|
108 static CHostMBufPool* NewL(CHCIFacade& aHCIFacade); |
|
109 ~CHostMBufPool(); |
|
110 RMBufChain TakeBuffer(const THCIConnHandle& aConnHandle); |
|
111 private: |
|
112 CHostMBufPool(CHCIFacade& aHCIFacade); |
|
113 void ConstructL(); |
|
114 void RunL(); |
|
115 void DoCancel(); |
|
116 |
|
117 void DeletePool(TSglQue<TPoolBuffer>& aPool); |
|
118 |
|
119 private: |
|
120 CHCIFacade& iHCIFacade; |
|
121 CAsyncCallBack* iBufferFreeCallback; |
|
122 |
|
123 TSglQue<TPoolBuffer> iBufferPool; |
|
124 TSglQue<TPoolBuffer> iWaitingAllocPool; |
|
125 |
|
126 TInt iCurrAckHandle; |
|
127 TUint iCurrCompletedPackets; |
|
128 |
|
129 RMBufAsyncRequest iMBufRequester; |
|
130 }; |
|
131 |
|
132 #endif //HOSTCONTROLLER_TO_HOST_FLOW_CONTROL |
|
133 |
|
134 NONSHARABLE_CLASS(CAFHTimer) : public CTimer |
|
135 { |
|
136 public: |
|
137 static CAFHTimer* NewL(CHCIFacade& aParent); |
|
138 void SetPending(const TBTAFHHostChannelClassification& aHCC); |
|
139 void Reset(); |
|
140 |
|
141 private: |
|
142 void ConstructL(); |
|
143 CAFHTimer(CHCIFacade& aParent); |
|
144 void RunL(); |
|
145 TInt RunError(TInt aError); |
|
146 void RemovePendingHostChannelClassifications(); |
|
147 //NB DoCancel not needed: version in CTimer does what we want.. |
|
148 //...so no destructor (calling Cancel()) needed either! |
|
149 |
|
150 private: |
|
151 CHCIFacade& iParent; |
|
152 TBTAFHHostChannelClassification iHCC; |
|
153 TBool iPending; |
|
154 }; |
|
155 |
|
156 |
|
157 |
|
158 /** |
|
159 (L2CAP) HCI Link manager. |
|
160 This class interfaces to the HCI. It's responsible for creating |
|
161 and destroying links, and passing commands from the l2cap level to |
|
162 the HCI. |
|
163 It is the one and only client of CHCI, and is responsible for loading |
|
164 the library that it lives in. |
|
165 |
|
166 It also passes on notifications that it receives from the HCI. |
|
167 **/ |
|
168 |
|
169 NONSHARABLE_CLASS(CHCIFacade) : public CBase, public MPINCodeResponseHandler, |
|
170 public MLinkKeyResponseHandler, |
|
171 public MHardResetInitiator, |
|
172 public MControllerStateObserver, |
|
173 public MControllerInitialisationObserver, |
|
174 public MHCICommandQueueClient, |
|
175 public MHCIDataEventObserver, |
|
176 public MHCIDataObserver, |
|
177 public MHCTLChannelObserver, |
|
178 public MPhysicalLinksState, |
|
179 public MLinkMuxNotifier, |
|
180 public MHCIClientUsage |
|
181 { |
|
182 #ifdef _DEBUG |
|
183 friend class CACLDataQController; // for updating HC model |
|
184 #endif |
|
185 |
|
186 public: |
|
187 // Construction |
|
188 static CHCIFacade* NewL(CLinkMgrProtocol& aProtocol); |
|
189 void InitL(const TBTLocalDevice& aLocalDevice); |
|
190 ~CHCIFacade(); |
|
191 |
|
192 void SetLinkMuxer(CLinkMuxer& aLinkMuxer); |
|
193 CHCICmdQController& CommandQController() const {return *iCmdController;}; |
|
194 |
|
195 CHctlAclDataFrame* NewACLDataFrameL(TUint16 aSize) const; |
|
196 #ifdef STACK_SCO_DATA |
|
197 CHctlSynchronousDataFrame* NewSynchronousDataFrameL(TUint8 aSCODataLen) const; |
|
198 #endif |
|
199 |
|
200 |
|
201 TInt WriteACLData(const CHctlAclDataFrame& aFrame) const; |
|
202 TInt WriteSCOData(const CHctlSynchronousDataFrame& aFrame) const; |
|
203 |
|
204 void FormatACLData(CHctlAclDataFrame& aFrame, THCIConnHandle aHandle, |
|
205 TUint8 aOptions, const TDesC8& aData) const; |
|
206 void FormatSCOData(CHctlSynchronousDataFrame& aFrame, THCIConnHandle aHandle, |
|
207 const TDesC8& aData) const; |
|
208 |
|
209 THCITransportChannel HCTLState() const; |
|
210 void SetPhysicalLinksMgr(CPhysicalLinksManager& aConnectionsMgr); |
|
211 |
|
212 // HCI commands |
|
213 void ConnectL(const TBTDevAddr& aAddr, TUint16 aPacketType=KDM1Packet, TUint8 aPageScanRepetitionMode=0, |
|
214 TUint8 aPageScanMode=0, TUint16 aClockOffset=0, TUint8 aAllowRoleSwitch=1); |
|
215 void SCOConnectL(THCIConnHandle aACLHandle, TUint16 aPacketTypeMask, const TBTDevAddr& aBdaddr); |
|
216 void SetupSynchronousConnectionCommandL(THCIConnHandle aACLHandle, TUint aTransmitBandwidth, TUint aReceiveBandwidth, |
|
217 TUint16 aMaxLatency, TUint16 aVoiceSettings, TUint8 aRetransmissionEffort, |
|
218 TBTSyncPacketTypes aPacketTypeMask, const TBTDevAddr& aBdaddr); |
|
219 void AcceptSynchronousConnectionL(const TBTDevAddr& aBdaddr, TUint aTransmitBandwidth, TUint aReceiveBandwidth, |
|
220 TUint16 aMaxLatency, TUint16 aContentFormat, TUint8 aRetransmissionEffort, |
|
221 TBTSyncPacketTypes aPacketTypeMask); |
|
222 void RejectSynchronousConnectionL(const TBTDevAddr& aBdaddr, THCIErrorCode aReason); |
|
223 void CompleteConnectHandleError(const TBTDevAddr& aAddr, TBool JuiceFound, TInquiryLogEntry& juice) const; //Called by async device with new juice info |
|
224 void DisconnectL(THCIConnHandle aConnH, THCIErrorCode aErr); |
|
225 void WriteScanEnableL(THCIScanEnable aEnable); |
|
226 |
|
227 void AcceptConnectionRequestL(const TBTDevAddr& aAddr, TUint8 aRole); |
|
228 void RejectConnectionRequestL(const TBTConnect& aConnect, THCIErrorCode aReason); |
|
229 void HostNumberOfCompletedPacketsL(THCIConnHandle aConnH, TUint16 aFrags); |
|
230 void WriteLinkPolicySettingsL(THCIConnHandle aConnH, TUint16 aSettings); |
|
231 void FlushL(THCIConnHandle aConnH); |
|
232 void SetEventMaskL(const THCIEventMask& aEventMask); |
|
233 |
|
234 void RefreshEncryptionKeyL(THCIConnHandle aHandle); |
|
235 void WriteLinkSupervisionTimeoutL(THCIConnHandle aHandle, TInt aTimeout); |
|
236 |
|
237 void WriteLocalNameL(const TDesC8& aName); |
|
238 void WriteDeviceClassL(TUint aCoD); |
|
239 void WriteAFHChannelAssessmentModeL(TBool aEnable); |
|
240 void SetAFHHostChannelClassificationL(const TBTAFHHostChannelClassification& aChannelClassification); |
|
241 |
|
242 void VendorSpecificCommandL(const THCIOpcode aOpcode, const TDesC8& aBuffer); |
|
243 |
|
244 // from MLinkKeyResponseHandler |
|
245 TInt LinkKeyRequestReply(const TBTDevAddr& aBdaddr,const TDesC8& aLinkKey) const; |
|
246 TInt LinkKeyRequestNegativeReply(const TBTDevAddr& aBdaddr) const; |
|
247 |
|
248 // from MPINCodeResponseHandler |
|
249 TInt PINCodeRequestReply(const TBTDevAddr& aBdaddr,const TDesC8& aPIN) const; |
|
250 TInt PINCodeRequestNegativeReply(const TBTDevAddr& aBdaddr) const; |
|
251 |
|
252 TInt ChangeConnectionPacketType(THCIConnHandle aConnHandle, TUint16 aType); |
|
253 void AuthenticateL(THCIConnHandle aConnHandle); |
|
254 TInt ChangeConnectionLinkKey(THCIConnHandle aConnHandle); |
|
255 void SetEncryptL(THCIConnHandle aConnHandle,TBool aEnable); |
|
256 void ReadRemoteVersionL(THCIConnHandle aHandle); |
|
257 void ReadRemoteSupportedFeaturesL(THCIConnHandle aHandle); |
|
258 void ReadRemoteExtendedFeaturesL(THCIConnHandle aHandle, TUint8 aPageNumber); |
|
259 void ReadClockOffsetL(THCIConnHandle aHandle); |
|
260 void WriteIACLAPL(TUint8 aNumCurrentIAC, TUint aIAC_LAP[]); |
|
261 |
|
262 // from MControllerInitialisationObserver |
|
263 void McioPreResetCommandComplete(TInt aError); |
|
264 void McioPostResetCommandComplete(TInt aError); |
|
265 |
|
266 // from MHCICommandQueueClient |
|
267 void MhcqcCommandEventReceived(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
268 void MhcqcCommandErrored(TInt aErrorCode, const CHCICommandBase* aCommand); |
|
269 |
|
270 // from MControllerStateObserver |
|
271 void McsoProcessPowerChange(TInt aError, TControllerChangeType aChangeType, TBTPowerState aState); |
|
272 void McsoProcessHardResetPhaseChange(TInt aError, TControllerChangeType aChangeType, TBTHardResetState aState); |
|
273 |
|
274 // from MHardResetInitiator |
|
275 void MhriStartHardReset(); |
|
276 |
|
277 // from MHCIDataEventObserver |
|
278 void MhdeoEventNotification(THCIEventBase& aEvent); |
|
279 |
|
280 // from MHCIDataObserver |
|
281 void MhdoProcessAclData(THCIConnHandle aConnH, TAclPacketBoundaryFlag aBoundaryFlag, TAclPacketBroadcastFlag aBroadcastFlag, const TDesC8& aData); |
|
282 void MhdoProcessSynchronousData(THCIConnHandle aConnH, TUint8 aReserved, const TDesC8& aData); |
|
283 |
|
284 // from MHCTLChannelObserver |
|
285 void MhcoChannelOpen(THCITransportChannel aChannels); |
|
286 void MhcoChannelClosed(THCITransportChannel aChannels); |
|
287 |
|
288 // from MPhysicalLinksState - Simply forward the request to iLinksMgr |
|
289 TInt MplsGetConnectionHandles(RHCIConnHandleArray& aConnectionHandles, TLinkType aLinkType) const; |
|
290 TInt MplsGetNumPendingHandles(TInt& aConnectionHandles, TLinkType aLinkType) const; |
|
291 TInt MplsGetConnectionHandles(RHCIConnHandleArray& aConnectionHandles, TLinkType aLinkType, const TBTDevAddr& aBDAddr) const; |
|
292 TInt MplsGetNumPendingHandles(TInt& aConnectionHandles, TLinkType aLinkType, const TBTDevAddr& aBDAddr) const; |
|
293 TInt MplsGetRemoteAddress(TBTDevAddr& aBDAddr, THCIConnHandle aConnectionHandle) const; |
|
294 TInt MplsGetRemoteDeviceClass(TBTDeviceClass& aDeviceClass, const TBTDevAddr& aBDAddr) const; |
|
295 TInt MplsGetRemoteSupportedFeatures(TBTFeatures& aRemoteSupportedFeatures, const TBTDevAddr& aBDAddr) const; |
|
296 TInt MplsGetLinkPolicySettings(TLinkPolicy& aLinkPolicySettings, const TBTDevAddr& aBDAddr) const; |
|
297 TInt MplsGetBasebandLinkState(TBTBasebandLinkState& aBasebandLinkState, const TBTDevAddr& aBDAddr) const; |
|
298 |
|
299 // from MLinkMuxNotifier - Simply forward the request to iLinkMuxer |
|
300 void TryToSend(); |
|
301 |
|
302 // from MHCIClientUsage |
|
303 void MhcuOpenClientReference(); |
|
304 void MhcuCloseClientReference(); |
|
305 |
|
306 TInt ChangeMode(TBTLinkMode aMode, THCIConnHandle aConnHandle); |
|
307 void DoChangeModeL(TBTLinkMode aMode, THCIConnHandle aConnHandle); |
|
308 TInt ExitMode(TBTLinkMode aMode, THCIConnHandle aConnHandle); |
|
309 void DoExitModeL(TBTLinkMode aMode, THCIConnHandle aConnHandle); |
|
310 |
|
311 void ChangeRoleL(TBTBasebandRole aRole, const TBTDevAddr& aAddr); |
|
312 |
|
313 void SetControllerToHostFlowControlL(); |
|
314 void AdvertiseHostBufferSizeL(TUint16 aNumBuffers); |
|
315 void ObtainHostControllerBufferSizeL(); |
|
316 |
|
317 // simple forwarders |
|
318 TUint16 ReadACLReportingInterval() const; |
|
319 TUint16 ReadACLFramingOverhead() const; |
|
320 |
|
321 #ifdef HOSTCONTROLLER_TO_HOST_FLOW_CONTROL |
|
322 RMBufChain TakeInboundACLDataBufferFromPool(const THCIConnHandle& aForConnHandle); |
|
323 #endif |
|
324 void ReadDeviceClassL(); |
|
325 private: |
|
326 TInt SendInitialisationCommand(CHCICommandBase* aCommand); |
|
327 void DoSendPostResetCommandsL(); |
|
328 |
|
329 // Event processing functions |
|
330 void ConnectionCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
331 void AuthenticationCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
332 void ReadRemSuppFeatCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
333 void ReadRemoteExtendedFeaturesCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
334 void ReadRemVerInfoCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
335 void CommandCompleteEvent(THCIOpcode aOpcode, THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
336 void CommandStatusEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
337 void FlushOccurredEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
338 void ReadClockOffsetEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
339 void ConnectionPacketTypeChangedEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
340 void LinkSupervisionTimeoutChangedEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
341 void SynchronousConnectionCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
342 void VendorDebugEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
343 void ConnectionRequestEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
344 void DisconnectionCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
345 void EncryptionChangeEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
346 void HardwareErrorEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
347 void RoleChangeEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
348 void ModeChangeEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
349 void PINCodeRequestEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
350 void LinkKeyRequestEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
351 void LinkKeyNotificationEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
352 void MaxSlotsChangeEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
|
353 |
|
354 // Data event processing functions |
|
355 void NumberOfCompletedPacketsEvent(THCIEventBase& aEvent); |
|
356 |
|
357 // Command Complete processing functions |
|
358 void WriteLinkPolicySettingsOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
359 void ResetOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
360 void ReadBdaddrOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
361 void ReadBufferSizeOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
362 void ReadClassOfDeviceOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
363 void WriteLocalNameOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
364 void WriteCurrentIACLAPOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
365 void WriteClassOfDeviceOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
366 void SetControllerToHostFlowControlOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
367 void WriteScanEnableOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
368 void SetAFHHostChannelClassificationOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
369 void WriteAFHChannelAssessmentModeOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
370 void ReadLocalVersionInfoOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
371 void ReadLocalSupportedFeaturesOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
372 void ReadLocalSupportedCommandsOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
373 void FlushOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
374 void SwitchRoleOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
375 void SetEventMaskOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
376 void ReadInquiryResponseTransmitPowerLevelOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand); |
|
377 |
|
378 // Functions |
|
379 CHCIFacade(CLinkMgrProtocol& aProtocol); |
|
380 void ConstructL(); |
|
381 |
|
382 void HandlePowerStatusChange(TBTPowerState aStatus); |
|
383 |
|
384 void SniffL(THCIConnHandle aHandleToRemote); |
|
385 void ExitSniffL(THCIConnHandle aHandleToRemote); |
|
386 void HoldL(THCIConnHandle aHandle); |
|
387 void ParkL(THCIConnHandle aHandleToRemote); |
|
388 void ExitParkL(THCIConnHandle aHandleToRemote); |
|
389 |
|
390 void SetupFlowControlL(TFlowControlMode aMode); |
|
391 |
|
392 // Helper methods. These are used to hide the issue |
|
393 // of having an RArray that stores 2 byte THCIOpcode values. |
|
394 TInt AddOutstandingCommandOpCode(THCIOpcode aOpCode); |
|
395 TInt FindOutstandingCommandOpCode(THCIOpcode aOpCode) const; |
|
396 |
|
397 // This function is used to Set Supported events mask then call SetEventMaskL |
|
398 void SetSupportedEventMasks(); |
|
399 |
|
400 private: |
|
401 // Data |
|
402 CLinkMgrProtocol& iLinkMgrProtocol; |
|
403 CPhysicalLinksManager* iLinksMgr; |
|
404 CHCIDirectAccessSAPsManager* iHCIDirectAccessSAPsMgr; |
|
405 |
|
406 CLinkMuxer* iLinkMuxer; // non-owned |
|
407 |
|
408 // HCI CommandQ |
|
409 CHCICmdQController* iCmdController; // we put things on the command Q |
|
410 |
|
411 enum TInitState |
|
412 { |
|
413 EIdle, |
|
414 EPreReset, |
|
415 EResetting, |
|
416 EReset, |
|
417 EPostReset, |
|
418 EInitialised, |
|
419 }; |
|
420 |
|
421 TBool iReadLocalSupportedFeaturesComplete; |
|
422 TBool iReadLocalVersionComplete; |
|
423 |
|
424 |
|
425 TInitState iInitState; |
|
426 |
|
427 // HCI utility library |
|
428 CHciUtil* iHciUtil; |
|
429 |
|
430 // Core HCI and associated interfaces |
|
431 CCoreHCIPlugin* iCoreHciPlugin; |
|
432 MCoreHci* iCoreHci; |
|
433 MHCTLInterface* iHctl; |
|
434 MControllerInitialisationInterface* iControllerInitialisor; |
|
435 MControllerInitialisationAbortExtensionInterface* iControllerInitAbortExtension; |
|
436 MHCIDataFramer* iDataFramer; |
|
437 MHardResetInitiator* iHardResetInitiator; |
|
438 |
|
439 // Timer for required interval between AFH Host Channel Classification commands |
|
440 CAFHTimer* iAFHTimer; |
|
441 |
|
442 // Data |
|
443 THCITransportChannel iHCTLState; // memorize the status of the free channels |
|
444 |
|
445 TBTPowerState iLastPowerState; |
|
446 |
|
447 #ifdef HOSTCONTROLLER_TO_HOST_FLOW_CONTROL |
|
448 CHostMBufPool* iMBufPool; |
|
449 #endif |
|
450 |
|
451 // This array contains outstanding command Op Codes. The array is |
|
452 // not defined using THCIOpcode as the template type because RArray |
|
453 // types must be word aligned. |
|
454 RArray<TUint32> iOutstandingCommands; |
|
455 TUint32 iDeviceClass; |
|
456 TBool iInitialisationError; |
|
457 TInt iTxPowerLevel; |
|
458 }; |
|
459 |
|
460 #endif |