44 class CBTPinRequester; |
44 class CBTPinRequester; |
45 class CACLLink; |
45 class CACLLink; |
46 class CRoleSwitcher; |
46 class CRoleSwitcher; |
47 class CBTNumericComparator; |
47 class CBTNumericComparator; |
48 class CBTPasskeyEntry; |
48 class CBTPasskeyEntry; |
49 class CEncryptionKeyRefresher; |
|
50 |
49 |
51 enum TPhysicalLinkSimplePairingMode |
50 enum TPhysicalLinkSimplePairingMode |
52 { |
51 { |
53 EPhySimplePairingUndefined, |
52 EPhySimplePairingUndefined, |
54 EPhySimplePairingDisabled, |
53 EPhySimplePairingDisabled, |
69 to prevent an early switch back into a low power mode. |
68 to prevent an early switch back into a low power mode. |
70 **/ |
69 **/ |
71 { |
70 { |
72 public: |
71 public: |
73 static CArbitrationDelayTimer* NewL(CPhysicalLink* aParent); |
72 static CArbitrationDelayTimer* NewL(CPhysicalLink* aParent); |
|
73 ~CArbitrationDelayTimer(); |
74 TInt Start(TBool aImmediate, TBool aLocalPriority); |
74 TInt Start(TBool aImmediate, TBool aLocalPriority); |
75 void Restart(); |
75 void Restart(); |
76 |
76 |
77 private: |
77 private: |
78 CArbitrationDelayTimer(CPhysicalLink* aParent); |
78 CArbitrationDelayTimer(CPhysicalLink* aParent); |
112 TLowPowModeCmdController(CPhysicalLink& aLink, MHCICommandQueue& aCmdController); |
112 TLowPowModeCmdController(CPhysicalLink& aLink, MHCICommandQueue& aCmdController); |
113 void Abort(); |
113 void Abort(); |
114 |
114 |
115 TInt ExitMode(TBTLinkMode aMode, THCIConnHandle aHandle); |
115 TInt ExitMode(TBTLinkMode aMode, THCIConnHandle aHandle); |
116 TInt ChangeMode(TBTLinkMode aMode, THCIConnHandle aHandle); |
116 TInt ChangeMode(TBTLinkMode aMode, THCIConnHandle aHandle); |
117 |
|
118 TInt ExecuteModeChange(TBTLinkMode aTargetMode); |
|
119 |
117 |
120 private: // events from MHCICommandQueueClient |
118 private: // events from MHCICommandQueueClient |
121 virtual void MhcqcCommandEventReceived(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
119 virtual void MhcqcCommandEventReceived(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand); |
122 virtual void MhcqcCommandErrored(TInt aErrorCode, const CHCICommandBase* aCommand); |
120 virtual void MhcqcCommandErrored(TInt aErrorCode, const CHCICommandBase* aCommand); |
123 |
121 |
128 void SniffL(THCIConnHandle aHandleToRemote); |
126 void SniffL(THCIConnHandle aHandleToRemote); |
129 void ExitSniffL(THCIConnHandle aHandleToRemote); |
127 void ExitSniffL(THCIConnHandle aHandleToRemote); |
130 void HoldL(THCIConnHandle aHandle); |
128 void HoldL(THCIConnHandle aHandle); |
131 void ParkL(THCIConnHandle aHandleToRemote); |
129 void ParkL(THCIConnHandle aHandleToRemote); |
132 void ExitParkL(THCIConnHandle aHandleToRemote); |
130 void ExitParkL(THCIConnHandle aHandleToRemote); |
133 |
131 |
134 private: |
132 private: |
135 CPhysicalLink& iParent; |
133 CPhysicalLink& iParent; |
136 MHCICommandQueue& iCmdController; |
134 MHCICommandQueue& iCmdController; |
137 TBool iOutstandingCmd; |
135 TBool iOutstandingCmd; |
138 TBTLinkMode iTargetMode; |
|
139 }; |
136 }; |
140 |
137 |
141 /** |
138 /** |
142 The following class controls disconnect commands and related events. |
139 The following class controls disconnect commands and related events. |
143 It bypasses HCI_Facade to keep deep control of all events including errors. |
140 It bypasses HCI_Facade to keep deep control of all events including errors. |
334 TInt Authenticate(TBool aRequireAuthenticatedLinkKey); |
331 TInt Authenticate(TBool aRequireAuthenticatedLinkKey); |
335 TInt ChangeLinkKey(); |
332 TInt ChangeLinkKey(); |
336 |
333 |
337 TInt ChangeConnectionPacketType(TUint16 aType); |
334 TInt ChangeConnectionPacketType(TUint16 aType); |
338 |
335 |
|
336 TInt ExitMode(TBTLinkMode aMode); |
339 TInt RequestHold(); |
337 TInt RequestHold(); |
|
338 TInt RequestSniff(); |
|
339 TInt RequestPark(); |
|
340 TInt RequestActive(); |
340 TInt RequestChangeRole(TBTBasebandRole aRole); |
341 TInt RequestChangeRole(TBTBasebandRole aRole); |
341 |
342 |
342 void ReadNewPhysicalLinkMetricValue(TUint aIoctlName, CBTProxySAP& aSAP, TInt aCurrentValue); |
343 void ReadNewPhysicalLinkMetricValue(TUint aIoctlName, CBTProxySAP& aSAP, TInt aCurrentValue); |
343 |
344 |
344 TInt OverridePark(); |
345 TInt OverridePark(); |
345 TInt UndoOverridePark(); |
346 TInt UndoOverridePark(); |
|
347 TInt OverrideLPMWithTimeout(TUint aTimeout); |
346 TInt OverrideLPM(); |
348 TInt OverrideLPM(); |
347 TInt UndoOverrideLPM(); |
349 TInt UndoOverrideLPM(); |
348 inline TBool IsParked() const; |
350 inline TBool IsParked() const; |
349 |
351 |
350 TBool ACLConnectPending() const; |
352 TBool ACLConnectPending() const; |
373 virtual void ModeChange(THCIErrorCode aErr, THCIConnHandle aConnH, TBTLinkMode aMode, TBasebandTime aInterval); |
375 virtual void ModeChange(THCIErrorCode aErr, THCIConnHandle aConnH, TBTLinkMode aMode, TBasebandTime aInterval); |
374 virtual void WriteLinkPolicySettingsCompleteEvent(THCIErrorCode aErr, THCIConnHandle aConnH); |
376 virtual void WriteLinkPolicySettingsCompleteEvent(THCIErrorCode aErr, THCIConnHandle aConnH); |
375 virtual void RoleChange(THCIErrorCode aErr, const TBTDevAddr& aAddr, TBTBasebandRole aRole); |
377 virtual void RoleChange(THCIErrorCode aErr, const TBTDevAddr& aAddr, TBTBasebandRole aRole); |
376 virtual void ClockOffset(THCIErrorCode aErr, THCIConnHandle aConnH, TBasebandTime aClockOffset); |
378 virtual void ClockOffset(THCIErrorCode aErr, THCIConnHandle aConnH, TBasebandTime aClockOffset); |
377 virtual void RemoteName(THCIErrorCode aErr, const TBTDevAddr& aAddr, const TBTDeviceName8& aName); |
379 virtual void RemoteName(THCIErrorCode aErr, const TBTDevAddr& aAddr, const TBTDeviceName8& aName); |
378 virtual void EncryptionKeyRefreshComplete(THCIErrorCode aErr, THCIConnHandle aConnH); |
380 |
379 |
|
380 void ConnectionComplete(TInt aResult, const TBTConnect& aConn); |
381 void ConnectionComplete(TInt aResult, const TBTConnect& aConn); |
381 |
382 |
382 TBool LinkKeyRequestPending(); |
383 TBool LinkKeyRequestPending(); |
383 void SetAuthenticationPending(TUint8 aFlag); |
384 void SetAuthenticationPending(TUint8 aFlag); |
384 virtual void AuthenticationComplete(TUint8 aFlag); |
385 virtual void AuthenticationComplete(TUint8 aFlag); |
411 TBool HasSyncLink() const; |
412 TBool HasSyncLink() const; |
412 void GetDeviceFromRegistryL(); |
413 void GetDeviceFromRegistryL(); |
413 TBTLinkMode LinkMode() const; |
414 TBTLinkMode LinkMode() const; |
414 |
415 |
415 void AsyncDeleteRoleSwitcher(); |
416 void AsyncDeleteRoleSwitcher(); |
416 void AsyncDeleteKeyRefresher(); |
|
417 |
417 |
418 inline const TLinkPolicy& LinkPolicy() const; |
418 inline const TLinkPolicy& LinkPolicy() const; |
419 inline const TBTFeatures& RemoteFeatures() const; |
419 inline const TBTFeatures& RemoteFeatures() const; |
420 inline const TBTDeviceClass& DeviceClass() const; |
420 inline const TBTDeviceClass& DeviceClass() const; |
421 TInt GetConnectionHandles(RHCIConnHandleArray& aConnectionHandles, |
421 TInt GetConnectionHandles(RHCIConnHandleArray& aConnectionHandles, |
485 void SetLinkKey(const TBTLinkKey& aLinkKey, TBTLinkKeyType aLinkKeyType); |
485 void SetLinkKey(const TBTLinkKey& aLinkKey, TBTLinkKeyType aLinkKeyType); |
486 |
486 |
487 void QueueIdleTimer(TInt aTime); |
487 void QueueIdleTimer(TInt aTime); |
488 void RemoveIdleTimer(); |
488 void RemoveIdleTimer(); |
489 |
489 |
|
490 void QueueLPMOverrideTimer(TInt aTimeout); |
490 void NotifyStateChange(TBTBasebandEventNotification & aEvent); |
491 void NotifyStateChange(TBTBasebandEventNotification & aEvent); |
491 |
492 |
492 TBool IsPhysicalLinkIdle() const; |
493 TBool IsPhysicalLinkIdle() const; |
|
494 TInt RequestMode(TBTLinkMode aMode); |
493 TBasebandTime CalculatePageTimeout(TBasebandPageTimePolicy aPolicy, TUint8 aRepMode, TBool aValidClockOffset); |
495 TBasebandTime CalculatePageTimeout(TBasebandPageTimePolicy aPolicy, TUint8 aRepMode, TBool aValidClockOffset); |
494 TBool IsPasskeyMinLengthOK(); |
496 TBool IsPasskeyMinLengthOK(); |
495 TBool PeerSupportsLinkKeyRegeneration() const; |
497 TBool PeerSupportsLinkKeyRegeneration() const; |
496 |
498 |
497 void DeleteRoleSwitcher(); |
499 void DeleteRoleSwitcher(); |
498 static TInt RoleSwitchCompleteCallBack(TAny* CPhysicalLink); |
500 static TInt RoleSwitchCompleteCallBack(TAny* CPhysicalLink); |
499 TInt ManageEncryptionEnforcement(THCIEncryptModeFlag aEnable); |
501 TInt ManageEncryptionEnforcement(THCIEncryptModeFlag aEnable); |
500 |
|
501 void DeleteKeyRefresher(); |
|
502 static TInt KeyRefreshCompleteCallBack(TAny* CPhysicalLink); |
|
503 |
502 |
504 void HandlePrefetch(); |
503 void HandlePrefetch(); |
505 void PINCodeRequestReply(const TBTDevAddr& aDevAddr,const TDesC8& aPin); |
504 void PINCodeRequestReply(const TBTDevAddr& aDevAddr,const TDesC8& aPin); |
506 void PINCodeRequestNegativeReply(const TBTDevAddr& aDevAddr); |
505 void PINCodeRequestNegativeReply(const TBTDevAddr& aDevAddr); |
507 |
506 |
554 TBTConnect iLastPendingConnection; // for if we have to wait for Registry to decide whether to rject or accept a connection |
553 TBTConnect iLastPendingConnection; // for if we have to wait for Registry to decide whether to rject or accept a connection |
555 TBool iPendingConnection; // is a connection request waiting for a reply |
554 TBool iPendingConnection; // is a connection request waiting for a reply |
556 TSglQue<CBTProxySAP> iProxySAPs; // the proxies bound to us |
555 TSglQue<CBTProxySAP> iProxySAPs; // the proxies bound to us |
557 TDeltaTimerEntry iIdleTimerEntry; |
556 TDeltaTimerEntry iIdleTimerEntry; |
558 TBool iIdleTimerQueued; |
557 TBool iIdleTimerQueued; |
|
558 TDeltaTimerEntry iOverrideLPMTimerEntry; |
559 |
559 |
560 TLinkPolicy iLinkPolicy; |
560 TLinkPolicy iLinkPolicy; |
561 TUint16 iPreviousRequestedModeMask; |
561 TUint16 iPreviousRequestedModeMask; |
562 TBool iOverrideParkRequests; //for maybe temporary unpark |
562 TBool iOverrideParkRequests; //for maybe temporary unpark |
563 TBool iOverrideLPMRequests; //for maybe temporary force active |
563 TBool iOverrideLPMRequests; //for maybe temporary force active |
|
564 TBool iLPMOverrideTimerQueued; |
564 TBool iConnectionPacketTypeChanged; //for triggering h/w |
565 TBool iConnectionPacketTypeChanged; //for triggering h/w |
565 |
566 |
566 TBool iPreventLinkKeyUpdateReg; //for case e.g. user has called unpair when there is a paired logical channel |
567 TBool iPreventLinkKeyUpdateReg; //for case e.g. user has called unpair when there is a paired logical channel |
567 TUint8 iAuthStateMask; // Authentication state mask to keep track of the authentication process |
568 TUint8 iAuthStateMask; // Authentication state mask to keep track of the authentication process |
568 TBool iLinkKeyPending; //PIN has been sent, awaiting a link key. |
569 TBool iLinkKeyPending; //PIN has been sent, awaiting a link key. |
570 TBool iPeerInSecurityMode3; |
571 TBool iPeerInSecurityMode3; |
571 TBasebandTime iSniffInterval; |
572 TBasebandTime iSniffInterval; |
572 CArbitrationDelayTimer* iArbitrationDelay; //for lower power modes |
573 CArbitrationDelayTimer* iArbitrationDelay; //for lower power modes |
573 CRoleSwitcher* iRoleSwitcher; //class handles role switch, prevents LPM, removes encryption |
574 CRoleSwitcher* iRoleSwitcher; //class handles role switch, prevents LPM, removes encryption |
574 CAsyncCallBack* iRoleSwitchCompleteCallBack;// Async Callback to delete role swticher class. |
575 CAsyncCallBack* iRoleSwitchCompleteCallBack;// Async Callback to delete role swticher class. |
575 CEncryptionKeyRefresher* iKeyRefresher; //class handles key refresh |
|
576 CAsyncCallBack* iKeyRefreshCompleteCallBack;// Async Callback to delete key refresher class. |
|
577 |
576 |
578 TLowPowModeCmdController iLowPowModeCtrl; |
577 TLowPowModeCmdController iLowPowModeCtrl; |
579 CPhysicalLinkMetrics* iPhysicalLinkMetrics; |
578 CPhysicalLinkMetrics* iPhysicalLinkMetrics; |
580 TDisconnectCmdController iDisconnectCtrl; |
579 TDisconnectCmdController iDisconnectCtrl; |
581 TAuthenticationCmdController iAuthenticationCtrl; |
580 TAuthenticationCmdController iAuthenticationCtrl; |