1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Inline methods for operations on PDU elements
27 * Leaves with KErrGsmuDecoding.
29 inline void TGsmuLex8::LeaveL() const
31 User::Leave(KErrGsmuDecoding);
36 * Constructor, initialising the octet value with a TInt8.
38 * @param aValue Octet value
40 inline TSmsOctet::TSmsOctet(TUint8 aValue)
48 * Constructor, initialising the octet value with a TInt.
50 * @param aValue Octet value
52 inline TSmsOctet::TSmsOctet(TInt aValue)
53 :iValue(static_cast<TUint8>(aValue))
59 * Sets the octet value to the next byte in TGsmuLex8 PDU.
61 * @param aPdu PDU to read value from
63 inline void TSmsOctet::DecodeL(TGsmuLex8& aPdu)
70 * @return The octet value
72 inline TSmsOctet::operator TInt() const
79 * Converts an integer to semi-octet format and set the object's data to this
82 * @param aNum Value to convert to semi-octet
84 inline void TSmsOctet::FillSemiOctets(TInt aNum)
86 *this=(aNum/10)|((aNum%10)<<4);
91 * Converts a semi-octet value to an integer.
93 * @return Object's data as an integer
95 inline TInt TSmsOctet::SemiOctetsToNum() const
97 return ((iValue&0x0F)*10) + ((iValue&0xF0)>>4);
102 * Internalises the object.
104 * @param aStream Stream to read from
106 inline void TSmsOctet::InternalizeL(RReadStream& aStream)
113 * Externalises the object.
115 * @param aStream Stream to write to
117 inline void TSmsOctet::ExternalizeL(RWriteStream& aStream) const
124 * Gets the error code.
128 inline TInt TSmsFailureCause::Error() const
135 * Sets the error code.
137 * @param aError Error code
139 inline void TSmsFailureCause::SetError(TSmsFailureCauseError aError)
141 iValue=(TUint8) aError;
148 * @return Status value
150 TSmsStatus::TSmsStatusValue TSmsStatus::Status() const
152 return (TSmsStatusValue) iValue;
159 * @param aValue Status value
161 inline void TSmsStatus::SetStatus(TSmsStatusValue aValue)
163 iValue=(TUint8) aValue;
170 * @return Command type
172 inline TInt TSmsCommandType::CommandType() const
181 * @param aType Command type
183 inline void TSmsCommandType::SetCommandType(TSmsCommandTypeValue aType)
185 iValue=(TUint8) aType;
190 * Tests if the extension flag is set.
192 * @return True if data contains a PID extension
194 inline TBool TSmsParameterIndicator::Extension() const
196 return iValue&ESmsPIDExtension;
201 * Sets extension flag.
203 * @param aExtension Extension flag
205 inline void TSmsParameterIndicator::SetExtension(TBool aExtension)
207 iValue=(TUint8) (aExtension? iValue|ESmsPIDExtension: (iValue&(~ESmsPIDExtension)));
212 * Tests user data present flag.
214 * @return True if User Data is indicated
216 inline TBool TSmsParameterIndicator::UserDataPresent() const
218 return iValue&ESmsPIDUserDataPresent;
223 * Sets user data present flag.
225 * @param aPresent Set to True/False to indicate/clear User Data
227 inline void TSmsParameterIndicator::SetUserDataPresent(TBool aPresent)
229 iValue=(TUint8) (aPresent? iValue|ESmsPIDUserDataPresent: iValue&(~ESmsPIDUserDataPresent));
234 * Tests data coding scheme present flag.
236 * @return True to indicate Data Coding Scheme present
238 inline TBool TSmsParameterIndicator::DataCodingSchemePresent() const
240 return iValue&ESmsPIDDataCodingSchemePresent;
245 * Sets data coding scheme present flag.
247 * @param aPresent Set to True/False to indicate/clear Data Coding Scheme present
249 inline void TSmsParameterIndicator::SetDataCodingSchemePresent(TBool aPresent)
251 iValue=(TUint8) (aPresent? iValue|ESmsPIDDataCodingSchemePresent: iValue&(~ESmsPIDDataCodingSchemePresent));
256 * Tests protocol identifier present flag.
258 * @return True to indicate Protocol ID present
260 inline TBool TSmsParameterIndicator::ProtocolIdentifierPresent() const
262 return iValue&ESmsPIDProtocolIdentifierPresent;
267 * Sets protocol identifier present flag.
269 * @param aPresent PSet to True/False to indicate/clear Protocol ID present
271 inline void TSmsParameterIndicator::SetProtocolIdentifierPresent(TBool aPresent)
273 iValue=(TUint8) (aPresent? iValue|ESmsPIDProtocolIdentifierPresent: iValue&(~ESmsPIDProtocolIdentifierPresent));
278 * Gets the Protocol ID type.
280 * @return Protocol ID type
282 inline TSmsProtocolIdentifier::TSmsPIDType TSmsProtocolIdentifier::PIDType() const
284 return (TSmsPIDType) (iValue&ESmsPIDTypeMask);
289 * Sets the Protocol ID type.
291 * @param aSmsPIDType Protocol ID type
293 inline void TSmsProtocolIdentifier::SetPIDType(TSmsPIDType aSmsPIDType)
295 iValue=(TUint8) aSmsPIDType;
300 * Gets bits 7 - 4 of the Data Coding Scheme.
302 * @return Bits 7 - 4 of the Data Coding Scheme
304 inline TSmsDataCodingScheme::TSmsDCSBits7To4 TSmsDataCodingScheme::Bits7To4() const
306 return (TSmsDCSBits7To4) (iValue&ESmsDCSBits7To4Mask);
311 * Sets bits 7 - 4 of the Data Coding Scheme.
313 * @param aBits7To4 Bits 7 - 4 of the Data Coding Scheme
315 inline void TSmsDataCodingScheme::SetBits7To4(TSmsDCSBits7To4 aBits7To4)
317 iValue=(TUint8) (aBits7To4);
322 * Constructor, specifying an octet value.
324 * @param aValue Octet value
326 inline TGsmSmsTypeOfAddress::TGsmSmsTypeOfAddress(TInt aValue)
333 * Constructor, specifying type of numbering and numbering plan identification.
335 * @param aTon Type of numbering
336 * @param aNPI Numbering plan identification
338 inline TGsmSmsTypeOfAddress::TGsmSmsTypeOfAddress(TGsmSmsTypeOfNumber aTon, TGsmSmsNumberingPlanIdentification aNPI)
339 : TSmsOctet(EGsmSmsFirstBitMask)
347 * Gets the type of numbering.
349 * @return Type of numbering
351 inline TGsmSmsTypeOfNumber TGsmSmsTypeOfAddress::TON() const
353 return (TGsmSmsTypeOfNumber) (iValue & EGsmSmsTONMask);
358 * Sets the type of numbering.
360 * @param aTON Type of numbering
362 inline void TGsmSmsTypeOfAddress::SetTON(TGsmSmsTypeOfNumber aTON)
364 iValue = (TUint8) ((iValue & (~EGsmSmsTONMask)) | aTON);
369 * Gets the numbering plan identification.
371 * @return Numbering plan identification
373 inline TGsmSmsNumberingPlanIdentification TGsmSmsTypeOfAddress::NPI() const
375 return (TGsmSmsNumberingPlanIdentification) (iValue & EGsmSmsNPIMask);
380 * Set the Numbering Plan Identification
382 inline void TGsmSmsTypeOfAddress::SetNPI(TGsmSmsNumberingPlanIdentification aNumberingPlanIdentification)
384 iValue = (TUint8) ((iValue &(~EGsmSmsNPIMask)) | aNumberingPlanIdentification);
391 inline TGsmSmsTelNumber::TGsmSmsTelNumber()
397 * Gets the time zone offset from GMT in +/- quarter hours.
398 * The allowed range is +/-79 per 23.040 V4.4.0 9.2.3.11.
400 * @return Time zone offset
402 inline TInt TSmsServiceCenterTimeStamp::TimeOffset() const
404 return iTimeZoneNumQuarterHours;
409 * Gets the Service Center Time in Universal Time.
411 * @return The Service Center Time
413 inline const TTime& TSmsServiceCenterTimeStamp::Time() const
420 * Sets the Service Center Time Stamp in Universal Time.
422 * @param aTime The Service Center Time
424 inline void TSmsServiceCenterTimeStamp::SetTime(const TTime& aTime)
431 * Gets the message Validity Period Format.
433 * @return The message Validity Period Format
435 inline TSmsFirstOctet::TSmsValidityPeriodFormat TSmsValidityPeriod::ValidityPeriodFormat() const
437 return (TSmsFirstOctet::TSmsValidityPeriodFormat) (iFirstOctet&TSmsFirstOctet::ESmsVPFMask);
442 * Sets the message Validity Period Format.
444 * @param aValidityPeriodFormat The message Validity Period Format
446 inline void TSmsValidityPeriod::SetValidityPeriodFormat(TSmsFirstOctet::TSmsValidityPeriodFormat aValidityPeriodFormat)
448 iFirstOctet=(iFirstOctet&(~TSmsFirstOctet::ESmsVPFMask)|aValidityPeriodFormat);
453 * Gets the message Validity Period in minutes.
455 * @return The message Validity Period in minutes
457 inline const TTimeIntervalMinutes& TSmsValidityPeriod::TimeIntervalMinutes() const
459 return iTimeIntervalMinutes;
464 * Sets the message Validity Period in minutes.
466 * @param aTimeIntervalMinutes The message Validity Period in minutes
468 inline void TSmsValidityPeriod::SetTimeIntervalMinutes(const TTimeIntervalMinutes& aTimeIntervalMinutes)
470 iTimeIntervalMinutes=aTimeIntervalMinutes;
475 * Resets the unconverted native character buffer.
477 inline void CSmsAlphabetConverter::ResetUnconvertedNativeCharacters()
479 iUnconvertedNativeCharactersPtr.Zero();
484 * Resets the unconverted user data elements buffer.
486 inline void CSmsAlphabetConverter::ResetUnconvertedUDElements()
488 iUnconvertedUDElementsPtr.Zero();
493 * Gets the unconverted native characters.
495 * @return Unconverted native characters
497 inline TPtrC CSmsAlphabetConverter::UnconvertedNativeCharacters()
499 return iUnconvertedNativeCharactersPtr;
504 * Gets the unconverted user data elements.
506 * @return Unconverted user data elements
508 inline TPtrC8 CSmsAlphabetConverter::UnconvertedUDElements()
510 return iUnconvertedUDElementsPtr;
515 * Gets the coding scheme alphabet.
517 * @return Coding scheme alphabet
519 inline TSmsDataCodingScheme::TSmsAlphabet CSmsAlphabetConverter::Alphabet() const
529 inline CSmsInformationElement::CSmsInformationElement(TSmsInformationElementIdentifier aInformationElementIdentifier):iIdentifier(aInformationElementIdentifier)
535 * Gets the number of information elements.
537 * @return Number of information elements
539 inline TInt CSmsUserData::NumInformationElements() const
541 return iInformationElementArray.Count();
546 * @return The number of Command Information Elements
550 inline TInt CSmsCommandData::NumInformationElements() const
552 return iInformationElementArray.Count();
557 * @return The amount of space in the Command buffer
561 inline TInt CSmsCommandData::MaxDataLength() const
563 return KSmsMaxDataSize-iBuffer->Des().Length();