1 /* |
1 /* |
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
84 |
84 |
85 // ---------------------------------------------------------------------------- |
85 // ---------------------------------------------------------------------------- |
86 // Standard active object error function. |
86 // Standard active object error function. |
87 // ---------------------------------------------------------------------------- |
87 // ---------------------------------------------------------------------------- |
88 // |
88 // |
89 TInt CEP0Reader::RunError( TInt /*aError*/ ) |
89 TInt CEP0Reader::RunError( TInt aError ) |
90 { |
90 { |
|
91 FTRACE(FPrint( |
|
92 _L("[USBDEVCON]\tCEP0Reader::RunError, aError = %d"), aError)); |
91 return KErrNone; |
93 return KErrNone; |
92 } |
94 } |
93 |
95 |
94 // --------------------------------------------------------------------------- |
96 // --------------------------------------------------------------------------- |
95 // Data has been read from EP0 |
97 // Data has been read from EP0 |
98 void CEP0Reader::RunL() |
100 void CEP0Reader::RunL() |
99 { |
101 { |
100 |
102 |
101 FLOG( _L( "[USBDEVCON]\tCEP0Reader::RunL Data received:" ) ); |
103 FLOG( _L( "[USBDEVCON]\tCEP0Reader::RunL Data received:" ) ); |
102 |
104 |
103 iObserver.ReadEP0(iBuffer, iStatus); |
105 iObserver.ReadEP0L(iBuffer, iStatus); |
104 } |
106 } |
105 |
107 |
106 // --------------------------------------------------------------------------- |
108 // --------------------------------------------------------------------------- |
107 // Issue request to read setup packet |
109 // Issue request to read setup packet |
108 // --------------------------------------------------------------------------- |
110 // --------------------------------------------------------------------------- |
109 // |
111 // |
110 void CEP0Reader::ReadSetupPacket() |
112 void CEP0Reader::ReadSetupPacketL() |
111 { |
113 { |
112 |
114 |
113 FLOG( _L( "[USBDEVCON]\tCEP0Reader::ReadSetupPacket" ) ); |
115 FLOG( _L( "[USBDEVCON]\tCEP0Reader::ReadSetupPacket" ) ); |
114 |
116 |
115 if(IsActive()) |
117 if(IsActive()) |
116 { |
118 { |
117 return; |
119 return; |
118 } |
120 } |
119 |
121 |
120 iBuffer.Close(); |
122 iBuffer.Close(); |
121 iBuffer.Create(KSetupPacketLength); |
123 iBuffer.CreateL(KSetupPacketLength); |
122 |
124 |
123 iLdd.ReadPacket(iStatus, EEndpoint0, iBuffer, KSetupPacketLength); |
125 iLdd.ReadPacket(iStatus, EEndpoint0, iBuffer, KSetupPacketLength); |
124 SetActive(); |
126 SetActive(); |
125 |
127 |
126 } |
128 } |
127 |
129 |
128 // --------------------------------------------------------------------------- |
130 // --------------------------------------------------------------------------- |
129 // Issue request to read data |
131 // Issue request to read data |
130 // --------------------------------------------------------------------------- |
132 // --------------------------------------------------------------------------- |
131 // |
133 // |
132 void CEP0Reader::Read(TUint aDataLength) |
134 void CEP0Reader::ReadL(TUint aDataLength) |
133 { |
135 { |
134 |
136 |
135 FLOG( _L( "[USBDEVCON]\tCEP0Reader::Read" ) ); |
137 FLOG( _L( "[USBDEVCON]\tCEP0Reader::Read" ) ); |
136 |
138 |
137 if(IsActive()) |
139 if(IsActive()) |
138 { |
140 { |
139 return; |
141 return; |
140 } |
142 } |
141 |
143 |
142 iBuffer.Close(); |
144 iBuffer.Close(); |
143 iBuffer.Create(aDataLength); |
145 iBuffer.CreateL(aDataLength); |
144 |
146 |
145 iLdd.Read(iStatus, EEndpoint0, iBuffer, aDataLength); |
147 iLdd.Read(iStatus, EEndpoint0, iBuffer, aDataLength); |
146 SetActive(); |
148 SetActive(); |
147 |
149 |
148 } |
150 } |