smsprotocols/smsstack/gsmu/src/gsmupriv.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2000-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".
    17 
    17 
    18 /**
    18 /**
    19  @file
    19  @file
    20 */
    20 */
    21 
    21 
       
    22 
       
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "gsmuprivTraces.h"
       
    26 #endif
       
    27 
    22 #include "gsmupriv.h"
    28 #include "gsmupriv.h"
    23 #include "Gsmumain.h"
    29 #include "Gsmumain.h"
    24 #include <exterror.h>
    30 #include <exterror.h>
    25 
    31 
    26 //
    32 //
    40 /**
    46 /**
    41  *  Packs user data units from aIn and appends to aOut.
    47  *  Packs user data units from aIn and appends to aOut.
    42  */
    48  */
    43 TInt TSmsAlphabetPacker::PackL(TDes8& aOut,const TDesC8& aIn)
    49 TInt TSmsAlphabetPacker::PackL(TDes8& aOut,const TDesC8& aIn)
    44 	{
    50 	{
    45 	LOGGSMU1("TSmsAlphabetPacker::PackL()");
    51 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TSMSALPHABETPACKER_PACKL_1, "TSmsAlphabetPacker::PackL()");
    46 
    52 
    47 	// Ensure we've got the right length
    53 	// Ensure we've got the right length
    48 	TInt packedOctetsRequired=PackedOctetsRequiredL(aIn.Length());
    54 	TInt packedOctetsRequired=PackedOctetsRequiredL(aIn.Length());
    49 	if (packedOctetsRequired>(aOut.MaxLength()-aOut.Length()))
    55 	if (packedOctetsRequired>(aOut.MaxLength()-aOut.Length()))
    50 		User::Leave(KErrOverflow);
    56 		User::Leave(KErrOverflow);
    88 /**
    94 /**
    89  *  Unpacks user data units from aIn and appends to aOut.
    95  *  Unpacks user data units from aIn and appends to aOut.
    90  */
    96  */
    91 TInt TSmsAlphabetPacker::UnpackL(const TDesC8& aIn,TDes8& aOut,TInt aNumUDUnits)
    97 TInt TSmsAlphabetPacker::UnpackL(const TDesC8& aIn,TDes8& aOut,TInt aNumUDUnits)
    92 	{
    98 	{
    93 	LOGGSMU1("TSmsAlphabetPacker::UnpackL()");
    99 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TSMSALPHABETPACKER_UNPACKL_1, "TSmsAlphabetPacker::UnpackL()");
    94 
   100 
    95 	TInt length=aNumUDUnits;
   101 	TInt length=aNumUDUnits;
    96 	// Ensure we've got enough input and output buffer
   102 	// Ensure we've got enough input and output buffer
    97  	// defect fix for
   103  	// defect fix for
    98  	// EDNOPMA-4YPJ34	Short message with alphanumeric address in From field is not received
   104  	// EDNOPMA-4YPJ34	Short message with alphanumeric address in From field is not received
   140 /**
   146 /**
   141  *  Converts then packs the input data, aIn, and appends to aOut
   147  *  Converts then packs the input data, aIn, and appends to aOut
   142  */
   148  */
   143 TInt TSmsAlphabetPacker::ConvertAndPackL(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TDes8& aOut,const TDesC& aIn,TInt& aConvertedNumUDUnits)
   149 TInt TSmsAlphabetPacker::ConvertAndPackL(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TDes8& aOut,const TDesC& aIn,TInt& aConvertedNumUDUnits)
   144     {
   150     {
   145 	LOGGSMU1("TSmsAlphabetPacker::ConvertAndPackL()");
   151 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TSMSALPHABETPACKER_CONVERTANDPACKL_1, "TSmsAlphabetPacker::ConvertAndPackL()");
   146 
   152 
   147 	// Do the conversion
   153 	// Do the conversion
   148 	// VEP Fix for defect EXT-568BMW, when length of alphanumeric destination address
   154 	// VEP Fix for defect EXT-568BMW, when length of alphanumeric destination address
   149 	// was set wrong and also special characters defined in 7-bit default aplhabet (ä,ö...)
   155 	// was set wrong and also special characters defined in 7-bit default aplhabet (ä,ö...)
   150 	// were converted incorrectly
   156 	// were converted incorrectly
   162 /**
   168 /**
   163  *  Unpacks the converts the input data, aIn, and appends to aOut
   169  *  Unpacks the converts the input data, aIn, and appends to aOut
   164  */
   170  */
   165 TInt TSmsAlphabetPacker::UnpackAndConvertL(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,const TDesC8& aIn,TDes& aOut,TInt aNumUDUnits)
   171 TInt TSmsAlphabetPacker::UnpackAndConvertL(CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,const TDesC8& aIn,TDes& aOut,TInt aNumUDUnits)
   166 	{
   172 	{
   167 	LOGGSMU1("TSmsAlphabetPacker::UnpackAndConvertL()");
   173 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TSMSALPHABETPACKER_UNPACKANDCONVERTL_1, "TSmsAlphabetPacker::UnpackAndConvertL()");
   168 
   174 
   169 	// Unpack first
   175 	// Unpack first
   170 	HBufC8* unpackedBuffer=HBufC8::NewLC(aNumUDUnits);
   176 	HBufC8* unpackedBuffer=HBufC8::NewLC(aNumUDUnits);
   171 	TPtr8 unpackedBufferPtr(unpackedBuffer->Des());
   177 	TPtr8 unpackedBufferPtr(unpackedBuffer->Des());
   172 	UnpackL(aIn,unpackedBufferPtr,aNumUDUnits);
   178 	UnpackL(aIn,unpackedBufferPtr,aNumUDUnits);
   185 /**
   191 /**
   186  *  Returns the number of octets needed to pack the specified number of
   192  *  Returns the number of octets needed to pack the specified number of
   187  */
   193  */
   188 TInt TSmsAlphabetPacker::PackedOctetsRequiredL(TInt aNumUDUnits) const
   194 TInt TSmsAlphabetPacker::PackedOctetsRequiredL(TInt aNumUDUnits) const
   189 	{
   195 	{
   190 	LOGGSMU1("TSmsAlphabetPacker::PackedOctetsRequiredL()");
   196 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TSMSALPHABETPACKER_PACKEDOCTETSREQUIREDL_1, "TSmsAlphabetPacker::PackedOctetsRequiredL()");
   191 
   197 
   192 	TInt octetsRequired=0;
   198 	TInt octetsRequired=0;
   193 	TInt elementSizeInBits=ElementSizeInBitsL();
   199 	TInt elementSizeInBits=ElementSizeInBitsL();
   194 	if (elementSizeInBits==8)
   200 	if (elementSizeInBits==8)
   195 		octetsRequired=aNumUDUnits;
   201 		octetsRequired=aNumUDUnits;
   216  *  Returns the size in bits of a UDL element for the alphabet.  Leaves if
   222  *  Returns the size in bits of a UDL element for the alphabet.  Leaves if
   217  *  invalid data coding scheme.
   223  *  invalid data coding scheme.
   218  */
   224  */
   219 TInt TSmsAlphabetPacker::ElementSizeInBitsL() const
   225 TInt TSmsAlphabetPacker::ElementSizeInBitsL() const
   220 	{
   226 	{
   221 	LOGGSMU1("TSmsAlphabetPacker::ElementSizeInBitsL()");
   227 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, TSMSALPHABETPACKER_ELEMENTSIZEINBITSL_1, "TSmsAlphabetPacker::ElementSizeInBitsL()");
   222 
   228 
   223     TInt ret = 8;
   229     TInt ret = 8;
   224 
   230 
   225 	if (iIsBinary)
   231 	if (iIsBinary)
   226 		return ret;
   232 		return ret;