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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
27 class RMsvWriteStream;
29 class CSmsEmailFields;
32 The SMS MTM encapsulation of an SMS message.
34 This class allows a messaging client to access the lower-level message encapsulation
35 used by the SMS stack.
37 It also provides functionality to restore and store an SMS message from/to the
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).
44 1. SMS-DELIVER - sent from SC to MS
46 2. SMS-DELIVER-REPORT - sent from MS to SC
48 3. SMS-SUBMIT - sent from MS to SC
50 4. SMS-SUBMIT-REPORT - sent from SC to MS
52 5. SMS-STATUS-REPORT - sent from SC to MS
54 6. SMS-COMMAND - sent from MS to SC
59 class CSmsHeader : public CBase
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();
68 inline CSmsPDU::TSmsPDUType Type() const;
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;
79 inline CSmsMessage& Message();
80 inline const CSmsMessage& Message() const;
82 inline TBool ReplyPathProvided() const;
83 inline void SetReplyPathProvided(TBool aReplyPathProvided);
85 inline TBioMsgIdType BioMsgIdType() const;
86 inline void SetBioMsgIdType(TBioMsgIdType aBioMsgIdType = EBioMsgIdNbs);
88 inline TPtrC ServiceCenterAddress() const;
89 inline void SetServiceCenterAddressL(const TDesC& aAddress);
91 IMPORT_C void SetSmsSettingsL(const CSmsMessageSettings& aSmsSettings);
92 IMPORT_C void GetSmsSettingsL(CSmsMessageSettings& aSmsSettings) const;
94 inline const CArrayPtrFlat<CSmsNumber>& Recipients() const;
95 inline CArrayPtrFlat<CSmsNumber>& Recipients();
97 inline void SetFromAddressL(const TDesC& aAddress);
98 inline TPtrC FromAddress() const;
100 TPtrC ReplyAddressL() const;
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;
107 IMPORT_C void InternalizeL( RMsvReadStream& aStream);
108 IMPORT_C void ExternalizeL( RMsvWriteStream& aStream) const;
110 IMPORT_C void RestoreL(CMsvStore& aStore);
111 IMPORT_C void StoreL(CMsvStore& aStore) const;
113 IMPORT_C TBool ContainsSmsHeaderL(const CMsvStore& aStore);
116 CSmsHeader(CSmsMessage* aSmsMessage = NULL);
117 void ConstructL(CSmsPDU::TSmsPDUType aType, CEditableText& aText);
118 void ConstructL(CSmsPDU::TSmsPDUType aType, CEditableText& aText, RFs& aFs);
123 ESmsHeaderNoFlags = 0x00,
124 ESmsHeaderReplyPathProvided = 0x01,
125 ESmsHeaderCanConcatenate = 0x02
128 TBool CanConcatenate() const;
129 void SetCanConcatenate(TBool aCanConcatenate);
131 void SetEmailReplyForwardSubjectL(CSmsEmailFields* aEmailFields, const TDesC& aSubject, const TDesC& aSubjectFormat);
134 CArrayPtrFlat<CSmsNumber> iRecipients;
135 CSmsMessage* iMessage;
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;
147 A specialisation of the message server index class for SMS message entries.
149 It provides accessers for SMS message specific data, for instance the class type
155 class TMsvSmsEntry : public TMsvEntry
160 Defines a set flags used to access message entry data specific to an SMS message.
166 enum TMsvSmsEntryFlags
169 Clears the entire set of SMS flags.
171 EMsvSmsEntryClearFlag = 0x00000000,
173 Mask for the protocol identifier data.
175 EMsvSmsEntryProtocolIdentifier = 0x000000FF,
177 Mask for the User Prompt Indicator flag.
179 EMsvSmsEntryUserPromptIndicator = 0x00000100,
181 Mask for the SMS class data.
183 EMsvSmsEntryClass = 0x00000E00,
185 Mask for the flag indicating whether the class data has been defined.
187 EMsvSmsEntryClassDefined = 0x00001000,
189 Mask for the flag indicating whether the message ID is valid.
191 EMsvSmsMessageValid = 0x00002000,
193 Mask for the delivery acknowledgement information.
195 EMsvSmsEntryDeliveryAckSummary = 0x0001C000,
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.
200 EMsvSmsEntryClassShift = 9,
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.
205 EMsvSmsEntryDeliveryAckSummaryShift = 14
209 Defines the summary acknowledgement information.
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.
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.
219 enum TMsvSmsEntryAckSummary
222 No summary information is being formed.
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.
232 The summary indicates that the message was successfully acknowledged by all recipients.
236 The summary indicates that the message failed to be acknowledged by all recipients.
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.
248 inline TMsvSmsEntry();
249 inline TMsvSmsEntry(const TMsvEntry& aEntry);
251 inline void SetUserPromptIndicator(TBool aUPI);
252 inline TBool UserPromptIndicator() const;
254 inline TUint8 ProtocolIdentifier() const;
255 inline void SetProtocolIdentifier(TSmsProtocolIdentifier aPID);
256 inline void SetProtocolIdentifier(TUint8 aPID);
258 inline TBool Class(TSmsDataCodingScheme::TSmsClass& aClass) const;
259 inline void SetClass(TBool aClassDefined,TSmsDataCodingScheme::TSmsClass aClass = TSmsDataCodingScheme::ESmsClass0);
261 IMPORT_C TMsvSmsEntryAckSummary AckSummary(TSmsAckType aAckType) const;
262 IMPORT_C void SetAckSummary(TSmsAckType aAckType, TMsvSmsEntryAckSummary aAckSummary);
264 IMPORT_C TBool MessageId(TInt32& aMessageId) const;
265 IMPORT_C void SetMessageId(TInt32 aMessageId, TBool aIsValid);
268 #include <smuthdr.inl>
270 #endif // __SMUTHDR_H__