1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
18 // |
18 // |
19 |
19 |
20 |
20 |
21 |
21 |
22 // INCLUDE FILES |
22 // INCLUDE FILES |
|
23 |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "CSatTsyReqHandleStoreTraces.h" |
|
27 #endif |
|
28 |
23 #include "CSatTsyReqHandleStore.h" // Class header |
29 #include "CSatTsyReqHandleStore.h" // Class header |
24 #include "CSatTsy.h" // Main tsy class header |
30 #include "CSatTsy.h" // Main tsy class header |
25 #include "TfLogger.h" // For TFLOGSTRING |
|
26 |
31 |
27 // ----------------------------------------------------------------------------- |
32 // ----------------------------------------------------------------------------- |
28 // CSatTsyReqHandleStore::NewL |
33 // CSatTsyReqHandleStore::NewL |
29 // This method is used to create a new instance of CSatTsyReqHandleStore. |
34 // This method is used to create a new instance of CSatTsyReqHandleStore. |
30 // Because the constructor of CSatTsyReqHandleStore class is private, calling |
35 // Because the constructor of CSatTsyReqHandleStore class is private, calling |
35 ( |
40 ( |
36 TInt aNumberOfRequests, // Number of requests |
41 TInt aNumberOfRequests, // Number of requests |
37 TTsyReqHandle* aFirstElement // Pointer to the first element |
42 TTsyReqHandle* aFirstElement // Pointer to the first element |
38 ) |
43 ) |
39 { |
44 { |
40 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::NewL" ); |
45 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_NEWL_1, "CSAT: CSatTsyReqHandleStore::NewL" ); |
41 CSatTsyReqHandleStore* tsyReqHandleStore = new ( ELeave ) |
46 CSatTsyReqHandleStore* tsyReqHandleStore = new ( ELeave ) |
42 CSatTsyReqHandleStore(); |
47 CSatTsyReqHandleStore(); |
43 |
48 |
44 CleanupStack::PushL( tsyReqHandleStore ); |
49 CleanupStack::PushL( tsyReqHandleStore ); |
45 tsyReqHandleStore->iNumOfRequests = aNumberOfRequests; |
50 tsyReqHandleStore->iNumOfRequests = aNumberOfRequests; |
50 { |
55 { |
51 *( tsyReqHandleStore->iReqHandles + i ) = 0; |
56 *( tsyReqHandleStore->iReqHandles + i ) = 0; |
52 } |
57 } |
53 |
58 |
54 CleanupStack::Pop( tsyReqHandleStore ); |
59 CleanupStack::Pop( tsyReqHandleStore ); |
55 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::NewL, end of method" ); |
60 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_NEWL_2, "CSAT: CSatTsyReqHandleStore::NewL, end of method" ); |
56 return tsyReqHandleStore; |
61 return tsyReqHandleStore; |
57 } |
62 } |
58 |
63 |
59 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
60 // CSatTsyReqHandleStore::~CSatTsyReqHandleStore |
65 // CSatTsyReqHandleStore::~CSatTsyReqHandleStore |
65 CSatTsyReqHandleStore::~CSatTsyReqHandleStore |
70 CSatTsyReqHandleStore::~CSatTsyReqHandleStore |
66 ( |
71 ( |
67 // None |
72 // None |
68 ) |
73 ) |
69 { |
74 { |
70 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::~CSatTsyReqHandleStore" ); |
75 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_DTOR_1, "CSAT: CSatTsyReqHandleStore::~CSatTsyReqHandleStore" ); |
71 } |
76 } |
72 |
77 |
73 // ----------------------------------------------------------------------------- |
78 // ----------------------------------------------------------------------------- |
74 // CSatTsyReqHandleStore::CSatTsyReqHandleStore |
79 // CSatTsyReqHandleStore::CSatTsyReqHandleStore |
75 // Constructor |
80 // Constructor |
78 CSatTsyReqHandleStore::CSatTsyReqHandleStore |
83 CSatTsyReqHandleStore::CSatTsyReqHandleStore |
79 ( |
84 ( |
80 // None |
85 // None |
81 ) |
86 ) |
82 { |
87 { |
83 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::CSatTsyReqHandleStore" ); |
88 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_CTOR_1, "CSAT: CSatTsyReqHandleStore::CSatTsyReqHandleStore" ); |
84 } |
89 } |
85 |
90 |
86 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |
87 // CSatTsyReqHandleStore::ConstructL |
92 // CSatTsyReqHandleStore::ConstructL |
88 // Symbian 2nd phase constructor. |
93 // Symbian 2nd phase constructor. |
91 void CSatTsyReqHandleStore::ConstructL |
96 void CSatTsyReqHandleStore::ConstructL |
92 ( |
97 ( |
93 // None |
98 // None |
94 ) |
99 ) |
95 { |
100 { |
96 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::ConstructL" ); |
101 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_CONSTRUCTL_1, "CSAT: CSatTsyReqHandleStore::ConstructL" ); |
97 } |
102 } |
98 |
103 |
99 // ----------------------------------------------------------------------------- |
104 // ----------------------------------------------------------------------------- |
100 // CSatTsyReqHandleStore::TsyReqHandle |
105 // CSatTsyReqHandleStore::TsyReqHandle |
101 // Returns TSY request handle for given index. |
106 // Returns TSY request handle for given index. |
104 TTsyReqHandle CSatTsyReqHandleStore::TsyReqHandle |
109 TTsyReqHandle CSatTsyReqHandleStore::TsyReqHandle |
105 ( |
110 ( |
106 const TInt aIndex // TSY req handle index |
111 const TInt aIndex // TSY req handle index |
107 ) |
112 ) |
108 { |
113 { |
109 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::TsyReqHandle" ); |
114 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_TSYREQHANDLE_1, "CSAT: CSatTsyReqHandleStore::TsyReqHandle" ); |
110 TTsyReqHandle ret( NULL ); |
115 TTsyReqHandle ret( NULL ); |
111 |
116 |
112 // Check the bounds |
117 // Check the bounds |
113 if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) ) |
118 if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) ) |
114 { |
119 { |
115 ret = *( iReqHandles + aIndex ); |
120 ret = *( iReqHandles + aIndex ); |
116 } |
121 } |
117 else |
122 else |
118 { |
123 { |
119 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::TsyReqHandle, \ |
124 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_TSYREQHANDLE_2, "CSAT: CSatTsyReqHandleStore::TsyReqHandle, Out of bounds" ); |
120 Out of bounds" ); |
|
121 } |
125 } |
122 return ret; |
126 return ret; |
123 } |
127 } |
124 |
128 |
125 // ----------------------------------------------------------------------------- |
129 // ----------------------------------------------------------------------------- |
131 ( |
135 ( |
132 const TInt aIndex, // Index |
136 const TInt aIndex, // Index |
133 const TTsyReqHandle aTsyReqHandle // Request handle |
137 const TTsyReqHandle aTsyReqHandle // Request handle |
134 ) |
138 ) |
135 { |
139 { |
136 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle" ); |
140 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_SETTSYREQHANDLE_1, "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle" ); |
137 if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) ) |
141 if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) ) |
138 { |
142 { |
139 *( iReqHandles + aIndex ) = aTsyReqHandle; |
143 *( iReqHandles + aIndex ) = aTsyReqHandle; |
140 TFLOGSTRING2( "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle, %d saved", |
144 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_SETTSYREQHANDLE_2, "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle, %d saved", aTsyReqHandle ); |
141 aTsyReqHandle ); |
|
142 } |
145 } |
143 else |
146 else |
144 { |
147 { |
145 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle,\ |
148 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_SETTSYREQHANDLE_3, "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle, Request handle not saved" ); |
146 Request handle not saved" ); |
|
147 } |
149 } |
148 } |
150 } |
149 |
151 |
150 // ----------------------------------------------------------------------------- |
152 // ----------------------------------------------------------------------------- |
151 // CSatTsyReqHandleStore::ResetTsyReqHandle |
153 // CSatTsyReqHandleStore::ResetTsyReqHandle |
158 ( |
160 ( |
159 const TInt aIndex // Index |
161 const TInt aIndex // Index |
160 ) |
162 ) |
161 { |
163 { |
162 |
164 |
163 TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle" ); |
165 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_RESETTSYREQHANDLE_1, "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle" ); |
164 // Req handle was not used. |
166 // Req handle was not used. |
165 TInt ret = 0; |
167 TInt ret = 0; |
166 |
168 |
167 if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) ) |
169 if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) ) |
168 { |
170 { |
172 // Return deleted req handle |
174 // Return deleted req handle |
173 ret = *( iReqHandles + aIndex ); |
175 ret = *( iReqHandles + aIndex ); |
174 |
176 |
175 // Reset req handle |
177 // Reset req handle |
176 *( iReqHandles + aIndex ) = 0; |
178 *( iReqHandles + aIndex ) = 0; |
177 TFLOGSTRING2( "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle, index \ |
179 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_RESETTSYREQHANDLE_2, "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle, index %d removed", aIndex ); |
178 %d removed", aIndex ); |
|
179 } |
180 } |
180 else |
181 else |
181 { |
182 { |
182 TFLOGSTRING("CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle,\ |
183 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_RESETTSYREQHANDLE_3, "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle, Not in use"); |
183 Not in use"); |
|
184 } |
184 } |
185 } |
185 } |
186 else |
186 else |
187 { |
187 { |
188 // Do nothing |
188 // Do nothing |
189 } |
189 } |
190 |
190 |
191 TFLOGSTRING2("CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle \ |
191 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_RESETTSYREQHANDLE_4, "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle reqHandle is :%d", ret ); |
192 reqHandle is :%d", ret ); |
|
193 |
192 |
194 return ret; |
193 return ret; |
195 } |
194 } |
196 |
195 |
197 // End of File |
196 // End of File |