ximpfw/core/srcutils/ximprequestidbuilder.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  TXIMPRequestId builder.
       
    15  *
       
    16 */
       
    17 
       
    18 #include <ximpbase.h>
       
    19 #include "ximprequestidbuilder.h"
       
    20 
       
    21 
       
    22 /**
       
    23  * Internal request ID layout.
       
    24  * This structure size must match structly to TXIMPRequestId size.
       
    25  */
       
    26 struct SXIMPRequestId
       
    27     {
       
    28     TUint32 iSpare;
       
    29     TUint32 iProtocol;
       
    30     TUint32 iSession;
       
    31     TUint32 iRequest;
       
    32     };
       
    33     
       
    34 __ASSERT_COMPILE( sizeof( TXIMPRequestId ) == sizeof( SXIMPRequestId ) );    
       
    35 
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // TXIMPRequestIdBuilder::TXIMPRequestIdBuilder()
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C TXIMPRequestIdBuilder::TXIMPRequestIdBuilder()
       
    42     : iSpare( 0 ),
       
    43       iProtocol( 0 ),
       
    44       iSession( 0 ),
       
    45       iRequest( 0 )
       
    46     {
       
    47     }
       
    48 
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // TXIMPRequestIdBuilder::SetProtocolId()
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 EXPORT_C void TXIMPRequestIdBuilder::SetProtocolId( TUint32 aProtocol )
       
    55     {
       
    56     iProtocol = aProtocol;
       
    57     }
       
    58 
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // TXIMPRequestIdBuilder::SetSessionId()
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 EXPORT_C void TXIMPRequestIdBuilder::SetSessionId( TUint32 aSession )
       
    65     {
       
    66     iSession = aSession;
       
    67     }
       
    68 
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // TXIMPRequestIdBuilder::SetRequestId()
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C void TXIMPRequestIdBuilder::SetRequestId( TUint32 aRequest )
       
    75     {
       
    76     iRequest = aRequest;
       
    77     }
       
    78 
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // TXIMPRequestIdBuilder::BuildRequestId()
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 EXPORT_C TXIMPRequestId TXIMPRequestIdBuilder::BuildRequestId() const
       
    85     {
       
    86     SXIMPRequestId regIdStruct;
       
    87     regIdStruct.iSpare = iSpare;
       
    88     regIdStruct.iProtocol = iProtocol;
       
    89     regIdStruct.iSession = iSession;
       
    90     regIdStruct.iRequest = iRequest;
       
    91 
       
    92     TXIMPRequestId regId;
       
    93     Mem::Copy( &regId, &regIdStruct, sizeof( TXIMPRequestId ) );
       
    94 
       
    95     return regId;
       
    96     }
       
    97 
       
    98 
       
    99 
       
   100 // END OF FILE