39 * Make a new CAcmPortFactory |
39 * Make a new CAcmPortFactory |
40 * |
40 * |
41 * @return Ownership of a newly created CAcmPortFactory object |
41 * @return Ownership of a newly created CAcmPortFactory object |
42 */ |
42 */ |
43 { |
43 { |
44 LOG_STATIC_FUNC_ENTRY |
44 OstTraceFunctionEntry0( CACMPORTFACTORY_NEWL_ENTRY ); |
45 |
|
46 CAcmPortFactory* self = new(ELeave) CAcmPortFactory; |
45 CAcmPortFactory* self = new(ELeave) CAcmPortFactory; |
47 CleanupClosePushL(*self); |
46 CleanupClosePushL(*self); |
48 self->ConstructL(); |
47 self->ConstructL(); |
49 CleanupStack::Pop(); |
48 CleanupStack::Pop(); |
|
49 OstTraceFunctionExit0( CACMPORTFACTORY_NEWL_EXIT ); |
50 return self; |
50 return self; |
51 } |
51 } |
52 |
52 |
53 CAcmPortFactory::CAcmPortFactory() |
53 CAcmPortFactory::CAcmPortFactory() |
54 /** |
54 /** |
55 * Constructor. |
55 * Constructor. |
56 */ |
56 */ |
57 { |
57 { |
|
58 OstTraceFunctionEntry0( CACMPORTFACTORY_CACMPORTFACTORY_ENTRY ); |
58 iVersion = TVersion( |
59 iVersion = TVersion( |
59 KEC32MajorVersionNumber, |
60 KEC32MajorVersionNumber, |
60 KEC32MinorVersionNumber, |
61 KEC32MinorVersionNumber, |
61 KEC32BuildVersionNumber); |
62 KEC32BuildVersionNumber); |
62 iConfigBuf().iAcmConfigVersion = 1; |
63 iConfigBuf().iAcmConfigVersion = 1; |
63 iOwned = EFalse; |
64 iOwned = EFalse; |
|
65 OstTraceFunctionExit0( CACMPORTFACTORY_CACMPORTFACTORY_EXIT ); |
64 } |
66 } |
65 |
67 |
66 void CAcmPortFactory::ConstructL() |
68 void CAcmPortFactory::ConstructL() |
67 /** |
69 /** |
68 * Second phase constructor. |
70 * Second phase constructor. |
69 */ |
71 */ |
70 { |
72 { |
71 LEAVEIFERRORL(SetName(&KAcmSerialName)); |
73 OstTraceFunctionEntry0( CACMPORTFACTORY_CONSTRUCTL_ENTRY ); |
|
74 TInt aReason = SetName(&KAcmSerialName); |
|
75 if (aReason < 0) |
|
76 { |
|
77 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL, "CAcmPortFactory::ConstructL;aReason=%d", aReason ); |
|
78 User::Leave(aReason); |
|
79 } |
|
80 |
72 iAcmServer = CAcmServer::NewL(*this); |
81 iAcmServer = CAcmServer::NewL(*this); |
73 |
82 |
74 TInt err = RProperty::Define(KUidSystemCategory, KAcmKey, RProperty::EByteArray, TPublishedAcmConfigs::KAcmMaxFunctions); |
83 TInt err = RProperty::Define(KUidSystemCategory, KAcmKey, RProperty::EByteArray, TPublishedAcmConfigs::KAcmMaxFunctions); |
75 if(err == KErrAlreadyExists) |
84 if(err == KErrAlreadyExists) |
76 { |
85 { |
77 LEAVEIFERRORL(iAcmProperty.Attach(KUidSystemCategory, KAcmKey, EOwnerThread)); |
86 aReason = iAcmProperty.Attach(KUidSystemCategory, KAcmKey, EOwnerThread); |
|
87 if (aReason < 0) |
|
88 { |
|
89 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL_DUP1, "CAcmPortFactory::ConstructL;aReason=%d", aReason ); |
|
90 User::Leave(aReason); |
|
91 } |
|
92 |
78 //Since the P&S data already exists we need to retrieve it |
93 //Since the P&S data already exists we need to retrieve it |
79 LEAVEIFERRORL(iAcmProperty.Get(iConfigBuf)); |
94 aReason = iAcmProperty.Get(iConfigBuf); |
|
95 if (aReason < 0) |
|
96 { |
|
97 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL_DUP2, "CAcmPortFactory::ConstructL;aReason=%d", aReason ); |
|
98 User::Leave(aReason); |
|
99 } |
80 } |
100 } |
81 else if(err == KErrNone) |
101 else if(err == KErrNone) |
82 { |
102 { |
83 //A blank iConfigBuf already exists at this point to we don't need to do anything to it |
103 //A blank iConfigBuf already exists at this point to we don't need to do anything to it |
84 //before publishing the P&S data |
104 //before publishing the P&S data |
85 LEAVEIFERRORL(iAcmProperty.Attach(KUidSystemCategory, KAcmKey, EOwnerThread)); |
105 aReason = iAcmProperty.Attach(KUidSystemCategory, KAcmKey, EOwnerThread); |
|
106 if (aReason < 0) |
|
107 { |
|
108 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL_DUP3, "CAcmPortFactory::ConstructL;aReason=%d", aReason ); |
|
109 User::Leave(aReason); |
|
110 } |
86 PublishAcmConfig(); |
111 PublishAcmConfig(); |
87 iOwned = ETrue; |
112 iOwned = ETrue; |
88 } |
113 } |
89 else |
114 else |
90 { |
115 { |
91 LEAVEIFERRORL(err); //This will always leave, but a log will be created at least. |
116 if (err < 0) |
|
117 { |
|
118 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CONSTRUCTL_DUP4, "CAcmPortFactory::ConstructL;err=%d", err ); |
|
119 User::Leave(err); |
|
120 } |
|
121 //Here will always leave, but a log will be created at least. |
92 } |
122 } |
93 |
123 |
|
124 OstTraceFunctionExit0( CACMPORTFACTORY_CONSTRUCTL_EXIT ); |
94 } |
125 } |
95 |
126 |
96 /** |
127 /** |
97 * Utility function for publishing the TPublishedAcmConfigs data |
128 * Utility function for publishing the TPublishedAcmConfigs data |
98 * @pre Requires iAcmProperty to be attached before it is called |
129 * @pre Requires iAcmProperty to be attached before it is called |
99 */ |
130 */ |
100 void CAcmPortFactory::PublishAcmConfig() |
131 void CAcmPortFactory::PublishAcmConfig() |
101 { |
132 { |
102 // Update the publish and subscribe info |
133 // Update the publish and subscribe info |
103 TInt err = iAcmProperty.Set(iConfigBuf); |
134 TInt err = iAcmProperty.Set(iConfigBuf); |
104 __ASSERT_DEBUG(err == KErrNone, _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
135 if (err != KErrNone) |
|
136 { |
|
137 OstTraceExt3( TRACE_NORMAL, CACMPORTFACTORY_PUBLISHACMCONFIG, |
|
138 "CAcmPortFactory::PublishAcmConfig;code=%d;name=%S;line = %d", |
|
139 (TInt)EPanicInternalError, KAcmPanicCat, (TInt)__LINE__); |
|
140 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
141 } |
|
142 |
105 (void)err; |
143 (void)err; |
106 } |
144 } |
107 |
145 |
108 TSecurityPolicy CAcmPortFactory::PortPlatSecCapability (TUint aPort) const |
146 TSecurityPolicy CAcmPortFactory::PortPlatSecCapability (TUint aPort) const |
109 /** |
147 /** |
113 * @param aPort The number of the port. |
151 * @param aPort The number of the port. |
114 * @return a security policy |
152 * @return a security policy |
115 */ |
153 */ |
116 //return the security policy for the given port number, aPort. |
154 //return the security policy for the given port number, aPort. |
117 { |
155 { |
118 LOG_FUNC |
156 OstTraceFunctionEntry0( CACMPORTFACTORY_PORTPLATSECCAPABILITY_ENTRY ); |
119 |
|
120 TSecurityPolicy securityPolicy; |
157 TSecurityPolicy securityPolicy; |
121 if ( aPort == KRegistrationPortUnit ) |
158 if ( aPort == KRegistrationPortUnit ) |
122 { |
159 { |
123 securityPolicy = TSecurityPolicy(ECapabilityNetworkControl); |
160 securityPolicy = TSecurityPolicy(ECapabilityNetworkControl); |
124 } |
161 } |
125 else |
162 else |
126 { |
163 { |
127 securityPolicy = TSecurityPolicy(ECapabilityLocalServices); |
164 securityPolicy = TSecurityPolicy(ECapabilityLocalServices); |
128 } |
165 } |
|
166 OstTraceFunctionExit0( CACMPORTFACTORY_PORTPLATSECCAPABILITY_EXIT ); |
129 return securityPolicy; |
167 return securityPolicy; |
130 } |
168 } |
131 |
169 |
132 void CAcmPortFactory::AcmPortClosed(const TUint aUnit) |
170 void CAcmPortFactory::AcmPortClosed(const TUint aUnit) |
133 /** |
171 /** |
134 * Called by an ACM port when it is closed. |
172 * Called by an ACM port when it is closed. |
135 * |
173 * |
136 * @param aUnit The port number of the closing port. |
174 * @param aUnit The port number of the closing port. |
137 */ |
175 */ |
138 { |
176 { |
139 LOG_FUNC |
177 OstTraceFunctionEntry0( CACMPORTFACTORY_ACMPORTCLOSED_ENTRY ); |
140 LOGTEXT2(_L8("\taUnit = %d"), aUnit); |
178 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_ACMPORTCLOSED, "CAcmPortFactory::AcmPortClosed;aUnit=%d", aUnit ); |
141 |
|
142 // I would assert that the calling port is stored in our array, but if we |
179 // I would assert that the calling port is stored in our array, but if we |
143 // ran out of memory during CAcmPort::NewL, this function would be called |
180 // ran out of memory during CAcmPort::NewL, this function would be called |
144 // from the port's destructor, but the slot in the port array would still |
181 // from the port's destructor, but the slot in the port array would still |
145 // be NULL. |
182 // be NULL. |
146 |
183 |
178 { |
215 { |
179 RProperty::Delete(KUidSystemCategory, KAcmKey); |
216 RProperty::Delete(KUidSystemCategory, KAcmKey); |
180 } |
217 } |
181 |
218 |
182 delete iAcmServer; |
219 delete iAcmServer; |
|
220 OstTraceFunctionExit0( DUP1_CACMPORTFACTORY_CACMPORTFACTORY_EXIT ); |
183 } |
221 } |
184 |
222 |
185 CPort* CAcmPortFactory::NewPortL(const TUint aUnit) |
223 CPort* CAcmPortFactory::NewPortL(const TUint aUnit) |
186 /** |
224 /** |
187 * Downcall from C32. Create a new port for the supplied unit number. |
225 * Downcall from C32. Create a new port for the supplied unit number. |
188 * |
226 * |
189 * @param aUnit Port unit number |
227 * @param aUnit Port unit number |
190 */ |
228 */ |
191 { |
229 { |
192 LOG_LINE |
230 OstTraceFunctionEntry0( CACMPORTFACTORY_NEWPORTL_ENTRY ); |
193 LOGTEXT2(_L8(">>CAcmPortFactory::NewPortL aUnit=%d"), aUnit); |
231 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_NEWPORTL, "CAcmPortFactory::NewPortL;aUnit=%d", aUnit ); |
194 |
|
195 CPort* port = NULL; |
232 CPort* port = NULL; |
196 |
|
197 TUint lowerLimit = KAcmLowUnit; // This non-const TUint avoids compiler remarks (low-level warnings) for the following comparisons.. |
233 TUint lowerLimit = KAcmLowUnit; // This non-const TUint avoids compiler remarks (low-level warnings) for the following comparisons.. |
198 // ACM ports |
234 // ACM ports |
199 if ( (aUnit >= lowerLimit) && aUnit < static_cast<TUint>( iAcmClassArray.Count()) + KAcmLowUnit) |
235 if ( (aUnit >= lowerLimit) && aUnit < static_cast<TUint>( iAcmClassArray.Count()) + KAcmLowUnit) |
200 { |
236 { |
201 // Can only create an ACM port if the corresponding ACM interface |
237 // Can only create an ACM port if the corresponding ACM interface |
202 // itself has been created. We keep the slots in the iAcmClassArray array |
238 // itself has been created. We keep the slots in the iAcmClassArray array |
203 // up-to-date with how many ACM interface instances have been created. |
239 // up-to-date with how many ACM interface instances have been created. |
204 const TUint index = aUnit - KAcmLowUnit; |
240 const TUint index = aUnit - KAcmLowUnit; |
205 if ( iAcmPortArray[index] ) |
241 if ( iAcmPortArray[index] ) |
206 { |
242 { |
207 LEAVEIFERRORL(KErrInUse); // TODO: is this ever executed? |
243 if (KErrInUse < 0) |
|
244 { |
|
245 OstTrace1( TRACE_ERROR, CACMPORTFACTORY_NEWPORTL_DUP2, "CAcmPortFactory::NewPortL;KErrInUse=%d", KErrInUse ); |
|
246 User::Leave(KErrInUse); |
|
247 } |
|
248 // TODO: is this ever executed? |
208 } |
249 } |
209 iAcmPortArray[index] = CAcmPort::NewL(aUnit, *this); |
250 iAcmPortArray[index] = CAcmPort::NewL(aUnit, *this); |
210 iAcmPortArray[index]->SetAcm( iAcmClassArray[index]); |
251 iAcmPortArray[index]->SetAcm( iAcmClassArray[index]); |
211 port = iAcmPortArray[index]; |
252 port = iAcmPortArray[index]; |
212 } |
253 } |
268 |
313 |
269 #ifdef _DEBUG |
314 #ifdef _DEBUG |
270 CheckAcmArray(); |
315 CheckAcmArray(); |
271 LogPortsAndFunctions(); |
316 LogPortsAndFunctions(); |
272 #endif |
317 #endif |
273 |
318 OstTrace0( TRACE_NORMAL, CACMPORTFACTORY_DESTROYFUNCTIONS_DUP1, "CAcmPortFactory::DestroyFunctions;<<CAcmPortFactory::DestroyFunctions" ); |
274 LOGTEXT(_L8("<<CAcmPortFactory::DestroyFunctions")); |
319 OstTraceFunctionExit0( CACMPORTFACTORY_DESTROYFUNCTIONS_EXIT ); |
275 } |
320 } |
276 |
321 |
277 void CAcmPortFactory::CheckAcmArray() |
322 void CAcmPortFactory::CheckAcmArray() |
278 /** |
323 /** |
279 * Utility to check that each slot in the ACM interface array points to |
324 * Utility to check that each slot in the ACM interface array points to |
280 * something valid. NB It is the ACM port array which may contain empty slots. |
325 * something valid. NB It is the ACM port array which may contain empty slots. |
281 */ |
326 */ |
282 { |
327 { |
283 LOG_FUNC |
328 OstTraceFunctionEntry0( CACMPORTFACTORY_CHECKACMARRAY_ENTRY ); |
284 |
|
285 for ( TUint ii = 0; ii < static_cast<TUint>( iAcmClassArray.Count()) ; ii++ ) |
329 for ( TUint ii = 0; ii < static_cast<TUint>( iAcmClassArray.Count()) ; ii++ ) |
286 { |
330 { |
287 __ASSERT_DEBUG( iAcmClassArray[ii], _USB_PANIC(KAcmPanicCat, EPanicInternalError)); |
331 if (!iAcmClassArray[ii]) |
288 } |
332 { |
|
333 OstTraceExt2( TRACE_NORMAL, CACMPORTFACTORY_CHECKACMARRAY, "CAcmPortFactory::CheckAcmArray;code=%d;name=%S", (TInt)EPanicInternalError, KAcmPanicCat); |
|
334 __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) ); |
|
335 } |
|
336 } |
|
337 OstTraceFunctionExit0( CACMPORTFACTORY_CHECKACMARRAY_EXIT ); |
289 } |
338 } |
290 |
339 |
291 TInt CAcmPortFactory::CreateFunctions(const TUint aNoAcms, const TUint8 aProtocolNum, const TDesC16& aAcmControlIfcName, const TDesC16& aAcmDataIfcName) |
340 TInt CAcmPortFactory::CreateFunctions(const TUint aNoAcms, const TUint8 aProtocolNum, const TDesC16& aAcmControlIfcName, const TDesC16& aAcmDataIfcName) |
292 /** |
341 /** |
293 * Tries to create the ACM functions. |
342 * Tries to create the ACM functions. |
296 * @param aProtocolNum Protocol setting to use for these ACM functions. |
345 * @param aProtocolNum Protocol setting to use for these ACM functions. |
297 * @param aAcmControlIfcName Control Interface Name or a null descriptor |
346 * @param aAcmControlIfcName Control Interface Name or a null descriptor |
298 * @param aAcmDataIfcName Data Interface Name or a null descriptor |
347 * @param aAcmDataIfcName Data Interface Name or a null descriptor |
299 */ |
348 */ |
300 { |
349 { |
301 LOGTEXT5(_L("\taNoAcms = %d, aProtocolNum = %d, Control Ifc Name = %S, Data Ifc Name = %S"), |
350 OstTraceFunctionEntry0( CACMPORTFACTORY_CREATEFUNCTIONS_ENTRY ); |
302 aNoAcms, aProtocolNum, &aAcmControlIfcName, &aAcmDataIfcName); |
351 OstTraceExt4( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONS, "CAcmPortFactory::CreateFunctions;aNoAcms=%d;aProtocolNum=%d;aAcmControlIfcName=%S;aAcmDataIfcName=%S", (TInt)aNoAcms, (TInt)aProtocolNum, aAcmControlIfcName, aAcmDataIfcName ); |
303 |
352 |
304 #ifdef _DEBUG |
353 #ifdef _DEBUG |
305 CheckAcmArray(); |
354 CheckAcmArray(); |
306 #endif |
355 #endif |
307 |
356 |
308 TInt ret = KErrNone; |
357 TInt ret = KErrNone; |
309 |
358 |
310 // Create the ACM class instances. |
359 // Create the ACM class instances. |
311 for ( TUint ii = 0 ; ii < aNoAcms ; ii++ ) |
360 for ( TUint ii = 0 ; ii < aNoAcms ; ii++ ) |
312 { |
361 { |
313 LOGTEXT2(_L8("\tabout to create ACM instance %d"), ii); |
362 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONS_DUP1, "CAcmPortFactory::CreateFunctions;\tabout to create ACM instance %d", ii ); |
314 TRAP(ret, CreateFunctionL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName)); |
363 TRAP(ret, CreateFunctionL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName)); |
315 if ( ret != KErrNone ) |
364 if ( ret != KErrNone ) |
316 { |
365 { |
317 // Destroy the most recent ACMs that _did_ get created. |
366 // Destroy the most recent ACMs that _did_ get created. |
318 DestroyFunctions(ii); |
367 DestroyFunctions(ii); |
326 #ifdef _DEBUG |
375 #ifdef _DEBUG |
327 CheckAcmArray(); |
376 CheckAcmArray(); |
328 LogPortsAndFunctions(); |
377 LogPortsAndFunctions(); |
329 #endif |
378 #endif |
330 |
379 |
331 LOGTEXT2(_L8("<<CAcmPortFactory::CreateFunctions ret = %d"), ret); |
380 OstTrace1( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONS_DUP2, "CAcmPortFactory::CreateFunctions;ret=%d", ret ); |
|
381 OstTraceFunctionExit0( CACMPORTFACTORY_CREATEFUNCTIONS_EXIT ); |
332 return ret; |
382 return ret; |
333 } |
383 } |
334 |
384 |
335 void CAcmPortFactory::CreateFunctionL(const TUint8 aProtocolNum, const TDesC16& aAcmControlIfcName, const TDesC16& aAcmDataIfcName) |
385 void CAcmPortFactory::CreateFunctionL(const TUint8 aProtocolNum, const TDesC16& aAcmControlIfcName, const TDesC16& aAcmDataIfcName) |
336 /** |
386 /** |
337 * Creates a single ACM function, appending it to the iAcmClassArray array. |
387 * Creates a single ACM function, appending it to the iAcmClassArray array. |
338 */ |
388 */ |
339 { |
389 { |
340 LOG_FUNC |
390 OstTraceFunctionEntry0( CACMPORTFACTORY_CREATEFUNCTIONL_ENTRY ); |
341 |
391 OstTraceExt2( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONL, |
342 LOGTEXT3(_L8("\tiAcmPortArray.Count() = %d, iAcmClassArray.Count() = %d"), |
392 "CAcmPortFactory::CreateFunctionL;\tiAcmPortArray.Count()=%d;iAcmClassArray.Count()=%d", |
343 iAcmPortArray.Count(), iAcmClassArray.Count()); |
393 iAcmPortArray.Count(), iAcmClassArray.Count() ); |
344 |
394 |
345 LOGTEXT4(_L("\taProtocolNum = %d, Control Ifc Name = %S, Data Ifc Name = %S"), |
395 OstTraceExt3( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONL_DUP1, |
346 aProtocolNum, &aAcmControlIfcName, &aAcmDataIfcName); |
396 "CAcmPortFactory::CreateFunctionL;aProtocolNum=%d;aAcmControlIfcName=%S;aAcmDataIfcName=%S", |
|
397 aProtocolNum, aAcmControlIfcName, aAcmDataIfcName ); |
347 |
398 |
348 CCdcAcmClass* acm = CCdcAcmClass::NewL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName); |
399 CCdcAcmClass* acm = CCdcAcmClass::NewL(aProtocolNum, aAcmControlIfcName, aAcmDataIfcName); |
349 CleanupStack::PushL(acm); |
400 CleanupStack::PushL(acm); |
350 |
401 |
351 // If there isn't already a slot in the ACM port array corresponding to |
402 // If there isn't already a slot in the ACM port array corresponding to |
352 // this ACM interface instance, create one. |
403 // this ACM interface instance, create one. |
|
404 TInt err; |
353 if ( iAcmPortArray.Count() < iAcmClassArray.Count() + 1 ) |
405 if ( iAcmPortArray.Count() < iAcmClassArray.Count() + 1 ) |
354 { |
406 { |
355 LOGTEXT(_L8("\tappending a slot to the ACM port array")); |
407 OstTrace0( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONL_DUP2, |
356 LEAVEIFERRORL(iAcmPortArray.Append(NULL)); |
408 "CAcmPortFactory::CreateFunctionL;\tappending a slot to the ACM port array" ); |
357 } |
409 err = iAcmPortArray.Append(NULL); |
358 |
410 if (err < 0) |
359 LEAVEIFERRORL(iAcmClassArray.Append(acm)); |
411 { |
|
412 OstTrace1( TRACE_ERROR, CACMPORTFACTORY_CREATEFUNCTIONL_DUP4, "CAcmPortFactory::CreateFunctionL;err=%d", err ); |
|
413 User::Leave(err); |
|
414 } |
|
415 } |
|
416 |
|
417 err = iAcmClassArray.Append(acm); |
|
418 if (err < 0) |
|
419 { |
|
420 OstTrace1( TRACE_ERROR, CACMPORTFACTORY_CREATEFUNCTIONL_DUP5, "CAcmPortFactory::CreateFunctionL;err=%d", err ); |
|
421 User::Leave(err); |
|
422 } |
|
423 |
360 CleanupStack::Pop(acm); |
424 CleanupStack::Pop(acm); |
361 |
425 |
362 // If there's an ACM port at the relevant index (held open from when USB |
426 // If there's an ACM port at the relevant index (held open from when USB |
363 // was previously Started, perhaps) then tell it about its new ACM |
427 // was previously Started, perhaps) then tell it about its new ACM |
364 // interface. |
428 // interface. |
365 if ( iAcmPortArray[iAcmClassArray.Count() - 1] ) |
429 if ( iAcmPortArray[iAcmClassArray.Count() - 1] ) |
366 { |
430 { |
367 LOGTEXT3(_L8("\tinforming CAcmPort instance %d of acm 0x%08x"), iAcmClassArray.Count() - 1, acm); |
431 OstTraceExt2( TRACE_NORMAL, CACMPORTFACTORY_CREATEFUNCTIONL_DUP3, |
|
432 "CAcmPortFactory::CreateFunctionL;\tinforming CAcmPort instance %d of acm 0x%p", |
|
433 iAcmClassArray.Count() - 1, acm ); |
368 iAcmPortArray[iAcmClassArray.Count() - 1]->SetAcm(acm); |
434 iAcmPortArray[iAcmClassArray.Count() - 1]->SetAcm(acm); |
369 } |
435 } |
370 |
436 |
371 // update the TPublishedAcmConfig with the current details |
437 // update the TPublishedAcmConfig with the current details |
372 iConfigBuf().iAcmConfig[iConfigBuf().iAcmCount].iProtocol = aProtocolNum; |
438 iConfigBuf().iAcmConfig[iConfigBuf().iAcmCount].iProtocol = aProtocolNum; |
373 iConfigBuf().iAcmCount++; |
439 iConfigBuf().iAcmCount++; |
374 //don't update the p&s data here, do it in CreateFunctions after the construction of |
440 //don't update the p&s data here, do it in CreateFunctions after the construction of |
375 //all the requested functions |
441 //all the requested functions |
|
442 OstTraceFunctionExit0( CACMPORTFACTORY_CREATEFUNCTIONL_EXIT ); |
376 } |
443 } |
377 |
444 |
378 void CAcmPortFactory::Info(TSerialInfo& aSerialInfo) |
445 void CAcmPortFactory::Info(TSerialInfo& aSerialInfo) |
379 /** |
446 /** |
380 * Get info about this CSY, fill in the supplied structure. |
447 * Get info about this CSY, fill in the supplied structure. |
381 * |
448 * |
382 * @param aSerialInfo where info will be written to |
449 * @param aSerialInfo where info will be written to |
383 */ |
450 */ |
384 { |
451 { |
|
452 OstTraceFunctionEntry0( CACMPORTFACTORY_INFO_ENTRY ); |
385 // NB Our TSerialInfo does not advertise the existence of the registration |
453 // NB Our TSerialInfo does not advertise the existence of the registration |
386 // port. |
454 // port. |
387 LOG_FUNC |
455 |
388 |
|
389 _LIT(KSerialDescription, "USB Serial Port Emulation via ACM"); |
456 _LIT(KSerialDescription, "USB Serial Port Emulation via ACM"); |
390 aSerialInfo.iDescription = KSerialDescription; |
457 aSerialInfo.iDescription = KSerialDescription; |
391 aSerialInfo.iName = KAcmSerialName; |
458 aSerialInfo.iName = KAcmSerialName; |
392 aSerialInfo.iLowUnit = KAcmLowUnit; |
459 aSerialInfo.iLowUnit = KAcmLowUnit; |
393 aSerialInfo.iHighUnit = (iAcmPortArray.Count()==0) ? 0 : (iAcmPortArray.Count()-1); |
460 aSerialInfo.iHighUnit = (iAcmPortArray.Count()==0) ? 0 : (iAcmPortArray.Count()-1); |
394 // See comments in AcmInterface.h |
461 // See comments in AcmInterface.h |
|
462 OstTraceFunctionExit0( CACMPORTFACTORY_INFO_EXIT ); |
395 } |
463 } |
396 |
464 |
397 void CAcmPortFactory::LogPortsAndFunctions() |
465 void CAcmPortFactory::LogPortsAndFunctions() |
398 /** |
466 /** |
399 * Utility to log in a tabular form all the ACM function instances and any |
467 * Utility to log in a tabular form all the ACM function instances and any |
409 * so the ACM port array must retain slots for them. |
477 * so the ACM port array must retain slots for them. |
410 * All this is just so the logging gives a clear picture of the functions and |
478 * All this is just so the logging gives a clear picture of the functions and |
411 * port open/closed history of the CSY. |
479 * port open/closed history of the CSY. |
412 */ |
480 */ |
413 { |
481 { |
|
482 OstTraceFunctionEntry0( CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_ENTRY ); |
414 TUint ii; |
483 TUint ii; |
415 |
484 |
416 // Log ACM functions and corresponding ports. |
485 // Log ACM functions and corresponding ports. |
417 for ( ii = 0 ; ii < static_cast<TUint>( iAcmClassArray.Count()) ; ii++ ) |
486 for ( ii = 0 ; ii < static_cast<TUint>( iAcmClassArray.Count()) ; ii++ ) |
418 { |
487 { |
419 LOGTEXT5(_L8("\t iAcmClassArray[%d] = 0x%08x, iAcmPortArray[%d] = 0x%08x"), ii, iAcmClassArray[ii], ii, iAcmPortArray[ii]); |
488 OstTraceExt4( TRACE_NORMAL, CACMPORTFACTORY_LOGPORTSANDFUNCTIONS, |
|
489 "CAcmPortFactory::LogPortsAndFunctions;\t iAcmClassArray[%d] = %p, iAcmPortArray[%d] = %p", |
|
490 (TInt)ii, iAcmClassArray[ii], (TInt)ii, iAcmPortArray[ii] ); |
420 } |
491 } |
421 // Log any ports extending beyond where we currently have ACM interfaces. |
492 // Log any ports extending beyond where we currently have ACM interfaces. |
422 for ( ; ii < static_cast<TUint>(iAcmPortArray.Count()) ; ii++ ) |
493 for ( ; ii < static_cast<TUint>(iAcmPortArray.Count()) ; ii++ ) |
423 { |
494 { |
424 LOGTEXT4(_L8("\t iAcmClassArray[%d] = <no slot>, iAcmPortArray[%d] = 0x%08x"), ii, ii, iAcmPortArray[ii]); |
495 OstTraceExt3( TRACE_NORMAL, CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_DUP1, |
425 } |
496 "CAcmPortFactory::LogPortsAndFunctions;\t iAcmClassArray[%d] = <no slot>, iAcmPortArray[%d] = %p", |
|
497 (TInt)ii, (TInt)ii, iAcmPortArray[ii] ); |
|
498 } |
|
499 OstTraceFunctionExit0( CACMPORTFACTORY_LOGPORTSANDFUNCTIONS_EXIT ); |
426 } |
500 } |
427 |
501 |
428 // |
502 // |
429 // End of file |
503 // End of file |