messagingappbase/smsmtm/clientmtm/inc/SMUTHDR.INL
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // SMUTHDR.INL
       
    15 //
       
    16 
       
    17 #include <smcmmain.h>
       
    18 #include <gsmumsg.h>
       
    19 
       
    20 /** 
       
    21 Gets the message PDU for a SMS-SUBMIT type message.
       
    22 
       
    23 The message PDU type can be checked by using the CSmsHeader::Type API.
       
    24 
       
    25 @return
       
    26 The SMS-SUBMIT PDU object.
       
    27 
       
    28 @panic	SMCM	0
       
    29 The message was not a PDU of type SMS-SUBMIT (debug only).
       
    30 
       
    31 @see	CSmsHeader::Type
       
    32 */
       
    33 inline CSmsSubmit& CSmsHeader::Submit()
       
    34 	{
       
    35 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsSubmit, Panic(ESmutPanicUnsupportedMsgType));
       
    36 	return (CSmsSubmit&)(iMessage->SmsPDU());
       
    37 	}
       
    38 
       
    39 /** 
       
    40 Gets the (const) message PDU for a SMS-SUBMIT type message.
       
    41 
       
    42 The message PDU type can be checked by using the CSmsHeader::Type API.
       
    43 
       
    44 @return
       
    45 The SMS-SUBMIT PDU const object.
       
    46 
       
    47 @panic	SMCM	0
       
    48 The message was not a PDU of type SMS-SUBMIT (debug only).
       
    49 
       
    50 @see	CSmsHeader::Type
       
    51 */
       
    52 inline const CSmsSubmit& CSmsHeader::Submit() const
       
    53 	{
       
    54 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsSubmit, Panic(ESmutPanicUnsupportedMsgType));
       
    55 	return (CSmsSubmit&)(iMessage->SmsPDU());
       
    56 	}
       
    57 
       
    58 /** 
       
    59 Gets the message PDU for a SMS-DELIVER type message.
       
    60 
       
    61 The message PDU type can be checked by using the CSmsHeader::Type API.
       
    62 
       
    63 @return
       
    64 The SMS-DELIVER PDU object.
       
    65 
       
    66 @panic	SMCM	0
       
    67 The message was not a PDU of type SMS-DELIVER (debug only).
       
    68 
       
    69 @see	CSmsHeader::Type
       
    70 */
       
    71 inline CSmsDeliver& CSmsHeader::Deliver()
       
    72 	{
       
    73 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsDeliver, Panic(ESmutPanicUnsupportedMsgType));
       
    74 	return (CSmsDeliver&)(iMessage->SmsPDU());
       
    75 	}
       
    76 
       
    77 /** 
       
    78 Gets the (const) message PDU for a SMS-DELIVER type message.
       
    79 
       
    80 The message PDU type can be checked by using the CSmsHeader::Type API.
       
    81 
       
    82 @return
       
    83 The SMS-DELIVER PDU const object.
       
    84 
       
    85 @panic	SMCM	0
       
    86 The message was not a PDU of type SMS-DELIVER (debug only).
       
    87 
       
    88 @see	CSmsHeader::Type
       
    89 */
       
    90 inline const CSmsDeliver& CSmsHeader::Deliver() const
       
    91 	{
       
    92 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsDeliver, Panic(ESmutPanicUnsupportedMsgType));
       
    93 	return (CSmsDeliver&)(iMessage->SmsPDU());
       
    94 	}
       
    95 
       
    96 /** 
       
    97 Gets the message PDU for a SMS-COMMMAND type message.
       
    98 
       
    99 The message PDU type can be checked by using the CSmsHeader::Type API.
       
   100 
       
   101 @return	The SMS-COMMMAND PDU object.
       
   102 
       
   103 @panic	SMCM	0
       
   104 The message was not a PDU of type SMS-COMMMAND (debug only).
       
   105 
       
   106 @see	CSmsHeader::Type
       
   107 */
       
   108 inline CSmsCommand& CSmsHeader::Command()
       
   109 	{
       
   110 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsCommand, Panic(ESmutPanicUnsupportedMsgType));
       
   111 	return (CSmsCommand&)(iMessage->SmsPDU());
       
   112 	}
       
   113 
       
   114 /** 
       
   115 Gets the (const) message PDU for a SMS-COMMMAND type message.
       
   116 
       
   117 The message PDU type can be checked by using the CSmsHeader::Type API.
       
   118 
       
   119 @return
       
   120 The SMS-COMMMAND PDU const object.
       
   121 
       
   122 @panic	SMCM	0
       
   123 The message was not a PDU of type SMS-COMMMAND (debug only).
       
   124 
       
   125 @see	CSmsHeader::Type
       
   126 */
       
   127 inline const CSmsCommand& CSmsHeader::Command() const
       
   128 	{
       
   129 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsCommand, Panic(ESmutPanicUnsupportedMsgType));
       
   130 	return (CSmsCommand&)(iMessage->SmsPDU());
       
   131 	}
       
   132 
       
   133 /** 
       
   134 Gets the message PDU for a SMS-STATUS-REPORT type message.
       
   135 
       
   136 The message PDU type can be checked by using the CSmsHeader::Type API.
       
   137 
       
   138 @return
       
   139 The SMS-STATUS-REPORT PDU object.
       
   140 
       
   141 @panic	SMCM	0
       
   142 The message was not a PDU of type SMS-STATUS-REPORT (debug only).
       
   143 
       
   144 @see	CSmsHeader::Type
       
   145 */
       
   146 inline CSmsStatusReport& CSmsHeader::StatusReport()
       
   147 	{
       
   148 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsStatusReport, Panic(ESmutPanicUnsupportedMsgType));
       
   149 	return (CSmsStatusReport&)(iMessage->SmsPDU());
       
   150 	}
       
   151 
       
   152 /** 
       
   153 Gets the (const) message PDU for a SMS-STATUS-REPORT type message.
       
   154 
       
   155 The message PDU type can be checked by using the CSmsHeader::Type API.
       
   156 
       
   157 @return
       
   158 The SMS-STATUS-REPORT PDU const object.
       
   159 
       
   160 @panic	SMCM	0
       
   161 The message was not a PDU of type SMS-STATUS-REPORT (debug only).
       
   162 
       
   163 @see	CSmsHeader::Type
       
   164 */
       
   165 inline const CSmsStatusReport& CSmsHeader::StatusReport() const
       
   166 	{
       
   167 	__ASSERT_DEBUG( Type() == CSmsPDU::ESmsStatusReport, Panic(ESmutPanicUnsupportedMsgType));
       
   168 	return (CSmsStatusReport&)(iMessage->SmsPDU());
       
   169 	}
       
   170 
       
   171 /**
       
   172 Gets the message PDU type.
       
   173 
       
   174 There are six types of PDU -  SMS-DELIVER, SMS-DELIVER-REPORT, SMS-SUBMIT, 
       
   175 SMS-SUBMIT-REPORT, SMS-STATUS-REPORT and SMS-COMMAND. 
       
   176 
       
   177 There is access to only to SMS-DELIVER, SMS-SUBMIT, SMS-STATUS-REPORT and
       
   178 SMS-COMMAND PDUs via the CSmsHeader encapsulation.
       
   179 
       
   180 @return
       
   181 The message PDU type.
       
   182 
       
   183 @see	CSmsPDU::TSmsPDUType
       
   184 */
       
   185 inline CSmsPDU::TSmsPDUType CSmsHeader::Type() const
       
   186 	{
       
   187 	return iMessage->SmsPDU().Type();
       
   188 	}
       
   189 
       
   190 /**
       
   191 Gets the (const) message recipients.
       
   192 
       
   193 @return
       
   194 The const array of message recipients 
       
   195 */
       
   196 inline const CArrayPtrFlat<CSmsNumber>& CSmsHeader::Recipients() const
       
   197 	{
       
   198 	return iRecipients;
       
   199 	}
       
   200 
       
   201 /** 
       
   202 Gets the (const) message recipients.
       
   203 
       
   204 @return
       
   205 The array of message recipients 
       
   206 */
       
   207 inline CArrayPtrFlat<CSmsNumber>& CSmsHeader::Recipients()
       
   208 	{
       
   209 	return iRecipients;
       
   210 	}
       
   211 
       
   212 /** 
       
   213 Gets the SMS stack representation of the message.
       
   214 
       
   215 @return
       
   216 The SMS stack representation of the message
       
   217 
       
   218 @see	CSmsMessage
       
   219 */
       
   220 inline CSmsMessage& CSmsHeader::Message()
       
   221 	{
       
   222 	return *iMessage;
       
   223 	}
       
   224 	
       
   225 /** 
       
   226 Gets the (const) SMS stack representation of the message.
       
   227 
       
   228 @return
       
   229 The const SMS stack representation of the message 
       
   230 */
       
   231 inline const CSmsMessage& CSmsHeader::Message() const
       
   232 	{
       
   233 	return *iMessage;
       
   234 	}
       
   235 
       
   236 /**
       
   237 Tests if the message contains a reply path.
       
   238 
       
   239 @return
       
   240 A value of True if the message contains a reply path.
       
   241 */
       
   242 inline TBool CSmsHeader::ReplyPathProvided() const
       
   243 	{
       
   244 	return iFlags & ESmsHeaderReplyPathProvided;
       
   245 	}
       
   246 
       
   247 /** 
       
   248 Set the message flag that indicates whether it contains a reply path.
       
   249 
       
   250 @param	aReplyPathProvided
       
   251 A value of True to set the flag.
       
   252 */
       
   253 inline void CSmsHeader::SetReplyPathProvided(TBool aReplyPathProvided)
       
   254 	{
       
   255 	iFlags = (iFlags & ~ESmsHeaderReplyPathProvided) | (aReplyPathProvided ? ESmsHeaderReplyPathProvided : ESmsHeaderNoFlags);
       
   256 	}
       
   257 
       
   258 /**
       
   259 Sets the originator address.
       
   260 
       
   261 @param	aAddress
       
   262 The originator address
       
   263 */
       
   264 inline void CSmsHeader::SetFromAddressL(const TDesC& aAddress)
       
   265 	{
       
   266 	Message().SmsPDU().SetToFromAddressL(aAddress);
       
   267 	}
       
   268 
       
   269 /** 
       
   270 Gets the originator address.
       
   271 
       
   272 Only valid for SMS-DELIVER and SMS-SUBMIT type messages. With any other message
       
   273 types the returned originator address is empty.
       
   274 
       
   275 @return
       
   276 The originator address.
       
   277 */
       
   278 inline TPtrC CSmsHeader::FromAddress() const
       
   279 	{
       
   280 	switch(Type())
       
   281 		{
       
   282 		case(CSmsPDU::ESmsSubmit):
       
   283 			return Submit().ToFromAddress();
       
   284 		case(CSmsPDU::ESmsDeliver):
       
   285 			return Deliver().ToFromAddress();
       
   286 		default: 
       
   287 			return TPtrC(0,0);
       
   288 		}
       
   289 	}
       
   290 
       
   291 /** 
       
   292 Gets the message's service center address.
       
   293 
       
   294 This can only be used on SMS-SUBMIT type messages. The message PDU type can be
       
   295 checked by using the CSmsHeader::Type API.
       
   296 
       
   297 @return
       
   298 The Service Center address.
       
   299 
       
   300 @panic	SMCM	0
       
   301 The message was not a PDU of type SMS-SUBMIT (debug only).
       
   302 
       
   303 @see	CSmsHeader::Type
       
   304 */
       
   305 inline TPtrC CSmsHeader::ServiceCenterAddress() const
       
   306 	{
       
   307 	return Submit().ServiceCenterAddress();
       
   308 	}
       
   309 
       
   310 /**
       
   311 Sets the message's service center address.
       
   312 
       
   313 This can only be used on SMS-SUBMIT type messages. The message PDU type can be
       
   314 checked by using the CSmsHeader::Type API.
       
   315 
       
   316 
       
   317 @param	aAddress
       
   318 The Service Center address
       
   319 
       
   320 @panic	SMCM	0
       
   321 The message was not a PDU of type SMS-SUBMIT (debug only).
       
   322 
       
   323 @see	CSmsHeader::Type
       
   324 */
       
   325 inline void CSmsHeader::SetServiceCenterAddressL(const TDesC& aAddress)
       
   326 	{
       
   327 	Submit().SetServiceCenterAddressL(aAddress);
       
   328 	}
       
   329 
       
   330 /** 
       
   331 Gets the message's BIO message type identifier.
       
   332 
       
   333 For non-BIO messages, this is EBioMsgIdNbs.
       
   334 
       
   335 @return
       
   336 The BIO message type identifier 
       
   337 */
       
   338 inline TBioMsgIdType CSmsHeader::BioMsgIdType() const
       
   339 	{
       
   340 	return iBioMsgIdType;
       
   341 	}
       
   342 
       
   343 /** 
       
   344 Sets the message's BIO message type identifier.
       
   345 
       
   346 @param	aBioMsgIdType
       
   347 The BIO message type identifier
       
   348 */
       
   349 inline void CSmsHeader::SetBioMsgIdType(TBioMsgIdType aBioMsgIdType)
       
   350 	{
       
   351 	iBioMsgIdType = aBioMsgIdType;
       
   352 	}
       
   353 
       
   354