telephonyserverplugins/simatktsy/utility/src/tsatutility.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 //
    18 //
    19 
    19 
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "tsatutilityTraces.h"
       
    27 #endif
       
    28 
       
    29 #include "tsatutility.h"        // Class header
    23 #include "tsatutility.h"        // Class header
       
    24 #include "tflogger.h"           // TFLOGSTRING
    30 #include <ctsy/serviceapi/cmmsmsutility.h>		// TON and NPI constants
    25 #include <ctsy/serviceapi/cmmsmsutility.h>		// TON and NPI constants
    31 
    26 
    32 // -----------------------------------------------------------------------------
    27 // -----------------------------------------------------------------------------
    33 // TSatUtility::TonAndNpi
    28 // TSatUtility::TonAndNpi
    34 // Map TON and NPI to RSat TON and NPI values
    29 // Map TON and NPI to RSat TON and NPI values
    39         const TInt aTonAndNpi,                
    34         const TInt aTonAndNpi,                
    40         RSat::TTypeOfNumber* aTon,      
    35         RSat::TTypeOfNumber* aTon,      
    41         RSat::TNumberingPlan* aNpi      
    36         RSat::TNumberingPlan* aNpi      
    42         )
    37         )
    43     {
    38     {
    44     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_TONANDNPI_1,  "UTILITY: TSatUtility::TonAndNpi" );
    39     TFLOGSTRING( "UTILITY: TSatUtility::TonAndNpi" );
    45     TInt ton( ( aTonAndNpi >> 4 ) & KTONMask ); // TON mask value 0x07
    40     TInt ton( ( aTonAndNpi >> 4 ) & KTONMask ); // TON mask value 0x07
    46 
    41 
    47     switch ( ton )
    42     switch ( ton )
    48         {
    43         {
    49         case KTonUnknown:
    44         case KTonUnknown:
   155         ( 
   150         ( 
   156         const TPtrC8 aSource,   
   151         const TPtrC8 aSource,   
   157         TDes8& aTarget    
   152         TDes8& aTarget    
   158         )
   153         )
   159     {
   154     {
   160     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_PACKED7TO8UNPACKED_1,  "UTILITY: TSatUtility::Packed7to8Unpacked" );
   155     TFLOGSTRING( "UTILITY: TSatUtility::Packed7to8Unpacked" );
   161     TInt ret( KErrNone );
   156     TInt ret( KErrNone );
   162     // The string is in packed GSM default alphabet format.
   157     // The string is in packed GSM default alphabet format.
   163     // Converted to 8-bit format
   158     // Converted to 8-bit format
   164     TUint8 maskRightPartOfCurrentByte( 0x7F );
   159     TUint8 maskRightPartOfCurrentByte( 0x7F );
   165     TUint8 shiftLeft( 0 );
   160     TUint8 shiftLeft( 0 );
   201         
   196         
   202     // Whe should still notify the requesting method about exceeding the length
   197     // Whe should still notify the requesting method about exceeding the length
   203     if ( length < sourceLength )
   198     if ( length < sourceLength )
   204         {
   199         {
   205         ret = KErrOverflow;
   200         ret = KErrOverflow;
   206         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_PACKED7TO8UNPACKED_2,  "UTILITY: TSatUtility::Packed7to8Unpacked,Input data too long. %d bytes could not be converted", ( sourceLength - length ) );
   201         TFLOGSTRING2( "UTILITY: TSatUtility::Packed7to8Unpacked,\
       
   202             Input data too long. %d bytes could not be converted", 
       
   203             ( sourceLength - length ) );
   207         }
   204         }
   208   
   205   
   209     return ret;
   206     return ret;
   210     }
   207     }
   211 
   208 
   218         ( 
   215         ( 
   219         const TPtrC aInput,   
   216         const TPtrC aInput,   
   220         TDes8& aOutput   
   217         TDes8& aOutput   
   221         )
   218         )
   222     {
   219     {
   223     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_UCSTOPACKED7_1,  "UTILITY: TSatUtility::UCSToPacked7" );
   220     TFLOGSTRING( "UTILITY: TSatUtility::UCSToPacked7" );
   224     
   221     
   225     TBuf8<KMaxUssdStringLengthInBytes> string;
   222     TBuf8<KMaxUssdStringLengthInBytes> string;
   226     
   223     
   227     // This method interrupts converting if the target buffer is full, so
   224     // This method interrupts converting if the target buffer is full, so
   228     // the length can not be exceeded
   225     // the length can not be exceeded
   285         ( 
   282         ( 
   286         const TPtrC8 aInput,  
   283         const TPtrC8 aInput,  
   287         TDes8& aOutput   
   284         TDes8& aOutput   
   288         )
   285         )
   289     {
   286     {
   290     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_BCDTOASCII_1,  "UTILITY: TSatUtility::BCDToAscii" );
   287     TFLOGSTRING( "UTILITY: TSatUtility::BCDToAscii" );
   291     TInt ret( KErrNone );
   288     TInt ret( KErrNone );
   292     
   289     
   293     // Convert Abbreviated dialling numbers format back to ASCII format.
   290     // Convert Abbreviated dialling numbers format back to ASCII format.
   294     // See 3GPP TS 11.11, EFadn
   291     // See 3GPP TS 11.11, EFadn
   295     aOutput.Zero();
   292     aOutput.Zero();
   312         
   309         
   313     // Whe should still notify the requesting method about exceeding the length
   310     // Whe should still notify the requesting method about exceeding the length
   314     if ( length < aInput.Length() )
   311     if ( length < aInput.Length() )
   315         {
   312         {
   316         ret = KErrOverflow;
   313         ret = KErrOverflow;
   317         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_BCDTOASCII_2,  "UTILITY: TSatUtility::BCDToAscii,Input data too long.%d bytes could not be converted", ( aInput.Length() - length ) );
   314         TFLOGSTRING2( "UTILITY: TSatUtility::BCDToAscii,Input data too long.\
       
   315             %d bytes could not be converted", ( aInput.Length() - length ) );
   318         }    
   316         }    
   319         
   317         
   320     return ret;
   318     return ret;
   321     }
   319     }
   322 
   320 
   330         ( 
   328         ( 
   331         const TDesC8& aInput, 
   329         const TDesC8& aInput, 
   332         TDes8& aOutput        
   330         TDes8& aOutput        
   333         )
   331         )
   334     {
   332     {
   335     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_ASCIITOBCD_1,  "UTILITY: TSatUtility::AsciiToBCD" );
   333     TFLOGSTRING( "UTILITY: TSatUtility::AsciiToBCD" );
   336     TInt ret( KErrNone );
   334     TInt ret( KErrNone );
   337     TInt i;
   335     TInt i;
   338     TInt j;
   336     TInt j;
   339     TInt outLen( 0 );
   337     TInt outLen( 0 );
   340     TInt length( aInput.Length() );
   338     TInt length( aInput.Length() );
   373 	                aOutput[outLen / 2] |= ( bcd << 4 );
   371 	                aOutput[outLen / 2] |= ( bcd << 4 );
   374 	                }
   372 	                }
   375             	}
   373             	}
   376             else
   374             else
   377                 {
   375                 {
   378                 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_ASCIITOBCD_2,  "UTILITY: TSatUtility::AsciiToBCD, Overflow!" );
   376                 TFLOGSTRING( "UTILITY: TSatUtility::AsciiToBCD, Overflow!" );
   379                 ret = KErrOverflow;
   377                 ret = KErrOverflow;
   380                 }
   378                 }
   381                 
   379                 
   382             outLen++;
   380             outLen++;
   383             }
   381             }
   384         else
   382         else
   385             {
   383             {
   386             OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_ASCIITOBCD_3, "UTILITY: TSatUtility::AsciiToBCD -- dropped character %d at i=%d", TInt( aInput[i] ), i );
   384             TFLOGSTRING3("UTILITY: TSatUtility::AsciiToBCD -- dropped \
       
   385                 character %d at i=%d", TInt( aInput[i] ), i );
   387             }
   386             }
   388             
   387             
   389         } // For
   388         } // For
   390 
   389 
   391     // If odd number of digits add endmark
   390     // If odd number of digits add endmark
   407         (
   406         (
   408         const TPtrC8 aString,  
   407         const TPtrC8 aString,  
   409         TDes8& aOutput   
   408         TDes8& aOutput   
   410         )
   409         )
   411     {
   410     {
   412     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_REMOVEWILDANDEXPANSIONDIGIT_1,  "UTILITY: TSatUtility::RemoveWildAndExpansionDigit" );
   411     TFLOGSTRING( "UTILITY: TSatUtility::RemoveWildAndExpansionDigit" );
   413     aOutput.Zero();    
   412     aOutput.Zero();    
   414     TUint8 i( 0 );
   413     TUint8 i( 0 );
   415     TInt maxLength = aOutput.MaxLength();
   414     TInt maxLength = aOutput.MaxLength();
   416     TInt length( aString.Length() );
   415     TInt length( aString.Length() );
   417     
   416     
   435         ( 
   434         ( 
   436         const TPtrC8 aRawData, 
   435         const TPtrC8 aRawData, 
   437         TDes& aAlphaId  
   436         TDes& aAlphaId  
   438         )
   437         )
   439     {
   438     {
   440     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_SETALPHAID_1,  "UTILITY: TSatUtility::SetAlphaId" );
   439     TFLOGSTRING( "UTILITY: TSatUtility::SetAlphaId" );
   441     if ( ( KUCS2ArabicCoding == aRawData[0] )
   440     if ( ( KUCS2ArabicCoding == aRawData[0] )
   442         || ( KUCS2GreekCoding == aRawData[0] )
   441         || ( KUCS2GreekCoding == aRawData[0] )
   443         || ( KUCS2TurkishCoding == aRawData[0] ) )
   442         || ( KUCS2TurkishCoding == aRawData[0] ) )
   444         {
   443         {
   445         ConvertAlphaFieldsToUnicode( aRawData, aAlphaId );
   444         ConvertAlphaFieldsToUnicode( aRawData, aAlphaId );
   462 EXPORT_C TUint8 TSatUtility::ConvertToSemiOctet
   461 EXPORT_C TUint8 TSatUtility::ConvertToSemiOctet
   463         ( 
   462         ( 
   464         const TInt aTime  
   463         const TInt aTime  
   465         )
   464         )
   466     {
   465     {
   467     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_CONVERTTOSEMIOCTET_1,  "UTILITY: TSatUtility::ConvertToSemiOctet" );
   466     TFLOGSTRING( "UTILITY: TSatUtility::ConvertToSemiOctet" );
   468     // Converting given time to meet the TP-Service-Centre-Time-Stamp format in
   467     // Converting given time to meet the TP-Service-Centre-Time-Stamp format in
   469     // 3GPP TS 23.040.
   468     // 3GPP TS 23.040.
   470 
   469 
   471     TInt msd( ( aTime / 10 ) % 10 ); // Most significant decimal
   470     TInt msd( ( aTime / 10 ) % 10 ); // Most significant decimal
   472     TInt lsd( ( aTime % 10 ) );      // Least significant decimal
   471     TInt lsd( ( aTime % 10 ) );      // Least significant decimal
   483         (
   482         (
   484         const TDesC8& aInput,
   483         const TDesC8& aInput,
   485         TDes16& aOutput  
   484         TDes16& aOutput  
   486         )
   485         )
   487     {
   486     {
   488     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_CONVERT7BITTOUNICODE16_1,  "UTILITY: TSatUtility::Convert7BitToUnicode16" );
   487     TFLOGSTRING( "UTILITY: TSatUtility::Convert7BitToUnicode16" );
   489     TInt i( 0 );
   488     TInt i( 0 );
   490     
   489     
   491     aOutput.Zero();
   490     aOutput.Zero();
   492     
   491     
   493     // Check out which string is the shortest and use its length as a limit
   492     // Check out which string is the shortest and use its length as a limit
   581         (
   580         (
   582         const TDesC16& aInput,
   581         const TDesC16& aInput,
   583         TDes8& aOutput   
   582         TDes8& aOutput   
   584         )
   583         )
   585     {
   584     {
   586     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_CONVERTUNICODE16TO7BIT_1,  "UTILITY: TSatUtility::ConvertUnicode16To7Bit" );
   585     TFLOGSTRING( "UTILITY: TSatUtility::ConvertUnicode16To7Bit" );
   587     TInt i( 0 );
   586     TInt i( 0 );
   588     TInt j( 0 );
   587     TInt j( 0 );
   589     TInt ret( KErrNone );
   588     TInt ret( KErrNone );
   590     TBool found( EFalse );
   589     TBool found( EFalse );
   591     TInt outputMaxLength = aOutput.MaxLength();
   590     TInt outputMaxLength = aOutput.MaxLength();
   615     
   614     
   616     // Whe should still notify the requesting method about exceeding the length
   615     // Whe should still notify the requesting method about exceeding the length
   617     if ( length < aInput.Length() )
   616     if ( length < aInput.Length() )
   618         {
   617         {
   619         ret = KErrOverflow;
   618         ret = KErrOverflow;
   620         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_CONVERTUNICODE16TO7BIT_2,  "UTILITY: TSatUtility::ConvertUnicode16To7Bit,Input data too long. %d bytes could not be converted", ( aInput.Length() - length ) );
   619         TFLOGSTRING2( "UTILITY: TSatUtility::ConvertUnicode16To7Bit,\
       
   620             Input data too long. %d bytes could not be converted", 
       
   621             ( aInput.Length() - length ) );
   621         }
   622         }
   622         
   623         
   623     return ret;
   624     return ret;
   624     }
   625     }
   625 
   626 
   632         (
   633         (
   633         CBerTlv& aBerTlv,             
   634         CBerTlv& aBerTlv,             
   634         RSat::TDuration& aTDuration   
   635         RSat::TDuration& aTDuration   
   635         )
   636         )
   636     {
   637     {
   637     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_FILLDURATIONSTRUCTURE_1,  "UTILITY: TSatUtility::FillDurationStructure" );
   638     TFLOGSTRING( "UTILITY: TSatUtility::FillDurationStructure" );
   638     CTlv duration;
   639     CTlv duration;
   639     aTDuration.iTimeUnit = RSat::ENoDurationAvailable;
   640     aTDuration.iTimeUnit = RSat::ENoDurationAvailable;
   640     TInt returnValue( aBerTlv.TlvByTagValue( 
   641     TInt returnValue( aBerTlv.TlvByTagValue( 
   641         &duration, KTlvDurationTag ) );
   642         &duration, KTlvDurationTag ) );
   642         
   643         
   683         CBerTlv& aBerTlv,        
   684         CBerTlv& aBerTlv,        
   684         RSat::TIconId& aTIconId, 
   685         RSat::TIconId& aTIconId, 
   685         const TInt aItemNmb            
   686         const TInt aItemNmb            
   686         )
   687         )
   687     {
   688     {
   688     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_FILLICONSTRUCTURE_1,  "UTILITY: TSatUtility::FillIconStructure" );
   689     TFLOGSTRING( "UTILITY: TSatUtility::FillIconStructure" );
   689     CTlv iconId;
   690     CTlv iconId;
   690     aTIconId.iQualifier = RSat::ENoIconId;
   691     aTIconId.iQualifier = RSat::ENoIconId;
   691     TInt returnValue( aBerTlv.TlvByTagValue( &iconId, KTlvIconIdentifierTag, 
   692     TInt returnValue( aBerTlv.TlvByTagValue( &iconId, KTlvIconIdentifierTag, 
   692         aItemNmb ) );
   693         aItemNmb ) );
   693     
   694     
   716         (
   717         (
   717         CTlv& aTextTlv, 
   718         CTlv& aTextTlv, 
   718         TDes& aUnicodeOutput   
   719         TDes& aUnicodeOutput   
   719         ) 
   720         ) 
   720     {
   721     {
   721     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_SETTEXT_1,  "UTILITY: TSatUtility::SetText" );
   722     TFLOGSTRING( "UTILITY: TSatUtility::SetText" );
   722     if ( aTextTlv.GetLength() )
   723     if ( aTextTlv.GetLength() )
   723         {
   724         {
   724         TPtrC8 sourceString;
   725         TPtrC8 sourceString;
   725 
   726 
   726         sourceString.Set( aTextTlv.GetData( ETLV_TextString ) );
   727         sourceString.Set( aTextTlv.GetData( ETLV_TextString ) );
   777         (
   778         (
   778         const TDesC8& aSource,
   779         const TDesC8& aSource,
   779         TDes& aTarget 
   780         TDes& aTarget 
   780         )
   781         )
   781     {   
   782     {   
   782     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_CONVERTALPHAFIELDSTOUNICODE_1,  "UTILITY: TSatUtility::ConvertAlphaFieldsToUnicode" );
   783     TFLOGSTRING( "UTILITY: TSatUtility::ConvertAlphaFieldsToUnicode" );
   783     // ArabicCoding, GreekCoding and TurkishCoding have different coding 
   784     // ArabicCoding, GreekCoding and TurkishCoding have different coding 
   784     // methods. There is a tag for each type of alphabet (resp. 80, 81 or 82) 
   785     // methods. There is a tag for each type of alphabet (resp. 80, 81 or 82) 
   785     // before the text, and there are base pointers used for expanding 1 byte 
   786     // before the text, and there are base pointers used for expanding 1 byte 
   786     // to 2 bytes as required by UCS2  
   787     // to 2 bytes as required by UCS2  
   787     // Ref: 3GPP TS 11.11, Annex B
   788     // Ref: 3GPP TS 11.11, Annex B
   880         (
   881         (
   881         const TDesC16& aSource,  
   882         const TDesC16& aSource,  
   882         TDes8& aTarget            
   883         TDes8& aTarget            
   883         )
   884         )
   884     {   
   885     {   
   885     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_COPY16TO8LE_1,  "UTILITY: TSatUtility::Copy16to8LE" );
   886     TFLOGSTRING( "UTILITY: TSatUtility::Copy16to8LE" );
   886     TInt ret( KErrNone );
   887     TInt ret( KErrNone );
   887     TInt length( 0 );
   888     TInt length( 0 );
   888     
   889     
   889     // Checks that data length are acceblable
   890     // Checks that data length are acceblable
   890     if ( aSource.Size() > aTarget.MaxSize() )
   891     if ( aSource.Size() > aTarget.MaxSize() )
   891         {
   892         {
   892         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_COPY16TO8LE_2,  "UTILITY: TSatUtility::Copy16to8LE, Length exceeded!" );
   893         TFLOGSTRING( "UTILITY: TSatUtility::Copy16to8LE, Length exceeded!" );
   893         ret = KErrOverflow;
   894         ret = KErrOverflow;
   894         length = ( aTarget.MaxSize() / 2 );
   895         length = ( aTarget.MaxSize() / 2 );
   895         }
   896         }
   896     else
   897     else
   897         {
   898         {
   917         (
   918         (
   918         const TDesC8& aSource,  
   919         const TDesC8& aSource,  
   919         TDes16& aTarget         
   920         TDes16& aTarget         
   920         )
   921         )
   921     {
   922     {
   922     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_COPY8TO16LE_1,  "UTILITY: TSatUtility::Copy8to16LE" );
   923     TFLOGSTRING( "UTILITY: TSatUtility::Copy8to16LE" );    
   923     TInt ret( KErrNone );
   924     TInt ret( KErrNone );
   924     // Check out which string is the shortest and use its length as a limit
   925     // Check out which string is the shortest and use its length as a limit
   925     TInt length ( Min( ( ( aSource.Length() / 2 ) * 2 ), aTarget.MaxSize() ) );
   926     TInt length ( Min( ( ( aSource.Length() / 2 ) * 2 ), aTarget.MaxSize() ) );
   926 
   927 
   927     // Append source to target using right endian
   928     // Append source to target using right endian
   932         
   933         
   933     // Whe should still notify the requesting method about exceeding the length
   934     // Whe should still notify the requesting method about exceeding the length
   934     if ( length < aSource.Length() )
   935     if ( length < aSource.Length() )
   935         {
   936         {
   936         ret = KErrOverflow;
   937         ret = KErrOverflow;
   937         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_COPY8TO16LE_2,  "UTILITY: TSatUtility::ConvertUnicode16To7Bit,Input data too long. %d bytes could not be converted", ( aSource.Length() - length ) );
   938         TFLOGSTRING2( "UTILITY: TSatUtility::ConvertUnicode16To7Bit,\
       
   939             Input data too long. %d bytes could not be converted", 
       
   940             ( aSource.Length() - length ) );
   938         }
   941         }
   939         
   942         
   940     return ret;
   943     return ret;
   941     }
   944     }
   942 
   945 
   950 EXPORT_C TSmsDcs TSatUtility::DecodeCbsDcs
   953 EXPORT_C TSmsDcs TSatUtility::DecodeCbsDcs
   951 		(
   954 		(
   952     	const TUint8 aDcs 
   955     	const TUint8 aDcs 
   953     	)
   956     	)
   954     {
   957     {
   955     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_DECODECBSDCS_1, "UTILITY: TSatUtility::DecodeCbsDcs");
   958     TFLOGSTRING("UTILITY: TSatUtility::DecodeCbsDcs");
   956     
   959     
   957     // Constant values are not defined in order to
   960     // Constant values are not defined in order to
   958     // avoid confusion with too many constants names.
   961     // avoid confusion with too many constants names.
   959     
   962     
   960     // Coding group: 4 left most significant bits
   963     // Coding group: 4 left most significant bits
  1033             break;
  1036             break;
  1034             }
  1037             }
  1035         default:
  1038         default:
  1036             {
  1039             {
  1037             // the DCS value is reserved.
  1040             // the DCS value is reserved.
  1038             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_DECODECBSDCS_2, "UTILITY: TSatUtility::DecodeCbsDcs, reserved value");
  1041             TFLOGSTRING("UTILITY: TSatUtility::DecodeCbsDcs, reserved value");
  1039             break;
  1042             break;
  1040             }
  1043             }
  1041         }
  1044         }
  1042     return decodedDcs;
  1045     return decodedDcs;
  1043     }
  1046     }
  1053         const TDesC8& aSource,
  1056         const TDesC8& aSource,
  1054         TUint16& aTarget,       
  1057         TUint16& aTarget,       
  1055         const TInt aIndex         
  1058         const TInt aIndex         
  1056         )
  1059         )
  1057     {
  1060     {
  1058     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_COPYTWO8TOONE16LE_1, "UTILITY: TSatUtility::CopyTwo8toOne16LE");
  1061     TFLOGSTRING("UTILITY: TSatUtility::CopyTwo8toOne16LE");
  1059     TInt ret( KErrNone );
  1062     TInt ret( KErrNone );
  1060     // Check first that we dont try to read data that is not there..
  1063     // Check first that we dont try to read data that is not there..
  1061     if ( aSource.Length() > aIndex + 1 )
  1064     if ( aSource.Length() > aIndex + 1 )
  1062         {
  1065         {
  1063         aTarget = static_cast<TUint16>( aSource[aIndex] << 8 );         
  1066         aTarget = static_cast<TUint16>( aSource[aIndex] << 8 );         
  1064         aTarget = static_cast<TUint16>( aTarget | aSource[aIndex + 1] );
  1067         aTarget = static_cast<TUint16>( aTarget | aSource[aIndex + 1] );
  1065         }
  1068         }
  1066     else
  1069     else
  1067         {
  1070         {
  1068         ret = KErrOverflow;
  1071         ret = KErrOverflow;
  1069         OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TSATUTILITY_COPYTWO8TOONE16LE_2, "UTILITY: TSatUtility::CopyTwo8toOne16LE, Index too highIndex: %d, Source data length: %d", aIndex, aSource.Length() );
  1072         TFLOGSTRING3("UTILITY: TSatUtility::CopyTwo8toOne16LE, Index too high\
       
  1073             Index: %d, Source data length: %d", aIndex, aSource.Length() );
  1070         }
  1074         }
  1071         
  1075         
  1072     return ret;
  1076     return ret;
  1073     }
  1077     }
  1074 
  1078