1 /* |
1 /* |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-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". |
21 */ |
21 */ |
22 |
22 |
23 #include "msmmnodebase.h" |
23 #include "msmmnodebase.h" |
24 |
24 |
25 #include <usb/usblogger.h> |
25 #include <usb/usblogger.h> |
26 #include "OstTraceDefinitions.h" |
26 |
27 #ifdef OST_TRACE_COMPILER_IN_USE |
27 #ifdef __FLOG_ACTIVE |
28 #include "msmmnodebaseTraces.h" |
28 _LIT8(KLogComponent, "UsbHostMsmmServer"); |
29 #endif |
29 #endif |
30 |
|
31 |
|
32 |
30 |
33 TMsmmNodeBase::TMsmmNodeBase(TInt aIdentifier): |
31 TMsmmNodeBase::TMsmmNodeBase(TInt aIdentifier): |
34 iIdentifier(aIdentifier), |
32 iIdentifier(aIdentifier), |
35 iNextPeer(NULL), |
33 iNextPeer(NULL), |
36 iFirstChild(NULL), |
34 iFirstChild(NULL), |
37 iLastChild(NULL), |
35 iLastChild(NULL), |
38 iParent(NULL) |
36 iParent(NULL) |
39 { |
37 { |
40 OstTraceFunctionEntry0( TMSMMNODEBASE_TMSMMNODEBASE_CONS_ENTRY ); |
38 LOG_FUNC |
41 } |
39 } |
42 |
40 |
43 TMsmmNodeBase::~TMsmmNodeBase() |
41 TMsmmNodeBase::~TMsmmNodeBase() |
44 { |
42 { |
45 OstTraceFunctionEntry0( TMSMMNODEBASE_TMSMMNODEBASE_DES_ENTRY ); |
43 LOG_FUNC |
46 |
|
47 // Remove current node from the parent node and destroy it. |
44 // Remove current node from the parent node and destroy it. |
48 DestroyNode(); |
45 DestroyNode(); |
49 OstTraceFunctionExit0( TMSMMNODEBASE_TMSMMNODEBASE_DES_EXIT ); |
|
50 } |
46 } |
51 |
47 |
52 void TMsmmNodeBase::DestroyNode() |
48 void TMsmmNodeBase::DestroyNode() |
53 { |
49 { |
54 OstTraceFunctionEntry0( TMSMMNODEBASE_DESTROYNODE_ENTRY ); |
50 LOG_FUNC |
55 |
|
56 TMsmmNodeBase* parentNode = iParent; |
51 TMsmmNodeBase* parentNode = iParent; |
57 TMsmmNodeBase* iterator(this); |
52 TMsmmNodeBase* iterator(this); |
58 TMsmmNodeBase* iteratorPrev(NULL); |
53 TMsmmNodeBase* iteratorPrev(NULL); |
59 TMsmmNodeBase* iteratorNext(NULL); |
54 TMsmmNodeBase* iteratorNext(NULL); |
60 |
55 |
115 { |
109 { |
116 iteratorNext = iterator->iNextPeer; |
110 iteratorNext = iterator->iNextPeer; |
117 } |
111 } |
118 } |
112 } |
119 } |
113 } |
120 OstTraceFunctionExit0( TMSMMNODEBASE_DESTROYNODE_EXIT_DUP1 ); |
|
121 } |
114 } |
122 |
115 |
123 void TMsmmNodeBase::AddChild(TMsmmNodeBase* aChild) |
116 void TMsmmNodeBase::AddChild(TMsmmNodeBase* aChild) |
124 { |
117 { |
125 OstTraceFunctionEntry0( TMSMMNODEBASE_ADDCHILD_ENTRY ); |
118 LOG_FUNC |
126 |
|
127 if (!iFirstChild) |
119 if (!iFirstChild) |
128 { |
120 { |
129 iFirstChild = aChild; |
121 iFirstChild = aChild; |
130 } |
122 } |
131 else |
123 else |
132 { |
124 { |
133 iLastChild->iNextPeer = aChild; |
125 iLastChild->iNextPeer = aChild; |
134 } |
126 } |
135 iLastChild = aChild; |
127 iLastChild = aChild; |
136 aChild->iParent = this; |
128 aChild->iParent = this; |
137 OstTraceFunctionExit0( TMSMMNODEBASE_ADDCHILD_EXIT ); |
|
138 } |
129 } |
139 |
130 |
140 TMsmmNodeBase* TMsmmNodeBase::SearchInChildren(TInt aIdentifier) |
131 TMsmmNodeBase* TMsmmNodeBase::SearchInChildren(TInt aIdentifier) |
141 { |
132 { |
142 OstTraceFunctionEntry0( TMSMMNODEBASE_SEARCHINCHILDREN_ENTRY ); |
133 LOG_FUNC |
143 |
|
144 TMsmmNodeBase* iterator(iFirstChild); |
134 TMsmmNodeBase* iterator(iFirstChild); |
145 |
135 |
146 while (iterator) |
136 while (iterator) |
147 { |
137 { |
148 if (iterator->iIdentifier == aIdentifier) |
138 if (iterator->iIdentifier == aIdentifier) |
150 break; |
140 break; |
151 } |
141 } |
152 iterator = iterator->iNextPeer; |
142 iterator = iterator->iNextPeer; |
153 } |
143 } |
154 |
144 |
155 OstTraceFunctionExit0( TMSMMNODEBASE_SEARCHINCHILDREN_EXIT ); |
|
156 return iterator; |
145 return iterator; |
157 } |
146 } |
158 |
147 |
159 // TUsbMsDevice |
148 // TUsbMsDevice |
160 // Function memeber |
149 // Function memeber |
161 TUsbMsDevice::TUsbMsDevice(const TUSBMSDeviceDescription& aDevice): |
150 TUsbMsDevice::TUsbMsDevice(const TUSBMSDeviceDescription& aDevice): |
162 TMsmmNodeBase(aDevice.iDeviceId), |
151 TMsmmNodeBase(aDevice.iDeviceId), |
163 iDevice(aDevice) |
152 iDevice(aDevice) |
164 { |
153 { |
165 OstTraceFunctionEntry0( TUSBMSDEVICE_TUSBMSDEVICE_CONS_ENTRY ); |
154 LOG_FUNC |
166 } |
155 } |
167 |
156 |
168 // TUsbMsInterface |
157 // TUsbMsInterface |
169 // Function memeber |
158 // Function memeber |
170 TUsbMsInterface::TUsbMsInterface(TUint8 aInterfaceNumber, |
159 TUsbMsInterface::TUsbMsInterface(TUint8 aInterfaceNumber, |
171 TUint32 aInterfaceToken): |
160 TUint32 aInterfaceToken): |
172 TMsmmNodeBase(aInterfaceNumber), |
161 TMsmmNodeBase(aInterfaceNumber), |
173 iInterfaceNumber(aInterfaceNumber), |
162 iInterfaceNumber(aInterfaceNumber), |
174 iInterfaceToken(aInterfaceToken) |
163 iInterfaceToken(aInterfaceToken) |
175 { |
164 { |
176 OstTraceFunctionEntry0( TUSBMSINTERFACE_TUSBMSINTERFACE_CONS_ENTRY ); |
165 LOG_FUNC |
177 } |
166 } |
178 |
167 |
179 TUsbMsInterface::~TUsbMsInterface() |
168 TUsbMsInterface::~TUsbMsInterface() |
180 { |
169 { |
181 OstTraceFunctionEntry0( TUSBMSINTERFACE_TUSBMSINTERFACE_DES_ENTRY ); |
170 LOG_FUNC |
182 |
|
183 iUsbMsDevice.Close(); |
171 iUsbMsDevice.Close(); |
184 OstTraceFunctionExit0( TUSBMSINTERFACE_TUSBMSINTERFACE_DES_EXIT ); |
|
185 } |
172 } |
186 |
173 |
187 // TUsbMsLogicalUnit |
174 // TUsbMsLogicalUnit |
188 // Function memeber |
175 // Function memeber |
189 TUsbMsLogicalUnit::TUsbMsLogicalUnit(TUint8 aLogicalUnitNumber, TText aDrive): |
176 TUsbMsLogicalUnit::TUsbMsLogicalUnit(TUint8 aLogicalUnitNumber, TText aDrive): |
190 TMsmmNodeBase(aLogicalUnitNumber), |
177 TMsmmNodeBase(aLogicalUnitNumber), |
191 iLogicalUnitNumber(aLogicalUnitNumber), |
178 iLogicalUnitNumber(aLogicalUnitNumber), |
192 iDrive(aDrive) |
179 iDrive(aDrive) |
193 { |
180 { |
194 OstTraceFunctionEntry0( TUSBMSLOGICALUNIT_TUSBMSLOGICALUNIT_CONS_ENTRY ); |
181 LOG_FUNC |
195 } |
182 } |
196 |
183 |
197 // End of file |
184 // End of file |