smsprotocols/smsstack/ems/src/EMSUserPromptIE.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 /*
       
     2 * Copyright (c) 2009 Sony Ericsson Mobile Communications AB
       
     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 * Sony Ericsson Mobile Communications AB - initial contribution.
       
    11 * Nokia Corporation - additional changes.
       
    12 * 
       
    13 * Contributors:
       
    14 * 
       
    15 * Description:
       
    16 * Implements the Enhanced SMS User Prompt Information Element.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  *  @file
       
    23  *  
       
    24  *  Implements  CEMSUserPromptIE class
       
    25  */
       
    26 
       
    27 #include <emsuserpromptie.h>
       
    28 
       
    29 EXPORT_C CEmsUserPrompt* CEmsUserPrompt::NewL(TUint aObjectCount)
       
    30 /**
       
    31  *  @capability None
       
    32  */
       
    33 	{
       
    34 	CEmsUserPrompt* self = new (ELeave) CEmsUserPrompt(aObjectCount);
       
    35 	return self;
       
    36 	}
       
    37 
       
    38 EXPORT_C CEmsInformationElement* CEmsUserPrompt::DuplicateL() const
       
    39 /**
       
    40  *  @capability None
       
    41  */
       
    42 	{
       
    43 	CEmsUserPrompt* copy = new (ELeave) CEmsUserPrompt();
       
    44 	CleanupStack::PushL(copy);
       
    45 	copy->CopyL(*this);
       
    46 	CleanupStack::Pop(copy);
       
    47 	return copy;
       
    48 	}
       
    49 
       
    50 EXPORT_C void CEmsUserPrompt::CopyL(const CEmsUserPrompt& aSrc)
       
    51 /**
       
    52  *  @capability None
       
    53  */
       
    54 	{
       
    55 	CEmsInformationElement::CopyL(aSrc);
       
    56 	iObjectCount = aSrc.iObjectCount;
       
    57 	}
       
    58 
       
    59 EXPORT_C TUint CEmsUserPrompt::ObjectCount() const
       
    60 /**
       
    61  *  @capability None
       
    62  */
       
    63 	{
       
    64 	return iObjectCount;
       
    65 	}
       
    66 EXPORT_C void CEmsUserPrompt::SetObjectCount(TUint aObjectCount)
       
    67 /**
       
    68  *  @capability None
       
    69  */
       
    70 	{
       
    71 	iObjectCount=aObjectCount;
       
    72 	}
       
    73 
       
    74 
       
    75 CEmsUserPrompt::CEmsUserPrompt(TUint aObjectCount)
       
    76 	// pass in a false parameter for start position encoded
       
    77 	: CEmsInformationElement(CSmsInformationElement::ESmsEnhancedUserPromptIndicator, EFalse), iObjectCount(aObjectCount)
       
    78 	{
       
    79 	iEncodedBodyLength=1;
       
    80 	}
       
    81 
       
    82 /**
       
    83  *  Encodes the information element into its raw format. (no IE id)
       
    84  *  
       
    85  *  @param aPtr the buffer to be used which is to contain the data
       
    86  *  @param TBool boolean to indicate if it is for serialisation or encoding
       
    87  */
       
    88 void CEmsUserPrompt::EncodeBodyL(TPtr8 aPtr, TBool) const
       
    89 	{
       
    90 	aPtr.Append(static_cast<TUint8>(iObjectCount));
       
    91 	}
       
    92 
       
    93 /**
       
    94  *  Decodes the raw data out of an information element into this class.
       
    95  *  
       
    96  *  @param aPtr The raw predefined animation data
       
    97  *  @param TBool boolean to indicate if it is from serialisation
       
    98  *  @leave KErrArgument If the size of the data does not match what is expected.
       
    99  */
       
   100 void CEmsUserPrompt::DecodeBodyL(const TPtrC8 aPtr, TBool)
       
   101 	{
       
   102 	__ASSERT_ALWAYS(aPtr.Length() == 1, User::Leave(KErrArgument));
       
   103 	iObjectCount = static_cast<TUint8>(aPtr[0]);
       
   104 	}