author | mikaruus <mika.a.ruuskanen@nokia.com> |
Wed, 17 Feb 2010 13:58:55 +0200 | |
changeset 7 | fa67e03b87df |
parent 0 | 63b37f68c1ce |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef CUSBPNUSBSENDER_H |
|
20 |
#define CUSBPNUSBSENDER_H |
|
21 |
||
22 |
// INCLUDES |
|
23 |
#include <e32base.h> // For CActive |
|
24 |
||
25 |
// CONSTANTS |
|
26 |
// MACROS |
|
27 |
// DATA TYPES |
|
28 |
// FUNCTION PROTOTYPES |
|
29 |
// FORWARD DECLARATIONS |
|
30 |
class RDevUsbcClient; |
|
31 |
class MUsbPnBufferListener; |
|
32 |
class CUsbPnPacket; |
|
33 |
||
34 |
// CLASS DECLARATION |
|
35 |
||
36 |
/** |
|
37 |
* Sends received messages to USB |
|
38 |
*/ |
|
39 |
class CUsbPnUsbSender : public CActive |
|
40 |
{ |
|
41 |
public: // Constructors and destructor |
|
42 |
||
43 |
/** |
|
44 |
* Two-phased constructor. |
|
45 |
*/ |
|
46 |
static CUsbPnUsbSender* NewL( MUsbPnBufferListener&, RDevUsbcClient& ); |
|
47 |
||
48 |
/** |
|
49 |
* Destructor. |
|
50 |
*/ |
|
51 |
~CUsbPnUsbSender(); |
|
52 |
||
53 |
public: // New functions |
|
54 |
||
55 |
/** |
|
56 |
* Adds message to sending queue. |
|
57 |
* @param CUsbPnPacket& aPacket. Cell of circular buffer holding received data. |
|
58 |
*/ |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
59 |
void AddPacketToSendingQueue( CUsbPnPacket& aPacket ); |
0 | 60 |
|
61 |
/** |
|
62 |
* Get next free packet from pool. |
|
63 |
* @return reference to usable packet for receiver. |
|
64 |
*/ |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
65 |
CUsbPnPacket& GetNextPacketL(); |
0 | 66 |
|
67 |
protected: // Functions from base classes |
|
68 |
||
69 |
/** |
|
70 |
* From CActive |
|
71 |
*/ |
|
72 |
void DoCancel(); |
|
73 |
||
74 |
/** |
|
75 |
* From CActive |
|
76 |
*/ |
|
77 |
void RunL(); |
|
78 |
||
79 |
/** |
|
80 |
* From CActive |
|
81 |
*/ |
|
82 |
TInt RunError( TInt ); |
|
83 |
||
84 |
||
85 |
private: |
|
86 |
||
87 |
/** |
|
88 |
* C++ default constructor. |
|
89 |
*/ |
|
90 |
CUsbPnUsbSender( MUsbPnBufferListener&, RDevUsbcClient& ); |
|
91 |
||
92 |
/** |
|
93 |
* By default Symbian 2nd phase constructor is private. |
|
94 |
*/ |
|
95 |
void ConstructL(); |
|
96 |
||
97 |
/** |
|
98 |
* Creates packet object. |
|
99 |
*/ |
|
100 |
void AddPacketBufferL( TInt ); |
|
101 |
||
102 |
/** |
|
103 |
* Writes oldest message from queue. |
|
104 |
*/ |
|
105 |
void TryToSendPacket( const CUsbPnPacket& ); |
|
106 |
||
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
107 |
/** |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
108 |
* Delete circular buffer objects |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
109 |
*/ |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
110 |
void DeletePackets(); |
0 | 111 |
|
112 |
private: // Data |
|
113 |
||
114 |
// Transfer mechanism observer |
|
115 |
MUsbPnBufferListener& iBufferListener; |
|
116 |
||
117 |
// Reference to USB driver LDD. |
|
118 |
RDevUsbcClient& iLdd; |
|
119 |
||
120 |
// Number of packets in queue |
|
121 |
TUint iPacketCount; |
|
122 |
||
123 |
// Ownership. Newest packet -marker of circular buffer. Packets added to this 'end' of pool. |
|
124 |
CUsbPnPacket* iPacket; |
|
125 |
||
126 |
// Pointer to oldest packet -marker of circular buffer. Packets written from this 'end' of pool. |
|
127 |
CUsbPnPacket* iCurrentPacket; |
|
128 |
||
129 |
}; |
|
130 |
||
131 |
#endif // CUSBPNUSBSENDER_H |
|
132 |
||
133 |
// End of File |