|
1 // Copyright (c) 2001-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 // |
|
15 |
|
16 #ifndef LINKMUXER_H__ |
|
17 #define LINKMUXER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include "linkqitem.h" |
|
21 #include "linkflowcontrol.h" |
|
22 #include "linkutil.h" |
|
23 #include <bluetooth/linkmuxnotifier.h> |
|
24 #include <bluetooth/hci/hctlchannelobserver.h> |
|
25 |
|
26 class CHCIFacade; |
|
27 class CHCILinkMgr; |
|
28 class MHCICommandQueue; |
|
29 class CACLDataQController; |
|
30 class CLinkMgrProtocol; |
|
31 class CHCICmdQController; |
|
32 |
|
33 /** |
|
34 Regulates the issuing of buffers send down the same channel. |
|
35 |
|
36 The mux decides and notifies the appropriate Q to send data when the wire |
|
37 is free. The mux will need to be fed with 'the wire is free' events and |
|
38 trigger events that will indicate reception of events (external) |
|
39 corresponding to the different Qs -(like NumCompletedPackets, Write |
|
40 Data CommandComplete etc) |
|
41 */ |
|
42 NONSHARABLE_CLASS(CLinkMuxer) : public CBase |
|
43 { |
|
44 public: |
|
45 static CLinkMuxer* NewL(CLinkMgrProtocol& aLinkMgrProtocol, CHCIFacade& aHCIFacade); |
|
46 void ObtainHostControllerBufferSizeL(); |
|
47 void RecordHostControllerToHostFlowControl(TBool aFlowFlag); |
|
48 CACLDataQController* HandleLocalReadBufferSizeResult(TUint16 aAclMaxLen, |
|
49 TUint8 /*aScoMaxLen*/,TUint16 aNoACL,TUint16 /*aNoSCO*/); |
|
50 TInt ACLPacketMTU() const; |
|
51 |
|
52 CACLDataQController& DataQController() const {return *iDataController;}; |
|
53 void ChannelsFree(THCITransportChannel aChannel); // notification of free channels |
|
54 void ChannelsClosed(THCITransportChannel aChannel); // notification of closed channels |
|
55 static TInt TryToSendCallBackStatic(TAny* aCLinkMuxer); |
|
56 void TryToSend(); // request to send on certain channels |
|
57 #ifdef STACK_SCO_DATA |
|
58 TBool CanWriteSCOData(); |
|
59 #endif |
|
60 ~CLinkMuxer(); |
|
61 |
|
62 private: |
|
63 void DataTrigger(); |
|
64 void CommandTrigger(); |
|
65 void ConstructL(); |
|
66 CLinkMuxer(CLinkMgrProtocol& aLinkMgrProtocol, CHCIFacade& aHCIFacade); |
|
67 void DoSend(/*THCITransportChannel aChannel*/); // request to send on certain channels |
|
68 private: |
|
69 // owned resources |
|
70 CHCICmdQController* iCommandController; |
|
71 CACLDataQController* iDataController; |
|
72 CAsyncCallBack* iSendCallBack; |
|
73 // non-owned resources |
|
74 CHCIFacade& iHCIFacade; |
|
75 THCITransportChannel iChannelsFree; |
|
76 TFlowControlMode iFlowControlMode; |
|
77 CLinkMgrProtocol& iLinkMgrProtocol; |
|
78 TInt iACLPacketMTU; |
|
79 }; |
|
80 |
|
81 #endif |