telephonyserverplugins/common_tsy/commontsy/src/mmutility/CMmCommonStaticUtility.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 
       
    18 //  INCLUDE FILES
       
    19 #include <etelmm.h>
       
    20 #include <etelmmerr.h>
       
    21 #include <exterror.h>
       
    22 #include <ctsy/serviceapi/gsmerror.h>
       
    23 #include "CMmCommonStaticUtility.h"
       
    24 
       
    25 #include <ctsy/tflogger.h>
       
    26 #include <in_sock.h>
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CMmCommonStaticUtility::EpocErrorCode
       
    32 // Stores the core error code to lower 16 bits and adds the 
       
    33 // extended error code to higher 16 bits and returns the error code that can 
       
    34 // be sent to ETel Server.
       
    35 // (other items were commented in a header).
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 TInt CMmCommonStaticUtility::EpocErrorCode( 
       
    39     TInt aCoreErrorCode, // core error
       
    40     TInt aExtendedErrorCode ) // extended error
       
    41     {
       
    42 TFLOGSTRING3("TSY: CMmStaticUtility::EpocErrorCode, Error mapping done, \
       
    43 Core error: %d, Extended error: %d", aCoreErrorCode, aExtendedErrorCode );
       
    44 
       
    45     TInt errorCode = ( aCoreErrorCode & 0x0000FFFF ) |
       
    46                      ( aExtendedErrorCode << 16 );
       
    47 
       
    48 TFLOGSTRING2("TSY: CMmStaticUtility::EpocErrorCode. It was mapped \
       
    49 to the following Symbian OS error: %d", errorCode );
       
    50 
       
    51     return errorCode;
       
    52     }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CMmCommonStaticUtility::EpocErrorCode
       
    56 // 
       
    57 // (other items were commented in a header).
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 TInt CMmCommonStaticUtility::ExtendedErrorCode( 
       
    61     TInt EpocErrorCode )
       
    62     {
       
    63     TInt temp = (EpocErrorCode & 0xFFFF0000) >> 16;
       
    64     if ( temp != KErrNone )
       
    65         {
       
    66         //add negative sign
       
    67         temp = temp | 0xFFFF0000;
       
    68         }
       
    69     return temp;
       
    70     }
       
    71 
       
    72 //  End of File