|
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 HCTLTIRECEIVER_H |
|
22 #define HCTLTIRECEIVER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <bluetooth/hci/hcievents.h> |
|
26 #include <bluetooth/hciframelogger.h> |
|
27 |
|
28 |
|
29 class CHCTLTi; |
|
30 class RBusDevComm; |
|
31 |
|
32 /** |
|
33 This is the class that implements the UART specifics of the Receiver AO and framer. |
|
34 |
|
35 This class is not intented for derivation. |
|
36 */ |
|
37 NONSHARABLE_CLASS(CHCTLTiReceiver) : public CActive |
|
38 { |
|
39 public: |
|
40 static CHCTLTiReceiver* NewL(CHCTLTi& aHCTLTi, RBusDevComm& aPort); |
|
41 ~CHCTLTiReceiver(); |
|
42 |
|
43 // Called to initiate the initial read on the port. |
|
44 void Start(); |
|
45 |
|
46 private: |
|
47 CHCTLTiReceiver(CHCTLTi& aHCTLTi, RBusDevComm& aPort); |
|
48 void ConstructL(); |
|
49 |
|
50 // Helper methods |
|
51 void QueueReadForNextFrame(TUint16 aOffset, TUint16 aBytesRequired); |
|
52 void ProcessData(); |
|
53 |
|
54 // From CActive |
|
55 virtual void RunL(); |
|
56 virtual void DoCancel(); |
|
57 |
|
58 private: |
|
59 enum THctlReceiverState |
|
60 { |
|
61 EWaitingForHctlHeaderByte, |
|
62 EWaitingForHciHeader, |
|
63 EWaitingForHciPayload, |
|
64 EInvalidDataReceived, |
|
65 }; |
|
66 |
|
67 // Set the receive buffer equal to the 3-DH5 packet size. |
|
68 // This value should be changed by licensees if the controller |
|
69 // is exceeding this packet size. |
|
70 |
|
71 // 3-DH5. Payload = 1021 octets. |
|
72 // Buffer length = payload + HCTL overhead + ACL Header |
|
73 static const TUint16 KHCTLRecvBufSize = 1026; |
|
74 |
|
75 CHCTLTi& iHCTLTi; |
|
76 THctlReceiverState iState; |
|
77 |
|
78 TUint8 iCurrentHCIPacketType; |
|
79 |
|
80 RBuf8 iReceiveBuffer; |
|
81 TPtr8 iReceiveBufPtr; |
|
82 |
|
83 RBusDevComm& iPort; |
|
84 DECLARE_HCI_LOGGER |
|
85 }; |
|
86 |
|
87 #endif // HCTLTIRECEIVER_H |
|
88 |