messagingappbase/smsmtm/clientmtm/inc/SMUTHDR.H
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.H
       
    15 //
       
    16 /**
       
    17  * @file 
       
    18  * @publishedAll
       
    19  * @released
       
    20  */
       
    21 #ifndef __SMUTHDR_H__
       
    22 #define __SMUTHDR_H__
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <gsmubuf.h>
       
    26 #include <bif.h>
       
    27 #include <gsmupdu.h>
       
    28 #include <msvstd.h>
       
    29 #include <smutset.h>
       
    30 
       
    31 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS  
       
    32 #include <tmsvsmsentry.h>
       
    33 #endif
       
    34 
       
    35 class RMsvReadStream;
       
    36 class RMsvWriteStream;
       
    37 class CMsvStore;
       
    38 class CSmsEmailFields;
       
    39 
       
    40 /** 
       
    41 The SMS MTM encapsulation of an SMS message.
       
    42 
       
    43 This class allows a messaging client to access the lower-level message encapsulation 
       
    44 used by the SMS stack.
       
    45 
       
    46 It also provides functionality to restore and store an SMS message from/to the
       
    47 message store.
       
    48 
       
    49 An SMS message is encapsulated in a Protocol Data Unit (PDU). In GSM there are 
       
    50 six types of SMS message PDU. In the descriptions below, SC means Service Center 
       
    51 and MS means Mobile Station (the phone).
       
    52 
       
    53 1. SMS-DELIVER - sent from SC to MS
       
    54 
       
    55 2. SMS-DELIVER-REPORT - sent from MS to SC
       
    56 
       
    57 3. SMS-SUBMIT - sent from MS to SC
       
    58 
       
    59 4. SMS-SUBMIT-REPORT - sent from SC to MS
       
    60 
       
    61 5. SMS-STATUS-REPORT - sent from SC to MS
       
    62 
       
    63 6. SMS-COMMAND - sent from MS to SC
       
    64 
       
    65 @publishedAll
       
    66 @released
       
    67 */
       
    68 NONSHARABLE_CLASS (CSmsHeader) : public CBase
       
    69 	{
       
    70 public:
       
    71 
       
    72 	IMPORT_C static CSmsHeader* NewL(CSmsPDU::TSmsPDUType aType,CEditableText& aText);
       
    73 	IMPORT_C static CSmsHeader* NewL(CSmsPDU::TSmsPDUType aType,CEditableText& aText,RFs& aFs);
       
    74 	IMPORT_C static CSmsHeader* NewL(CSmsMessage* aMessage);
       
    75 	IMPORT_C ~CSmsHeader();
       
    76 
       
    77 	inline CSmsPDU::TSmsPDUType Type() const;
       
    78 
       
    79 	inline CSmsSubmit& Submit();
       
    80 	inline const CSmsSubmit& Submit() const;
       
    81 	inline CSmsDeliver& Deliver();
       
    82 	inline const CSmsDeliver& Deliver() const;
       
    83 	inline CSmsCommand& Command();
       
    84 	inline const CSmsCommand& Command() const;
       
    85 	inline CSmsStatusReport& StatusReport();
       
    86 	inline const CSmsStatusReport& StatusReport() const;
       
    87 	
       
    88 	inline CSmsMessage& Message();
       
    89 	inline const CSmsMessage& Message() const;
       
    90 
       
    91 	inline TBool ReplyPathProvided() const;
       
    92 	inline void SetReplyPathProvided(TBool aReplyPathProvided);
       
    93 
       
    94 	inline TBioMsgIdType BioMsgIdType() const;
       
    95 	inline void SetBioMsgIdType(TBioMsgIdType aBioMsgIdType = EBioMsgIdNbs);
       
    96 	
       
    97 	inline TPtrC ServiceCenterAddress() const;
       
    98 	inline void SetServiceCenterAddressL(const TDesC& aAddress);
       
    99 
       
   100 	IMPORT_C void SetSmsSettingsL(const CSmsMessageSettings& aSmsSettings);
       
   101 	IMPORT_C void GetSmsSettingsL(CSmsMessageSettings& aSmsSettings) const;
       
   102 
       
   103 	inline const CArrayPtrFlat<CSmsNumber>& Recipients() const;
       
   104 	inline CArrayPtrFlat<CSmsNumber>& Recipients();
       
   105 
       
   106 	inline void SetFromAddressL(const TDesC& aAddress);
       
   107 	inline TPtrC FromAddress() const;
       
   108 	
       
   109 	TPtrC ReplyAddressL() const;
       
   110 	
       
   111 	IMPORT_C void SetEmailFieldsL(const CSmsEmailFields& aEmailFields);
       
   112 	void SetReplyEmailFieldsL(const CSmsEmailFields& aEmailFields, const TDesC& aReplySubjectFormat);
       
   113 	void SetForwardEmailFieldsL(const CSmsEmailFields& aEmailFields, const TDesC& aForwardSubjectFormat);
       
   114 	IMPORT_C const CSmsEmailFields& EmailFields() const;
       
   115 
       
   116 	IMPORT_C void InternalizeL( RMsvReadStream& aStream);
       
   117 	IMPORT_C void ExternalizeL( RMsvWriteStream& aStream) const;
       
   118 
       
   119 	IMPORT_C void RestoreL(CMsvStore& aStore);
       
   120 	IMPORT_C void StoreL(CMsvStore& aStore) const;
       
   121 
       
   122 	IMPORT_C  TBool ContainsSmsHeaderL(const CMsvStore& aStore); 
       
   123 
       
   124 	
       
   125 private:
       
   126 	CSmsHeader(CSmsMessage* aSmsMessage = NULL);
       
   127 	void ConstructL(CSmsPDU::TSmsPDUType aType, CEditableText& aText);
       
   128 	void ConstructL(CSmsPDU::TSmsPDUType aType, CEditableText& aText, RFs& aFs);
       
   129 	void ConstructL();
       
   130 
       
   131 	enum TSmsHeaderFlags
       
   132 		{
       
   133 		ESmsHeaderNoFlags			= 0x00,
       
   134 		ESmsHeaderReplyPathProvided = 0x01,
       
   135 		ESmsHeaderCanConcatenate	= 0x02
       
   136 		};
       
   137 
       
   138 	TBool CanConcatenate() const;
       
   139 	void SetCanConcatenate(TBool aCanConcatenate);
       
   140 	
       
   141 	void SetEmailReplyForwardSubjectL(CSmsEmailFields* aEmailFields, const TDesC& aSubject, const TDesC& aSubjectFormat);
       
   142 
       
   143 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
       
   144 	void StoreDbL(CMsvStore& aStore) const;
       
   145 	void ReStoreDBL(CMsvStore& aStore);
       
   146 	void GetRecipientL(TDesC16& aRecipientStrList);
       
   147 	TInt ConvertToTInt(TDesC16& aStr);
       
   148 #endif
       
   149 
       
   150 private:
       
   151 	CArrayPtrFlat<CSmsNumber> iRecipients;
       
   152 	CSmsMessage* iMessage;
       
   153 	TUint32 iFlags;
       
   154 	RFs iFs;
       
   155 
       
   156 	// iBioMsgIdType is only used during sending and will be ignored if the 
       
   157 	// TMsvEntry.iBioType == 0. The default is EBioMsgIdNbs.
       
   158 	TBioMsgIdType iBioMsgIdType;
       
   159 	CSmsEmailFields*	iEmailFields;
       
   160 	TBool			iCloseFs;
       
   161 	};
       
   162 	
       
   163 #include <smuthdr.inl>
       
   164 
       
   165 #endif	// __SMUTHDR_H__
       
   166