mtpfws/mtpfw/inc/tmtptypeobjecthandle.h
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  @internalComponent
       
    19 */
       
    20 
       
    21 #ifndef TMTPTYPEOBJECTHANDLE_H
       
    22 #define TMTPTYPEOBJECTHANDLE_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32std.h>
       
    26 #include <mtp/tmtptypeuint32.h>
       
    27     
       
    28 /**
       
    29 Defines the MTP object handle type. The MTP object handle encoding comprises
       
    30 the following fields.
       
    31 
       
    32     1. MS 8 bits - The ID of the data provider responsible for the object.
       
    33     2. LS 24 bits - A data provider unique object identifier.
       
    34     
       
    35 @internalComponent
       
    36  
       
    37 */
       
    38 class TMTPTypeObjectHandle : public TMTPTypeUint32
       
    39     {
       
    40 public:
       
    41 
       
    42     TMTPTypeObjectHandle(TUint32 aId, TUint8 aDp);
       
    43     TMTPTypeObjectHandle(TMTPTypeUint32 aId, TUint8 aDp);
       
    44     TMTPTypeObjectHandle(TMTPTypeUint32 aHandle);
       
    45     
       
    46     ~TMTPTypeObjectHandle();
       
    47     
       
    48     TUint8 DpId() const;
       
    49 	TUint32 DPObjectId() const;
       
    50     void SetDPHandle(TUint8 aDp);
       
    51     
       
    52     inline static TUint ObjectID( TUint32 aHandleID )
       
    53         {
       
    54         return ( (~KDpMask) & aHandleID);
       
    55         }
       
    56 
       
    57     inline static TUint DataProviderID( TUint32 aHandleID )
       
    58         {
       
    59         return ((KDpMask & aHandleID) >> KObjectIdWidth);
       
    60         }
       
    61     
       
    62 public:
       
    63 
       
    64     static const TUint32    KDpMask         = 0xFF000000;
       
    65     static const TUint32    KObjectIdMax    = 0x00FFFFFF;
       
    66     static const TUint      KObjectIdWidth  = 24;
       
    67     };
       
    68 
       
    69 #endif // TMTPTYPEOBJECTHANDLE_H