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