0
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
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 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include "satdatadownload.h" // sat datadownload class
|
|
22 |
#include "satmesshandler.h" // sat message handler class
|
|
23 |
#include "satmessaging.h" // sat messaging 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 <smsisi.h> // sms server
|
|
30 |
#include <etelmm.h> // etel multimode api
|
|
31 |
#include <uiccisi.h> // UICC server
|
|
32 |
#include "osttracedefinitions.h"
|
|
33 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
34 |
#include "satdatadownloadtraces.h"
|
|
35 |
#endif
|
|
36 |
|
|
37 |
|
|
38 |
// CONSTANTS
|
|
39 |
// Temporary TPDU data store buffer
|
|
40 |
const TUint8 KTtpduMaxSize = 255;
|
|
41 |
// Cell Broadcast isi msg length
|
|
42 |
const TUint8 KCbsMsgMaxLength = 92;
|
|
43 |
// Max address length
|
|
44 |
const TUint8 KAddrMaxLength = 255;
|
|
45 |
// ParamIndicator value
|
|
46 |
const TUint8 KParamIndicators = 7;
|
|
47 |
// ParamIndicator length
|
|
48 |
const TUint8 KParamIndicatorsLength = 1;
|
|
49 |
// Max Info Length
|
|
50 |
const TUint8 KMaxInfoLength = 82;
|
|
51 |
// SMS Delivery report buffer size
|
|
52 |
const TUint8 KDeliveryReportSize = 248;
|
|
53 |
|
|
54 |
|
|
55 |
// ==================== MEMBER FUNCTIONS ====================================
|
|
56 |
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
// CSatDataDownload::CSatDataDownload
|
|
59 |
// C++ default constructor can NOT contain any code, that
|
|
60 |
// might leave.
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
CSatDataDownload::CSatDataDownload
|
|
64 |
(
|
|
65 |
CSatMessHandler* aSatMessHandler,
|
|
66 |
CTsySatMessaging* aSatMessaging
|
|
67 |
)
|
|
68 |
:
|
|
69 |
iSatMessHandler( aSatMessHandler ),
|
|
70 |
iSatMessaging( aSatMessaging ),
|
|
71 |
iSmsPpProtocolId( KZero ),
|
|
72 |
iSmsPpDcs( KZero ),
|
|
73 |
iSmsPpTransactionId( KZero ),
|
|
74 |
iSmsPpDdOngoing( EFalse ), // No SMS PP DD on going during construction
|
|
75 |
iSmsPpDdSupported( ETrue ) // Most likely SIM supports SMS PP DD
|
|
76 |
{
|
|
77 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_CSATDATADOWNLOAD, "CSatDataDownload::CSatDataDownload" );
|
|
78 |
}
|
|
79 |
|
|
80 |
|
|
81 |
// -----------------------------------------------------------------------------
|
|
82 |
// CSatDataDownload::ConstructL
|
|
83 |
// Symbian 2nd phase constructor can leave.
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
void CSatDataDownload::ConstructL()
|
|
87 |
{
|
|
88 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_CONSTRUCTL, "CSatDataDownload::ConstructL" );
|
|
89 |
}
|
|
90 |
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
// CSatDataDownload::NewL
|
|
93 |
// Two-phased constructor.
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
CSatDataDownload* CSatDataDownload::NewL
|
|
97 |
(
|
|
98 |
CSatMessHandler* aSatMessHandler,
|
|
99 |
CTsySatMessaging* aSatMessaging
|
|
100 |
)
|
|
101 |
{
|
|
102 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_NEWL, "CSatDataDownload::NewL" );
|
|
103 |
TFLOGSTRING("TSY: CSatDataDownload::NewL");
|
|
104 |
|
|
105 |
CSatDataDownload* self =
|
|
106 |
new ( ELeave ) CSatDataDownload( aSatMessHandler, aSatMessaging );
|
|
107 |
|
|
108 |
CleanupStack::PushL( self );
|
|
109 |
self->ConstructL();
|
|
110 |
CleanupStack::Pop( self );
|
|
111 |
|
|
112 |
return self;
|
|
113 |
}
|
|
114 |
|
|
115 |
|
|
116 |
// -----------------------------------------------------------------------------
|
|
117 |
// CSatDataDownload::~CSatDataDownload
|
|
118 |
// C++ destructor
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
CSatDataDownload::~CSatDataDownload()
|
|
122 |
{
|
|
123 |
OstTrace0( TRACE_NORMAL, DUP1_CSATDATADOWNLOAD_CSATDATADOWNLOAD, "CSatDataDownload::~CSatDataDownload" );
|
|
124 |
TFLOGSTRING("TSY: CSatDataDownload::~CSatDataDownload");
|
|
125 |
}
|
|
126 |
|
|
127 |
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
// CSatDataDownload::UiccCatRespEnvelopeReceived
|
|
130 |
// Breaks a ISI message data notification from Sim server
|
|
131 |
// -----------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
void CSatDataDownload::UiccCatRespEnvelopeReceived(
|
|
134 |
const TIsiReceiveC& aIsiMessage
|
|
135 |
)
|
|
136 |
{
|
|
137 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_UICCCATRESPENVELOPERECEIVED, "CSatDataDownload::UiccCatRespEnvelopeReceived" );
|
|
138 |
TFLOGSTRING("TSY:CSatDataDownload::UiccCatRespEnvelopeReceived");
|
|
139 |
|
|
140 |
TUint8 status( aIsiMessage.Get8bit(
|
|
141 |
ISI_HEADER_SIZE + UICC_CAT_RESP_OFFSET_STATUS ) );
|
|
142 |
|
|
143 |
TUint8 sw1( 0 );
|
|
144 |
TUint8 sw2( 0 );
|
|
145 |
TPtrC8 apduData;
|
|
146 |
|
|
147 |
if ( UICC_STATUS_OK == status )
|
|
148 |
{
|
|
149 |
TUint uiccSbApduOffset( 0 );
|
|
150 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
151 |
ISI_HEADER_SIZE + SIZE_UICC_CAT_RESP,
|
|
152 |
UICC_SB_APDU,
|
|
153 |
EIsiSubBlockTypeId16Len16,
|
|
154 |
uiccSbApduOffset ) )
|
|
155 |
{
|
|
156 |
TUint16 apduLength( aIsiMessage.Get16bit(
|
|
157 |
uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDULENGTH ) );
|
|
158 |
apduData.Set( aIsiMessage.GetData(
|
|
159 |
uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDU,
|
|
160 |
apduLength ) );
|
|
161 |
// Status bytes are two last bytes in APDU
|
|
162 |
TUint8 sw1( apduData[apduLength - 2] );
|
|
163 |
TUint8 sw2( apduData[apduLength - 1] );
|
|
164 |
}
|
|
165 |
else // Subblock is mandatory
|
|
166 |
{
|
|
167 |
TFLOGSTRING("TSY: CSatMessHandler::UiccCatRespEnvelopeReceived - Mandatory subblock UICC_SB_APDU not found");
|
|
168 |
OstTrace0( TRACE_NORMAL, DUP1_CSATDATADOWNLOAD_UICCCATRESPENVELOPERECEIVED, "CSatDataDownload::UiccCatRespEnvelopeReceived- Mandatory subblock UICC_SB_APDU not found" );
|
|
169 |
}
|
|
170 |
}
|
|
171 |
|
|
172 |
// Create delivery report according to SW result
|
|
173 |
if ( KError != TSatUtility::Sw1Sw2Check( sw1, sw2 ) )
|
|
174 |
{
|
|
175 |
TFLOGSTRING("TSY: CSatDataDownload::UiccCatRespEnvelopeReceived, OK");
|
|
176 |
OstTrace0( TRACE_NORMAL, DUP2_CSATDATADOWNLOAD_UICCCATRESPENVELOPERECEIVED, "CSatDataDownload::UiccCatRespEnvelopeReceived" );
|
|
177 |
BuildSimMsgReport( ENone, apduData );
|
|
178 |
}
|
|
179 |
else if ( KAtkSwDataNtfSw1busy == sw1 )
|
|
180 |
{
|
|
181 |
TFLOGSTRING("TSY:CSatDataDownload::UiccCatRespEnvelopeReceived, SIM Busy");
|
|
182 |
OstTrace0( TRACE_NORMAL, DUP3_CSATDATADOWNLOAD_UICCCATRESPENVELOPERECEIVED, "CSatDataDownload::UiccCatRespEnvelopeReceived" );
|
|
183 |
BuildSimMsgReport( ESatBusy, apduData );
|
|
184 |
}
|
|
185 |
else
|
|
186 |
{
|
|
187 |
TFLOGSTRING("TSY:CSatDataDownload::UiccCatRespEnvelopeReceived, Data Download Error");
|
|
188 |
OstTrace0( TRACE_NORMAL, DUP4_CSATDATADOWNLOAD_UICCCATRESPENVELOPERECEIVED, "CSatDataDownload::UiccCatRespEnvelopeReceived" );
|
|
189 |
BuildSimMsgReport( ESatDlError, apduData );
|
|
190 |
}
|
|
191 |
}
|
|
192 |
|
|
193 |
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
// CSatDataDownload::BuildSmsSimReport
|
|
196 |
// Creates a SMS PP DD delivery report
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
//
|
|
199 |
|
|
200 |
|
|
201 |
void CSatDataDownload::BuildSimMsgReport
|
|
202 |
(
|
|
203 |
const TTpFailure aTpFailure,
|
|
204 |
const TDesC8& aUserData
|
|
205 |
)
|
|
206 |
{
|
|
207 |
OstTraceExt2( TRACE_NORMAL, CSATDATADOWNLOAD_BUILDSIMMSGREPORT, "CSatDataDownload::BuildSimMsgReport TpFailure: %{TTpFailure}, UserDataLen: %d", aTpFailure, aUserData.Length() );
|
|
208 |
TFLOGSTRING3("TSY:CSatDataDownload::BuildSimMsgReport TpFailure: %x, UserDataLen: %d", aTpFailure, aUserData.Length() );
|
|
209 |
|
|
210 |
// Select Cause and CauseType according to routing result
|
|
211 |
TUint8 causeType( ENone == aTpFailure ?
|
|
212 |
SMS_CAUSE_TYPE_COMMON : SMS_CAUSE_TYPE_EXT );
|
|
213 |
TUint8 smsCause( ENone == aTpFailure ?
|
|
214 |
SMS_OK : SMS_ERR_PP_RESERVED );
|
|
215 |
|
|
216 |
TUint16 dataLen( aUserData.Length() );
|
|
217 |
|
|
218 |
// SMS_RECEIVED_MSG_REPORT_REQ- first subblock is needed when:
|
|
219 |
// 1) Delivery of SMS PP failed
|
|
220 |
// second and third subblock is added when
|
|
221 |
// 2) SIM provided data in AtkSwDataNtf
|
|
222 |
|
|
223 |
// Create SMS_RECEIVED_MSG_REPORT_REQ message
|
|
224 |
TBuf8<KDeliveryReportSize> msgBuffer;
|
|
225 |
TIsiSend reportReq( msgBuffer );
|
|
226 |
|
|
227 |
// Report has following structure:
|
|
228 |
// SMS_RECEIVED_MSG_REPORT_REQ (Minimum, OK case AND no SIM Data)
|
|
229 |
// + SMS_SB_DELIVER_REPORT (optional Added when reception is not OK)
|
|
230 |
// + SMS_SB_PARAM_INDICATOR (optional, Added when user data is not empty )
|
|
231 |
// + SMS_SB_USER_DATA (optional, Response user data is put here)
|
|
232 |
|
|
233 |
// SMS_RECEIVED_MSG_REPORT_REQ header
|
|
234 |
msgBuffer.Append( causeType );
|
|
235 |
msgBuffer.Append( smsCause );
|
|
236 |
msgBuffer.AppendFill( KPadding, 3 );
|
|
237 |
msgBuffer.Append( 0 ); // no of sublocks
|
|
238 |
|
|
239 |
// Add SMS_SB_DELIVER_REPORT subblock if any failure is there
|
|
240 |
if( ENone != aTpFailure )
|
|
241 |
{
|
|
242 |
TFLOGSTRING("TSY:CSatDataDownload::BuildSimMsgReport \
|
|
243 |
Adding SMS_SB_DELIVER_REPORT" );
|
|
244 |
OstTrace0( TRACE_NORMAL, DUP1_CSATDATADOWNLOAD_BUILDSIMMSGREPORT, "CSatDataDownload::BuildSimMsgReport Adding SMS_SB_DELIVER_REPORT" );
|
|
245 |
|
|
246 |
TIsiSubBlock deliverReport( msgBuffer, SMS_SB_DELIVER_REPORT,EIsiSubBlockTypeId16Len16 );
|
|
247 |
|
|
248 |
// set message parameters zero as in S40 ATK server also
|
|
249 |
// First octet of SMS-Deliver-Report TPDU. Contains TP-UDHI and TP-MTI
|
|
250 |
// elements. See 3GPP TS 23.040 chapter 9.2.2.1a (i) and (ii)
|
|
251 |
// SMS-DELIVER-REPORT for RP-ACK and RP-ERROR.
|
|
252 |
|
|
253 |
msgBuffer.Append( 0x00 ); // SMS_MTI_DELIVER_REPORT
|
|
254 |
|
|
255 |
msgBuffer.Append( aTpFailure ); // GSM-TP Failure cause
|
|
256 |
msgBuffer.AppendFill( KPadding, 2);
|
|
257 |
// Increment number of subblock
|
|
258 |
msgBuffer[5]++;
|
|
259 |
deliverReport.CompleteSubBlock();
|
|
260 |
}
|
|
261 |
|
|
262 |
// Add SMS_SB_PRSM_INDICATOR and SMS_SB_USER_DATA subblock
|
|
263 |
if ( dataLen )
|
|
264 |
{
|
|
265 |
TFLOGSTRING("TSY:CSatDataDownload::BuildSimMsgReport \
|
|
266 |
Adding SMS_SB_PARAM_INDICATOR & SMS_SB_USER_DATA" );
|
|
267 |
OstTrace0( TRACE_NORMAL, DUP2_CSATDATADOWNLOAD_BUILDSIMMSGREPORT, "CSatDataDownload::BuildSimMsgReport Adding SMS_SB_PARAM_INDICATOR AND SMS_SB_USER_DATA" );
|
|
268 |
|
|
269 |
// Add two more Sublock:
|
|
270 |
// SMS_SB_PARAM_INDICATOR
|
|
271 |
/////////////////////////
|
|
272 |
TIsiSubBlock paramInd( msgBuffer, SMS_SB_PARAM_INDICATOR,
|
|
273 |
EIsiSubBlockTypeId16Len16 );
|
|
274 |
|
|
275 |
msgBuffer.Append( iSmsPpProtocolId );
|
|
276 |
msgBuffer.Append( iSmsPpDcs );
|
|
277 |
|
|
278 |
msgBuffer.Append( KParamIndicatorsLength ); // = 1
|
|
279 |
msgBuffer.Append( KParamIndicators ); // All selected (=7)
|
|
280 |
// Increment number of subblock
|
|
281 |
msgBuffer[5]++;
|
|
282 |
|
|
283 |
paramInd.CompleteSubBlock();
|
|
284 |
|
|
285 |
// SMS_SB_USER_DATA (subblock for TPDU data)
|
|
286 |
//////////////////
|
|
287 |
TIsiSubBlock userData( msgBuffer, SMS_SB_USER_DATA,
|
|
288 |
EIsiSubBlockTypeId16Len16 );
|
|
289 |
|
|
290 |
// data length
|
|
291 |
// to append MSB byte
|
|
292 |
msgBuffer.Append( dataLen >> 8 );
|
|
293 |
msgBuffer.Append( dataLen );
|
|
294 |
|
|
295 |
// Append for character count on basis of DCS used
|
|
296 |
TUint16 dataLengthInOctets = 0;
|
|
297 |
TUint8 aDefaultAlphabet = ( iSmsPpDcs && 0x0C) ;
|
|
298 |
if( !aDefaultAlphabet )
|
|
299 |
{
|
|
300 |
dataLengthInOctets = ( ( dataLen + 1 ) * 7 ) / 8 ;
|
|
301 |
}
|
|
302 |
else
|
|
303 |
{
|
|
304 |
dataLengthInOctets = dataLen;
|
|
305 |
}
|
|
306 |
// To append MSB byte
|
|
307 |
msgBuffer.Append( dataLengthInOctets >> 8 );
|
|
308 |
msgBuffer.Append( dataLengthInOctets );
|
|
309 |
|
|
310 |
// Append whole msg or SMS_GSM_DELIVER_ACK_UD_MAX_LEN bytes
|
|
311 |
msgBuffer.Append( aUserData.Left(Min( dataLen,
|
|
312 |
SMS_COMMAND_DATA_MAX_LEN ) ) );
|
|
313 |
// Increment number of subblock
|
|
314 |
msgBuffer[5]++;
|
|
315 |
|
|
316 |
userData.CompleteSubBlock();
|
|
317 |
}
|
|
318 |
|
|
319 |
iSatMessHandler->SendSmsReportReq( iSatMessaging->GetTransactionId(),
|
|
320 |
msgBuffer );
|
|
321 |
}
|
|
322 |
|
|
323 |
|
|
324 |
// -----------------------------------------------------------------------------
|
|
325 |
// CSatDataDownload::CellBroadcastReceived
|
|
326 |
// Breaks a cell broadcast isi message coming from network.
|
|
327 |
// Calls SendEnvelopeForCellBroadcast in order to send the envelope to
|
|
328 |
// SIM server
|
|
329 |
// -----------------------------------------------------------------------------
|
|
330 |
//
|
|
331 |
void CSatDataDownload::CellBroadcastReceived
|
|
332 |
(
|
|
333 |
const TIsiReceiveC& aIsiMessage // SMS_GSM(_TEMP)_CB_ROUTING_NTF
|
|
334 |
)
|
|
335 |
{
|
|
336 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_CELLBROADCASTRECEIVED, "CSatDataDownload::CellBroadcastReceived" );
|
|
337 |
TFLOGSTRING( "TSY:CSatDataDownload::CellBroadcastReceived" );
|
|
338 |
|
|
339 |
TBuf8<KCbsMsgMaxLength> cbsMsg;
|
|
340 |
|
|
341 |
// For each subblock i
|
|
342 |
// Check whether the CB message id of this subblock is allowed:
|
|
343 |
// if allowed,
|
|
344 |
// - Retrieve the infoLenght byte B
|
|
345 |
// - if B==0xFF, then this is a GSM CB DDL message
|
|
346 |
// - otherwise this is a WCDMA CD DDL message (0<B<83)
|
|
347 |
// and the content of message must be truncated to B bytes,
|
|
348 |
// the unused bytes (B+1 to 82) must be filled with zeros.
|
|
349 |
// - send envelope containing Page data
|
|
350 |
// End
|
|
351 |
|
|
352 |
TInt sbNumber( aIsiMessage.Get8bit(
|
|
353 |
ISI_HEADER_SIZE + SMS_CB_SIM_ROUTING_IND_OFFSET_SUBBLOCKCOUNT ) );
|
|
354 |
|
|
355 |
TUint startsbOffset( 0 );
|
|
356 |
|
|
357 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
358 |
ISI_HEADER_SIZE + SIZE_SMS_CB_SIM_ROUTING_IND ,
|
|
359 |
SMS_SB_CB_MESSAGE,
|
|
360 |
EIsiSubBlockTypeId16Len16,
|
|
361 |
startsbOffset ) )
|
|
362 |
{
|
|
363 |
TUint sbOffset( 0 );
|
|
364 |
for ( TInt sb( 1 ); sb < sbNumber; sb++ )
|
|
365 |
{
|
|
366 |
// fill cbsMsg block with 0
|
|
367 |
cbsMsg.Zero();
|
|
368 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetByIndex(
|
|
369 |
startsbOffset ,
|
|
370 |
sb,
|
|
371 |
EIsiSubBlockTypeId16Len16,
|
|
372 |
sbOffset ) )
|
|
373 |
{
|
|
374 |
//Append Serial number
|
|
375 |
cbsMsg.Append( ( aIsiMessage.Get16bit(
|
|
376 |
sbOffset + SMS_SB_CB_MESSAGE_OFFSET_SERIALNUMBER )>> 8) );
|
|
377 |
cbsMsg.Append( aIsiMessage.Get16bit(
|
|
378 |
sbOffset + SMS_SB_CB_MESSAGE_OFFSET_SERIALNUMBER ) );
|
|
379 |
|
|
380 |
// Append CB Message id
|
|
381 |
cbsMsg.Append( aIsiMessage.Get16bit(
|
|
382 |
sbOffset + SMS_SB_CB_MESSAGE_OFFSET_CBMESSAGEID )>> 8 );
|
|
383 |
cbsMsg.Append( aIsiMessage.Get16bit(
|
|
384 |
sbOffset + SMS_SB_CB_MESSAGE_OFFSET_CBMESSAGEID ) );
|
|
385 |
|
|
386 |
// Append Data Coding scheme
|
|
387 |
cbsMsg.Append( aIsiMessage.Get8bit(
|
|
388 |
sbOffset + SMS_SB_CB_MESSAGE_OFFSET_DATACODINGSCHEME ) );
|
|
389 |
|
|
390 |
// Append Page
|
|
391 |
cbsMsg.Append( aIsiMessage.Get8bit(
|
|
392 |
sbOffset + SMS_SB_CB_MESSAGE_OFFSET_PAGE ) );
|
|
393 |
|
|
394 |
// Append data length
|
|
395 |
TUint8 infoLength( aIsiMessage.Get8bit(
|
|
396 |
sbOffset + SMS_SB_CB_MESSAGE_OFFSET_INFOLENGTH ) );
|
|
397 |
|
|
398 |
if ( KMaxInfoLength < infoLength )
|
|
399 |
{
|
|
400 |
// CB message max length is 82. Info length may contain
|
|
401 |
// value 0xFF, which means that length should be ignored.
|
|
402 |
// Inthis case maximum is used.
|
|
403 |
infoLength = SMS_CB_MESSAGE_CONTENT_SIZE; // 82
|
|
404 |
}
|
|
405 |
|
|
406 |
// Append the message content and fill with zeroes if necessary
|
|
407 |
cbsMsg.AppendJustify( aIsiMessage.GetData( sbOffset +
|
|
408 |
SMS_SB_CB_MESSAGE_OFFSET_CONTENTOFMESSAGE, infoLength ),
|
|
409 |
SMS_CB_MESSAGE_CONTENT_SIZE, ELeft, KPadding );
|
|
410 |
|
|
411 |
SendCellBroadcastDdlEnvelope(
|
|
412 |
iSatMessaging->GetTransactionId(),
|
|
413 |
cbsMsg );
|
|
414 |
}
|
|
415 |
}
|
|
416 |
}
|
|
417 |
}
|
|
418 |
|
|
419 |
// -----------------------------------------------------------------------------
|
|
420 |
// CSatDataDownload::SmsSimMsgIndReceived
|
|
421 |
// Breaks a sms point to point isi message
|
|
422 |
// Sends envelope
|
|
423 |
// -----------------------------------------------------------------------------
|
|
424 |
//
|
|
425 |
|
|
426 |
void CSatDataDownload::SmsSimMsgIndReceived
|
|
427 |
(
|
|
428 |
const TIsiReceiveC& aIsiMessage
|
|
429 |
)
|
|
430 |
{
|
|
431 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_SMSSIMMSGINDRECEIVED, "CSatDataDownload::SmsSimMsgIndReceived" );
|
|
432 |
TFLOGSTRING( "TSY:CSatDataDownload::SmsSimMsgIndReceived" );
|
|
433 |
|
|
434 |
TBuf8<KAddrMaxLength> bcdSmscAddress; // to store Service centre number
|
|
435 |
TBuf8<KTtpduMaxSize> smsTpdu; // Temporary buffer to store TPDU data
|
|
436 |
TUint sbDeliver( 0 );
|
|
437 |
|
|
438 |
// Check for correct subblock SMS_SB_ADDRESS
|
|
439 |
if( KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
440 |
ISI_HEADER_SIZE + SIZE_SMS_RECEIVED_SIM_MSG_IND,
|
|
441 |
SMS_SB_ADDRESS,
|
|
442 |
EIsiSubBlockTypeId16Len16,
|
|
443 |
sbDeliver ) )
|
|
444 |
{
|
|
445 |
TUint8 addressLen( aIsiMessage.Get8bit(
|
|
446 |
sbDeliver + SMS_SB_ADDRESS_OFFSET_ADDRESSDATALENGTH ) );
|
|
447 |
// Service centre Address append in bcdSmscAddress buffer
|
|
448 |
// If address type is SMS_SMSC_ADDRESS, addtional length is
|
|
449 |
// included in addres data. Let's omit that.
|
|
450 |
TUint8 addressType( aIsiMessage.Get8bit(
|
|
451 |
sbDeliver + SMS_SB_ADDRESS_OFFSET_ADDRESSTYPE ) );
|
|
452 |
|
|
453 |
if ( SMS_SMSC_ADDRESS == addressType )
|
|
454 |
{
|
|
455 |
bcdSmscAddress.Append( aIsiMessage.GetData(
|
|
456 |
sbDeliver + SMS_SB_ADDRESS_OFFSET_ADDRESSDATA + 1,
|
|
457 |
addressLen - 1 ) );
|
|
458 |
}
|
|
459 |
}
|
|
460 |
// Check for correct Subblock SMS_SB_TPDU
|
|
461 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
462 |
ISI_HEADER_SIZE + SIZE_SMS_RECEIVED_SIM_MSG_IND,
|
|
463 |
SMS_SB_TPDU,
|
|
464 |
EIsiSubBlockTypeId16Len16,
|
|
465 |
sbDeliver ) )
|
|
466 |
{
|
|
467 |
// Read user data length
|
|
468 |
TUint8 userDataLen( aIsiMessage.Get8bit(
|
|
469 |
sbDeliver + SMS_SB_TPDU_OFFSET_DATALENGTH ) );
|
|
470 |
// SMS_SB_TPDU subblock,
|
|
471 |
// which contain the message payload data.
|
|
472 |
smsTpdu.Append( aIsiMessage.GetData(
|
|
473 |
sbDeliver + SMS_SB_TPDU_OFFSET_DATABYTES, userDataLen ));
|
|
474 |
// Destination Address Length
|
|
475 |
// 1st Byte of destination address contains no os semioctets
|
|
476 |
//in address bytes
|
|
477 |
|
|
478 |
// +1 to calculate correct nos of bytes in address
|
|
479 |
// divide by 2 to convert semioctets to no of octets
|
|
480 |
// +2 to add type of address byte and no of
|
|
481 |
TUint8 tpduIndexCalc( ( ( smsTpdu[1] + 1 )/2 ) + 2 );
|
|
482 |
|
|
483 |
// Storing protocol id and datacoding scheme from TPDU data buffer
|
|
484 |
iSmsPpProtocolId = smsTpdu[ tpduIndexCalc + 1 ];
|
|
485 |
iSmsPpDcs = smsTpdu[ tpduIndexCalc + 2 ];
|
|
486 |
}
|
|
487 |
|
|
488 |
// Either Envelope sending or SMS storing is going on
|
|
489 |
iSmsPpDdOngoing = ETrue;
|
|
490 |
|
|
491 |
if( iSmsPpDdSupported ) // Check for SMS PP-DATA Download supported
|
|
492 |
{
|
|
493 |
TFLOGSTRING( "TSY:CSatDataDownload::SmsSimMsgIndReceived SMS SIM Supported, sending Envelope..." );
|
|
494 |
OstTrace0( TRACE_NORMAL, DUP1_CSATDATADOWNLOAD_SMSSIMMSGINDRECEIVED, "CSatDataDownload::SmsSimMsgIndReceived SMS Sim Supported, sending Envelope..." );
|
|
495 |
|
|
496 |
iSmsPpTransactionId = iSatMessaging->GetTransactionId();
|
|
497 |
// Data Download supported, send envelope
|
|
498 |
SendSmsPpDdlEnvelope(
|
|
499 |
iSmsPpTransactionId,
|
|
500 |
bcdSmscAddress,
|
|
501 |
smsTpdu );
|
|
502 |
}
|
|
503 |
else
|
|
504 |
{
|
|
505 |
TFLOGSTRING( "TSY:CSatDataDownload::SmsSimMsgIndReceived SMS SIM not supported, storing SMS..." );
|
|
506 |
OstTrace0( TRACE_NORMAL, DUP2_CSATDATADOWNLOAD_SMSSIMMSGINDRECEIVED, "CSatDataDownload::SmsSimMsgIndReceived SMS SIM not supported, storing SMS..." );
|
|
507 |
|
|
508 |
// Save the SMS instead.
|
|
509 |
RMobileSmsStore::TMobileGsmSmsEntryV1 smsEntry;
|
|
510 |
|
|
511 |
// if SMSC present
|
|
512 |
if ( bcdSmscAddress.Length() )
|
|
513 |
{
|
|
514 |
// TON & NPI, stored in first index
|
|
515 |
TSatUtility::GetTonAndNpi(
|
|
516 |
bcdSmscAddress[0],
|
|
517 |
smsEntry.iServiceCentre.iTypeOfNumber,
|
|
518 |
smsEntry.iServiceCentre.iNumberPlan );
|
|
519 |
|
|
520 |
// SMSC Address, exclude TON/NPI
|
|
521 |
TBuf8<KAddrMaxLength> scAscii;
|
|
522 |
TSatUtility::BCDToAscii( bcdSmscAddress.Mid( 1 ), scAscii );
|
|
523 |
smsEntry.iServiceCentre.iTelNumber.Copy( scAscii );
|
|
524 |
}
|
|
525 |
// TPDU data
|
|
526 |
smsEntry.iMsgData.Copy( smsTpdu );
|
|
527 |
|
|
528 |
// Store SMS
|
|
529 |
if ( KErrNone != iSatMessaging->StoreSmsL( smsEntry ) )
|
|
530 |
{
|
|
531 |
// Clear the flag
|
|
532 |
iSmsPpDdOngoing = EFalse;
|
|
533 |
BuildSimMsgReport( ESatDlError, KNullDesC8 );
|
|
534 |
}
|
|
535 |
}
|
|
536 |
}
|
|
537 |
|
|
538 |
// -----------------------------------------------------------------------------
|
|
539 |
// CSatDataDownload::SendCellBroadcastDdlEnvelope
|
|
540 |
// Prepare the envelope to be sent to SIM server after a Cell Broadcast message
|
|
541 |
// has been received, without request, by the mobile equipment.
|
|
542 |
// -----------------------------------------------------------------------------
|
|
543 |
//
|
|
544 |
void CSatDataDownload::SendCellBroadcastDdlEnvelope
|
|
545 |
(
|
|
546 |
TUint8 aTransId,
|
|
547 |
TDesC8& aPdu
|
|
548 |
)
|
|
549 |
{
|
|
550 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_SENDCELLBROADCASTDDLENVELOPE, "CSatDataDownload::SendCellBroadcastDdlEnvelope" );
|
|
551 |
TFLOGSTRING( "TSY:CSatDataDownload::SendEnvelopeForCellBroadcast" );
|
|
552 |
|
|
553 |
TTlv envelope;
|
|
554 |
//Tag
|
|
555 |
envelope.Begin( KBerTlvCellBroadcastTag );
|
|
556 |
//device identities
|
|
557 |
envelope.AddTag( KTlvDeviceIdentityTag );
|
|
558 |
envelope.AddByte( KNetwork );
|
|
559 |
envelope.AddByte( KSim );
|
|
560 |
// cell broadcast page
|
|
561 |
envelope.AddTag( KTlvCellBroadcastPageTag );
|
|
562 |
envelope.AddData( aPdu );
|
|
563 |
|
|
564 |
iSatMessHandler->UiccCatReqEnvelope( aTransId, envelope.End() );
|
|
565 |
}
|
|
566 |
|
|
567 |
// -----------------------------------------------------------------------------
|
|
568 |
// CSatDataDownload::SendSmsPpDdlEnvelope
|
|
569 |
// Prepare the envelope to be sent to SIM server after a SMS-PP message has
|
|
570 |
// has been received, without request, by the mobile equipment.
|
|
571 |
// -----------------------------------------------------------------------------
|
|
572 |
//
|
|
573 |
void CSatDataDownload::SendSmsPpDdlEnvelope
|
|
574 |
(
|
|
575 |
TUint8 aTransId,
|
|
576 |
TDesC8& aSmsScAddress,
|
|
577 |
TDesC8& aPdu
|
|
578 |
)
|
|
579 |
{
|
|
580 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_SENDSMSPPDDLENVELOPE, "CSatDataDownload::SendSmsPpDdlEnvelope" );
|
|
581 |
TFLOGSTRING( "TSY:CSatDataDownload::SendEnvelopeForSmsPpDownload" );
|
|
582 |
|
|
583 |
TTlv envelope;
|
|
584 |
|
|
585 |
envelope.Begin( KBerTlvSmsPpDownloadTag );
|
|
586 |
//device identities
|
|
587 |
envelope.AddTag( KTlvDeviceIdentityTag );
|
|
588 |
envelope.AddByte( KNetwork );
|
|
589 |
envelope.AddByte( KSim );
|
|
590 |
envelope.AddTag( KTlvAddressTag );
|
|
591 |
envelope.AddData( aSmsScAddress );
|
|
592 |
envelope.AddTag( KTlvSmsTpduTag );
|
|
593 |
envelope.AddData( aPdu );
|
|
594 |
|
|
595 |
iSatMessHandler->UiccCatReqEnvelope( aTransId, envelope.End() );
|
|
596 |
}
|
|
597 |
|
|
598 |
|
|
599 |
// -----------------------------------------------------------------------------
|
|
600 |
// CSatDataDownload::SmsPpDlSupported
|
|
601 |
// Setter for SMP PP DD support status
|
|
602 |
// -----------------------------------------------------------------------------
|
|
603 |
//
|
|
604 |
void CSatDataDownload::SmsPpDlSupported
|
|
605 |
(
|
|
606 |
TBool aStatus
|
|
607 |
)
|
|
608 |
{
|
|
609 |
OstTrace1( TRACE_NORMAL, CSATDATADOWNLOAD_SMSPPDLSUPPORTED, "CSatDataDownload::SmsPpDlSupported: %d", aStatus );
|
|
610 |
TFLOGSTRING2( "TSY: CSatDataDownload::SmsPpDlSupported: %d", aStatus );
|
|
611 |
|
|
612 |
iSmsPpDdSupported = aStatus;
|
|
613 |
}
|
|
614 |
|
|
615 |
|
|
616 |
// -----------------------------------------------------------------------------
|
|
617 |
// CSatDataDownload::MessageReceivedL
|
|
618 |
// Handle received messages related to event download
|
|
619 |
// Called by CSatMessHandler::MessageReceivedL, when a new ISI message arrives.
|
|
620 |
// -----------------------------------------------------------------------------
|
|
621 |
//
|
|
622 |
void CSatDataDownload::MessageReceivedL
|
|
623 |
(
|
|
624 |
const TIsiReceiveC& aIsiMessage
|
|
625 |
)
|
|
626 |
{
|
|
627 |
OstTrace0( TRACE_NORMAL, CSATDATADOWNLOAD_MESSAGERECEIVEDL, "CSatDataDownload::MessageReceivedL" );
|
|
628 |
TFLOGSTRING( "TSY:CSatDataDownload::MessageReceivedL" );
|
|
629 |
|
|
630 |
TInt resource( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_RESOURCEID ) );
|
|
631 |
TInt messageId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) );
|
|
632 |
|
|
633 |
// handle SIM Data Download related isi messages
|
|
634 |
if ( PN_SMS == resource )
|
|
635 |
{
|
|
636 |
switch ( messageId )
|
|
637 |
{
|
|
638 |
case SMS_CB_SIM_ROUTING_IND:
|
|
639 |
{
|
|
640 |
// A Cell Broadcast message was sent by the
|
|
641 |
// network, without having been requested by the phone.
|
|
642 |
// Process received message
|
|
643 |
CellBroadcastReceived( aIsiMessage );
|
|
644 |
break;
|
|
645 |
}
|
|
646 |
case SMS_RECEIVED_SIM_MSG_IND:
|
|
647 |
{
|
|
648 |
// Receive SMS PP Data Download Indication , Send by SMS Server
|
|
649 |
// on reception of message on network
|
|
650 |
SmsSimMsgIndReceived(aIsiMessage);
|
|
651 |
break;
|
|
652 |
}
|
|
653 |
default:
|
|
654 |
{
|
|
655 |
// none
|
|
656 |
break;
|
|
657 |
}
|
|
658 |
}
|
|
659 |
}
|
|
660 |
else if ( PN_UICC == resource )
|
|
661 |
{
|
|
662 |
switch( messageId )
|
|
663 |
{
|
|
664 |
case UICC_CAT_RESP:
|
|
665 |
{
|
|
666 |
// In case of envelope response handle the data
|
|
667 |
TUint8 serviceType(
|
|
668 |
aIsiMessage.Get8bit(
|
|
669 |
ISI_HEADER_SIZE + UICC_CAT_RESP_OFFSET_SERVICETYPE ) );
|
|
670 |
if ( UICC_CAT_ENVELOPE == serviceType )
|
|
671 |
{
|
|
672 |
if ( iSmsPpDdOngoing &&
|
|
673 |
iSmsPpTransactionId ==
|
|
674 |
aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) )
|
|
675 |
{
|
|
676 |
// Set flag iSmsPpDdOngoing false
|
|
677 |
// since a response is received for the envelope
|
|
678 |
// that was sent for a received sms-pp message
|
|
679 |
iSmsPpDdOngoing = EFalse;
|
|
680 |
// Process received message
|
|
681 |
UiccCatRespEnvelopeReceived( aIsiMessage );
|
|
682 |
}
|
|
683 |
}
|
|
684 |
break;
|
|
685 |
}
|
|
686 |
default:
|
|
687 |
{
|
|
688 |
// none
|
|
689 |
break;
|
|
690 |
}
|
|
691 |
}
|
|
692 |
}
|
|
693 |
|
|
694 |
else
|
|
695 |
{
|
|
696 |
// None
|
|
697 |
}
|
|
698 |
}
|
|
699 |
|
|
700 |
// End of File
|