mtpfws/mtpfw/datatypes/src/tmtptypedatapair.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 01:11:40 +0200
changeset 0 d0791faffa3f
permissions -rw-r--r--
Revision: 201003 Kit: 201005

// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

/**
@file
@publishedPartner
*/ 

#include <mtp/mtpdatatypeconstants.h>
#include <mtp/tmtptypedatapair.h>

// data pair element metadata.
const TMTPTypeDataPair::TElementInfo TMTPTypeDataPair::iElementMetaData[ENumElements] = 
    {
        {EMTPTypeUINT32,    0,  KMTPTypeUINT32Size},    // EOwnerHandle
        {EMTPTypeUINT16,    4,  KMTPTypeUINT16Size},    // EDataCode
    };

/**
Constructor.
*/
EXPORT_C TMTPTypeDataPair::TMTPTypeDataPair() :
    iElementInfo(iElementMetaData, ENumElements),
    iBuffer(KSize)
    {
    SetBuffer(iBuffer);
    }
    
EXPORT_C TMTPTypeDataPair::TMTPTypeDataPair( const TUint32 aHandle, const TUint16 aCode ):
	iElementInfo(iElementMetaData, ENumElements),
	iBuffer(KSize)
	{
    SetBuffer(iBuffer);
	SetUint32( TMTPTypeDataPair::EOwnerHandle, aHandle );
	SetUint16(TMTPTypeDataPair::EDataCode, aCode);
	}

EXPORT_C TMTPTypeDataPair::TMTPTypeDataPair(const TMTPTypeDataPair& aPair):
    iElementInfo(iElementMetaData, ENumElements),
    iBuffer(KSize)
    {
    iBuffer = aPair.iBuffer;
    SetBuffer(iBuffer);
    }

EXPORT_C TUint TMTPTypeDataPair::Type() const
    {
    return EMTPTypeDataPair;
    }
    
const TMTPTypeFlatBase::TElementInfo& TMTPTypeDataPair::ElementInfo(TInt aElementId) const
    {
    return iElementInfo[aElementId];
    }