|
1 // Copyright (c) 2006-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 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <e32std.h> // error values |
|
20 #include <mmlist.h> |
|
21 #include "cmmsmsgsmext.h" |
|
22 #include <ctsy/tflogger.h> |
|
23 #include <ctsy/pluginapi/cmmdatapackage.h> |
|
24 #include "cmmphonetsy.h" |
|
25 #include <ctsy/serviceapi/cmmsmsutility.h> |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 CMmSmsGsmExt::CMmSmsGsmExt() |
|
30 { |
|
31 } |
|
32 |
|
33 CMmSmsGsmExt* CMmSmsGsmExt::NewL() |
|
34 { |
|
35 CMmSmsGsmExt* aSmsGsmExt = new ( ELeave ) CMmSmsGsmExt(); |
|
36 |
|
37 return aSmsGsmExt; |
|
38 } |
|
39 |
|
40 CMmSmsGsmExt::~CMmSmsGsmExt() |
|
41 { |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // CMmSmsGsmExt::CompleteReceiveMessage |
|
46 // This method takes reception of incoming unstored SMS |
|
47 // (other items were commented in a header). |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 TInt CMmSmsGsmExt::CompleteReceiveMessage( |
|
51 TSmsMsg* aSmsMsg, |
|
52 TAny* aReceiveMessageParamsPtr, |
|
53 TDes8* aReceiveMessagePduPtr ) |
|
54 { |
|
55 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg* msgAttPckg = |
|
56 reinterpret_cast< RMobileSmsMessaging:: |
|
57 TMobileSmsReceiveAttributesV1Pckg* > ( aReceiveMessageParamsPtr ); |
|
58 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1& msgAttributes = |
|
59 ( *msgAttPckg )(); |
|
60 |
|
61 // This information is available |
|
62 msgAttributes.iFlags = ( RMobileSmsMessaging::KSmsDataFormat | |
|
63 RMobileSmsMessaging::KGsmServiceCentre | |
|
64 RMobileSmsMessaging::KIncomingStatus ); |
|
65 |
|
66 // Message type |
|
67 msgAttributes.iDataFormat = RMobileSmsMessaging::EFormatGsmTpdu; |
|
68 |
|
69 // Lets handle Service Centre address |
|
70 msgAttributes.iGsmServiceCentre.iTypeOfNumber = aSmsMsg->iMobileScTON; |
|
71 msgAttributes.iGsmServiceCentre.iNumberPlan = aSmsMsg->iMobileScNPI; |
|
72 msgAttributes.iGsmServiceCentre.iTelNumber.Copy( |
|
73 aSmsMsg->iServiceCentre ); |
|
74 |
|
75 // Copy SMS TPDU |
|
76 aReceiveMessagePduPtr->Copy( aSmsMsg->iSmsMsg ); |
|
77 |
|
78 if ( KSimSmsNotPresent == aSmsMsg->iMessageStatus ) |
|
79 { |
|
80 TFLOGSTRING("TSY: CMmSmsGsmExt::CompleteReceiveMessage. Class 0, 1 or 3 message"); |
|
81 |
|
82 // SMS message that is routed directly to the TSY. This message is not |
|
83 // acknowledge to the network. |
|
84 msgAttributes.iStatus = |
|
85 RMobileSmsMessaging::EMtMessageUnstoredClientAck; |
|
86 // Reset store information |
|
87 msgAttributes.iStore.SetLength( 0 ); |
|
88 msgAttributes.iStoreIndex = 0; |
|
89 } |
|
90 else if ( aSmsMsg->iSmsClass2 && ( 0 != aSmsMsg->iLocation ) ) |
|
91 { |
|
92 TFLOGSTRING("TSY: CMmSmsGsmExt::CompleteReceiveMessage. Class 2 message stored in SIM"); |
|
93 // Class 2 SMS message that is stored in SIM. This message is |
|
94 // acknowledged to the network by SMS server. |
|
95 msgAttributes.iStatus = RMobileSmsMessaging::EMtMessageUnknownStatus; |
|
96 // Add storage information |
|
97 msgAttributes.iFlags |= RMobileSmsMessaging::KStorageLocation; |
|
98 msgAttributes.iStore = KETelIccSmsStore; |
|
99 msgAttributes.iStoreIndex = aSmsMsg->iLocation; |
|
100 } |
|
101 else |
|
102 { |
|
103 TFLOGSTRING("TSY: CMmSmsGsmExt::CompleteReceiveMessage. Class 2 message not stored in SIM"); |
|
104 // Class 2 SMS message that is not stored in SIM. This message is |
|
105 // acknowledged to the network by SMS server. |
|
106 msgAttributes.iStatus = |
|
107 RMobileSmsMessaging::EMtMessageUnstoredPhoneAck; |
|
108 |
|
109 // Reset store information |
|
110 msgAttributes.iStore.SetLength( 0 ); |
|
111 msgAttributes.iStoreIndex = 0; |
|
112 } |
|
113 |
|
114 return KErrNone; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CMmSmsGsmExt::MessageStoreInfo |
|
119 // This method set attributes values to the store info |
|
120 // (other items were commented in a header). |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 TInt CMmSmsGsmExt::MessageStoreInfo( |
|
124 TAny* aGetMessageStoreInfoPtr, |
|
125 TInt aTotalEntries, |
|
126 TInt aUsedEntries ) |
|
127 { |
|
128 RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg* storeInfoPckg = |
|
129 reinterpret_cast< RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg* > |
|
130 ( aGetMessageStoreInfoPtr ); |
|
131 RMobileSmsStore::TMobilePhoneStoreInfoV1& storeInfo = |
|
132 ( *storeInfoPckg )(); |
|
133 |
|
134 storeInfo.iName = KETelIccSmsStore; |
|
135 storeInfo.iType = RMobilePhoneStore::EShortMessageStore; |
|
136 storeInfo.iTotalEntries = aTotalEntries; |
|
137 storeInfo.iUsedEntries = aUsedEntries; |
|
138 storeInfo.iCaps = KSmsMessageStoreInfoCaps; |
|
139 |
|
140 return KErrNone; |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CMmSmsGsmExt::StoreInfo |
|
145 // This method set attributes values to the sms store info |
|
146 // (other items were commented in a header). |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 TInt CMmSmsGsmExt::StoreInfo( |
|
150 TAny* aGetInfoInfoPtr, |
|
151 TInt aTotalEntries, |
|
152 TInt aUsedEntries ) |
|
153 { |
|
154 RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg* storeInfoPckg = |
|
155 reinterpret_cast< RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg* > |
|
156 ( aGetInfoInfoPtr ); |
|
157 RMobileSmsStore::TMobilePhoneStoreInfoV1& storeInfo = |
|
158 ( *storeInfoPckg )(); |
|
159 |
|
160 storeInfo.iName = KETelIccSmsStore; |
|
161 storeInfo.iType = RMobilePhoneStore::EShortMessageStore; |
|
162 storeInfo.iTotalEntries = aTotalEntries; |
|
163 storeInfo.iUsedEntries = aUsedEntries; |
|
164 storeInfo.iCaps = KSmsStoreInfoCaps; |
|
165 |
|
166 return KErrNone; |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // CMmSmsGsmExt::CompleteReadAllSmsPhase1L |
|
171 // This method read the list, store its content and then return |
|
172 // size of this buffer to client. This methos runs until TSY's |
|
173 // internal SMS storage is empty |
|
174 // (other items were commented in a header). |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 TInt CMmSmsGsmExt::CompleteReadAllSmsPhase1L( |
|
178 CArrayPtrFlat<TSmsMsg>* aSmsListArray, |
|
179 RMobilePhone::TClientId aReadAllId, |
|
180 CArrayPtrFlat<CListReadAllAttempt>* aSmsReadAllArray, |
|
181 TInt* aReadAllBufSizePtr ) |
|
182 { |
|
183 TFLOGSTRING("TSY: CMmSmsGsmExt::CompleteReadAllSmsPhase1L"); |
|
184 // read the list, store its content and then return size of this |
|
185 // buffer to client |
|
186 CMobilePhoneGsmSmsList* list = CMobilePhoneGsmSmsList::NewL(); |
|
187 CleanupStack::PushL( list ); |
|
188 |
|
189 RMobileSmsStore::TMobileGsmSmsEntryV1 entry; |
|
190 |
|
191 for ( TInt i = 0; i < aSmsListArray->Count(); i++ ) |
|
192 { |
|
193 TSmsMsg* smsMsg = aSmsListArray->At( i ); |
|
194 |
|
195 // Lets handle Service Centre address |
|
196 entry.iServiceCentre.iTypeOfNumber = smsMsg->iMobileScTON; |
|
197 entry.iServiceCentre.iNumberPlan = smsMsg->iMobileScNPI; |
|
198 entry.iServiceCentre.iTelNumber.Copy( smsMsg->iServiceCentre ); |
|
199 |
|
200 // Lets copy location index |
|
201 entry.iIndex = smsMsg->iLocation; |
|
202 |
|
203 // TMobileSmsFixedEntryV1 information |
|
204 entry.iMsgData.Copy( smsMsg->iSmsMsg ); |
|
205 |
|
206 switch ( smsMsg->iMessageStatus ) |
|
207 { |
|
208 case KSimSmsMoNotSent: //0x07 |
|
209 entry.iMsgStatus = RMobileSmsStore::EStoredMessageUnsent; |
|
210 break; |
|
211 case KSimSmsStatusReportReqNotReceived: //0x0D |
|
212 case KSimSmsMoSent: //0x05 |
|
213 entry.iMsgStatus = RMobileSmsStore::EStoredMessageSent; |
|
214 break; |
|
215 case KSimSmsMtRead: //0x01 |
|
216 entry.iMsgStatus = RMobileSmsStore::EStoredMessageRead; |
|
217 break; |
|
218 case KSimSmsMtNotRead: //0x03 |
|
219 entry.iMsgStatus = RMobileSmsStore::EStoredMessageUnread; |
|
220 break; |
|
221 case KSimSmsStatusReportReqReceivedNotStored: //0x15 |
|
222 case KSimSmsStatusReportReqReceivedStored: //0x1D |
|
223 entry.iMsgStatus = RMobileSmsStore::EStoredMessageDelivered; |
|
224 break; |
|
225 default: |
|
226 entry.iMsgStatus = |
|
227 RMobileSmsStore::EStoredMessageUnknownStatus; |
|
228 break; |
|
229 } |
|
230 |
|
231 list->AddEntryL( entry ); |
|
232 |
|
233 // Delete handled SMS message from TSY's internal store |
|
234 delete smsMsg; // delete object |
|
235 } |
|
236 |
|
237 // Store the streamed list and the client ID |
|
238 CListReadAllAttempt* read = CListReadAllAttempt::NewL( &aReadAllId ); |
|
239 CleanupStack::PushL( read ); |
|
240 |
|
241 read->iListBuf = list->StoreLC(); |
|
242 CleanupStack::Pop(); // pop the CBufFlat allocated by StoreLC |
|
243 |
|
244 aSmsReadAllArray->AppendL( read ); |
|
245 CleanupStack::Pop(); // pop the CListReadAllAttempt |
|
246 |
|
247 // return the CBufFlat’s size to client |
|
248 *aReadAllBufSizePtr=( read->iListBuf )->Size(); |
|
249 |
|
250 CleanupStack::PopAndDestroy(list); |
|
251 |
|
252 return KErrNone; |
|
253 } |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // CMmSmsGsmExt::GetSupportedEntry |
|
257 // Return supported entry |
|
258 // (other items were commented in a header). |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 TInt CMmSmsGsmExt::GetSupportedEntry() |
|
262 { |
|
263 return RMobileSmsStore::KETelMobileGsmSmsEntryV1; |
|
264 } |
|
265 |
|
266 // End of File |