epoc32/include/smuthdr.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
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 #ifndef __SMUTHDR_H__
    17 #define __SMUTHDR_H__
    18 
    19 #include <e32base.h>
    20 #include <gsmubuf.h>
    21 #include <bif.h>
    22 #include <gsmupdu.h>
    23 #include <msvstd.h>
    24 #include <smutset.h>
    25 
    26 class RMsvReadStream;
    27 class RMsvWriteStream;
    28 class CMsvStore;
    29 class CSmsEmailFields;
    30 
    31 /** 
    32 The SMS MTM encapsulation of an SMS message.
    33 
    34 This class allows a messaging client to access the lower-level message encapsulation 
    35 used by the SMS stack.
    36 
    37 It also provides functionality to restore and store an SMS message from/to the
    38 message store.
    39 
    40 An SMS message is encapsulated in a Protocol Data Unit (PDU). In GSM there are 
    41 six types of SMS message PDU. In the descriptions below, SC means Service Center 
    42 and MS means Mobile Station (the phone).
    43 
    44 1. SMS-DELIVER - sent from SC to MS
    45 
    46 2. SMS-DELIVER-REPORT - sent from MS to SC
    47 
    48 3. SMS-SUBMIT - sent from MS to SC
    49 
    50 4. SMS-SUBMIT-REPORT - sent from SC to MS
    51 
    52 5. SMS-STATUS-REPORT - sent from SC to MS
    53 
    54 6. SMS-COMMAND - sent from MS to SC
    55 
    56 @publishedAll
    57 @released
    58 */
    59 class CSmsHeader : public CBase
    60 	{
    61 public:
    62 
    63 	IMPORT_C static CSmsHeader* NewL(CSmsPDU::TSmsPDUType aType,CEditableText& aText);
    64 	IMPORT_C static CSmsHeader* NewL(CSmsPDU::TSmsPDUType aType,CEditableText& aText,RFs& aFs);
    65 	IMPORT_C static CSmsHeader* NewL(CSmsMessage* aMessage);
    66 	IMPORT_C ~CSmsHeader();
    67 
    68 	inline CSmsPDU::TSmsPDUType Type() const;
    69 
    70 	inline CSmsSubmit& Submit();
    71 	inline const CSmsSubmit& Submit() const;
    72 	inline CSmsDeliver& Deliver();
    73 	inline const CSmsDeliver& Deliver() const;
    74 	inline CSmsCommand& Command();
    75 	inline const CSmsCommand& Command() const;
    76 	inline CSmsStatusReport& StatusReport();
    77 	inline const CSmsStatusReport& StatusReport() const;
    78 	
    79 	inline CSmsMessage& Message();
    80 	inline const CSmsMessage& Message() const;
    81 
    82 	inline TBool ReplyPathProvided() const;
    83 	inline void SetReplyPathProvided(TBool aReplyPathProvided);
    84 
    85 	inline TBioMsgIdType BioMsgIdType() const;
    86 	inline void SetBioMsgIdType(TBioMsgIdType aBioMsgIdType = EBioMsgIdNbs);
    87 	
    88 	inline TPtrC ServiceCenterAddress() const;
    89 	inline void SetServiceCenterAddressL(const TDesC& aAddress);
    90 
    91 	IMPORT_C void SetSmsSettingsL(const CSmsMessageSettings& aSmsSettings);
    92 	IMPORT_C void GetSmsSettingsL(CSmsMessageSettings& aSmsSettings) const;
    93 
    94 	inline const CArrayPtrFlat<CSmsNumber>& Recipients() const;
    95 	inline CArrayPtrFlat<CSmsNumber>& Recipients();
    96 
    97 	inline void SetFromAddressL(const TDesC& aAddress);
    98 	inline TPtrC FromAddress() const;
    99 	
   100 	TPtrC ReplyAddressL() const;
   101 	
   102 	IMPORT_C void SetEmailFieldsL(const CSmsEmailFields& aEmailFields);
   103 	void SetReplyEmailFieldsL(const CSmsEmailFields& aEmailFields, const TDesC& aReplySubjectFormat);
   104 	void SetForwardEmailFieldsL(const CSmsEmailFields& aEmailFields, const TDesC& aForwardSubjectFormat);
   105 	IMPORT_C const CSmsEmailFields& EmailFields() const;
   106 
   107 	IMPORT_C void InternalizeL( RMsvReadStream& aStream);
   108 	IMPORT_C void ExternalizeL( RMsvWriteStream& aStream) const;
   109 
   110 	IMPORT_C void RestoreL(CMsvStore& aStore);
   111 	IMPORT_C void StoreL(CMsvStore& aStore) const;
   112 
   113 	IMPORT_C  TBool ContainsSmsHeaderL(const CMsvStore& aStore); 
   114 	
   115 private:
   116 	CSmsHeader(CSmsMessage* aSmsMessage = NULL);
   117 	void ConstructL(CSmsPDU::TSmsPDUType aType, CEditableText& aText);
   118 	void ConstructL(CSmsPDU::TSmsPDUType aType, CEditableText& aText, RFs& aFs);
   119 	void ConstructL();
   120 
   121 	enum TSmsHeaderFlags
   122 		{
   123 		ESmsHeaderNoFlags			= 0x00,
   124 		ESmsHeaderReplyPathProvided = 0x01,
   125 		ESmsHeaderCanConcatenate	= 0x02
   126 		};
   127 
   128 	TBool CanConcatenate() const;
   129 	void SetCanConcatenate(TBool aCanConcatenate);
   130 	
   131 	void SetEmailReplyForwardSubjectL(CSmsEmailFields* aEmailFields, const TDesC& aSubject, const TDesC& aSubjectFormat);
   132 	
   133 private:
   134 	CArrayPtrFlat<CSmsNumber> iRecipients;
   135 	CSmsMessage* iMessage;
   136 	TUint32 iFlags;
   137 	RFs iFs;
   138 
   139 	// iBioMsgIdType is only used during sending and will be ignored if the 
   140 	// TMsvEntry.iBioType == 0. The default is EBioMsgIdNbs.
   141 	TBioMsgIdType iBioMsgIdType;
   142 	CSmsEmailFields*	iEmailFields;
   143 	TBool			iCloseFs;
   144 	};
   145 	
   146 /**
   147 A specialisation of the message server index class for SMS message entries.
   148 
   149 It provides accessers for SMS message specific data, for instance the class type
   150 of the SMS message.
   151 
   152 @publishedPartner
   153 @released
   154 */
   155 class TMsvSmsEntry : public TMsvEntry
   156 	{
   157 public:
   158 
   159 /**
   160 Defines a set flags used to access message entry data specific to an SMS message.
   161 
   162 @internalTechnology
   163 @released
   164 
   165 */
   166 	enum TMsvSmsEntryFlags
   167 		{
   168 /**
   169 Clears the entire set of SMS flags.
   170 */
   171 		EMsvSmsEntryClearFlag				= 0x00000000,
   172 /**
   173 Mask for the protocol identifier data.
   174 */
   175 		EMsvSmsEntryProtocolIdentifier		= 0x000000FF,
   176 /**
   177 Mask for the User Prompt Indicator flag.
   178 */
   179 		EMsvSmsEntryUserPromptIndicator 	= 0x00000100,
   180 /**
   181 Mask for the SMS class data.
   182 */
   183 		EMsvSmsEntryClass					= 0x00000E00,
   184 /**
   185 Mask for the flag indicating whether the class data has been defined.
   186 */
   187 		EMsvSmsEntryClassDefined			= 0x00001000,
   188 /**
   189 Mask for the flag indicating whether the message ID is valid. 
   190 */
   191 		EMsvSmsMessageValid					= 0x00002000,
   192 /**
   193 Mask for the delivery acknowledgement information.
   194 */
   195 		EMsvSmsEntryDeliveryAckSummary		= 0x0001C000,
   196 /**
   197 Parameter defining the number of bits to be shifted in order for the SMS class
   198 data to be at the LSB of the data block.
   199 */
   200 		EMsvSmsEntryClassShift				= 9,
   201 /**
   202 Parameter defining the number of bits to be shifted in order for the delivery
   203 acknowlwdgement information to be at the LSB of the data block.
   204 */
   205 		EMsvSmsEntryDeliveryAckSummaryShift	= 14
   206 		};
   207 
   208 /**
   209 Defines the summary acknowledgement information.
   210 
   211 This information indicates whether the SMS message is not supplying a summary 
   212 for an acknowledgement, is still expecting acknowledgments or it has received 
   213 all expected acknowledgements.
   214 
   215 If all acknowledgements have been received the summary indicates whether all 
   216 the recipients have successfully acknowledged the message, all failed or there
   217 was a mixture of successful and failed acknowledgements from the recipients. 
   218 */
   219 	enum TMsvSmsEntryAckSummary
   220 		{
   221 /**
   222 No summary information is being formed.
   223 */
   224 		ENoAckSummary			= 0,
   225 /**
   226 The message is waiting for acknowledgements to be received for all recipients
   227 of this message. Some recipients may have received their acknowledgements but
   228 there are still some recipients that have not.
   229 */
   230 		EPendingAcks,
   231 /**
   232 The summary indicates that the message was successfully acknowledged by all recipients.
   233 */
   234 		EAllSuccessful,
   235 /**
   236 The summary indicates that the message failed to be acknowledged by all recipients.
   237 */
   238 		EAllFailed,
   239 /**
   240 The summary indicates a mixture of successful and failed acknowledgements from 
   241 the recipients of the message. All recipients of this message have received 
   242 their acknowledgements.
   243 */
   244 		EMixed
   245 		};
   246 
   247 public:
   248 	inline TMsvSmsEntry();
   249 	inline TMsvSmsEntry(const TMsvEntry& aEntry);
   250 
   251 	inline void SetUserPromptIndicator(TBool aUPI);
   252 	inline TBool UserPromptIndicator() const;
   253 
   254 	inline TUint8 ProtocolIdentifier() const;
   255 	inline void SetProtocolIdentifier(TSmsProtocolIdentifier aPID);
   256 	inline void SetProtocolIdentifier(TUint8 aPID);
   257 
   258 	inline TBool Class(TSmsDataCodingScheme::TSmsClass& aClass) const;
   259 	inline void SetClass(TBool aClassDefined,TSmsDataCodingScheme::TSmsClass aClass = TSmsDataCodingScheme::ESmsClass0);
   260 
   261 	IMPORT_C TMsvSmsEntryAckSummary AckSummary(TSmsAckType aAckType) const;
   262 	IMPORT_C void SetAckSummary(TSmsAckType aAckType, TMsvSmsEntryAckSummary aAckSummary);
   263 
   264 	IMPORT_C TBool MessageId(TInt32& aMessageId) const;
   265 	IMPORT_C void SetMessageId(TInt32 aMessageId, TBool aIsValid);
   266 	};
   267 
   268 #include <smuthdr.inl>
   269 
   270 #endif	// __SMUTHDR_H__