usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp
changeset 31 4bea936937d0
parent 12 e9d124871462
child 29 59aa7d6e3e0f
equal deleted inserted replaced
30:0897fb188e2a 31:4bea936937d0
     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".
   516 		ret = GetPersonalityIds(aMessage);
   516 		ret = GetPersonalityIds(aMessage);
   517 		break;
   517 		break;
   518 	case EUsbGetDescription:
   518 	case EUsbGetDescription:
   519 		ret = GetDescription(aMessage);
   519 		ret = GetDescription(aMessage);
   520 		break;
   520 		break;
   521 	case EUsbGetDetailedDescription:
       
   522 		ret = GetDetailedDescription(aMessage);
       
   523 		break;
       
   524 	case EUsbGetPersonalityProperty:
   521 	case EUsbGetPersonalityProperty:
   525 		ret = GetPersonalityProperty(aMessage);
   522 		ret = GetPersonalityProperty(aMessage);
   526 		break;
   523 		break;
   527 	case EUsbClassSupported:
   524 	case EUsbClassSupported:
   528 		ret = ClassSupported(aMessage);
   525 		ret = ClassSupported(aMessage);
  1272 			classUids[0] = personalities[i]->SupportedClasses().Count();
  1269 			classUids[0] = personalities[i]->SupportedClasses().Count();
  1273 			for (TInt j = 1; j <= classUids[0]; j++)
  1270 			for (TInt j = 1; j <= classUids[0]; j++)
  1274 				{
  1271 				{
  1275 				if (j < KUsbMaxSupportedClasses + 1)
  1272 				if (j < KUsbMaxSupportedClasses + 1)
  1276 					{
  1273 					{
  1277 					classUids[j] = personalities[i]->SupportedClasses()[j - 1].iUid;
  1274 					classUids[j] = personalities[i]->SupportedClasses()[j - 1].iClassUid.iUid;
  1278 					LOGTEXT3(_L8("\tclassUids[%d] = %d"), j, classUids[j]);
  1275 					LOGTEXT3(_L8("\tclassUids[%d] = %d"), j, classUids[j]);
  1279 					}
  1276 					}
  1280 				else
  1277 				else
  1281 					{
  1278 					{
  1282 					return KErrTooBig;
  1279 					return KErrTooBig;
  1373 
  1370 
  1374 	// We should never reach here
  1371 	// We should never reach here
  1375 	return KErrNotSupported;
  1372 	return KErrNotSupported;
  1376 	}
  1373 	}
  1377 
  1374 
  1378 /**
       
  1379  * Gets personality detailed description
       
  1380  *
       
  1381  * @internalComponent
       
  1382  * @param   aMessage    Message received from the client
       
  1383  * @return  Any error that occurred or KErrNone
       
  1384  */
       
  1385 TInt CUsbSession::GetDetailedDescription(const RMessage2& aMessage)
       
  1386 	{
       
  1387 	LOG_FUNC
       
  1388 
       
  1389  	if (!iPersonalityCfged)
       
  1390 		{
       
  1391 		return KErrNotSupported;
       
  1392 		}
       
  1393 
       
  1394 	TInt personalityId = aMessage.Int0();
       
  1395 	const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId);
       
  1396     	if (personality)
       
  1397         	{
       
  1398         	if(personality->Version() < EUsbManagerResourceVersionTwo)
       
  1399             		{
       
  1400             		return KErrNotFound;
       
  1401             		}
       
  1402 		return aMessage.Write(1, *(personality->DetailedDescription()));
       
  1403 		}
       
  1404 
       
  1405 	// We should never reach here
       
  1406 	return KErrNotSupported;
       
  1407 	}
       
  1408 
  1375 
  1409 /**
  1376 /**
  1410  * Gets personality property
  1377  * Gets personality property
  1411  *
  1378  *
  1412  * @internalComponent
  1379  * @internalComponent
  1424 
  1391 
  1425 		TInt personalityId = aMessage.Int0();
  1392 		TInt personalityId = aMessage.Int0();
  1426 		const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId);
  1393 		const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId);
  1427 		if (personality)
  1394 		if (personality)
  1428 			{
  1395 			{
  1429 			if(personality->Version() < EUsbManagerResourceVersionThree)
       
  1430 				{
       
  1431 				return KErrNotFound;
       
  1432 				}
       
  1433 			TPckg<TUint32> pckg(personality->Property());
  1396 			TPckg<TUint32> pckg(personality->Property());
  1434 			return aMessage.Write(1, pckg);
  1397 			return aMessage.Write(1, pckg);
  1435 			}
  1398 			}
  1436 
  1399 
  1437 		return KErrNotSupported;
  1400 		return KErrNotSupported;
  1457 	TInt personalityId = aMessage.Int0();
  1420 	TInt personalityId = aMessage.Int0();
  1458 	TUid classUid = TUid::Uid(aMessage.Int1());
  1421 	TUid classUid = TUid::Uid(aMessage.Int1());
  1459 	const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId);
  1422 	const CPersonality* personality = iUsbServer->Device().GetPersonality(personalityId);
  1460 	if (personality)
  1423 	if (personality)
  1461 		{
  1424 		{
  1462 		isSupported = (personality->ClassSupported(classUid) != KErrNotFound);
  1425 		isSupported = personality->ClassSupported(classUid);
  1463 		TPckg<TBool> pkg2(isSupported);
  1426 		TPckg<TBool> pkg2(isSupported);
  1464 		return aMessage.Write(2, pkg2);
  1427 		return aMessage.Write(2, pkg2);
  1465 		}
  1428 		}
  1466 
  1429 
  1467 	// We should never reach here
  1430 	// We should never reach here