diff -r 000000000000 -r 3553901f7fa8 smsprotocols/smsstack/ems/src/EMSUserPromptIE.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/smsprotocols/smsstack/ems/src/EMSUserPromptIE.cpp Tue Feb 02 01:41:59 2010 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2009 Sony Ericsson Mobile Communications AB +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Sony Ericsson Mobile Communications AB - initial contribution. +* Nokia Corporation - additional changes. +* +* Contributors: +* +* Description: +* Implements the Enhanced SMS User Prompt Information Element. +* +*/ + + +/** + * @file + * + * Implements CEMSUserPromptIE class + */ + +#include + +EXPORT_C CEmsUserPrompt* CEmsUserPrompt::NewL(TUint aObjectCount) +/** + * @capability None + */ + { + CEmsUserPrompt* self = new (ELeave) CEmsUserPrompt(aObjectCount); + return self; + } + +EXPORT_C CEmsInformationElement* CEmsUserPrompt::DuplicateL() const +/** + * @capability None + */ + { + CEmsUserPrompt* copy = new (ELeave) CEmsUserPrompt(); + CleanupStack::PushL(copy); + copy->CopyL(*this); + CleanupStack::Pop(copy); + return copy; + } + +EXPORT_C void CEmsUserPrompt::CopyL(const CEmsUserPrompt& aSrc) +/** + * @capability None + */ + { + CEmsInformationElement::CopyL(aSrc); + iObjectCount = aSrc.iObjectCount; + } + +EXPORT_C TUint CEmsUserPrompt::ObjectCount() const +/** + * @capability None + */ + { + return iObjectCount; + } +EXPORT_C void CEmsUserPrompt::SetObjectCount(TUint aObjectCount) +/** + * @capability None + */ + { + iObjectCount=aObjectCount; + } + + +CEmsUserPrompt::CEmsUserPrompt(TUint aObjectCount) + // pass in a false parameter for start position encoded + : CEmsInformationElement(CSmsInformationElement::ESmsEnhancedUserPromptIndicator, EFalse), iObjectCount(aObjectCount) + { + iEncodedBodyLength=1; + } + +/** + * Encodes the information element into its raw format. (no IE id) + * + * @param aPtr the buffer to be used which is to contain the data + * @param TBool boolean to indicate if it is for serialisation or encoding + */ +void CEmsUserPrompt::EncodeBodyL(TPtr8 aPtr, TBool) const + { + aPtr.Append(static_cast(iObjectCount)); + } + +/** + * Decodes the raw data out of an information element into this class. + * + * @param aPtr The raw predefined animation data + * @param TBool boolean to indicate if it is from serialisation + * @leave KErrArgument If the size of the data does not match what is expected. + */ +void CEmsUserPrompt::DecodeBodyL(const TPtrC8 aPtr, TBool) + { + __ASSERT_ALWAYS(aPtr.Length() == 1, User::Leave(KErrArgument)); + iObjectCount = static_cast(aPtr[0]); + }