epoc32/include/smuthdr.inl
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <smcmmain.h>
    17 #include <gsmumsg.h>
    18 
    19 /** 
    20 Gets the message PDU for a SMS-SUBMIT type message.
    21 
    22 The message PDU type can be checked by using the CSmsHeader::Type API.
    23 
    24 @return
    25 The SMS-SUBMIT PDU object.
    26 
    27 @panic	SMCM	0
    28 The message was not a PDU of type SMS-SUBMIT (debug only).
    29 
    30 @see	CSmsHeader::Type
    31 */
    32 inline CSmsSubmit& CSmsHeader::Submit()
    33 	{
    34 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsSubmit, Panic(ESmutPanicUnsupportedMsgType));
    35 	return (CSmsSubmit&)(iMessage->SmsPDU());
    36 	}
    37 
    38 /** 
    39 Gets the (const) message PDU for a SMS-SUBMIT type message.
    40 
    41 The message PDU type can be checked by using the CSmsHeader::Type API.
    42 
    43 @return
    44 The SMS-SUBMIT PDU const object.
    45 
    46 @panic	SMCM	0
    47 The message was not a PDU of type SMS-SUBMIT (debug only).
    48 
    49 @see	CSmsHeader::Type
    50 */
    51 inline const CSmsSubmit& CSmsHeader::Submit() const
    52 	{
    53 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsSubmit, Panic(ESmutPanicUnsupportedMsgType));
    54 	return (CSmsSubmit&)(iMessage->SmsPDU());
    55 	}
    56 
    57 /** 
    58 Gets the message PDU for a SMS-DELIVER type message.
    59 
    60 The message PDU type can be checked by using the CSmsHeader::Type API.
    61 
    62 @return
    63 The SMS-DELIVER PDU object.
    64 
    65 @panic	SMCM	0
    66 The message was not a PDU of type SMS-DELIVER (debug only).
    67 
    68 @see	CSmsHeader::Type
    69 */
    70 inline CSmsDeliver& CSmsHeader::Deliver()
    71 	{
    72 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsDeliver, Panic(ESmutPanicUnsupportedMsgType));
    73 	return (CSmsDeliver&)(iMessage->SmsPDU());
    74 	}
    75 
    76 /** 
    77 Gets the (const) message PDU for a SMS-DELIVER type message.
    78 
    79 The message PDU type can be checked by using the CSmsHeader::Type API.
    80 
    81 @return
    82 The SMS-DELIVER PDU const object.
    83 
    84 @panic	SMCM	0
    85 The message was not a PDU of type SMS-DELIVER (debug only).
    86 
    87 @see	CSmsHeader::Type
    88 */
    89 inline const CSmsDeliver& CSmsHeader::Deliver() const
    90 	{
    91 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsDeliver, Panic(ESmutPanicUnsupportedMsgType));
    92 	return (CSmsDeliver&)(iMessage->SmsPDU());
    93 	}
    94 
    95 /** 
    96 Gets the message PDU for a SMS-COMMMAND type message.
    97 
    98 The message PDU type can be checked by using the CSmsHeader::Type API.
    99 
   100 @return	The SMS-COMMMAND PDU object.
   101 
   102 @panic	SMCM	0
   103 The message was not a PDU of type SMS-COMMMAND (debug only).
   104 
   105 @see	CSmsHeader::Type
   106 */
   107 inline CSmsCommand& CSmsHeader::Command()
   108 	{
   109 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsCommand, Panic(ESmutPanicUnsupportedMsgType));
   110 	return (CSmsCommand&)(iMessage->SmsPDU());
   111 	}
   112 
   113 /** 
   114 Gets the (const) message PDU for a SMS-COMMMAND type message.
   115 
   116 The message PDU type can be checked by using the CSmsHeader::Type API.
   117 
   118 @return
   119 The SMS-COMMMAND PDU const object.
   120 
   121 @panic	SMCM	0
   122 The message was not a PDU of type SMS-COMMMAND (debug only).
   123 
   124 @see	CSmsHeader::Type
   125 */
   126 inline const CSmsCommand& CSmsHeader::Command() const
   127 	{
   128 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsCommand, Panic(ESmutPanicUnsupportedMsgType));
   129 	return (CSmsCommand&)(iMessage->SmsPDU());
   130 	}
   131 
   132 /** 
   133 Gets the message PDU for a SMS-STATUS-REPORT type message.
   134 
   135 The message PDU type can be checked by using the CSmsHeader::Type API.
   136 
   137 @return
   138 The SMS-STATUS-REPORT PDU object.
   139 
   140 @panic	SMCM	0
   141 The message was not a PDU of type SMS-STATUS-REPORT (debug only).
   142 
   143 @see	CSmsHeader::Type
   144 */
   145 inline CSmsStatusReport& CSmsHeader::StatusReport()
   146 	{
   147 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsStatusReport, Panic(ESmutPanicUnsupportedMsgType));
   148 	return (CSmsStatusReport&)(iMessage->SmsPDU());
   149 	}
   150 
   151 /** 
   152 Gets the (const) message PDU for a SMS-STATUS-REPORT type message.
   153 
   154 The message PDU type can be checked by using the CSmsHeader::Type API.
   155 
   156 @return
   157 The SMS-STATUS-REPORT PDU const object.
   158 
   159 @panic	SMCM	0
   160 The message was not a PDU of type SMS-STATUS-REPORT (debug only).
   161 
   162 @see	CSmsHeader::Type
   163 */
   164 inline const CSmsStatusReport& CSmsHeader::StatusReport() const
   165 	{
   166 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsStatusReport, Panic(ESmutPanicUnsupportedMsgType));
   167 	return (CSmsStatusReport&)(iMessage->SmsPDU());
   168 	}
   169 
   170 /**
   171 Gets the message PDU type.
   172 
   173 There are six types of PDU -  SMS-DELIVER, SMS-DELIVER-REPORT, SMS-SUBMIT, 
   174 SMS-SUBMIT-REPORT, SMS-STATUS-REPORT and SMS-COMMAND. 
   175 
   176 There is access to only to SMS-DELIVER, SMS-SUBMIT, SMS-STATUS-REPORT and
   177 SMS-COMMAND PDUs via the CSmsHeader encapsulation.
   178 
   179 @return
   180 The message PDU type.
   181 
   182 @see	CSmsPDU::TSmsPDUType
   183 */
   184 inline CSmsPDU::TSmsPDUType CSmsHeader::Type() const
   185 	{
   186 	return iMessage->SmsPDU().Type();
   187 	}
   188 
   189 /**
   190 Gets the (const) message recipients.
   191 
   192 @return
   193 The const array of message recipients 
   194 */
   195 inline const CArrayPtrFlat<CSmsNumber>& CSmsHeader::Recipients() const
   196 	{
   197 	return iRecipients;
   198 	}
   199 
   200 /** 
   201 Gets the (const) message recipients.
   202 
   203 @return
   204 The array of message recipients 
   205 */
   206 inline CArrayPtrFlat<CSmsNumber>& CSmsHeader::Recipients()
   207 	{
   208 	return iRecipients;
   209 	}
   210 
   211 /** 
   212 Gets the SMS stack representation of the message.
   213 
   214 @return
   215 The SMS stack representation of the message
   216 
   217 @see	CSmsMessage
   218 */
   219 inline CSmsMessage& CSmsHeader::Message()
   220 	{
   221 	return *iMessage;
   222 	}
   223 	
   224 /** 
   225 Gets the (const) SMS stack representation of the message.
   226 
   227 @return
   228 The const SMS stack representation of the message 
   229 */
   230 inline const CSmsMessage& CSmsHeader::Message() const
   231 	{
   232 	return *iMessage;
   233 	}
   234 
   235 /**
   236 Tests if the message contains a reply path.
   237 
   238 @return
   239 A value of True if the message contains a reply path.
   240 */
   241 inline TBool CSmsHeader::ReplyPathProvided() const
   242 	{
   243 	return iFlags & ESmsHeaderReplyPathProvided;
   244 	}
   245 
   246 /** 
   247 Set the message flag that indicates whether it contains a reply path.
   248 
   249 @param	aReplyPathProvided
   250 A value of True to set the flag.
   251 */
   252 inline void CSmsHeader::SetReplyPathProvided(TBool aReplyPathProvided)
   253 	{
   254 	iFlags = (iFlags & ~ESmsHeaderReplyPathProvided) | (aReplyPathProvided ? ESmsHeaderReplyPathProvided : ESmsHeaderNoFlags);
   255 	}
   256 
   257 /**
   258 Sets the originator address.
   259 
   260 @param	aAddress
   261 The originator address
   262 */
   263 inline void CSmsHeader::SetFromAddressL(const TDesC& aAddress)
   264 	{
   265 	Message().SmsPDU().SetToFromAddressL(aAddress);
   266 	}
   267 
   268 /** 
   269 Gets the originator address.
   270 
   271 Only valid for SMS-DELIVER and SMS-SUBMIT type messages. With any other message
   272 types the returned originator address is empty.
   273 
   274 @return
   275 The originator address.
   276 */
   277 inline TPtrC CSmsHeader::FromAddress() const
   278 	{
   279 	switch(Type())
   280 		{
   281 		case(CSmsPDU::ESmsSubmit):
   282 			return Submit().ToFromAddress();
   283 		case(CSmsPDU::ESmsDeliver):
   284 			return Deliver().ToFromAddress();
   285 		default: 
   286 			return TPtrC(0,0);
   287 		}
   288 	}
   289 
   290 /** 
   291 Gets the message's service center address.
   292 
   293 This can only be used on SMS-SUBMIT type messages. The message PDU type can be
   294 checked by using the CSmsHeader::Type API.
   295 
   296 @return
   297 The Service Center address.
   298 
   299 @panic	SMCM	0
   300 The message was not a PDU of type SMS-SUBMIT (debug only).
   301 
   302 @see	CSmsHeader::Type
   303 */
   304 inline TPtrC CSmsHeader::ServiceCenterAddress() const
   305 	{
   306 	return Submit().ServiceCenterAddress();
   307 	}
   308 
   309 /**
   310 Sets the message's service center address.
   311 
   312 This can only be used on SMS-SUBMIT type messages. The message PDU type can be
   313 checked by using the CSmsHeader::Type API.
   314 
   315 
   316 @param	aAddress
   317 The Service Center address
   318 
   319 @panic	SMCM	0
   320 The message was not a PDU of type SMS-SUBMIT (debug only).
   321 
   322 @see	CSmsHeader::Type
   323 */
   324 inline void CSmsHeader::SetServiceCenterAddressL(const TDesC& aAddress)
   325 	{
   326 	Submit().SetServiceCenterAddressL(aAddress);
   327 	}
   328 
   329 /** 
   330 Gets the message's BIO message type identifier.
   331 
   332 For non-BIO messages, this is EBioMsgIdNbs.
   333 
   334 @return
   335 The BIO message type identifier 
   336 */
   337 inline TBioMsgIdType CSmsHeader::BioMsgIdType() const
   338 	{
   339 	return iBioMsgIdType;
   340 	}
   341 
   342 /** 
   343 Sets the message's BIO message type identifier.
   344 
   345 @param	aBioMsgIdType
   346 The BIO message type identifier
   347 */
   348 inline void CSmsHeader::SetBioMsgIdType(TBioMsgIdType aBioMsgIdType)
   349 	{
   350 	iBioMsgIdType = aBioMsgIdType;
   351 	}
   352 
   353 /*
   354  *	TMsvSmsEntry
   355  */
   356 
   357 /**
   358 Constructor.
   359 
   360 @internalTechnology
   361 @released
   362 */
   363 inline TMsvSmsEntry::TMsvSmsEntry()
   364 	{
   365 	}
   366 
   367 /**
   368 Copy constuctor.
   369 
   370 @param	aEntry
   371 The index entry to copy.
   372 
   373 @internalTechnology
   374 @released
   375 */
   376 inline TMsvSmsEntry::TMsvSmsEntry(const TMsvEntry& aEntry)  
   377 : TMsvEntry(aEntry)
   378 	{
   379 	}
   380 
   381 /**
   382 Sets the User Prompt Indicator flag.
   383 
   384 @param	aUPI
   385 A value of True to set the flag.
   386 
   387 @internalTechnology
   388 @released
   389 */
   390 inline void TMsvSmsEntry::SetUserPromptIndicator(TBool aUPI)
   391 	{
   392 	(aUPI) ? (iMtmData2 |= EMsvSmsEntryUserPromptIndicator) : (iMtmData2 &= ~EMsvSmsEntryUserPromptIndicator);
   393 	}
   394 
   395 /**
   396 Gets the User Prompt Indicator flag.
   397 
   398 @return
   399 A value of True if the User Prompt Indicator flag is.
   400 
   401 @internalTechnology
   402 @released
   403 */
   404 inline TBool TMsvSmsEntry::UserPromptIndicator() const
   405 	{
   406 	return (iMtmData2 & EMsvSmsEntryUserPromptIndicator);
   407 	}
   408 
   409 /**
   410 Gets the Protocol Identifier data.
   411 
   412 @return
   413 The Protocol Identifier data.
   414 
   415 @internalTechnology
   416 @released
   417 */
   418 inline TUint8 TMsvSmsEntry::ProtocolIdentifier() const
   419 	{
   420 	return STATIC_CAST(TUint8, iMtmData2 & EMsvSmsEntryProtocolIdentifier);
   421 	}
   422 
   423 /**
   424 Sets the Protocol Identifier data.
   425 
   426 @param	aPID
   427 The Protocol Identifier data.
   428 
   429 @internalTechnology
   430 @released
   431 */
   432 inline void TMsvSmsEntry::SetProtocolIdentifier(TSmsProtocolIdentifier aPID)
   433 	{
   434 	SetProtocolIdentifier(STATIC_CAST(TUint8, aPID));
   435 	}
   436 
   437 /**
   438 Sets the Protocol Identifier data.
   439 
   440 @param	aPID
   441 The Protocol Identifier data.
   442 
   443 @internalTechnology
   444 @released
   445 */
   446 inline void TMsvSmsEntry::SetProtocolIdentifier(TUint8 aPID)
   447 	{
   448 	iMtmData2 = (iMtmData2 & ~EMsvSmsEntryProtocolIdentifier) | (aPID & EMsvSmsEntryProtocolIdentifier);
   449 	}
   450 
   451 /**
   452 Sets the SMS class data and defined flag.
   453 
   454 @param	aClassDefined
   455 A value of True to set the SMS class data defined flag.
   456 
   457 @param	aClass
   458 The SMS class data.
   459 
   460 @internalTechnology
   461 @released
   462 */
   463 inline void TMsvSmsEntry::SetClass(TBool aClassDefined, TSmsDataCodingScheme::TSmsClass aClass)
   464 	{
   465 	aClassDefined ? (iMtmData2 |= EMsvSmsEntryClassDefined) : (iMtmData2 &= ~EMsvSmsEntryClassDefined);
   466 	iMtmData2 = (iMtmData2 & ~EMsvSmsEntryClass) | ((aClass << EMsvSmsEntryClassShift) & EMsvSmsEntryClass);
   467 	}
   468 
   469 /**
   470 Gets the SMS class data and defined flag.
   471 
   472 @param	aClass
   473 An output argument with the SMS class data.
   474 
   475 @return
   476 A value of True if the SMS class data defined flag is set.
   477 
   478 @internalTechnology
   479 @released
   480 */
   481 inline TBool TMsvSmsEntry::Class(TSmsDataCodingScheme::TSmsClass& aClass) const
   482 	{
   483 	aClass = STATIC_CAST(TSmsDataCodingScheme::TSmsClass, ((iMtmData2 & EMsvSmsEntryClass) >> EMsvSmsEntryClassShift));
   484 	return iMtmData2 & EMsvSmsEntryClassDefined;
   485 	}