|
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 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef HCICOMMANDQITEM_H |
|
23 #define HCICOMMANDQITEM_H |
|
24 |
|
25 #include <e32base.h> |
|
26 |
|
27 class CHCICmdQCompletionTimer; |
|
28 class CHCICmdQController; |
|
29 class CHctlCommandFrame; |
|
30 class MHCICommandAllocator; |
|
31 class MHCICommandQueueClient; |
|
32 class CHCICommandBase; |
|
33 |
|
34 |
|
35 /** |
|
36 Encapsulates a Command frame so that it can be placed on and handled by |
|
37 the CHCICmdQController. |
|
38 |
|
39 The class is designed to be used by the Command Queue Controller |
|
40 |
|
41 @see CHCICmdQController |
|
42 */ |
|
43 NONSHARABLE_CLASS(CHCICommandQItem) : public CBase |
|
44 { |
|
45 friend class CHCICmdQController; |
|
46 public: // exported |
|
47 IMPORT_C static CHCICommandQItem* NewL(MHCICommandAllocator& aCommandAllocator, |
|
48 MHCICommandQueueClient& aCmdProgressRecipient, |
|
49 CHCICommandBase* aCommand); |
|
50 IMPORT_C ~CHCICommandQItem(); |
|
51 |
|
52 IMPORT_C CHCICommandBase& Command() const; |
|
53 |
|
54 IMPORT_C MHCICommandQueueClient* Client() const; |
|
55 |
|
56 IMPORT_C TAny* QdpData() const; |
|
57 IMPORT_C void SetQdpData(TAny* aQdpData); |
|
58 |
|
59 IMPORT_C TBool ReceivedCmdStatusEvent() const; |
|
60 IMPORT_C TBool IsInitialisation() const; |
|
61 IMPORT_C TBool IsParent() const; |
|
62 IMPORT_C TBool IsPreChild() const; |
|
63 IMPORT_C TBool IsPostChild() const; |
|
64 IMPORT_C TBool IsNormal() const; |
|
65 IMPORT_C TUint SentCount() const; |
|
66 |
|
67 public: |
|
68 /** |
|
69 @internalComponent |
|
70 */ |
|
71 enum TType |
|
72 { |
|
73 /** |
|
74 A CHCICommandQItem is this type until QDP::MhcqdiDoesCommandRequireWorkaround(...) is called on it. |
|
75 */ |
|
76 EIndeterminate = 0, |
|
77 |
|
78 /** |
|
79 A CHCICommandQItem is this type if QDP::MhcqdiDoesCommandRequireWorkaround(...) returned EFalse for this object. |
|
80 */ |
|
81 ENormal = 1, |
|
82 |
|
83 /** |
|
84 A CHCICommandQItem is this type if QDP::MhcqdiDoesCommandRequireWorkaround(...) returned ETrue for this object. |
|
85 */ |
|
86 EParent = 2, |
|
87 |
|
88 /** |
|
89 A CHCICommandQItem is set to this type after it is returned by QDP::GetPreChild. |
|
90 */ |
|
91 EPreChild = 3, |
|
92 |
|
93 /** |
|
94 A CHCICommandQItem is set to this type after it is returned by QDP::GetPostChild. |
|
95 */ |
|
96 EPostChild = 4, |
|
97 }; |
|
98 |
|
99 public: |
|
100 |
|
101 CHctlCommandFrame& Frame() const; |
|
102 |
|
103 TUint CommandQId() const; |
|
104 void SetCommandQId(TUint aId); |
|
105 |
|
106 void SetReceivedCmdStatusEvent(TBool aReceivedCmdStatusEvent); |
|
107 |
|
108 void SetInitialisationCmd(); |
|
109 |
|
110 TBool DuplicatedOpcode() const; |
|
111 void SetDuplicatedOpcode(TBool aDuplicatedOpcode); |
|
112 |
|
113 void StartCompletionTimer(TUint aMilliseconds, CHCICmdQController& aController); |
|
114 void CancelCompletionTimer(); |
|
115 |
|
116 TType Type() const; |
|
117 void SetType(TType aType); |
|
118 |
|
119 void CommandSent(); |
|
120 |
|
121 void FormatFrame(); |
|
122 |
|
123 void DetachClient(); |
|
124 |
|
125 private: |
|
126 CHCICommandQItem(MHCICommandQueueClient& aCmdProgressRecipient, |
|
127 CHCICommandBase* aCommand); |
|
128 void ConstructL(MHCICommandAllocator& aCommandAllocator); |
|
129 |
|
130 private: |
|
131 /** |
|
132 Command state bit flags |
|
133 */ |
|
134 enum TCommandStateBits |
|
135 { |
|
136 /** |
|
137 Indicates that a Command Status Event has been processed |
|
138 for the command |
|
139 */ |
|
140 EReceivedCmdStatusEvent = 0x01, |
|
141 |
|
142 /** |
|
143 Indicates that a duplicate command has been detected. |
|
144 */ |
|
145 EDuplicatedOpcode = 0x02, |
|
146 |
|
147 /** |
|
148 Indicates that the command was added as an Initialisation command. |
|
149 */ |
|
150 EInitialisationCmd = 0x04, |
|
151 }; |
|
152 |
|
153 private: // owned |
|
154 TDblQueLink iLink; |
|
155 TUint iCommandQId; |
|
156 TType iType; |
|
157 |
|
158 /** |
|
159 This is a bit mask of the possible TCommandStateBits states |
|
160 */ |
|
161 TUint8 iCommandState; |
|
162 TUint8 iSentCounter; |
|
163 |
|
164 /** |
|
165 The timer runs between when the command is sent and when it completes. |
|
166 If the timeout value given is 0 then no timer will be run. |
|
167 |
|
168 NB a Command Status event doesn't stop the timer. |
|
169 */ |
|
170 CHCICmdQCompletionTimer* iCompletionTimer; |
|
171 |
|
172 CHCICommandBase* iCommand; |
|
173 CHctlCommandFrame* iCmdFrame; |
|
174 |
|
175 private: |
|
176 /** |
|
177 Owned by this class in the sense that we will delete this pointer (after notifying |
|
178 the licensee provided QDP) but this class must not otherwise touch this data. It |
|
179 is to be used only by the licensee provided QDP. |
|
180 */ |
|
181 TAny* iQdpData; |
|
182 |
|
183 private: //unowned |
|
184 |
|
185 MHCICommandQueueClient* iCmdProgressRecipient; |
|
186 }; |
|
187 |
|
188 |
|
189 #endif // HCICOMMANDQITEM_H |