mtpfws/mtpfw/datatypes/src/tmtptyperequest.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 /**
       
    17  @file
       
    18  @publishedPartner
       
    19 */
       
    20 
       
    21 #include <mtp/mtpdatatypeconstants.h>
       
    22 #include <mtp/tmtptyperequest.h>
       
    23 
       
    24 // Dataset element metadata.
       
    25 const TMTPTypeRequest::TElementInfo TMTPTypeRequest::iElementMetaData[ENumElements] = 
       
    26     {
       
    27         {EMTPTypeUINT16, 0,  KMTPTypeUINT16Size},   // ERequestOperationCode
       
    28         {EMTPTypeUINT32, 2,  KMTPTypeUINT32Size},   // ERequestSessionID
       
    29         {EMTPTypeUINT32, 6,  KMTPTypeUINT32Size},   // ERequestTransactionID
       
    30         {EMTPTypeUINT32, 10, KMTPTypeUINT32Size},   // ERequestParameter1  
       
    31         {EMTPTypeUINT32, 14, KMTPTypeUINT32Size},   // ERequestParameter2
       
    32         {EMTPTypeUINT32, 18, KMTPTypeUINT32Size},   // ERequestParameter3
       
    33         {EMTPTypeUINT32, 22, KMTPTypeUINT32Size},   // ERequestParameter4
       
    34         {EMTPTypeUINT32, 26, KMTPTypeUINT32Size},   // ERequestParameter5
       
    35     };
       
    36 
       
    37 /**
       
    38 Constructor.
       
    39 */
       
    40 EXPORT_C TMTPTypeRequest::TMTPTypeRequest() :
       
    41     iElementInfo(iElementMetaData, ENumElements),
       
    42     iBuffer(KSize)
       
    43     {
       
    44     SetBuffer(iBuffer);
       
    45     }	
       
    46     
       
    47 /**
       
    48 Equality operator.
       
    49 @param aRequest The request to compare against this TMTPTypeRequest.
       
    50 @return ETrue if the two TMTPTypeRequests are equal, otherwise EFalse. 
       
    51 */	
       
    52 EXPORT_C TBool TMTPTypeRequest::operator==(const TMTPTypeRequest& aRequest) const
       
    53 	{
       
    54 	return iBuffer == aRequest.iBuffer;
       
    55 	}
       
    56     
       
    57 /**
       
    58 Inequality operator.
       
    59 @param aRequest The request to compare against this TMTPTypeRequest.
       
    60 @return ETrue if the two TMTPTypeRequests are different, otherwise EFalse. 
       
    61 */	
       
    62 EXPORT_C TBool TMTPTypeRequest::operator!=(const TMTPTypeRequest& aRequest) const
       
    63 	{
       
    64 	return !(*this == aRequest);
       
    65 	}
       
    66 
       
    67 EXPORT_C TMTPTypeRequest::TMTPTypeRequest(const TMTPTypeRequest& aRequest):
       
    68     iElementInfo(iElementMetaData, ENumElements),
       
    69     iBuffer(KSize)
       
    70     {
       
    71     iBuffer = aRequest.iBuffer;
       
    72     SetBuffer(iBuffer);
       
    73     }
       
    74 
       
    75 EXPORT_C TUint TMTPTypeRequest::Type() const
       
    76     {
       
    77     return EMTPTypeRequestDataset;
       
    78     }
       
    79     
       
    80 EXPORT_C const TMTPTypeFlatBase::TElementInfo& TMTPTypeRequest::ElementInfo(TInt aElementId) const
       
    81     {
       
    82     return iElementInfo[aElementId];
       
    83     }
       
    84