|
1 // Copyright (c) 2007-2010 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 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef HCTLUSBORIGINAL_H |
|
22 #define HCTLUSBORIGINAL_H |
|
23 |
|
24 #include <bluetooth/hci/hctlbase.h> |
|
25 #include <bluetooth/hciframelogger.h> |
|
26 #include <bluetooth/hci/hcitypes.h> |
|
27 #include <bluetooth/hci/hctlinterface.h> |
|
28 #include <bluetooth/hardresetinitiator.h> |
|
29 #include <d32usbdi.h> |
|
30 #include <fdchctloriginalcli.h> |
|
31 |
|
32 |
|
33 class CHCTLUsbOriginalCommand; |
|
34 class CHCTLUsbOriginalAclOut; |
|
35 class CHCTLUsbOriginalAclIn; |
|
36 class CHCTLUsbOriginalEvent; |
|
37 class CControllerManager; |
|
38 class CDeviceStateManager; |
|
39 class CHCTLUsbOriginalServer; |
|
40 class MHCTLChannelObserver; |
|
41 class MHCTLDataObserver; |
|
42 class MHCTLEventObserver; |
|
43 class MControllerStateObserver; |
|
44 class MQdpPluginInterfaceFinder; |
|
45 |
|
46 |
|
47 /**USB Original HCI Framing constants for command frames */ |
|
48 static const TInt KHCTLCommandHeaderSize = 0; |
|
49 static const TInt KHCTLCommandTrailerSize = 0; |
|
50 |
|
51 /**USB Original HCI Framing constants for ACL data frames */ |
|
52 static const TInt KHCTLAclDataHeaderSize = 0; |
|
53 static const TInt KHCTLAclDataTrailerSize = 0; |
|
54 |
|
55 /**USB Original HCI Framing constants for Synchronous data frames */ |
|
56 static const TInt KHCTLSynchronousDataHeaderSize = 0; |
|
57 static const TInt KHCTLSynchronousDataTrailerSize = 0; |
|
58 |
|
59 /** |
|
60 This is the class that implements the USB specific HCTL. |
|
61 */ |
|
62 NONSHARABLE_CLASS(CHCTLUsbOriginal) |
|
63 : public CHCTLBase |
|
64 , public MHCTLInterface |
|
65 , public MHardResetInitiator |
|
66 { |
|
67 public: |
|
68 static CHCTLUsbOriginal* NewL(); |
|
69 ~CHCTLUsbOriginal(); |
|
70 |
|
71 void ProcessACLData(const TDesC8& aData); |
|
72 void ProcessSynchronousData(const TDesC8& aData); |
|
73 void ProcessEvent(const TDesC8& aEvent); |
|
74 |
|
75 MQdpPluginInterfaceFinder* QdpPluginInterfaceFinder(); |
|
76 |
|
77 // Called from the Controller Manager |
|
78 void HandlePowerOff(); |
|
79 void HandlePowerOn(); |
|
80 TBTPowerState CurrentPowerState() const; |
|
81 |
|
82 // Called from Server Session. |
|
83 void DeviceAttachedL(TUint32 aStandardIf, TUint32 aScoIf); |
|
84 void DeviceRemoved(); |
|
85 |
|
86 TBool DevicePresent() const; |
|
87 |
|
88 private: |
|
89 CHCTLUsbOriginal(); |
|
90 void ConstructL(); |
|
91 TAny* Interface(TUid aUid); |
|
92 |
|
93 static TInt AsyncCallBackSecondStage(TAny* aUsbOriginal); |
|
94 static void Rollback(TAny* aPtr); |
|
95 |
|
96 void HandleChannelStateChange(); |
|
97 TInt SetPower(TBTPowerState aState); |
|
98 |
|
99 private: // from MHCTLInterface |
|
100 virtual TInt MhiWriteCommand(const TDesC8& aData); |
|
101 virtual TInt MhiWriteAclData(const TDesC8& aData); |
|
102 virtual TInt MhiWriteSynchronousData(const TDesC8& aData); |
|
103 virtual void MhiGetAclDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const; |
|
104 virtual void MhiGetSynchronousDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const; |
|
105 virtual void MhiGetCommandTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const; |
|
106 virtual void MhiSetChannelObserver(MHCTLChannelObserver& aChannelObserver); |
|
107 virtual void MhiSetDataObserver(MHCTLDataObserver& aDataObserver); |
|
108 virtual void MhiSetEventObserver(MHCTLEventObserver& aEventObserver); |
|
109 virtual void MhiSetControllerStateObserver(MControllerStateObserver& aControllerStateObserver); |
|
110 virtual void MhiSetQdpPluginInterfaceFinder(MQdpPluginInterfaceFinder& aQdpPluginInterfaceFinder); |
|
111 |
|
112 public: // from MHardResetInitiator |
|
113 virtual void MhriStartHardReset(); |
|
114 |
|
115 private: |
|
116 RUsbInterface iInterface; |
|
117 RUsbInterface iScoInterface; |
|
118 |
|
119 // Senders |
|
120 CHCTLUsbOriginalCommand* iControl; |
|
121 CHCTLUsbOriginalAclOut* iAclOut; |
|
122 // Receivers |
|
123 CHCTLUsbOriginalAclIn* iAclIn; |
|
124 CHCTLUsbOriginalEvent* iEvent; |
|
125 |
|
126 MQdpPluginInterfaceFinder* iQdpPluginInterfaceFinder; |
|
127 MHCTLChannelObserver* iChannelObserver; |
|
128 MHCTLEventObserver* iEventObserver; |
|
129 MHCTLDataObserver* iDataObserver; |
|
130 MControllerStateObserver* iControllerStateObserver; |
|
131 |
|
132 TBTPowerState iCurrentPowerState; |
|
133 |
|
134 CControllerManager* iControllerMan; |
|
135 CDeviceStateManager* iDeviceStateMan; |
|
136 CHCTLUsbOriginalServer* iServer; |
|
137 |
|
138 CAsyncCallBack* iSecondStageCallBack; |
|
139 |
|
140 RFdcHctlOriginal iFdc; |
|
141 |
|
142 DECLARE_HCI_LOGGER |
|
143 }; |
|
144 |
|
145 |
|
146 #endif // HCTLUSBORIGINAL_H |
|
147 |