1 /* |
1 /* |
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 1997-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". |
20 #include "ActiveReadOneOrMoreReader.h" |
20 #include "ActiveReadOneOrMoreReader.h" |
21 #include "AcmConstants.h" |
21 #include "AcmConstants.h" |
22 #include "AcmPanic.h" |
22 #include "AcmPanic.h" |
23 #include "AcmUtils.h" |
23 #include "AcmUtils.h" |
24 #include "ReadOneOrMoreObserver.h" |
24 #include "ReadOneOrMoreObserver.h" |
25 #include <usb/usblogger.h> |
25 #include "OstTraceDefinitions.h" |
26 |
26 #ifdef OST_TRACE_COMPILER_IN_USE |
27 #ifdef __FLOG_ACTIVE |
27 #include "ActiveReadOneOrMoreReaderTraces.h" |
28 _LIT8(KLogComponent, "ECACM"); |
|
29 #endif |
28 #endif |
30 |
29 |
31 CActiveReadOneOrMoreReader::CActiveReadOneOrMoreReader( |
30 CActiveReadOneOrMoreReader::CActiveReadOneOrMoreReader( |
32 MReadOneOrMoreObserver& aParent, |
31 MReadOneOrMoreObserver& aParent, |
33 RDevUsbcClient& aLdd, |
32 RDevUsbcClient& aLdd, |
43 * complete. |
42 * complete. |
44 * @param aLdd The LDD handle to be used for posting read requests. |
43 * @param aLdd The LDD handle to be used for posting read requests. |
45 * @param aEndpoint The endpoint to read from. |
44 * @param aEndpoint The endpoint to read from. |
46 */ |
45 */ |
47 { |
46 { |
|
47 OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_CONS_ENTRY ); |
48 CActiveScheduler::Add(this); |
48 CActiveScheduler::Add(this); |
|
49 OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_CONS_EXIT ); |
49 } |
50 } |
50 |
51 |
51 CActiveReadOneOrMoreReader::~CActiveReadOneOrMoreReader() |
52 CActiveReadOneOrMoreReader::~CActiveReadOneOrMoreReader() |
52 /** |
53 /** |
53 * Destructor. |
54 * Destructor. |
54 */ |
55 */ |
55 { |
56 { |
56 LOG_FUNC |
57 OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_DES_ENTRY ); |
57 |
|
58 Cancel(); |
58 Cancel(); |
|
59 OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_CACTIVEREADONEORMOREREADER_DES_EXIT ); |
59 } |
60 } |
60 |
61 |
61 CActiveReadOneOrMoreReader* CActiveReadOneOrMoreReader::NewL( |
62 CActiveReadOneOrMoreReader* CActiveReadOneOrMoreReader::NewL( |
62 MReadOneOrMoreObserver& aParent, |
63 MReadOneOrMoreObserver& aParent, |
63 RDevUsbcClient& aLdd, |
64 RDevUsbcClient& aLdd, |
70 * @param aLdd The LDD handle to be used for posting read requests. |
71 * @param aLdd The LDD handle to be used for posting read requests. |
71 * @param aEndpoint The endpoint to read from. |
72 * @param aEndpoint The endpoint to read from. |
72 * @return Ownership of a new CActiveReadOneOrMoreReader object. |
73 * @return Ownership of a new CActiveReadOneOrMoreReader object. |
73 */ |
74 */ |
74 { |
75 { |
75 LOG_STATIC_FUNC_ENTRY |
76 OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_NEWL_ENTRY ); |
76 |
|
77 CActiveReadOneOrMoreReader* self = |
77 CActiveReadOneOrMoreReader* self = |
78 new(ELeave) CActiveReadOneOrMoreReader(aParent, aLdd, aEndpoint); |
78 new(ELeave) CActiveReadOneOrMoreReader(aParent, aLdd, aEndpoint); |
|
79 OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_NEWL_EXIT ); |
79 return self; |
80 return self; |
80 } |
81 } |
81 |
82 |
82 void CActiveReadOneOrMoreReader::ReadOneOrMore(TDes8& aDes, TInt aLength) |
83 void CActiveReadOneOrMoreReader::ReadOneOrMore(TDes8& aDes, TInt aLength) |
83 /** |
84 /** |
85 * |
86 * |
86 * @param aDes A descriptor into which the data will be read. |
87 * @param aDes A descriptor into which the data will be read. |
87 * @param aLength The length to read. |
88 * @param aLength The length to read. |
88 */ |
89 */ |
89 { |
90 { |
90 LOGTEXT2(_L8(">>CActiveReadOneOrMoreReader::ReadOneOrMore " |
91 OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_READONEORMORE_ENTRY ); |
91 "aLength=%d"), aLength); |
92 OstTrace1( TRACE_NORMAL, CACTIVEREADONEORMOREREADER_READONEORMORE, |
92 |
93 "CActiveReadOneOrMoreReader::ReadOneOrMore;aLength=%d", aLength ); |
93 iLdd.ReadOneOrMore(iStatus, iEndpoint, aDes, aLength); |
94 iLdd.ReadOneOrMore(iStatus, iEndpoint, aDes, aLength); |
94 SetActive(); |
95 SetActive(); |
95 |
96 OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_READONEORMORE_EXIT ); |
96 LOGTEXT(_L8("<<CActiveReadOneOrMoreReader::ReadOneOrMore")); |
|
97 } |
97 } |
98 |
98 |
99 void CActiveReadOneOrMoreReader::DoCancel() |
99 void CActiveReadOneOrMoreReader::DoCancel() |
100 /** |
100 /** |
101 * Cancel an outstanding request. |
101 * Cancel an outstanding request. |
102 */ |
102 */ |
103 { |
103 { |
104 LOG_FUNC |
104 OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_DOCANCEL_ENTRY ); |
105 |
|
106 iLdd.ReadCancel(iEndpoint); |
105 iLdd.ReadCancel(iEndpoint); |
|
106 OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_DOCANCEL_EXIT ); |
107 } |
107 } |
108 |
108 |
109 void CActiveReadOneOrMoreReader::RunL() |
109 void CActiveReadOneOrMoreReader::RunL() |
110 /** |
110 /** |
111 * This function will be called when the request completes. It notifies the |
111 * This function will be called when the request completes. It notifies the |
112 * parent class of the completion. |
112 * parent class of the completion. |
113 */ |
113 */ |
114 { |
114 { |
115 LOG_LINE |
115 OstTraceFunctionEntry0( CACTIVEREADONEORMOREREADER_RUNL_ENTRY ); |
116 LOGTEXT2(_L8(">>CActiveReadOneOrMoreReader::RunL iStatus=%d"), |
116 OstTrace1( TRACE_NORMAL, CACTIVEREADONEORMOREREADER_RUNL, |
117 iStatus.Int()); |
117 "CActiveReadOneOrMoreReader::RunL;iStatus=%d", iStatus.Int() ); |
118 |
|
119 iParent.ReadOneOrMoreCompleted(iStatus.Int()); |
118 iParent.ReadOneOrMoreCompleted(iStatus.Int()); |
120 |
119 OstTraceFunctionExit0( CACTIVEREADONEORMOREREADER_RUNL_EXIT ); |
121 LOGTEXT(_L8("<<CActiveReadOneOrMoreReader::RunL")); |
|
122 } |
120 } |
123 |
121 |
124 // |
122 // |
125 // End of file |
123 // End of file |