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