mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetreferences.cpp
changeset 0 d0791faffa3f
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/cmtptypearray.h>
       
    17 #include <mtp/mmtpdataproviderframework.h>
       
    18 #include <mtp/mmtpreferencemgr.h>
       
    19 #include <mtp/tmtptyperequest.h>
       
    20 
       
    21 #include "cmtpgetreferences.h"
       
    22 
       
    23 /**
       
    24 Verification data for the GetReferences request
       
    25 */
       
    26 const TMTPRequestElementInfo KMTPGetReferencesPolicy[] = 
       
    27     {
       
    28         {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrNone, 0, 0, 0}
       
    29     };
       
    30 
       
    31 /**
       
    32 Two-phase construction method
       
    33 @param aPlugin The data provider plugin
       
    34 @param aFramework The data provider framework
       
    35 @param aConnection The connection from which the request comes
       
    36 @return a pointer to the created request processor object
       
    37 */    
       
    38 EXPORT_C MMTPRequestProcessor* CMTPGetReferences::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection)
       
    39     {
       
    40     CMTPGetReferences* self = new (ELeave) CMTPGetReferences(aFramework, aConnection);
       
    41     return self;
       
    42     }
       
    43 
       
    44 /**
       
    45 Destructor
       
    46 */    
       
    47 EXPORT_C CMTPGetReferences::~CMTPGetReferences()
       
    48     {
       
    49     delete iReferences;
       
    50     }
       
    51 
       
    52 /**
       
    53 Standard c++ constructor
       
    54 */    
       
    55 CMTPGetReferences::CMTPGetReferences(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection)
       
    56     :CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPGetReferencesPolicy)/sizeof(TMTPRequestElementInfo), KMTPGetReferencesPolicy)
       
    57     {
       
    58     }
       
    59 
       
    60 /**
       
    61 GetReferences request handler
       
    62 */    
       
    63 void CMTPGetReferences::ServiceL()
       
    64     {
       
    65     TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
       
    66     MMTPReferenceMgr& referenceMgr = iFramework.ReferenceMgr();
       
    67     delete iReferences;
       
    68     iReferences = NULL;
       
    69     iReferences = referenceMgr.ReferencesLC(TMTPTypeUint32(objectHandle));
       
    70     CleanupStack::Pop(iReferences);
       
    71     SendDataL(*iReferences);
       
    72     }
       
    73 
       
    74