mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp
changeset 0 d0791faffa3f
child 3 8b094906a049
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <mtp/tmtptyperequest.h>
       
    17 #include <mtp/mmtpdataproviderframework.h>
       
    18 #include <mtp/mmtpobjectmgr.h>
       
    19 #include <mtp/cmtptypearray.h>
       
    20 #include <mtp/mtpdatatypeconstants.h>
       
    21 
       
    22 #include "cmtpgetobjecthandles.h"
       
    23 #include "mtpdevicedpconst.h"
       
    24 #include "mtpdevdppanic.h"
       
    25 
       
    26 
       
    27 /**
       
    28 Two-phase construction method
       
    29 @param aPlugin	The data provider plugin
       
    30 @param aFramework	The data provider framework
       
    31 @param aConnection	The connection from which the request comes
       
    32 @return a pointer to the created request processor object
       
    33 */    
       
    34 MMTPRequestProcessor* CMTPGetObjectHandles::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection)
       
    35 	{
       
    36 	CMTPGetObjectHandles* self = new (ELeave) CMTPGetObjectHandles(aFramework, aConnection);
       
    37 	CleanupStack::PushL(self);
       
    38 	self->ConstructL();
       
    39 	CleanupStack::Pop();
       
    40 	return self;
       
    41 	}
       
    42 
       
    43 /**
       
    44 GetObjectHandles request handler
       
    45 */	
       
    46 CMTPGetObjectHandles::~CMTPGetObjectHandles()
       
    47 	{
       
    48 	delete iHandles;	
       
    49 	}
       
    50 
       
    51 /**
       
    52 Standard c++ constructor
       
    53 */	
       
    54 CMTPGetObjectHandles::CMTPGetObjectHandles(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
       
    55     CMTPGetNumObjects(aFramework, aConnection)
       
    56 	{
       
    57 	
       
    58 	}
       
    59     
       
    60 /**
       
    61 Second phase constructor.
       
    62 */
       
    63 void CMTPGetObjectHandles::ConstructL()
       
    64     {
       
    65     CMTPGetNumObjects::ConstructL();
       
    66     }
       
    67 
       
    68 /**
       
    69 GetObjectHandles request handler
       
    70 */	
       
    71 void CMTPGetObjectHandles::ServiceL()
       
    72 	{
       
    73 	RMTPObjectMgrQueryContext   context;
       
    74 	RArray<TUint>               handles;
       
    75 	TMTPObjectMgrQueryParams    params(Request().Uint32(TMTPTypeRequest::ERequestParameter1), Request().Uint32(TMTPTypeRequest::ERequestParameter2), Request().Uint32(TMTPTypeRequest::ERequestParameter3));
       
    76 	CleanupClosePushL(context);
       
    77 	CleanupClosePushL(handles);
       
    78 	
       
    79 	delete iHandles;
       
    80 	iHandles = CMTPTypeArray::NewL(EMTPTypeAUINT32);
       
    81 	
       
    82 	do
       
    83 	    {
       
    84     	iFramework.ObjectMgr().GetObjectHandlesL(params, context, handles);
       
    85     	iHandles->AppendL(handles);
       
    86 	    }
       
    87 	while (!context.QueryComplete());
       
    88 	
       
    89 	CleanupStack::PopAndDestroy(&handles);
       
    90 	CleanupStack::PopAndDestroy(&context);					
       
    91 	SendDataL(*iHandles);	
       
    92 	}
       
    93 
       
    94 
       
    95 
       
    96 
       
    97 
       
    98 
       
    99 	
       
   100 
       
   101 	
       
   102 
       
   103 
       
   104    	
       
   105 
       
   106 	
       
   107 
       
   108 
       
   109 
       
   110 
       
   111 
       
   112