|
1 // Copyright (c) 2000-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 // |
|
15 |
|
16 #ifndef SMSS_SIM_UTILS_H_ |
|
17 #define SMSS_SIM_UTILS_H_ |
|
18 |
|
19 //Includes |
|
20 |
|
21 #include <smsustrm.h> |
|
22 #include <msvstd.h> |
|
23 #include "smssactive.h" |
|
24 #include <smsuaddr.h> |
|
25 #include <csmsgetdetdescinterface.h> |
|
26 |
|
27 //Forward declarations |
|
28 |
|
29 class RSocket; |
|
30 class RSocketServ; |
|
31 class CParaFormatLayer; |
|
32 class CCharFormatLayer; |
|
33 class CSmsHeader; |
|
34 class CBIODatabase; |
|
35 |
|
36 |
|
37 //CSmsSimUtils |
|
38 const TUid KSmsSimUtilsDataUid = {0x101f747e}; |
|
39 const TInt16 KSmsSimUtilsDataVersion = 1; |
|
40 |
|
41 class TSmsSimUtilsData |
|
42 /** |
|
43 @internalComponent |
|
44 @released |
|
45 */ |
|
46 { |
|
47 public: |
|
48 |
|
49 inline TSmsSimUtilsData(); |
|
50 void StoreL(CMsvStore& aStore) const; |
|
51 void RestoreL(const CMsvStore& aStore); |
|
52 inline TBool IsPresentL(const CMsvStore& aStore) const; |
|
53 void ExternalizeL(RWriteStream& aStream) const; |
|
54 void InternalizeL(RReadStream& aStream); |
|
55 |
|
56 public: |
|
57 |
|
58 TMsvId iLastEnumerateFolder; //< Last folder used for enumerating SIM messages |
|
59 }; |
|
60 |
|
61 class CSmsSimUtils : public CSmssActive |
|
62 /** |
|
63 @internalComponent |
|
64 @released |
|
65 */ |
|
66 { |
|
67 public: |
|
68 static CSmsSimUtils* NewL(CMsvServerEntry& aServerEntry, RFs& aFs, TMsvId aSmsServiceId); |
|
69 void EnumerateL(const TDesC8& aParameter, TRequestStatus& aStatus); |
|
70 |
|
71 void DeleteFromPhoneStoreL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
72 void CopyFromPhoneStoreL(const CMsvEntrySelection& aSelection, const TDesC8& aParameter, TRequestStatus& aStatus); |
|
73 void MoveFromPhoneStoreL(const CMsvEntrySelection& aSelection, const TDesC8& aParameter, TRequestStatus& aStatus); |
|
74 |
|
75 void ReadSimParamsL(TRequestStatus& aStatus); |
|
76 void WriteSimParamsL(TRequestStatus& aStatus); |
|
77 |
|
78 inline const TSmsProgress& Progress(); |
|
79 ~CSmsSimUtils(); |
|
80 |
|
81 static void ConnectL(RSocketServ& arSocketServ, RSocket& arSocket, TSmsAddrFamily aSmsAddrFamily); |
|
82 |
|
83 //Write messages to a phone store |
|
84 void CopyToPhoneStoreL(const CMsvEntrySelection& aSelection, const TDesC8& aParameter, TRequestStatus& aStatus); |
|
85 void MoveToPhoneStoreL(const CMsvEntrySelection& aSelection, const TDesC8& aParameter, TRequestStatus& aStatus); |
|
86 private: |
|
87 CSmsSimUtils(CMsvServerEntry& aServerEntry, RFs& aFs, TMsvId aSmsServiceId); |
|
88 void ConstructL(); |
|
89 |
|
90 void ConstructHeaderAndBodyL(); |
|
91 void DoRunL(); |
|
92 void DoSmssCancel(); |
|
93 void DoComplete(TInt& aStatus); //from CSmssActive |
|
94 void ConnectL(); |
|
95 void RetrieveMessageFromPhoneStoreL(); |
|
96 void SetupMoveDeleteL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
97 void DoDeleteFromPhoneStoreL(); |
|
98 void DoDeleteThenMoveFromPhoneStoreL(); |
|
99 void DeleteEachMessageFromPhoneStoreL(); |
|
100 |
|
101 void SetDestination(const TDesC8& aParameter); |
|
102 void MoveEntriesL(const CMsvEntrySelection& aSelection, TBool aCopy=EFalse); |
|
103 |
|
104 //Count the messages in the phone stores |
|
105 void CountMessagesInPhoneStoresL(); |
|
106 void CreateBioDbL(); |
|
107 TBool GetDefaultSendBearerL(TInt aBioType, TBioMsgIdType aBearer, TBioMsgId& rBioMsgId) const; |
|
108 TUid DecodeBioMessageL(TBioMsgId& rId); |
|
109 void EncodeBioMessageL(); |
|
110 |
|
111 void DoRunReadSimParamsL(); |
|
112 |
|
113 void DoCopyToPhoneStoreL(); |
|
114 |
|
115 void StoreSimUtilsDataL(); |
|
116 void RestoreSimUtilsDataL(); |
|
117 TMsvId CreateNewEnumerateFolderL(); |
|
118 void SetAndCleanEnumerateFolderL(const TDesC8& aParameter); |
|
119 void DeleteChildrenL(TMsvId aId); |
|
120 void DeleteEnumerateFolderL(TMsvId aId); |
|
121 void LoadClass2FolderIdL(); |
|
122 void SetLocalStorageInfoL(const CMsvEntrySelection& aSelection); |
|
123 void RestoreSmsSettingsL(); |
|
124 |
|
125 private: |
|
126 |
|
127 enum TSmsSimUtilsState |
|
128 { |
|
129 ESimUtilsStateOther, |
|
130 ESimUtilsDeleteEachMessage, |
|
131 EWritingToSIM, |
|
132 EUpdatingClass2, |
|
133 EMovingEntries, |
|
134 ESimUtilsDeletedLastMessage |
|
135 } iState; |
|
136 |
|
137 RSocket iSocket; |
|
138 RSocketServ iSocketServ; |
|
139 |
|
140 TSmsProgress iProgress; |
|
141 CMsvEntrySelection* iSelection; |
|
142 |
|
143 //Enumerating Messages & Reading SMS Parameters |
|
144 TPckgBuf<TUint> iEnumerateCountBuf; |
|
145 RSmsSocketReadStream iReadStream; |
|
146 TMsvId iSmsServiceId; |
|
147 |
|
148 //Copy, Move, Delete messages from SIM |
|
149 CParaFormatLayer* iParaFormat; |
|
150 CCharFormatLayer* iCharFormat; |
|
151 CRichText* iBody; |
|
152 CSmsHeader* iHeader; |
|
153 TMsvId iDestination; |
|
154 CBIODatabase* iBioDb; |
|
155 CMsvEntrySelection* iCompletedSelection; |
|
156 TInt iRecipientCount; |
|
157 TInt iRecipientIndex; |
|
158 |
|
159 //Writing messages to phone stores and writing SMS Parameters |
|
160 RSmsSocketWriteStream iWriteStream; //< SMS socket write stream |
|
161 TBool iReadingSimParams; |
|
162 TSmsSimUtilsData iSimUtilsData; |
|
163 TMsvId iClass2Folder; |
|
164 CSmsSettings* iSettings; |
|
165 TBuf8<IoctlWriteSMSBufferSize> iSlotBuffer; |
|
166 CSmsGetDetDescInterface* iGetDetDesc; |
|
167 }; |
|
168 |
|
169 #include "SmssSimUtils.inl" |
|
170 |
|
171 #endif |