|
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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef HCTLTI_H |
|
22 #define HCTLTI_H |
|
23 |
|
24 #include "HCTLConfigInterface.h" |
|
25 |
|
26 #include <bluetooth/hci/hctluartbase.h> |
|
27 #include <bluetooth/hciframelogger.h> |
|
28 #include <bluetooth/hci/hcitypes.h> |
|
29 |
|
30 |
|
31 class CHCTLTiReceiver; |
|
32 class CHCTLTiSender; |
|
33 class CControllerManager; |
|
34 |
|
35 // Define HCTL Packet Header Size |
|
36 static const TInt KHctlHeaderSize = 1; |
|
37 static const TInt KHctlPacketTypeOffset = 0; |
|
38 |
|
39 // UART HCI Framing constants for command frames |
|
40 static const TInt KHCTLCommandHeaderSize = 1; |
|
41 static const TInt KHCTLCommandTrailerSize = 0; |
|
42 |
|
43 // UART HCI Framing constants for ACL data frames |
|
44 static const TInt KHCTLAclDataHeaderSize = 1; |
|
45 static const TInt KHCTLAclDataTrailerSize = 0; |
|
46 |
|
47 // UART HCI Framing constants for Synchronous data frames |
|
48 static const TInt KHCTLSynchronousDataHeaderSize = 1; |
|
49 static const TInt KHCTLSynchronousDataTrailerSize = 0; |
|
50 |
|
51 _LIT(KIniFileName, "hctl_ti"); |
|
52 |
|
53 /** |
|
54 This is the class that implements the UART specific HCTL. |
|
55 */ |
|
56 NONSHARABLE_CLASS(CHCTLTi) : public CHCTLUartBase, |
|
57 public MHctlConfigInterface |
|
58 { |
|
59 public: |
|
60 static CHCTLTi* NewL(); |
|
61 ~CHCTLTi(); |
|
62 |
|
63 void DoConfigL(); |
|
64 virtual void ProcessACLData(const TDesC8& aData); |
|
65 virtual void ProcessSynchronousData(const TDesC8& aData); |
|
66 virtual void ProcessEvent(const TDesC8& aEvent); |
|
67 |
|
68 MQdpPluginInterfaceFinder* QdpPluginInterfaceFinder(); |
|
69 |
|
70 // From MHardResetInitiator |
|
71 virtual void MhriStartHardReset(); |
|
72 |
|
73 // From MHCTLConfigInterface |
|
74 virtual TInt MhciUpdateBaudRate(TUint32 aBaudRate); |
|
75 |
|
76 // Called from the Controller Manager |
|
77 void HandlePowerOff(); |
|
78 void HandlePowerOn(); |
|
79 |
|
80 TBTPowerState CurrentPowerState() const; |
|
81 |
|
82 public: |
|
83 // HCTL packet types as defined in Section 2, Part H: 4 of the |
|
84 // bluetooth specification. |
|
85 enum THctlPacketType |
|
86 { |
|
87 ECommandPacket = 0x01, |
|
88 EACLDataPacket = 0x02, |
|
89 ESynchronousDataPacket = 0x03, |
|
90 EEventPacket = 0x04, |
|
91 }; |
|
92 |
|
93 private: |
|
94 CHCTLTi(); |
|
95 void ConstructL(); |
|
96 TAny* Interface(TUid aUid); |
|
97 |
|
98 static void SetPacketIndicator(THctlPacketType aType, const TDesC8& aData); |
|
99 |
|
100 // From CHCTLUartBase |
|
101 virtual void PortOpenedL(); |
|
102 |
|
103 // From MHCTLInterface |
|
104 virtual TInt MhiWriteCommand(const TDesC8& aData); |
|
105 virtual TInt MhiWriteAclData(const TDesC8& aData); |
|
106 virtual TInt MhiWriteSynchronousData(const TDesC8& aData); |
|
107 virtual void MhiGetAclDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const; |
|
108 virtual void MhiGetSynchronousDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const; |
|
109 virtual void MhiGetCommandTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const; |
|
110 virtual void MhiSetChannelObserver(MHCTLChannelObserver& aChannelObserver); |
|
111 virtual void MhiSetDataObserver(MHCTLDataObserver& aDataObserver); |
|
112 virtual void MhiSetEventObserver(MHCTLEventObserver& aEventObserver); |
|
113 virtual void MhiSetControllerStateObserver(MControllerStateObserver& aControllerStateObserver); |
|
114 virtual void MhiSetQdpPluginInterfaceFinder(MQdpPluginInterfaceFinder& aQdpPluginInterfaceFinder); |
|
115 |
|
116 private: |
|
117 CHCTLTiReceiver* iReceiver; |
|
118 CHCTLTiSender* iSender; |
|
119 MQdpPluginInterfaceFinder* iQdpPluginInterfaceFinder; |
|
120 TBTPowerState iCurrentPowerState; |
|
121 |
|
122 CControllerManager* iControllerMan; |
|
123 DECLARE_HCI_LOGGER |
|
124 }; |
|
125 |
|
126 |
|
127 #endif // HCTLTI_H |
|
128 |