1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/smuthdr.inl Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,485 @@
1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <smcmmain.h>
1.20 +#include <gsmumsg.h>
1.21 +
1.22 +/**
1.23 +Gets the message PDU for a SMS-SUBMIT type message.
1.24 +
1.25 +The message PDU type can be checked by using the CSmsHeader::Type API.
1.26 +
1.27 +@return
1.28 +The SMS-SUBMIT PDU object.
1.29 +
1.30 +@panic SMCM 0
1.31 +The message was not a PDU of type SMS-SUBMIT (debug only).
1.32 +
1.33 +@see CSmsHeader::Type
1.34 +*/
1.35 +inline CSmsSubmit& CSmsHeader::Submit()
1.36 + {
1.37 + __ASSERT_DEBUG( Type() == CSmsPDU::ESmsSubmit, Panic(ESmutPanicUnsupportedMsgType));
1.38 + return (CSmsSubmit&)(iMessage->SmsPDU());
1.39 + }
1.40 +
1.41 +/**
1.42 +Gets the (const) message PDU for a SMS-SUBMIT type message.
1.43 +
1.44 +The message PDU type can be checked by using the CSmsHeader::Type API.
1.45 +
1.46 +@return
1.47 +The SMS-SUBMIT PDU const object.
1.48 +
1.49 +@panic SMCM 0
1.50 +The message was not a PDU of type SMS-SUBMIT (debug only).
1.51 +
1.52 +@see CSmsHeader::Type
1.53 +*/
1.54 +inline const CSmsSubmit& CSmsHeader::Submit() const
1.55 + {
1.56 + __ASSERT_DEBUG( Type() == CSmsPDU::ESmsSubmit, Panic(ESmutPanicUnsupportedMsgType));
1.57 + return (CSmsSubmit&)(iMessage->SmsPDU());
1.58 + }
1.59 +
1.60 +/**
1.61 +Gets the message PDU for a SMS-DELIVER type message.
1.62 +
1.63 +The message PDU type can be checked by using the CSmsHeader::Type API.
1.64 +
1.65 +@return
1.66 +The SMS-DELIVER PDU object.
1.67 +
1.68 +@panic SMCM 0
1.69 +The message was not a PDU of type SMS-DELIVER (debug only).
1.70 +
1.71 +@see CSmsHeader::Type
1.72 +*/
1.73 +inline CSmsDeliver& CSmsHeader::Deliver()
1.74 + {
1.75 + __ASSERT_DEBUG( Type() == CSmsPDU::ESmsDeliver, Panic(ESmutPanicUnsupportedMsgType));
1.76 + return (CSmsDeliver&)(iMessage->SmsPDU());
1.77 + }
1.78 +
1.79 +/**
1.80 +Gets the (const) message PDU for a SMS-DELIVER type message.
1.81 +
1.82 +The message PDU type can be checked by using the CSmsHeader::Type API.
1.83 +
1.84 +@return
1.85 +The SMS-DELIVER PDU const object.
1.86 +
1.87 +@panic SMCM 0
1.88 +The message was not a PDU of type SMS-DELIVER (debug only).
1.89 +
1.90 +@see CSmsHeader::Type
1.91 +*/
1.92 +inline const CSmsDeliver& CSmsHeader::Deliver() const
1.93 + {
1.94 + __ASSERT_DEBUG( Type() == CSmsPDU::ESmsDeliver, Panic(ESmutPanicUnsupportedMsgType));
1.95 + return (CSmsDeliver&)(iMessage->SmsPDU());
1.96 + }
1.97 +
1.98 +/**
1.99 +Gets the message PDU for a SMS-COMMMAND type message.
1.100 +
1.101 +The message PDU type can be checked by using the CSmsHeader::Type API.
1.102 +
1.103 +@return The SMS-COMMMAND PDU object.
1.104 +
1.105 +@panic SMCM 0
1.106 +The message was not a PDU of type SMS-COMMMAND (debug only).
1.107 +
1.108 +@see CSmsHeader::Type
1.109 +*/
1.110 +inline CSmsCommand& CSmsHeader::Command()
1.111 + {
1.112 + __ASSERT_DEBUG( Type() == CSmsPDU::ESmsCommand, Panic(ESmutPanicUnsupportedMsgType));
1.113 + return (CSmsCommand&)(iMessage->SmsPDU());
1.114 + }
1.115 +
1.116 +/**
1.117 +Gets the (const) message PDU for a SMS-COMMMAND type message.
1.118 +
1.119 +The message PDU type can be checked by using the CSmsHeader::Type API.
1.120 +
1.121 +@return
1.122 +The SMS-COMMMAND PDU const object.
1.123 +
1.124 +@panic SMCM 0
1.125 +The message was not a PDU of type SMS-COMMMAND (debug only).
1.126 +
1.127 +@see CSmsHeader::Type
1.128 +*/
1.129 +inline const CSmsCommand& CSmsHeader::Command() const
1.130 + {
1.131 + __ASSERT_DEBUG( Type() == CSmsPDU::ESmsCommand, Panic(ESmutPanicUnsupportedMsgType));
1.132 + return (CSmsCommand&)(iMessage->SmsPDU());
1.133 + }
1.134 +
1.135 +/**
1.136 +Gets the message PDU for a SMS-STATUS-REPORT type message.
1.137 +
1.138 +The message PDU type can be checked by using the CSmsHeader::Type API.
1.139 +
1.140 +@return
1.141 +The SMS-STATUS-REPORT PDU object.
1.142 +
1.143 +@panic SMCM 0
1.144 +The message was not a PDU of type SMS-STATUS-REPORT (debug only).
1.145 +
1.146 +@see CSmsHeader::Type
1.147 +*/
1.148 +inline CSmsStatusReport& CSmsHeader::StatusReport()
1.149 + {
1.150 + __ASSERT_DEBUG( Type() == CSmsPDU::ESmsStatusReport, Panic(ESmutPanicUnsupportedMsgType));
1.151 + return (CSmsStatusReport&)(iMessage->SmsPDU());
1.152 + }
1.153 +
1.154 +/**
1.155 +Gets the (const) message PDU for a SMS-STATUS-REPORT type message.
1.156 +
1.157 +The message PDU type can be checked by using the CSmsHeader::Type API.
1.158 +
1.159 +@return
1.160 +The SMS-STATUS-REPORT PDU const object.
1.161 +
1.162 +@panic SMCM 0
1.163 +The message was not a PDU of type SMS-STATUS-REPORT (debug only).
1.164 +
1.165 +@see CSmsHeader::Type
1.166 +*/
1.167 +inline const CSmsStatusReport& CSmsHeader::StatusReport() const
1.168 + {
1.169 + __ASSERT_DEBUG( Type() == CSmsPDU::ESmsStatusReport, Panic(ESmutPanicUnsupportedMsgType));
1.170 + return (CSmsStatusReport&)(iMessage->SmsPDU());
1.171 + }
1.172 +
1.173 +/**
1.174 +Gets the message PDU type.
1.175 +
1.176 +There are six types of PDU - SMS-DELIVER, SMS-DELIVER-REPORT, SMS-SUBMIT,
1.177 +SMS-SUBMIT-REPORT, SMS-STATUS-REPORT and SMS-COMMAND.
1.178 +
1.179 +There is access to only to SMS-DELIVER, SMS-SUBMIT, SMS-STATUS-REPORT and
1.180 +SMS-COMMAND PDUs via the CSmsHeader encapsulation.
1.181 +
1.182 +@return
1.183 +The message PDU type.
1.184 +
1.185 +@see CSmsPDU::TSmsPDUType
1.186 +*/
1.187 +inline CSmsPDU::TSmsPDUType CSmsHeader::Type() const
1.188 + {
1.189 + return iMessage->SmsPDU().Type();
1.190 + }
1.191 +
1.192 +/**
1.193 +Gets the (const) message recipients.
1.194 +
1.195 +@return
1.196 +The const array of message recipients
1.197 +*/
1.198 +inline const CArrayPtrFlat<CSmsNumber>& CSmsHeader::Recipients() const
1.199 + {
1.200 + return iRecipients;
1.201 + }
1.202 +
1.203 +/**
1.204 +Gets the (const) message recipients.
1.205 +
1.206 +@return
1.207 +The array of message recipients
1.208 +*/
1.209 +inline CArrayPtrFlat<CSmsNumber>& CSmsHeader::Recipients()
1.210 + {
1.211 + return iRecipients;
1.212 + }
1.213 +
1.214 +/**
1.215 +Gets the SMS stack representation of the message.
1.216 +
1.217 +@return
1.218 +The SMS stack representation of the message
1.219 +
1.220 +@see CSmsMessage
1.221 +*/
1.222 +inline CSmsMessage& CSmsHeader::Message()
1.223 + {
1.224 + return *iMessage;
1.225 + }
1.226 +
1.227 +/**
1.228 +Gets the (const) SMS stack representation of the message.
1.229 +
1.230 +@return
1.231 +The const SMS stack representation of the message
1.232 +*/
1.233 +inline const CSmsMessage& CSmsHeader::Message() const
1.234 + {
1.235 + return *iMessage;
1.236 + }
1.237 +
1.238 +/**
1.239 +Tests if the message contains a reply path.
1.240 +
1.241 +@return
1.242 +A value of True if the message contains a reply path.
1.243 +*/
1.244 +inline TBool CSmsHeader::ReplyPathProvided() const
1.245 + {
1.246 + return iFlags & ESmsHeaderReplyPathProvided;
1.247 + }
1.248 +
1.249 +/**
1.250 +Set the message flag that indicates whether it contains a reply path.
1.251 +
1.252 +@param aReplyPathProvided
1.253 +A value of True to set the flag.
1.254 +*/
1.255 +inline void CSmsHeader::SetReplyPathProvided(TBool aReplyPathProvided)
1.256 + {
1.257 + iFlags = (iFlags & ~ESmsHeaderReplyPathProvided) | (aReplyPathProvided ? ESmsHeaderReplyPathProvided : ESmsHeaderNoFlags);
1.258 + }
1.259 +
1.260 +/**
1.261 +Sets the originator address.
1.262 +
1.263 +@param aAddress
1.264 +The originator address
1.265 +*/
1.266 +inline void CSmsHeader::SetFromAddressL(const TDesC& aAddress)
1.267 + {
1.268 + Message().SmsPDU().SetToFromAddressL(aAddress);
1.269 + }
1.270 +
1.271 +/**
1.272 +Gets the originator address.
1.273 +
1.274 +Only valid for SMS-DELIVER and SMS-SUBMIT type messages. With any other message
1.275 +types the returned originator address is empty.
1.276 +
1.277 +@return
1.278 +The originator address.
1.279 +*/
1.280 +inline TPtrC CSmsHeader::FromAddress() const
1.281 + {
1.282 + switch(Type())
1.283 + {
1.284 + case(CSmsPDU::ESmsSubmit):
1.285 + return Submit().ToFromAddress();
1.286 + case(CSmsPDU::ESmsDeliver):
1.287 + return Deliver().ToFromAddress();
1.288 + default:
1.289 + return TPtrC(0,0);
1.290 + }
1.291 + }
1.292 +
1.293 +/**
1.294 +Gets the message's service center address.
1.295 +
1.296 +This can only be used on SMS-SUBMIT type messages. The message PDU type can be
1.297 +checked by using the CSmsHeader::Type API.
1.298 +
1.299 +@return
1.300 +The Service Center address.
1.301 +
1.302 +@panic SMCM 0
1.303 +The message was not a PDU of type SMS-SUBMIT (debug only).
1.304 +
1.305 +@see CSmsHeader::Type
1.306 +*/
1.307 +inline TPtrC CSmsHeader::ServiceCenterAddress() const
1.308 + {
1.309 + return Submit().ServiceCenterAddress();
1.310 + }
1.311 +
1.312 +/**
1.313 +Sets the message's service center address.
1.314 +
1.315 +This can only be used on SMS-SUBMIT type messages. The message PDU type can be
1.316 +checked by using the CSmsHeader::Type API.
1.317 +
1.318 +
1.319 +@param aAddress
1.320 +The Service Center address
1.321 +
1.322 +@panic SMCM 0
1.323 +The message was not a PDU of type SMS-SUBMIT (debug only).
1.324 +
1.325 +@see CSmsHeader::Type
1.326 +*/
1.327 +inline void CSmsHeader::SetServiceCenterAddressL(const TDesC& aAddress)
1.328 + {
1.329 + Submit().SetServiceCenterAddressL(aAddress);
1.330 + }
1.331 +
1.332 +/**
1.333 +Gets the message's BIO message type identifier.
1.334 +
1.335 +For non-BIO messages, this is EBioMsgIdNbs.
1.336 +
1.337 +@return
1.338 +The BIO message type identifier
1.339 +*/
1.340 +inline TBioMsgIdType CSmsHeader::BioMsgIdType() const
1.341 + {
1.342 + return iBioMsgIdType;
1.343 + }
1.344 +
1.345 +/**
1.346 +Sets the message's BIO message type identifier.
1.347 +
1.348 +@param aBioMsgIdType
1.349 +The BIO message type identifier
1.350 +*/
1.351 +inline void CSmsHeader::SetBioMsgIdType(TBioMsgIdType aBioMsgIdType)
1.352 + {
1.353 + iBioMsgIdType = aBioMsgIdType;
1.354 + }
1.355 +
1.356 +/*
1.357 + * TMsvSmsEntry
1.358 + */
1.359 +
1.360 +/**
1.361 +Constructor.
1.362 +
1.363 +@internalTechnology
1.364 +@released
1.365 +*/
1.366 +inline TMsvSmsEntry::TMsvSmsEntry()
1.367 + {
1.368 + }
1.369 +
1.370 +/**
1.371 +Copy constuctor.
1.372 +
1.373 +@param aEntry
1.374 +The index entry to copy.
1.375 +
1.376 +@internalTechnology
1.377 +@released
1.378 +*/
1.379 +inline TMsvSmsEntry::TMsvSmsEntry(const TMsvEntry& aEntry)
1.380 +: TMsvEntry(aEntry)
1.381 + {
1.382 + }
1.383 +
1.384 +/**
1.385 +Sets the User Prompt Indicator flag.
1.386 +
1.387 +@param aUPI
1.388 +A value of True to set the flag.
1.389 +
1.390 +@internalTechnology
1.391 +@released
1.392 +*/
1.393 +inline void TMsvSmsEntry::SetUserPromptIndicator(TBool aUPI)
1.394 + {
1.395 + (aUPI) ? (iMtmData2 |= EMsvSmsEntryUserPromptIndicator) : (iMtmData2 &= ~EMsvSmsEntryUserPromptIndicator);
1.396 + }
1.397 +
1.398 +/**
1.399 +Gets the User Prompt Indicator flag.
1.400 +
1.401 +@return
1.402 +A value of True if the User Prompt Indicator flag is.
1.403 +
1.404 +@internalTechnology
1.405 +@released
1.406 +*/
1.407 +inline TBool TMsvSmsEntry::UserPromptIndicator() const
1.408 + {
1.409 + return (iMtmData2 & EMsvSmsEntryUserPromptIndicator);
1.410 + }
1.411 +
1.412 +/**
1.413 +Gets the Protocol Identifier data.
1.414 +
1.415 +@return
1.416 +The Protocol Identifier data.
1.417 +
1.418 +@internalTechnology
1.419 +@released
1.420 +*/
1.421 +inline TUint8 TMsvSmsEntry::ProtocolIdentifier() const
1.422 + {
1.423 + return STATIC_CAST(TUint8, iMtmData2 & EMsvSmsEntryProtocolIdentifier);
1.424 + }
1.425 +
1.426 +/**
1.427 +Sets the Protocol Identifier data.
1.428 +
1.429 +@param aPID
1.430 +The Protocol Identifier data.
1.431 +
1.432 +@internalTechnology
1.433 +@released
1.434 +*/
1.435 +inline void TMsvSmsEntry::SetProtocolIdentifier(TSmsProtocolIdentifier aPID)
1.436 + {
1.437 + SetProtocolIdentifier(STATIC_CAST(TUint8, aPID));
1.438 + }
1.439 +
1.440 +/**
1.441 +Sets the Protocol Identifier data.
1.442 +
1.443 +@param aPID
1.444 +The Protocol Identifier data.
1.445 +
1.446 +@internalTechnology
1.447 +@released
1.448 +*/
1.449 +inline void TMsvSmsEntry::SetProtocolIdentifier(TUint8 aPID)
1.450 + {
1.451 + iMtmData2 = (iMtmData2 & ~EMsvSmsEntryProtocolIdentifier) | (aPID & EMsvSmsEntryProtocolIdentifier);
1.452 + }
1.453 +
1.454 +/**
1.455 +Sets the SMS class data and defined flag.
1.456 +
1.457 +@param aClassDefined
1.458 +A value of True to set the SMS class data defined flag.
1.459 +
1.460 +@param aClass
1.461 +The SMS class data.
1.462 +
1.463 +@internalTechnology
1.464 +@released
1.465 +*/
1.466 +inline void TMsvSmsEntry::SetClass(TBool aClassDefined, TSmsDataCodingScheme::TSmsClass aClass)
1.467 + {
1.468 + aClassDefined ? (iMtmData2 |= EMsvSmsEntryClassDefined) : (iMtmData2 &= ~EMsvSmsEntryClassDefined);
1.469 + iMtmData2 = (iMtmData2 & ~EMsvSmsEntryClass) | ((aClass << EMsvSmsEntryClassShift) & EMsvSmsEntryClass);
1.470 + }
1.471 +
1.472 +/**
1.473 +Gets the SMS class data and defined flag.
1.474 +
1.475 +@param aClass
1.476 +An output argument with the SMS class data.
1.477 +
1.478 +@return
1.479 +A value of True if the SMS class data defined flag is set.
1.480 +
1.481 +@internalTechnology
1.482 +@released
1.483 +*/
1.484 +inline TBool TMsvSmsEntry::Class(TSmsDataCodingScheme::TSmsClass& aClass) const
1.485 + {
1.486 + aClass = STATIC_CAST(TSmsDataCodingScheme::TSmsClass, ((iMtmData2 & EMsvSmsEntryClass) >> EMsvSmsEntryClassShift));
1.487 + return iMtmData2 & EMsvSmsEntryClassDefined;
1.488 + }