author | mikaruus |
Tue, 19 Oct 2010 13:16:20 +0300 | |
changeset 9 | 8486d82aef45 |
parent 8 | 6295dc2169f3 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
2 |
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 3 |
* All rights reserved. |
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
14 |
* Description: |
0 | 15 |
* |
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
// INCLUDE FILES |
|
21 |
#include "satmosmsctrl.h" // sat mo sms control class |
|
22 |
#include "satmessaging.h" // sat messaging class |
|
23 |
#include "satmesshandler.h" // sat message handler class |
|
24 |
#include "ber_tlv.h" // sat ber-tlv classes |
|
25 |
#include "satutil.h" // sat utility class |
|
26 |
||
27 |
#include <pn_const.h> // server id constants |
|
28 |
#include <tisi.h> // isi message |
|
29 |
#include <uiccisi.h> // UICC server |
|
30 |
#include <smsisi.h> // sms server |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
31 |
#include "OstTraceDefinitions.h" |
0 | 32 |
#ifdef OST_TRACE_COMPILER_IN_USE |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
33 |
#include "satmosmsctrlTraces.h" |
0 | 34 |
#endif |
35 |
||
36 |
||
37 |
||
38 |
// CONSTANTS |
|
39 |
const TUint8 KReservedTonNpi1 = 0x7F; |
|
40 |
const TUint8 KReservedTonNpi2 = 0xF7; |
|
41 |
const TUint8 KMaxLengthAddr1Addr2 = 249; |
|
42 |
const TUint8 KMaxLengthOfAtkSwDataNtf = 255; |
|
43 |
const TUint8 KMaxLengthOfResourceReq = 255; |
|
44 |
const TUint8 KSmControlAllowed = 0; |
|
45 |
const TUint8 KSmControlNotAllowed = 1; |
|
46 |
const TUint8 KSmControlAllowedWithModif = 2; |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
47 |
const TUint8 KSmsSubmitAddrDataIndex = 3; |
9 | 48 |
const TUint8 KMessageParamsIndex = 0; |
49 |
const TUint8 KCommandTypeMask = 0x03; |
|
50 |
const TUint8 KSmsCommandAddrIndex = 5; |
|
51 |
const TUint8 KSmsSubmitAddrIndex = 2; |
|
52 |
const TUint8 KTpDaTonNpiIndex = 1; |
|
53 |
const TUint8 KTpDaTonNpiSize = 1; |
|
0 | 54 |
|
55 |
// ==================== MEMBER FUNCTIONS ==================================== |
|
56 |
||
57 |
// ----------------------------------------------------------------------------- |
|
58 |
// CSatMoSmsCtrl::CSatMoSmsCtrl |
|
59 |
// C++ default constructor can NOT contain any code, that |
|
60 |
// might leave. |
|
61 |
// ----------------------------------------------------------------------------- |
|
62 |
// |
|
63 |
CSatMoSmsCtrl::CSatMoSmsCtrl |
|
64 |
( |
|
65 |
CSatMessHandler* aSatMessHandler, |
|
66 |
CTsySatMessaging* aSatMessaging |
|
67 |
) |
|
68 |
: |
|
69 |
iSatMessHandler( aSatMessHandler ), |
|
70 |
iSatMessaging( aSatMessaging ), |
|
71 |
iWaitingForEnvelopeResp( EFalse ), |
|
72 |
iIsMoSmsCtrlActivated( EFalse ), |
|
73 |
iMoSmsCtrlEnvelopeTransactionId( KZero ), |
|
74 |
iMoSmsCtrlReqTransactionId( KZero ), |
|
75 |
iSenderObject( KZero ) |
|
76 |
{ |
|
9 | 77 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_CSATMOSMSCTRL_TD, "CSatMoSmsCtrl::CSatMoSmsCtrl" ); |
0 | 78 |
} |
79 |
||
80 |
||
81 |
// ----------------------------------------------------------------------------- |
|
82 |
// CSatMoSmsCtrl::ConstructL |
|
83 |
// Symbian 2nd phase constructor can leave. |
|
84 |
// ----------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
void CSatMoSmsCtrl::ConstructL() |
|
87 |
{ |
|
9 | 88 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_CONSTRUCTL_TD, "CSatMoSmsCtrl::ConstructL" ); |
89 |
/*#ifdef INFO_PP_ATK_MO_SM_CONTROL |
|
0 | 90 |
// Check MO SMS control is supported by ME's Product Profile |
91 |
iSatMessHandler->InfoPpReadReq( INFO_PP_ATK_MO_SM_CONTROL ); |
|
92 |
#else |
|
93 |
// Check if MO-SMS control should be activated in SMS server |
|
94 |
// This is done by sending a request SimReadTableReq to Sim server, with |
|
95 |
// service type KSimStMoSmsSimControlAvail |
|
96 |
iSatMessHandler->SimReadTableReq( SIM_ST_MO_SMS_SIM_CONTROL_AVAIL ); |
|
9 | 97 |
#endif // INFO_PP_ATK_MO_SM_CONTROL*/ |
0 | 98 |
} |
99 |
||
100 |
||
101 |
// ----------------------------------------------------------------------------- |
|
102 |
// CSatMoSmsCtrl::NewL |
|
103 |
// Two-phased constructor. |
|
104 |
// ----------------------------------------------------------------------------- |
|
105 |
// |
|
106 |
CSatMoSmsCtrl* CSatMoSmsCtrl::NewL |
|
107 |
( |
|
108 |
CSatMessHandler* aSatMessHandler, |
|
109 |
CTsySatMessaging* aSatMessaging |
|
110 |
) |
|
111 |
{ |
|
9 | 112 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_NEWL_TD, "CSatMoSmsCtrl::NewL" ); |
0 | 113 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::NewL"); |
114 |
||
115 |
CSatMoSmsCtrl* self = |
|
116 |
new( ELeave ) CSatMoSmsCtrl( aSatMessHandler, aSatMessaging ); |
|
117 |
||
118 |
CleanupStack::PushL( self ); |
|
119 |
self->ConstructL(); |
|
120 |
CleanupStack::Pop( self ); |
|
121 |
||
122 |
return self; |
|
123 |
} |
|
124 |
||
125 |
||
126 |
// ----------------------------------------------------------------------------- |
|
127 |
// CSatMoSmsCtrl::~CSatMoSmsCtrl |
|
128 |
// Destructor |
|
129 |
// ----------------------------------------------------------------------------- |
|
130 |
// |
|
131 |
CSatMoSmsCtrl::~CSatMoSmsCtrl() |
|
132 |
{ |
|
9 | 133 |
OstTrace0( TRACE_NORMAL, DUP1_CSATMOSMSCTRL_CSATMOSMSCTRL_TD, "CSatMoSmsCtrl::~CSatMoSmsCtrl" ); |
0 | 134 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::~CSatMoSmsCtrl"); |
135 |
} |
|
136 |
||
137 |
||
138 |
// ----------------------------------------------------------------------------- |
|
139 |
// CSatMoSmsCtrl::IsActivated |
|
140 |
// Returns ETrue if MO-SMS Control is activated |
|
141 |
// ----------------------------------------------------------------------------- |
|
142 |
// |
|
143 |
TBool CSatMoSmsCtrl::IsActivated() |
|
144 |
{ |
|
9 | 145 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_ISACTIVATED_TD, "CSatMoSmsCtrl::IsActivated" ); |
0 | 146 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::IsActivated"); |
147 |
return iIsMoSmsCtrlActivated; |
|
148 |
} |
|
149 |
||
150 |
// ----------------------------------------------------------------------------- |
|
151 |
// CSatMoSmsCtrl::Activate |
|
152 |
// Set iIsMoSmsCtrlActivated to ETrue if MO-SMS Control has to be activated |
|
153 |
// ----------------------------------------------------------------------------- |
|
154 |
// |
|
155 |
void CSatMoSmsCtrl::Activate() |
|
156 |
{ |
|
9 | 157 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_ACTIVATE_TD, "CSatMoSmsCtrl::Activate" ); |
0 | 158 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::Activate"); |
159 |
iIsMoSmsCtrlActivated = ETrue; |
|
160 |
} |
|
161 |
||
162 |
// ----------------------------------------------------------------------------- |
|
163 |
// CSatMoSmsCtrl::Deactivate |
|
164 |
// Set iIsMoSmsCtrlActivated to EFalse if MO-SMS Control has to be deactivated |
|
165 |
// ----------------------------------------------------------------------------- |
|
166 |
// |
|
167 |
void CSatMoSmsCtrl::Deactivate() |
|
168 |
{ |
|
9 | 169 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_DEACTIVATE_TD, "CSatMoSmsCtrl::Deactivate" ); |
0 | 170 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::Deactivate"); |
171 |
iIsMoSmsCtrlActivated = EFalse; |
|
172 |
} |
|
173 |
||
174 |
// ----------------------------------------------------------------------------- |
|
175 |
// CSatMoSmsCtrl::UiccCatRespEnvelopeReceived |
|
176 |
// Handler function of incoming MO-SMS Control related data notification messages |
|
177 |
// ----------------------------------------------------------------------------- |
|
178 |
// |
|
179 |
TInt CSatMoSmsCtrl::UiccCatRespEnvelopeReceived |
|
180 |
( |
|
181 |
const TIsiReceiveC& aIsiMessage //Received data notification |
|
182 |
) |
|
183 |
{ |
|
9 | 184 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_UICCCATRESPENVELOPERECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived" ); |
0 | 185 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived"); |
186 |
TBuf8<KMaxLengthOfAtkSwDataNtf> addr1; |
|
187 |
TBuf8<KMaxLengthOfAtkSwDataNtf> addr2; |
|
188 |
iWaitingForEnvelopeResp = EFalse; |
|
189 |
||
190 |
TUint8 status( aIsiMessage.Get8bit( |
|
191 |
ISI_HEADER_SIZE + UICC_CAT_RESP_OFFSET_STATUS ) ); |
|
192 |
TBool simRespDataConsistent = ETrue; |
|
193 |
TUint8 resourceStatus = 0; |
|
194 |
TUint8 sw1( 0 ); |
|
195 |
TUint8 sw2( 0 ); |
|
196 |
TInt8 atkResult( 0 ); |
|
197 |
TUint8 numSb( 3 ); // Mandatory no of subblocks |
|
198 |
TBuf8<SIZE_SMS_RESOURCE_REQ+SIZE_SMS_SB_RESOURCE+SIZE_SMS_SB_RESOURCE_SEQ_ID+ |
|
199 |
SIZE_SMS_SB_ADDRESS+SMS_ADDRESS_MAX_LEN+SIZE_SMS_SB_TPDU_PACKING+ |
|
200 |
SMS_TPDU_MAX_LEN+SIZE_SMS_SB_CAUSE> dataResp; |
|
201 |
TIsiSend resourceReq( dataResp ); |
|
202 |
dataResp.AppendFill( KPadding, 1 ); // filler byte |
|
203 |
dataResp.Append( numSb ); // no of Subblocks |
|
204 |
||
205 |
if ( UICC_STATUS_OK == status ) |
|
206 |
{ |
|
207 |
TUint uiccSbApduOffset( 0 ); |
|
208 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
209 |
ISI_HEADER_SIZE + SIZE_UICC_CAT_RESP, |
|
210 |
UICC_SB_APDU, |
|
211 |
EIsiSubBlockTypeId16Len16, |
|
212 |
uiccSbApduOffset ) ) |
|
213 |
{ |
|
214 |
TPtrC8 apduData; |
|
215 |
TUint16 apduLength( aIsiMessage.Get16bit( |
|
216 |
uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDULENGTH ) ); |
|
217 |
apduData.Set( aIsiMessage.GetData( |
|
218 |
uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDU, |
|
219 |
apduLength ) ); |
|
220 |
// Status bytes are two last bytes in APDU |
|
221 |
sw1 = apduData[apduLength - 2]; |
|
222 |
sw2 = apduData[apduLength - 1]; |
|
223 |
// Get Call Control General Result |
|
224 |
atkResult = TSatUtility::Sw1Sw2Check( sw1, sw2 ); |
|
225 |
||
226 |
if ( KError != atkResult ) // If ATK result is OK |
|
227 |
{ |
|
228 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, Ok"); |
|
9 | 229 |
OstTrace0( TRACE_NORMAL, DUP1_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, Ok" ); |
0 | 230 |
RSat::TAlphaId alphaId; |
231 |
alphaId.iAlphaId.Zero(); |
|
232 |
TBool isAlphaIdEmpty( EFalse ); |
|
233 |
||
234 |
if ( KMaxLengthOfAtkSwDataNtf < apduLength ) // If data length greater than 255 |
|
235 |
{ |
|
236 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, the length of Sim resp data is > 255" ); |
|
9 | 237 |
OstTrace0( TRACE_NORMAL, DUP2_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, the length of Sim resp data is > 255" ); |
0 | 238 |
// Data is not consistent, so not allowed condition |
239 |
if( KSmControlNotAllowed == apduData[0] ) |
|
240 |
{ |
|
241 |
resourceStatus = SMS_RESOURCE_DENIED; |
|
242 |
} |
|
243 |
else |
|
244 |
{ |
|
245 |
resourceStatus = SMS_RESOURCE_ALLOWED; |
|
246 |
} |
|
247 |
FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 ); |
|
248 |
// Send resp to SMS server |
|
249 |
// Return to the calling function right now, even if it's not |
|
250 |
// a good thing to have several returns in the same method. |
|
251 |
// To avoid it, more if statements would be needed and |
|
252 |
// this doesn't make it any better. |
|
253 |
return ( iSatMessHandler->SendSmsResourceReq( |
|
254 |
iMoSmsCtrlReqTransactionId, |
|
255 |
dataResp, |
|
256 |
iSenderObject ) ); |
|
257 |
} |
|
258 |
else if ( apduLength ) // If data length in non zero and less than 255 |
|
259 |
{ |
|
260 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, atkData.Length()!=0 "); |
|
9 | 261 |
OstTrace0( TRACE_NORMAL, DUP3_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, atkData.Length()!=0 " ); |
0 | 262 |
|
263 |
// Note: The alpha id can be provided by the SIM even if the addresses |
|
264 |
// have not been modified. |
|
265 |
ParseAtkSwDataNtf( apduData, addr1, addr2, alphaId, isAlphaIdEmpty ); |
|
266 |
||
267 |
if ( KSmControlAllowedWithModif == apduData[0] ) |
|
268 |
{ |
|
269 |
simRespDataConsistent = VerifySimRespData( addr1, addr2 ); |
|
270 |
} |
|
271 |
if ( simRespDataConsistent ) |
|
272 |
{ |
|
273 |
if( KSmControlNotAllowed == apduData[0] ) |
|
274 |
{ |
|
275 |
resourceStatus = SMS_RESOURCE_DENIED; |
|
276 |
} |
|
277 |
else |
|
278 |
{ |
|
279 |
resourceStatus = SMS_RESOURCE_ALLOWED; |
|
280 |
} |
|
281 |
FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 ); |
|
282 |
TFLOGSTRING2("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, apduData[0]: %d",apduData[0] ); |
|
9 | 283 |
OstTrace1( TRACE_NORMAL, DUP4_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, apduData[0]: %d", apduData[0] ); |
0 | 284 |
} |
285 |
else |
|
286 |
{ |
|
287 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, Sim response data not consistent" ); |
|
9 | 288 |
OstTrace0( TRACE_NORMAL, DUP5_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, Sim response data not consistent" ); |
0 | 289 |
if( KSmControlNotAllowed == apduData[0] ) |
290 |
{ |
|
291 |
resourceStatus = SMS_RESOURCE_DENIED; |
|
292 |
} |
|
293 |
else |
|
294 |
{ |
|
295 |
resourceStatus = SMS_RESOURCE_ALLOWED; |
|
296 |
} |
|
297 |
FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 ); |
|
298 |
||
299 |
// Send resp to Sms server |
|
300 |
// Return to the calling function right now, even if it's not |
|
301 |
// a good thing to have several returns in the same method. |
|
302 |
// To avoid it, more if statements would be needed and |
|
303 |
// this doesn't make it any better. |
|
304 |
return ( iSatMessHandler->SendSmsResourceReq( |
|
305 |
iMoSmsCtrlReqTransactionId, |
|
306 |
dataResp, |
|
307 |
iSenderObject ) ); |
|
308 |
} |
|
309 |
} // end of if statement for data length nonzero and less than 255 |
|
310 |
else // block for data length zero |
|
311 |
{ |
|
312 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, atkData.Length()=0 "); |
|
9 | 313 |
OstTrace0( TRACE_NORMAL, DUP6_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, atkData.Length()=0" ); |
0 | 314 |
TUint8 resourceStatus( SMS_RESOURCE_ALLOWED ); |
315 |
FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 ); |
|
316 |
}// end of block with data length zero |
|
317 |
||
318 |
// If AlphaID is present, the client SatServer |
|
319 |
// must be notified in order to inform it that the ETel |
|
320 |
// API MO-SMS Control structure TMoSmControlV1 has been modified. |
|
321 |
if ( alphaId.iAlphaId.Length() || isAlphaIdEmpty ) |
|
322 |
{ |
|
323 |
// Inform client |
|
324 |
// Control result must be mapped to ETel API values. |
|
325 |
TUint8 controlResult; |
|
326 |
switch ( apduData[0] ) |
|
327 |
{ |
|
328 |
case KSmControlAllowed: |
|
329 |
{ |
|
330 |
controlResult = RSat::EAllowedNoModification; |
|
331 |
break; |
|
332 |
} |
|
333 |
case KSmControlAllowedWithModif: |
|
334 |
{ |
|
335 |
controlResult = RSat::EAllowedWithModifications; |
|
336 |
break; |
|
337 |
} |
|
338 |
case KSmControlNotAllowed: |
|
339 |
{ |
|
340 |
controlResult = RSat::ENotAllowed; |
|
341 |
break; |
|
342 |
} |
|
343 |
default: |
|
344 |
{ |
|
345 |
controlResult = RSat::EControlResultNotSet; |
|
346 |
break; |
|
347 |
} |
|
348 |
} |
|
349 |
iSatMessaging->NotifyClientAboutMoSmControlEvent( |
|
350 |
alphaId.iAlphaId, (RSat::TControlResult) controlResult ); |
|
351 |
} |
|
352 |
} |
|
353 |
} |
|
354 |
else // else for UICC status not ok |
|
355 |
{ |
|
356 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, KAtkError = atkResult "); |
|
9 | 357 |
OstTrace0( TRACE_NORMAL, DUP7_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, KAtkError = atkResult" ); |
0 | 358 |
TUint8 resourceStatus = SMS_RESOURCE_DENIED; |
359 |
FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 ); |
|
360 |
} |
|
361 |
} // end if if UICC status is ok |
|
362 |
||
363 |
// Send resp to Sms server |
|
364 |
return ( iSatMessHandler->SendSmsResourceReq( |
|
365 |
iMoSmsCtrlReqTransactionId, |
|
366 |
dataResp, |
|
367 |
iSenderObject ) ); |
|
368 |
} |
|
369 |
||
370 |
||
371 |
// ----------------------------------------------------------------------------- |
|
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
372 |
// CSatMoSmsCtrl::SmsResourceIndReceivedL |
0 | 373 |
// Request received from SMS server with the SMS parameters |
374 |
// of the SMS to be sent by the Mobile Equipment. |
|
375 |
// The response will tell whether the SMS can be sent |
|
376 |
// to network or not. |
|
377 |
// ----------------------------------------------------------------------------- |
|
378 |
// |
|
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
379 |
void CSatMoSmsCtrl::SmsResourceIndReceivedL |
0 | 380 |
( |
381 |
const TIsiReceiveC& aIsiMessage //Received data notification |
|
382 |
) |
|
383 |
{ |
|
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
384 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceivedL"); |
9 | 385 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_SMSRESOURCEINDRECEIVEDL_TD, "CSatMoSmsCtrl::SmsResourceIndReceivedL" ); |
0 | 386 |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
387 |
TUint sbOffset; |
0 | 388 |
|
389 |
// Save the transaction id, which is going to |
|
390 |
// be re-used in the resp. |
|
391 |
iMoSmsCtrlReqTransactionId = aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ); |
|
392 |
||
393 |
// Save the sender object id, in order to re-use it |
|
394 |
// in the response to this request |
|
395 |
iSenderObject = aIsiMessage.Get8bit( ISI_HEADER_OFFSET_SENDEROBJECT ); |
|
396 |
||
397 |
// Save Sequence id to send it in request message |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
398 |
if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
399 |
ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
400 |
SMS_SB_RESOURCE_SEQ_ID, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
401 |
EIsiSubBlockTypeId16Len16, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
402 |
sbOffset ) ) |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
403 |
{ |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
404 |
iSequenceId = aIsiMessage.Get8bit( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
405 |
sbOffset + SMS_SB_RESOURCE_SEQ_ID_OFFSET_SEQUENCEID ); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
406 |
} |
0 | 407 |
|
408 |
// save resource id to send it in request mesage |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
409 |
if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
410 |
ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
411 |
SMS_SB_RESOURCE, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
412 |
EIsiSubBlockTypeId16Len16, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
413 |
sbOffset ) ) |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
414 |
{ |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
415 |
iResourceId = aIsiMessage.Get16bit( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
416 |
sbOffset + SMS_SB_RESOURCE_OFFSET_RESOURCES ); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
417 |
} |
0 | 418 |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
419 |
// Save Service Centre Address Subblock to send it in request message if server has |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
420 |
//denied to access |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
421 |
if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
422 |
ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
423 |
SMS_SB_ADDRESS, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
424 |
EIsiSubBlockTypeId16Len16, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
425 |
sbOffset ) ) |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
426 |
{ |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
427 |
TUint8 addressLength = aIsiMessage.Get8bit( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
428 |
sbOffset + SMS_SB_ADDRESS_OFFSET_ADDRESSDATALENGTH ); |
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
429 |
// According to sms_isi specification |
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
430 |
__ASSERT_ALWAYS( |
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
431 |
2 <= addressLength && SMS_ADDRESS_MAX_LEN >= addressLength, |
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
432 |
User::Leave( KErrCorrupt ) ); |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
433 |
iAddressSubblock = aIsiMessage.GetData( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
434 |
sbOffset + SMS_SB_ADDRESS_OFFSET_ADDRESSDATA, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
435 |
addressLength ); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
436 |
} |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
437 |
else |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
438 |
{ |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
439 |
iAddressSubblock.Zero(); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
440 |
} |
0 | 441 |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
442 |
// Save TPDU to send it in request message if server has |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
443 |
// Denied the access for that address |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
444 |
if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
445 |
ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
446 |
SMS_SB_TPDU, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
447 |
EIsiSubBlockTypeId16Len16, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
448 |
sbOffset ) ) |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
449 |
{ |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
450 |
TUint8 tpduLength = |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
451 |
aIsiMessage.Get8bit( sbOffset + SMS_SB_TPDU_OFFSET_DATALENGTH ); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
452 |
iUserDataSubblock = aIsiMessage.GetData( |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
453 |
sbOffset + SMS_SB_TPDU_OFFSET_DATABYTES, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
454 |
tpduLength ); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
455 |
} |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
456 |
else |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
457 |
{ |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
458 |
iUserDataSubblock.Zero(); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
459 |
} |
0 | 460 |
|
9 | 461 |
//Check if location data is present. Otherwise response to SmsResourceInd |
462 |
//is always ALLOWED. |
|
463 |
if ( !iSatMessHandler->ServiceAvailable() ) |
|
464 |
{ |
|
465 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceivedL: Not Allowed Condition, Send response to SMS server"); |
|
466 |
OstTrace0( TRACE_NORMAL, DUP1_CSATMOSMSCTRL_SMSRESOURCEINDRECEIVEDL_TD, "CSatMoSmsCtrl::SmsResourceIndReceivedL: Not Allowed conditon, Send response to SMS server" ); |
|
0 | 467 |
|
9 | 468 |
SendSmsResourceReq( |
469 |
SMS_RESOURCE_ALLOWED, |
|
470 |
SMS_CAUSE_TYPE_COMMON, |
|
471 |
SMS_OK ); |
|
472 |
} |
|
473 |
else |
|
474 |
{ |
|
0 | 475 |
if( iIsMoSmsCtrlActivated ) // Check is MO SMS is activated or not |
476 |
{ |
|
9 | 477 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceivedL, Send envelope"); |
478 |
OstTrace0( TRACE_NORMAL, DUP3_CSATMOSMSCTRL_SMSRESOURCEINDRECEIVEDL_TD, "CSatMoSmsCtrl::SmsResourceIndReceivedL, Send envelope" ); |
|
0 | 479 |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
480 |
iMoSmsCtrlEnvelopeTransactionId = iSatMessaging->GetTransactionId(); |
9 | 481 |
FormMoSmsCtrlEnvelope(); |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
482 |
} |
0 | 483 |
else // If MO SMS is not activated |
484 |
{ |
|
9 | 485 |
SendSmsResourceReq( |
486 |
SMS_RESOURCE_DENIED, |
|
487 |
SMS_CAUSE_TYPE_COMMON, |
|
488 |
SMS_ERR_ROUTE_NOT_ALLOWED ); |
|
0 | 489 |
} |
490 |
} |
|
491 |
} |
|
492 |
||
493 |
// ----------------------------------------------------------------------------- |
|
494 |
// CSatMoSmsCtrl::SendMoSmsCtrlEnvelope |
|
495 |
// Send an envelope to SIM server in order to check wheter the SMS |
|
496 |
// can be sent or not. The response will be used to send a response |
|
497 |
// to SMS server |
|
498 |
// ----------------------------------------------------------------------------- |
|
499 |
// |
|
500 |
void CSatMoSmsCtrl::SendMoSmsCtrlEnvelope |
|
501 |
( |
|
502 |
TUint8 aTraId, |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
503 |
const TDesC8& aAddressData1, |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
504 |
const TDesC8& aAddressData2 |
0 | 505 |
) |
506 |
{ |
|
9 | 507 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_SENDMOSMSCTRLENVELOPE_TD, "CSatMoSmsCtrl::SendMoSmsCtrlEnvelope" ); |
0 | 508 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::SendMoSmsCtrlEnvelope"); |
509 |
||
510 |
// Get location info |
|
511 |
const CSatMessHandler::TLocationInfo& locInfo |
|
512 |
= iSatMessHandler->LocationInfo(); |
|
513 |
||
514 |
// A SwDataNtf is expected later |
|
515 |
iWaitingForEnvelopeResp = ETrue; |
|
516 |
||
517 |
TTlv envelope; |
|
518 |
||
519 |
envelope.Begin( KBerTlvMoShortMessageControlTag ); |
|
520 |
//device identities |
|
521 |
envelope.AddTag( KTlvDeviceIdentityTag ); |
|
522 |
envelope.AddByte( KMe ); |
|
523 |
envelope.AddByte( KSim ); |
|
524 |
// Address Data object 1 |
|
525 |
// Ton and Npi is in the first byte of address data |
|
526 |
envelope.AddTag( KTlvAddressTag ); |
|
527 |
envelope.AddData( aAddressData1 ); |
|
528 |
// Address Data object 2 |
|
529 |
// Ton and Npi is in the first byte of address data |
|
530 |
envelope.AddTag( KTlvAddressTag ); |
|
531 |
envelope.AddData( aAddressData2 ); |
|
532 |
// Location info |
|
533 |
envelope.AddTag(KTlvLocationInformationTag); |
|
534 |
||
535 |
// This part assumes that location info (NetCellInfoInd) |
|
536 |
// has been received |
|
537 |
// Mobile Country & Network Codes (MCC & MNC) |
|
538 |
envelope.AddData( locInfo.iOperatorCode ); |
|
539 |
// Location Area Code (LAC) |
|
540 |
envelope.AddData( locInfo.iLac ); |
|
541 |
// Cell Id |
|
542 |
envelope.AddData( locInfo.iCellId ); |
|
543 |
||
544 |
||
545 |
// Send envelope only if its length is less than the maximum allowed |
|
546 |
// envelope length. |
|
547 |
||
548 |
iSatMessHandler->UiccCatReqEnvelope( aTraId, envelope.End() ); |
|
549 |
||
550 |
} |
|
551 |
||
552 |
// ----------------------------------------------------------------------------- |
|
553 |
// CSatMoSmsCtrl::ParseAtkSwDataNtf |
|
554 |
// Extracts data from AtkSwDataNtf message data part. |
|
555 |
// ----------------------------------------------------------------------------- |
|
556 |
// |
|
557 |
void CSatMoSmsCtrl::ParseAtkSwDataNtf |
|
558 |
( |
|
559 |
TPtrC8& aAtkData, |
|
560 |
TDes8& aAddr1, |
|
561 |
TDes8& aAddr2, |
|
562 |
RSat::TAlphaId& aAlphaId, |
|
563 |
TBool& aEmptyAlphaId |
|
564 |
) |
|
565 |
{ |
|
9 | 566 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_PARSEATKSWDATANTF_TD, "CSatMoSmsCtrl::ParseAtkSwDataNtf" ); |
0 | 567 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::ParseAtkSwDataNtf"); |
568 |
||
569 |
// Input data: |
|
570 |
// aAtkData[0] : result |
|
571 |
// aAtkData[1][2] : length of BER-TLV, set n=1 if aAtkData[1]=0x81 |
|
572 |
// aAtkData[2+n] : tag of first TLV |
|
573 |
// aAtkData[3+n][4+n] : length of first TLV, set nn=1 if aAtkData[3+n]=0x81 |
|
574 |
// etc.. |
|
575 |
||
576 |
// Comments drawn from SAT TS lab test cases: |
|
577 |
// - The SIM may insert a wild '0xD' character in addresses and therefore |
|
578 |
// the phone sw should prevent the sending of the SMS. At the time when this |
|
579 |
// comment is being written, it is not clear which part prevents it, and does |
|
580 |
// it really prevent it ? And this is not yet handled in SimAtkTsy. |
|
581 |
// - The SIM may insert a 0xF in addresses, and the phone sw should discard |
|
582 |
// all characters placed after the 0xF. At the time when this |
|
583 |
// comment is being written, it is not clear which part should do that, |
|
584 |
// and this is not yet handled in SimAtkTsy. |
|
585 |
||
586 |
// Check if the BER-TLV length is coded with 2 bytes. |
|
587 |
TInt indexInBerTlv( 1 ); |
|
588 |
TUint8 tag( aAtkData[indexInBerTlv] ); |
|
589 |
TUint8 lengthBerTlv( 0 ); |
|
590 |
TInt n( (KTwoByteLengthCoding == tag)?1:0 ); |
|
591 |
lengthBerTlv = aAtkData[1 + n]; |
|
592 |
indexInBerTlv = 2 + n; |
|
9 | 593 |
// MO SMS control result |
594 |
TUint8 moSmsResult( aAtkData[0] ); |
|
0 | 595 |
// Extract TLVs and fill in output variables |
596 |
TBool address1_got( EFalse ); |
|
597 |
while( lengthBerTlv ) |
|
598 |
{ |
|
599 |
// Get tag value without 'comprehension required' bit |
|
600 |
tag = aAtkData[indexInBerTlv]&0x7F; |
|
601 |
// Length of TLV with 2 bytes ? |
|
602 |
TInt nn( ( KTwoByteLengthCoding == aAtkData[indexInBerTlv+1] )?1:0 ); |
|
603 |
// Length of TLV |
|
604 |
TInt lengthTlv( aAtkData[indexInBerTlv+nn+1] ); |
|
605 |
// Check what TLV is received |
|
606 |
if ( ( KTlvAddressTag == tag ) |
|
9 | 607 |
&& ( !address1_got ) |
608 |
&& KSmControlAllowedWithModif == moSmsResult ) |
|
0 | 609 |
{ |
610 |
// RP address first |
|
611 |
address1_got = ETrue; |
|
612 |
// Copy data to output variable |
|
613 |
aAddr1.Copy( aAtkData.Mid( indexInBerTlv + nn + 2, |
|
614 |
lengthTlv ) ); |
|
615 |
if ( (1<lengthTlv) && |
|
616 |
KReservedTonNpi1!=aAddr1[0] && KReservedTonNpi2!=aAddr1[0] ) |
|
617 |
{ |
|
618 |
CleanAddressData( aAddr1 ); |
|
619 |
} |
|
620 |
} |
|
9 | 621 |
else if ( KTlvAddressTag == tag |
622 |
&& KSmControlAllowedWithModif == moSmsResult ) |
|
0 | 623 |
{ |
624 |
// TP address |
|
625 |
// Copy data to output variable |
|
626 |
aAddr2.Copy( aAtkData.Mid( indexInBerTlv + nn + 2, |
|
627 |
lengthTlv ) ); |
|
628 |
if ( (1<lengthTlv) && |
|
629 |
KReservedTonNpi1!=aAddr2[0] && KReservedTonNpi2!=aAddr2[0] ) |
|
630 |
{ |
|
631 |
CleanAddressData( aAddr2 ); |
|
632 |
} |
|
633 |
} |
|
634 |
else if ( KTlvAlphaIdentifierTag == tag ) |
|
635 |
{ |
|
636 |
// Alpha Id |
|
637 |
// Alpha id must be converted to TBuf16/unicode |
|
638 |
if ( lengthTlv ) |
|
639 |
{ |
|
640 |
TSatUtility::SetAlphaId( aAtkData.Mid( indexInBerTlv + nn + 2, |
|
641 |
lengthTlv ), aAlphaId.iAlphaId ); |
|
642 |
} |
|
643 |
else |
|
644 |
{ |
|
645 |
aEmptyAlphaId = ETrue; |
|
646 |
} |
|
647 |
||
648 |
} |
|
649 |
else |
|
650 |
{ |
|
651 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::ParseAtkSwDataNtf, Tlv tag was not address/alpha id tag."); |
|
9 | 652 |
OstTrace0( TRACE_NORMAL, DUP1_CSATMOSMSCTRL_PARSEATKSWDATANTF_TD, "CSatMoSmsCtrl::ParseAtkSwDataNtf, Tlv tag was not address/alpha id tag." ); |
0 | 653 |
|
654 |
} |
|
655 |
||
656 |
// update length for the while loop |
|
657 |
lengthBerTlv -= ( lengthTlv+2+nn ); |
|
658 |
// updata index for the while loop |
|
659 |
indexInBerTlv += ( lengthTlv+2+nn ); |
|
660 |
} |
|
661 |
} |
|
662 |
||
663 |
// ----------------------------------------------------------------------------- |
|
664 |
// CSatMoSmsCtrl::CleanAddressData |
|
665 |
// This method cleans the input address data, so that all the bytes found |
|
666 |
// after a 0xXF or a 0xFX are removed. |
|
667 |
// ----------------------------------------------------------------------------- |
|
668 |
// |
|
669 |
void CSatMoSmsCtrl::CleanAddressData |
|
670 |
( |
|
671 |
TDes8& aAddr |
|
672 |
) |
|
673 |
{ |
|
9 | 674 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_CLEANADDRESSDATA_TD, "CSatMoSmsCtrl::CleanAddressData" ); |
0 | 675 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::CleanAddressData"); |
676 |
// Starts from index 1, since index 0 is for TON/NPI |
|
677 |
for ( TInt i=1; i < aAddr.Length(); i++ ) |
|
678 |
{ |
|
679 |
if ( 0xF0==(aAddr[i]&0xF0) ) |
|
680 |
{ |
|
681 |
if ( ( i+1 ) < aAddr.Length() ) |
|
682 |
{ |
|
683 |
aAddr.Delete( i+1, aAddr.Length() - i - 1 ); |
|
684 |
} |
|
685 |
break; |
|
686 |
} |
|
687 |
else if ( 0x0F==(aAddr[i]&0x0F) ) |
|
688 |
{ |
|
689 |
aAddr.Delete( i, aAddr.Length() - i ); |
|
690 |
break; |
|
691 |
} |
|
692 |
} |
|
693 |
||
694 |
} |
|
695 |
||
696 |
// ----------------------------------------------------------------------------- |
|
697 |
// CSatMoSmsCtrl::VerifySimRespData |
|
698 |
// This method checks the consistency of the data sent by the SIM to the ME, |
|
699 |
// when the call is allowed and modified. |
|
700 |
// ----------------------------------------------------------------------------- |
|
701 |
// |
|
702 |
TBool CSatMoSmsCtrl::VerifySimRespData |
|
703 |
( |
|
704 |
TDes8& aRPAddr, |
|
705 |
TDes8& aTPAddr |
|
706 |
) |
|
707 |
{ |
|
9 | 708 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_VERIFYSIMRESPDATA_TD, "CSatMoSmsCtrl::VerifySimRespData" ); |
0 | 709 |
TBool ret( ETrue ); |
710 |
if ( ( 0==aRPAddr.Length() && 0==aTPAddr.Length() ) |
|
711 |
|| ( KMaxLengthAddr1Addr2 <= ( aRPAddr.Length()+aTPAddr.Length() ) ) |
|
712 |
) |
|
713 |
{ |
|
714 |
ret = EFalse; |
|
715 |
} |
|
716 |
else |
|
717 |
{ |
|
718 |
// detect the presence of 'wild' values in the digits of the addresses |
|
719 |
for ( TInt i=0; i<aRPAddr.Length(); i++) |
|
720 |
{ |
|
721 |
if ( ( 0xA<(0x0F&aRPAddr[i]) && 0xF>(0x0F&aRPAddr[i]) ) |
|
722 |
||( 0xA0<(0xF0&aRPAddr[i]) && 0xF0>(0xF0&aRPAddr[i]) ) ) |
|
723 |
{ |
|
724 |
ret = EFalse; |
|
725 |
break; |
|
726 |
} |
|
727 |
} |
|
728 |
for ( TInt i=0; i<aTPAddr.Length(); i++) |
|
729 |
{ |
|
730 |
if ( ( 0x9<(0x0F&aTPAddr[i]) && 0xF>(0x0F&aTPAddr[i]) ) |
|
731 |
||( 0x90<(0xF0&aTPAddr[i]) && 0xF0>(0xF0&aTPAddr[i]) ) ) |
|
732 |
{ |
|
733 |
ret = EFalse; |
|
734 |
break; |
|
735 |
} |
|
736 |
} |
|
737 |
} |
|
738 |
return ret; |
|
739 |
} |
|
740 |
||
741 |
// ----------------------------------------------------------------------------- |
|
742 |
// CSatMoSmsCtrl::FormSmsResourceReqSb |
|
743 |
// Form subblock of SMS_RESOURCE_REQ |
|
744 |
// ----------------------------------------------------------------------------- |
|
745 |
// |
|
746 |
||
747 |
void CSatMoSmsCtrl::FormSmsResourceReqSb |
|
748 |
(const TUint8 status, |
|
749 |
TDes8& data, |
|
750 |
const TDes8& address1, |
|
751 |
const TDes8& address2 |
|
752 |
) |
|
753 |
{ |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
754 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::FormSmsResourceReqSb"); |
0 | 755 |
// First three mandatory subblocks |
756 |
TIsiSubBlock resource( data, SMS_SB_RESOURCE , |
|
757 |
EIsiSubBlockTypeId16Len16 ); // Message ID and Subblock length |
|
758 |
data.Append( iResourceId >> 8 ); // SMS resource IDs MSB same as received in indication |
|
759 |
data.Append( iResourceId ); // SMS resource IDs LSB |
|
760 |
resource.CompleteSubBlock(); |
|
761 |
||
762 |
// Add Sequence ID subblock |
|
763 |
||
764 |
TIsiSubBlock resourceSeqId( data, SMS_SB_RESOURCE_SEQ_ID , |
|
765 |
EIsiSubBlockTypeId16Len16 ); |
|
766 |
data.Append( iSequenceId ); // Sequence ID same as received in indication message |
|
767 |
resourceSeqId.CompleteSubBlock(); |
|
768 |
||
769 |
// Add Resource Status subblock |
|
770 |
||
771 |
TIsiSubBlock resourceStatus( data, SMS_SB_RESOURCE_STATUS , |
|
772 |
EIsiSubBlockTypeId16Len16 ); |
|
773 |
data.Append( status ); // Resource status |
|
774 |
resourceStatus.CompleteSubBlock(); |
|
775 |
||
776 |
if(iIsMoSmsCtrlActivated) |
|
777 |
{ |
|
778 |
//Resource is disallowed || Resource is allowed without modification |
|
779 |
if((SMS_RESOURCE_ALLOWED != status)||(0 == address1.Length())) |
|
780 |
{ |
|
781 |
// Increment subblock |
|
782 |
data[1]++; |
|
783 |
// Copy address subblocks from Indication message |
|
784 |
// Add Address Subblock |
|
9 | 785 |
TIsiSubBlock address( |
786 |
data, |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
787 |
SMS_SB_ADDRESS , |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
788 |
EIsiSubBlockTypeId16Len16 ); |
0 | 789 |
data.Append( SMS_SMSC_ADDRESS ); // Address type |
790 |
data.Append( iAddressSubblock.Length() ); // Address data length |
|
791 |
data.Append( iAddressSubblock ); |
|
792 |
// Filler Bytes calculation |
|
793 |
address.CompleteSubBlock(); |
|
794 |
||
795 |
// increment subblock |
|
796 |
data[1]++; |
|
797 |
// Add User Data Subblock |
|
9 | 798 |
TIsiSubBlock userData( |
799 |
data, |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
800 |
SMS_SB_TPDU , |
0 | 801 |
EIsiSubBlockTypeId16Len16 ); |
802 |
data.Append( iUserDataSubblock.Length() ); // data Length |
|
803 |
data.Append( KPadding ); // Filler Byte |
|
804 |
data.Append( iUserDataSubblock ); // Data Bytes |
|
805 |
userData.CompleteSubBlock(); |
|
806 |
} |
|
807 |
else |
|
808 |
{ |
|
809 |
// when resource is allowed with modification |
|
810 |
// then copy SIM data in address subblock |
|
811 |
if ( address1.Length() ) |
|
812 |
{ |
|
813 |
// Add Address subblock |
|
814 |
data[1]++; // increase no of subblocks |
|
815 |
||
9 | 816 |
TIsiSubBlock address( |
817 |
data, |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
818 |
SMS_SB_ADDRESS , |
0 | 819 |
EIsiSubBlockTypeId16Len16 ); |
820 |
data.Append(SMS_SMSC_ADDRESS); // Address Type |
|
821 |
||
822 |
// Data in bytes |
|
823 |
// First byte is the address length in 3GPP, GSM_0411 format |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
824 |
// "data length in bytes, including TON & NPI". |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
825 |
data.Append( address1.Length() + 1 ); |
9 | 826 |
// Actual address data. |
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
827 |
data.Append( address1.Length()); |
9 | 828 |
data.Append( address1 ); |
0 | 829 |
address.CompleteSubBlock(); |
830 |
} // end of Service centre Address Subblock |
|
831 |
||
832 |
// Add subblock for Address2 (Destination address, TP) if present |
|
833 |
if ( address2.Length() ) |
|
834 |
{ |
|
835 |
// Add subblock |
|
836 |
data[1]++; |
|
837 |
||
838 |
// For User Data Subblock |
|
9 | 839 |
TIsiSubBlock userDataSb( |
840 |
data, |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
841 |
SMS_SB_TPDU, |
0 | 842 |
EIsiSubBlockTypeId16Len16 ); |
843 |
||
844 |
// Check what type of TPDU to be sent |
|
845 |
switch( iMessageType ) |
|
846 |
{ |
|
847 |
case KSmsCommandType: |
|
848 |
{ |
|
849 |
// Data in bytes |
|
850 |
// First byte is the address length in 3GPP, GSM_0340 format |
|
851 |
// "number of useful semioctets ( = digits ), excluding TON & NPI " |
|
852 |
||
853 |
if ( 1 == address2.Length() || |
|
854 |
( 1 < address2.Length() && |
|
855 |
( KReservedTonNpi1 == address2[0] |
|
856 |
|| KReservedTonNpi2 == address2[0] ) ) |
|
857 |
) |
|
858 |
{ |
|
859 |
// Only Ton&Npi is present |
|
860 |
// or TON&NPI has a reserved value |
|
861 |
iUserDataSubblock[6] = 0x00; |
|
862 |
} |
|
863 |
else if ( 0xF0 == ( address2[address2.Length() - 1] & 0xF0 ) ) |
|
864 |
{ |
|
865 |
// Odd length destination address |
|
866 |
// Destination address length ( in semioctets ) |
|
867 |
iUserDataSubblock[5] = ( ( address2.Length() * 2 ) - 1 ); |
|
868 |
} |
|
869 |
else |
|
870 |
{ |
|
871 |
// Even length destination address |
|
872 |
iUserDataSubblock[5] = ( address2.Length() * 2 ); |
|
873 |
} |
|
874 |
||
875 |
||
876 |
for( TUint8 i = 0; i < address2.Length(); i++) |
|
877 |
{ |
|
878 |
iUserDataSubblock[i+6] = address2[i]; |
|
879 |
} |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
880 |
break; |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
881 |
} |
0 | 882 |
case KSmsSubmitType: |
883 |
{ |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
884 |
TUint8 oldAddrLen( ( iUserDataSubblock[ 2 ] + 1 ) / 2 ); |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
885 |
// Data in bytes |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
886 |
// First byte is the address length in 3GPP, GSM_0340 format |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
887 |
// "number of useful semioctets ( = digits ), excluding TON & NPI " |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
888 |
if ( 1 == address2.Length() || |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
889 |
( 1 < address2.Length() && |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
890 |
( KReservedTonNpi1 == address2[0] |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
891 |
|| KReservedTonNpi2 == address2[0] ) ) |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
892 |
) |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
893 |
{ |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
894 |
// Only Ton&Npi is present |
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
895 |
// or TON&NPI has a reserved value |
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
896 |
iUserDataSubblock[2] = 0x00; |
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
897 |
} |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
898 |
else if ( 0xF0 == ( address2[address2.Length() - 1] & 0xF0 ) ) |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
899 |
{ |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
900 |
// Odd length destination address |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
901 |
// Destination address lenght ( in semioctets ) |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
902 |
iUserDataSubblock[2] = ( ( ( address2.Length() - 1 ) * 2 ) - 1 ); |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
903 |
} |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
904 |
else |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
905 |
{ |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
906 |
// Even length destination address |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
907 |
iUserDataSubblock[2] = ( ( address2.Length() - 1 ) * 2 ); |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
908 |
} |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
909 |
|
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
910 |
// old addresss needs to be deleted before new one can be inserted |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
911 |
// to the tpdu |
9 | 912 |
iUserDataSubblock.Delete( |
913 |
KSmsSubmitAddrDataIndex, |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
914 |
oldAddrLen + 1 ); |
9 | 915 |
iUserDataSubblock.Insert( |
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
916 |
KSmsSubmitAddrDataIndex, |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
917 |
address2 ); |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
918 |
break; |
0 | 919 |
} |
920 |
default: |
|
921 |
{ |
|
922 |
break; |
|
923 |
} |
|
924 |
} |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
925 |
data.Append( iUserDataSubblock.Length() ); |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
926 |
data.Append( KPadding ); // Filler Byte |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
927 |
data.Append( iUserDataSubblock ); |
0 | 928 |
userDataSb.CompleteSubBlock(); |
929 |
} |
|
930 |
} |
|
931 |
if( SMS_RESOURCE_DENIED == status ) |
|
932 |
{ |
|
933 |
// Add SMS_SB_CAUSE subblock |
|
934 |
data[1]++; //Increment no of subblocks |
|
9 | 935 |
TIsiSubBlock cause( |
936 |
data, |
|
7
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
937 |
SMS_SB_CAUSE , |
fa67e03b87df
New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
5
diff
changeset
|
938 |
EIsiSubBlockTypeId16Len16 ); |
0 | 939 |
data.Append( SMS_CAUSE_TYPE_COMMON ); // Cause type |
940 |
data.Append( SMS_ERR_ROUTE_NOT_ALLOWED ); // Cause |
|
941 |
cause.CompleteSubBlock(); |
|
942 |
} |
|
943 |
} |
|
944 |
} |
|
945 |
// ----------------------------------------------------------------------------- |
|
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
946 |
// CSatMoSmsCtrl::MessageReceivedL |
0 | 947 |
// Handle received messages related to MO-SMS Control |
948 |
// ----------------------------------------------------------------------------- |
|
949 |
// |
|
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
950 |
TInt CSatMoSmsCtrl::MessageReceivedL |
0 | 951 |
( |
952 |
const TIsiReceiveC& aIsiMessage |
|
953 |
) |
|
954 |
{ |
|
9 | 955 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_MESSAGERECEIVED_TD, "CSatMoSmsCtrl::MessageReceived" ); |
0 | 956 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::MessageReceived"); |
957 |
// SMS server -> SimAtkTsy : MO-SMS request sent to SAT (KSmsResourceReq) |
|
958 |
// UICC server <- SimAtkTsy : Envelope sent to UICC server (KAtkEnvelopeNtf) |
|
959 |
// UICC server -> SimAtkTsy : AtkSwNtf send to SAT, with modified (or not) |
|
960 |
// addresses and parameters (KAtkSwDataNtf) |
|
961 |
// SMS server <- SimAtkTsy : SAT sends final decision to SMS server |
|
962 |
// with modified (or not) addresses and parameters |
|
963 |
// (KSmsResourceResp) |
|
964 |
||
965 |
// Note: When SendSms proactive command is issued, and MO-SMS control |
|
966 |
// does not allow sending the SMS, then a terminal response with general result |
|
967 |
// "interaction with call control by SIM or MO short message control by SIM, |
|
968 |
// action not allowed". |
|
969 |
TUint8 resource = aIsiMessage.Get8bit( ISI_HEADER_OFFSET_RESOURCEID ); |
|
970 |
||
971 |
if ( PN_SMS == resource ) |
|
972 |
{ |
|
973 |
switch ( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) ) |
|
974 |
{ |
|
975 |
case SMS_RESOURCE_IND: |
|
976 |
{ |
|
8
6295dc2169f3
New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
7
diff
changeset
|
977 |
SmsResourceIndReceivedL( aIsiMessage ); |
0 | 978 |
break; |
979 |
} |
|
980 |
case SMS_RESOURCE_RESP: |
|
981 |
{ |
|
982 |
// Take a log |
|
983 |
TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceRespReceived: Response for Resource Req, Receive response from SMS server"); |
|
9 | 984 |
OstTrace0( TRACE_NORMAL, DUP1_CSATMOSMSCTRL_SMSRESOURCERESPRECEIVED_TD, "CSatMoSmsCtrl::SmsResourceRespReceived: Response for Resource Req, Receive response from SMS server" ); |
0 | 985 |
|
986 |
break; |
|
987 |
} |
|
988 |
default: |
|
989 |
{ |
|
990 |
// none |
|
991 |
break; |
|
992 |
} |
|
993 |
} |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
994 |
|
0 | 995 |
} |
996 |
else if ( PN_UICC == resource ) |
|
997 |
{ |
|
998 |
switch( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) ) |
|
999 |
{ |
|
1000 |
case UICC_CAT_RESP: |
|
1001 |
{ |
|
1002 |
// In case of envelope response handle the data |
|
1003 |
TUint8 serviceType( |
|
1004 |
aIsiMessage.Get8bit( |
|
1005 |
ISI_HEADER_SIZE + UICC_CAT_RESP_OFFSET_SERVICETYPE ) ); |
|
1006 |
if ( UICC_CAT_ENVELOPE == serviceType ) |
|
1007 |
{ |
|
1008 |
if ( iWaitingForEnvelopeResp && |
|
1009 |
( iMoSmsCtrlEnvelopeTransactionId == |
|
1010 |
aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) ) ) |
|
1011 |
{ |
|
1012 |
// Set flag iWaitingForEnvelopeResp false |
|
1013 |
// since a response is received for the envelope |
|
1014 |
// that was sent for a received sms-pp message |
|
1015 |
iWaitingForEnvelopeResp = EFalse; |
|
1016 |
UiccCatRespEnvelopeReceived( aIsiMessage ); |
|
1017 |
} |
|
1018 |
} |
|
1019 |
break; |
|
1020 |
} |
|
1021 |
default: |
|
1022 |
{ |
|
1023 |
break; |
|
1024 |
} |
|
1025 |
} |
|
1026 |
} |
|
1027 |
return KErrNone; |
|
1028 |
} |
|
1029 |
||
9 | 1030 |
// ----------------------------------------------------------------------------- |
1031 |
// CSatMoSmsCtrl::SendSmsResourceReq |
|
1032 |
// Constructs and sends SMS_RESOURCE_REQ |
|
1033 |
// ----------------------------------------------------------------------------- |
|
1034 |
// |
|
1035 |
void CSatMoSmsCtrl::SendSmsResourceReq( |
|
1036 |
TUint8 aResourceStatus, |
|
1037 |
TUint8 aCauseType, |
|
1038 |
TUint8 aCause ) |
|
1039 |
{ |
|
1040 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::SendSmsResourceReq"); |
|
1041 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_SENDSMSRESOURCEREQ_TD, "CSatMoSmsCtrl::SendSmsResourceReq" ); |
|
1042 |
||
1043 |
TBuf8<KMaxLengthOfResourceReq> dataResp; |
|
1044 |
TIsiSend resourceReq( dataResp ); |
|
1045 |
||
1046 |
dataResp.AppendFill( KPadding, 1 ); // filler byte |
|
1047 |
TUint8 sbCount( 0 ); |
|
1048 |
if ( SMS_RESOURCE_ALLOWED == aResourceStatus ) |
|
1049 |
{ |
|
1050 |
sbCount = 5; // in ok case there are 5 subblocks |
|
1051 |
} |
|
1052 |
else |
|
1053 |
{ |
|
1054 |
sbCount = 4; // otherwise 4 |
|
1055 |
} |
|
1056 |
dataResp.Append( sbCount ); // no of Subblocks |
|
1057 |
||
1058 |
// Add first SB Resource Subblock |
|
1059 |
TIsiSubBlock resource( |
|
1060 |
dataResp, |
|
1061 |
SMS_SB_RESOURCE , |
|
1062 |
EIsiSubBlockTypeId16Len16 ); // Message ID and Subblock length |
|
1063 |
||
1064 |
dataResp.Append( iResourceId >> 8 ); // SMS Resource IDs MSB |
|
1065 |
dataResp.Append( iResourceId ); // SMS resource IDs LSB |
|
1066 |
resource.CompleteSubBlock(); |
|
1067 |
||
1068 |
// Add 2nd resource sequence ID subblock |
|
1069 |
TIsiSubBlock resourceSeqId( |
|
1070 |
dataResp, |
|
1071 |
SMS_SB_RESOURCE_SEQ_ID , |
|
1072 |
EIsiSubBlockTypeId16Len16 ); |
|
1073 |
||
1074 |
dataResp.Append(iSequenceId); // Sequence ID |
|
1075 |
resourceSeqId.CompleteSubBlock(); |
|
1076 |
||
1077 |
// Add Third subblock SMS_SB_RESOURCE_STATUS |
|
1078 |
TIsiSubBlock resourceStatus( |
|
1079 |
dataResp, |
|
1080 |
SMS_SB_RESOURCE_STATUS , |
|
1081 |
EIsiSubBlockTypeId16Len16 ); |
|
1082 |
||
1083 |
dataResp.Append( aResourceStatus ); // Resource status |
|
1084 |
resourceStatus.CompleteSubBlock(); |
|
1085 |
||
1086 |
if ( SMS_RESOURCE_ALLOWED == aResourceStatus ) |
|
1087 |
{ |
|
1088 |
// Add 4th subblock SMS_SB_ADDRESS (SMSC) |
|
1089 |
TIsiSubBlock addressSb( |
|
1090 |
dataResp, |
|
1091 |
SMS_SB_ADDRESS , |
|
1092 |
EIsiSubBlockTypeId16Len16 ); |
|
1093 |
||
1094 |
dataResp.Append( SMS_SMSC_ADDRESS ); // Addrees Type |
|
1095 |
dataResp.Append( iAddressSubblock.Length() ); |
|
1096 |
dataResp.Append( iAddressSubblock ); |
|
1097 |
addressSb.CompleteSubBlock(); |
|
1098 |
||
1099 |
// Add 5th Subblock SMS_SB_TPDU (Destination address) |
|
1100 |
TIsiSubBlock userDataSb( |
|
1101 |
dataResp, |
|
1102 |
SMS_SB_TPDU , |
|
1103 |
EIsiSubBlockTypeId16Len16 ); |
|
1104 |
||
1105 |
dataResp.Append( iUserDataSubblock.Length() ); // Addrees Length |
|
1106 |
dataResp.Append( KPadding ); |
|
1107 |
dataResp.Append( iUserDataSubblock ); |
|
1108 |
userDataSb.CompleteSubBlock(); |
|
1109 |
} |
|
1110 |
else |
|
1111 |
{ |
|
1112 |
// Add cause subblock |
|
1113 |
TIsiSubBlock sbCause( |
|
1114 |
dataResp, |
|
1115 |
SMS_SB_CAUSE, |
|
1116 |
EIsiSubBlockTypeId16Len16 ); |
|
1117 |
||
1118 |
dataResp.Append( aCauseType ); |
|
1119 |
dataResp.Append( aCause ); |
|
1120 |
sbCause.CompleteSubBlock(); |
|
1121 |
} |
|
1122 |
||
1123 |
// Send resp to Sms server with not allowed status |
|
1124 |
iSatMessHandler->SendSmsResourceReq( |
|
1125 |
iMoSmsCtrlReqTransactionId, |
|
1126 |
dataResp, |
|
1127 |
iSenderObject ); |
|
1128 |
} |
|
1129 |
// ----------------------------------------------------------------------------- |
|
1130 |
// CSatMoSmsCtrl::FormMoSmsCtrlEnvelope |
|
1131 |
// Forms and sends MO SMS Control envelope |
|
1132 |
// ----------------------------------------------------------------------------- |
|
1133 |
// |
|
1134 |
void CSatMoSmsCtrl::FormMoSmsCtrlEnvelope() |
|
1135 |
{ |
|
1136 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::FormMoSmsCtrlEnvelope"); |
|
1137 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_FORMMOSMSCTRLENVELOPE_TD, "CSatMoSmsCtrl::FormMoSmsCtrlEnvelope" ); |
|
1138 |
||
1139 |
TPtrC8 addressData2; |
|
1140 |
if ( iUserDataSubblock.Length() ) |
|
1141 |
{ |
|
1142 |
iMessageType = FetchTpDa( iUserDataSubblock, addressData2 ); |
|
1143 |
} |
|
1144 |
// no else |
|
1145 |
||
1146 |
// Dialled Number String, the length has to be removed (first byte) |
|
1147 |
// The envelope is sent if MO SMS is activated |
|
1148 |
// iAddressSubblock is not sent as it's received |
|
1149 |
// from SMS server because of iAddressSubblock's first |
|
1150 |
// byte is length of the address data and MO SMS Control envelope |
|
1151 |
// is NOT allowed to contain that in address data. So length |
|
1152 |
// field is skipped |
|
1153 |
SendMoSmsCtrlEnvelope( |
|
1154 |
iMoSmsCtrlEnvelopeTransactionId, |
|
1155 |
iAddressSubblock.Mid( 1, iAddressSubblock.Length() - 1 ), |
|
1156 |
addressData2 ); |
|
1157 |
} |
|
1158 |
||
1159 |
// ----------------------------------------------------------------------------- |
|
1160 |
// CSatMoSmsCtrl::FetchTpDa |
|
1161 |
// Fetches TP-DA contents from TPDU |
|
1162 |
// ----------------------------------------------------------------------------- |
|
1163 |
// |
|
1164 |
TUint8 CSatMoSmsCtrl::FetchTpDa( const TDesC8& aTpdu, TPtrC8& aTpda ) |
|
1165 |
{ |
|
1166 |
TFLOGSTRING("TSY: CSatMoSmsCtrl::FetchTpDa"); |
|
1167 |
OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_FETCHTPDA_TD, "CSatMoSmsCtrl::FetchTpDa" ); |
|
1168 |
||
1169 |
TUint8 ret( 0 ); |
|
1170 |
||
1171 |
// TP-DA has the following structure |
|
1172 |
// (see 3GPP TS 23.040 clause 9.1.2.5) |
|
1173 |
// [0] Address-Length |
|
1174 |
// [1] TonNpi |
|
1175 |
// [2..] Address-Value ADN encoding |
|
1176 |
// resulting descriptor contains TonNpi+Address-Value |
|
1177 |
// 'Address-Length' does not count filler byte if it is present, so it |
|
1178 |
// can be odd value. If it is we need to add 1 and then divide by 2 to |
|
1179 |
// calculate number of bytes. Although if it is even, then adding 1 will |
|
1180 |
// give us odd value which gives the same number of bytes after integer |
|
1181 |
// division by 2. |
|
1182 |
// So we always add 1 to Address-Length inside TP-DA |
|
1183 |
if ( KSmsCommandType == ( aTpdu[KMessageParamsIndex] & KCommandTypeMask ) ) |
|
1184 |
{ |
|
1185 |
ret = KSmsCommandType; |
|
1186 |
TUint8 addressLength = aTpdu[KSmsCommandAddrIndex] + 1; |
|
1187 |
aTpda.Set( aTpdu.Mid( |
|
1188 |
KSmsCommandAddrIndex + KTpDaTonNpiIndex, |
|
1189 |
addressLength/2 + KTpDaTonNpiSize ) ); |
|
1190 |
} |
|
1191 |
else if ( KSmsSubmitType == ( aTpdu[KMessageParamsIndex] & KCommandTypeMask ) ) |
|
1192 |
{ |
|
1193 |
ret = KSmsSubmitType; |
|
1194 |
TUint8 addressLength = aTpdu[KSmsSubmitAddrIndex] + 1; |
|
1195 |
aTpda.Set( aTpdu.Mid( |
|
1196 |
KSmsSubmitAddrIndex + KTpDaTonNpiIndex, |
|
1197 |
addressLength/2 + KTpDaTonNpiSize ) ); |
|
1198 |
} |
|
1199 |
// no else |
|
1200 |
||
1201 |
return ret; |
|
1202 |
} |
|
0 | 1203 |
// End of File |