bluetooth/btstack/linkmgr/hcifacade.h
changeset 32 f72906e669b4
parent 0 29b1cd4cb562
child 45 99439b07e980
equal deleted inserted replaced
31:b9d1744dc449 32:f72906e669b4
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    91 	static const TReal KQuickTimeMultiplier;
    91 	static const TReal KQuickTimeMultiplier;
    92 
    92 
    93 private:
    93 private:
    94 	};
    94 	};
    95 
    95 
    96 #ifdef HOSTCONTROLLER_TO_HOST_FLOW_CONTROL
    96 
    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 
    97 
   134 NONSHARABLE_CLASS(CAFHTimer) : public CTimer
    98 NONSHARABLE_CLASS(CAFHTimer) : public CTimer
   135 	{
    99 	{
   136 public:
   100 public:
   137 	static CAFHTimer* NewL(CHCIFacade& aParent);
   101 	static CAFHTimer* NewL(CHCIFacade& aParent);
   224 	void DisconnectL(THCIConnHandle aConnH, THCIErrorCode aErr);
   188 	void DisconnectL(THCIConnHandle aConnH, THCIErrorCode aErr);
   225 	void WriteScanEnableL(THCIScanEnable aEnable);
   189 	void WriteScanEnableL(THCIScanEnable aEnable);
   226 	
   190 	
   227 	void AcceptConnectionRequestL(const TBTDevAddr& aAddr, TUint8 aRole);
   191 	void AcceptConnectionRequestL(const TBTDevAddr& aAddr, TUint8 aRole);
   228 	void RejectConnectionRequestL(const TBTConnect& aConnect, THCIErrorCode aReason);
   192 	void RejectConnectionRequestL(const TBTConnect& aConnect, THCIErrorCode aReason);
   229 	void HostNumberOfCompletedPacketsL(THCIConnHandle aConnH, TUint16 aFrags);
       
   230 	void WriteLinkPolicySettingsL(THCIConnHandle aConnH, TUint16 aSettings);
   193 	void WriteLinkPolicySettingsL(THCIConnHandle aConnH, TUint16 aSettings);
   231 	void FlushL(THCIConnHandle aConnH);
   194 	void FlushL(THCIConnHandle aConnH);
   232 	void SetEventMaskL(const THCIEventMask& aEventMask);
   195 	void SetEventMaskL(const THCIEventMask& aEventMask);
   233 
   196 
   234 	void RefreshEncryptionKeyL(THCIConnHandle aHandle);
   197 	void RefreshEncryptionKeyL(THCIConnHandle aHandle);
   316 
   279 
   317 	// simple forwarders
   280 	// simple forwarders
   318 	TUint16 ReadACLReportingInterval() const;
   281 	TUint16 ReadACLReportingInterval() const;
   319 	TUint16 ReadACLFramingOverhead() const;
   282 	TUint16 ReadACLFramingOverhead() const;
   320 	
   283 	
   321 	#ifdef HOSTCONTROLLER_TO_HOST_FLOW_CONTROL
       
   322 	RMBufChain TakeInboundACLDataBufferFromPool(const THCIConnHandle& aForConnHandle);
       
   323 	#endif
       
   324 	void ReadDeviceClassL();
   284 	void ReadDeviceClassL();
   325 private:
   285 private:
   326 	TInt SendInitialisationCommand(CHCICommandBase* aCommand);
   286 	TInt SendInitialisationCommand(CHCICommandBase* aCommand);
   327 	void DoSendPostResetCommandsL();
   287 	void DoSendPostResetCommandsL();
   328 	
   288 	
   362 	void ReadClassOfDeviceOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   322 	void ReadClassOfDeviceOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   363 	void WriteLocalNameOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   323 	void WriteLocalNameOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   364 	void WriteCurrentIACLAPOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   324 	void WriteCurrentIACLAPOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   365 	void WriteClassOfDeviceOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   325 	void WriteClassOfDeviceOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   366 	void SetControllerToHostFlowControlOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   326 	void SetControllerToHostFlowControlOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
       
   327 	void HostBufferSizeOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   367 	void WriteScanEnableOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   328 	void WriteScanEnableOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   368 	void SetAFHHostChannelClassificationOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   329 	void SetAFHHostChannelClassificationOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   369 	void WriteAFHChannelAssessmentModeOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   330 	void WriteAFHChannelAssessmentModeOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   370 	void ReadLocalVersionInfoOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   331 	void ReadLocalVersionInfoOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   371 	void ReadLocalSupportedFeaturesOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   332 	void ReadLocalSupportedFeaturesOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   373 	void FlushOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   334 	void FlushOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   374 	void SwitchRoleOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   335 	void SwitchRoleOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   375 	void SetEventMaskOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   336 	void SetEventMaskOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   376 	void ReadInquiryResponseTransmitPowerLevelOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   337 	void ReadInquiryResponseTransmitPowerLevelOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);
   377 	
   338 	
       
   339 	void WriteSimplePairingModeOpcode(THCIErrorCode aHciErr, const THCIEventBase* aEvent, const CHCICommandBase* aRelatedCommand);	
       
   340 	
   378 	// Functions
   341 	// Functions
   379 	CHCIFacade(CLinkMgrProtocol& aProtocol);
   342 	CHCIFacade(CLinkMgrProtocol& aProtocol);
   380 	void ConstructL();
   343 	void ConstructL();
   381 
   344 
   382 	void HandlePowerStatusChange(TBTPowerState aStatus);
   345 	void HandlePowerStatusChange(TBTPowerState aStatus);
   441 
   404 
   442 	// Data
   405 	// Data
   443 	THCITransportChannel	iHCTLState; // memorize the status of the free channels
   406 	THCITransportChannel	iHCTLState; // memorize the status of the free channels
   444 
   407 
   445 	TBTPowerState        iLastPowerState;
   408 	TBTPowerState        iLastPowerState;
   446 	
       
   447 	#ifdef HOSTCONTROLLER_TO_HOST_FLOW_CONTROL
       
   448 	CHostMBufPool*			iMBufPool;
       
   449 	#endif	
       
   450 
   409 
   451 	// This array contains outstanding command Op Codes.  The array is 
   410 	// This array contains outstanding command Op Codes.  The array is 
   452 	// not defined using THCIOpcode as the template type because RArray
   411 	// not defined using THCIOpcode as the template type because RArray
   453 	// types must be word aligned.
   412 	// types must be word aligned.
   454 	RArray<TUint32> iOutstandingCommands;
   413 	RArray<TUint32> iOutstandingCommands;