changeset 5 | 8ccc39f9d787 |
parent 0 | 63b37f68c1ce |
child 8 | 6295dc2169f3 |
4:510c70acdbf6 | 5:8ccc39f9d787 |
---|---|
37 #include "cmmstaticutility.h" |
37 #include "cmmstaticutility.h" |
38 #include "cmmmessagerouter.h" |
38 #include "cmmmessagerouter.h" |
39 #include "cmmphonemesshandler.h" |
39 #include "cmmphonemesshandler.h" |
40 #include "tsylogger.h" |
40 #include "tsylogger.h" |
41 #include "cmmphonetsender.h" |
41 #include "cmmphonetsender.h" |
42 #include "osttracedefinitions.h" |
42 #include "OstTraceDefinitions.h" |
43 #ifdef OST_TRACE_COMPILER_IN_USE |
43 #ifdef OST_TRACE_COMPILER_IN_USE |
44 #include "cmmsmsmesshandlertraces.h" |
44 #include "cmmsmsmesshandlerTraces.h" |
45 #endif |
45 #endif |
46 |
46 |
47 // External Data Structures |
47 // External Data Structures |
48 // none |
48 // none |
49 |
49 |
81 const TUint8 KTpduCommandIndexUserDataLength( 7 ); |
81 const TUint8 KTpduCommandIndexUserDataLength( 7 ); |
82 |
82 |
83 // const TUint8 KSizeOfAlphaTag( 34 ); Compiler warning removal |
83 // const TUint8 KSizeOfAlphaTag( 34 ); Compiler warning removal |
84 const TUint8 KSmsScTimeStampMaxLength( 7 ); |
84 const TUint8 KSmsScTimeStampMaxLength( 7 ); |
85 |
85 |
86 // Constanst for SMS parameters |
|
87 const TUint8 KSmsMandatoryParamsLength( 28 ); |
|
88 const TUint8 KSmsMaxAddressLength( 12 ); |
|
89 const TUint8 KSmsParamsParamIndicatorOffset( 0 ); |
|
90 const TUint8 KSmsParamsDestAddressOffset( 1 ); |
|
91 const TUint8 KSmsParamsScAddressOffset( 13 ); |
|
92 const TUint8 KSmsParamsProtocolIdOffset( 25 ); |
|
93 const TUint8 KSmsParamsDcsOffset( 26 ); |
|
94 const TUint8 KSmsParamsValidityPeriodOffset( 27 ); |
|
95 const TUint8 KSizeOfAlphaTag( 62 ); |
|
96 |
|
86 // MODULE DATA STRUCTURES |
97 // MODULE DATA STRUCTURES |
87 |
98 |
88 // Local Data Structures |
99 // Local Data Structures |
89 // none |
100 // none |
90 |
101 |
173 iSmspListArray = new ( ELeave ) CArrayPtrFlat<TSmsParameters>( 1 ); |
184 iSmspListArray = new ( ELeave ) CArrayPtrFlat<TSmsParameters>( 1 ); |
174 |
185 |
175 iReceivedClass2ToBeReSent = EFalse; |
186 iReceivedClass2ToBeReSent = EFalse; |
176 // default bearer setting is "CS preferred" |
187 // default bearer setting is "CS preferred" |
177 iMobileSmsBearer = RMobileSmsMessaging::ESmsBearerCircuitPreferred; |
188 iMobileSmsBearer = RMobileSmsMessaging::ESmsBearerCircuitPreferred; |
189 |
|
190 iMemoryCapacityExceeded = EFalse; |
|
191 |
|
192 // Reading of SMSP entries starts from record 1 |
|
193 iSmspRecordNumber = 1; |
|
178 } |
194 } |
179 |
195 |
180 // ----------------------------------------------------------------------------- |
196 // ----------------------------------------------------------------------------- |
181 // CMmSmsMessHandler::ReceiveMessageL |
197 // CMmSmsMessHandler::ReceiveMessageL |
182 // Called by PhonetReceiver when an ISI message has been received |
198 // Called by PhonetReceiver when an ISI message has been received |
295 |
311 |
296 // Check TPDU length |
312 // Check TPDU length |
297 if ( RMobileSmsMessaging::KGsmTpduSize >= sendData.iMsgData->Length() ) |
313 if ( RMobileSmsMessaging::KGsmTpduSize >= sendData.iMsgData->Length() ) |
298 { |
314 { |
299 msgData.Append( *sendData.iMsgData ); |
315 msgData.Append( *sendData.iMsgData ); |
316 |
|
317 // Get TP-MTI (TP-Message-Type-Indicator) from first octet of TPDU |
|
318 TUint8 tpMti( msgData[KTpduIndexMessageParameters] & |
|
319 TSmsFirstOctet::ESmsMTIMask ); |
|
320 if ( TSmsFirstOctet::ESmsMTISubmitOrSubmitReport == tpMti ) |
|
321 { |
|
322 subBlockId = SMS_SB_SUBMIT; |
|
323 } |
|
324 else if ( TSmsFirstOctet::ESmsMTIStatusReportOrCommand == tpMti ) |
|
325 { |
|
326 subBlockId = SMS_SB_COMMAND; |
|
327 } |
|
328 else // Message type not supported |
|
329 { |
|
330 ret = CMmStaticUtility::EpocErrorCode( |
|
331 KErrArgument, |
|
332 KErrGsmSMSTpduNotSupported ); |
|
333 TFLOGSTRING2("TSY: CMmSmsMessHandler::SmsMessageSendReq. Error! SMS type not supported: %d", tpMti); |
|
334 OstTraceExt1( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_SMSMESSAGESENDREQ, "CMmSmsMessHandler::SmsMessageSendReq.Error! SMS type not supported;tpMti=%hhu", tpMti ); |
|
335 } |
|
300 } |
336 } |
301 else |
337 else |
302 { |
338 { |
303 // TPDU too long |
339 // TPDU too long |
304 ret = CMmStaticUtility::EpocErrorCode( |
340 ret = CMmStaticUtility::EpocErrorCode( |
315 ret = CMmStaticUtility::EpocErrorCode( |
351 ret = CMmStaticUtility::EpocErrorCode( |
316 KErrArgument, |
352 KErrArgument, |
317 KErrGsmSMSTpduNotSupported ); |
353 KErrGsmSMSTpduNotSupported ); |
318 TFLOGSTRING3("TSY: CMmSmsMessHandler::SmsMessageSendReq. Error! Invalid TPDU format (%d) or data buffer format (%d)", msgAttr->iFlags, msgAttr->iDataFormat ); |
354 TFLOGSTRING3("TSY: CMmSmsMessHandler::SmsMessageSendReq. Error! Invalid TPDU format (%d) or data buffer format (%d)", msgAttr->iFlags, msgAttr->iDataFormat ); |
319 OstTraceExt2( TRACE_NORMAL, DUP2_CMMSMSMESSHANDLER_SMSMESSAGESENDREQ, "CMmSmsMessHandler::SmsMessageSendReq.Error!;msgAttr->iFlags=%d;msgAttr->iDataFormat=%hhu", msgAttr->iFlags, msgAttr->iDataFormat ); |
355 OstTraceExt2( TRACE_NORMAL, DUP2_CMMSMSMESSHANDLER_SMSMESSAGESENDREQ, "CMmSmsMessHandler::SmsMessageSendReq.Error!;msgAttr->iFlags=%d;msgAttr->iDataFormat=%hhu", msgAttr->iFlags, msgAttr->iDataFormat ); |
320 } |
|
321 |
|
322 // Get TP-MTI (TP-Message-Type-Indicator) from first octet of TPDU |
|
323 TUint8 tpMti( msgData[KTpduIndexMessageParameters] & |
|
324 TSmsFirstOctet::ESmsMTIMask ); |
|
325 if ( TSmsFirstOctet::ESmsMTISubmitOrSubmitReport == tpMti ) |
|
326 { |
|
327 subBlockId = SMS_SB_SUBMIT; |
|
328 } |
|
329 else if ( TSmsFirstOctet::ESmsMTIStatusReportOrCommand == tpMti ) |
|
330 { |
|
331 subBlockId = SMS_SB_COMMAND; |
|
332 } |
|
333 else // Message type not supported |
|
334 { |
|
335 ret = CMmStaticUtility::EpocErrorCode( |
|
336 KErrArgument, |
|
337 KErrGsmSMSTpduNotSupported ); |
|
338 TFLOGSTRING2("TSY: CMmSmsMessHandler::SmsMessageSendReq. Error! SMS type not supported: %d", tpMti); |
|
339 OstTraceExt1( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_SMSMESSAGESENDREQ, "CMmSmsMessHandler::SmsMessageSendReq.Error! SMS type not supported;tpMti=%hhu", tpMti ); |
|
340 } |
356 } |
341 |
357 |
342 #if (NCP_COMMON_S60_VERSION_SUPPORT>S60_VERSION_32) |
358 #if (NCP_COMMON_S60_VERSION_SUPPORT>S60_VERSION_32) |
343 // Check whether there is SMS sending ongoing. |
359 // Check whether there is SMS sending ongoing. |
344 if ( iSMSSendingOngoing ) |
360 if ( iSMSSendingOngoing ) |
590 aMsgData, |
606 aMsgData, |
591 isiMsg, |
607 isiMsg, |
592 tpUdl, |
608 tpUdl, |
593 tpUserDataIndex, |
609 tpUserDataIndex, |
594 defaultAlphabet, |
610 defaultAlphabet, |
595 msgOffset |
611 msgOffset ); |
596 ); |
|
597 numOfSubblocks++; |
612 numOfSubblocks++; |
598 msgOffset += lengthOfSMSUserDataSb + 1; // Add one byte to put offset into |
613 msgOffset += lengthOfSMSUserDataSb; |
599 // next free position. |
614 TFLOGSTRING2("TSY: CMmSmsMessHandler::CreateSmsMessageSendReq. SMS_SB_USER_DATA created. Message offset: %d", msgOffset ); |
600 TFLOGSTRING("TSY: CMmSmsMessHandler::CreateSmsMessageSendReq. SMS_SB_USER_DATA created." ); |
615 OstTraceExt1( TRACE_NORMAL, DUP7_CMMSMSMESSHANDLER_CREATESMSMESSAGESENDREQ, "CMmSmsMessHandler::CreateSmsMessageSendReq. SMS_SB_USER_DATA created.;msgOffset=%hhu", msgOffset ); |
601 OstTrace0( TRACE_NORMAL, DUP7_CMMSMSMESSHANDLER_CREATESMSMESSAGESENDREQ, "CMmSmsMessHandler::CreateSmsMessageSendReq. SMS_SB_USER_DATA created." ); |
|
602 } |
616 } |
603 |
617 |
604 // Create SMS_SB_CHECK_INFO subblock if user data exists |
618 // Create SMS_SB_CHECK_INFO subblock if user data exists |
605 // Destination address length must be added to get user data |
619 // Destination address length must be added to get user data |
606 // length index |
620 // length index |
647 TUint8 trId( 0 ); |
661 TUint8 trId( 0 ); |
648 if ( SMS_RECEPTION_STORAGE_STATUS_UPDATE == aAction ) |
662 if ( SMS_RECEPTION_STORAGE_STATUS_UPDATE == aAction ) |
649 { |
663 { |
650 trId = ESmsMessagingResumeSmsReception; |
664 trId = ESmsMessagingResumeSmsReception; |
651 } |
665 } |
666 |
|
652 TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
667 TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
653 isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_SMS ); |
668 isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_SMS ); |
654 isiMsg.Set8bit( |
669 isiMsg.Set8bit( |
655 ISI_HEADER_SIZE + SMS_RECEIVE_MESSAGE_REQ_OFFSET_TRANSID, trId ); |
670 ISI_HEADER_SIZE + SMS_RECEIVE_MESSAGE_REQ_OFFSET_TRANSID, trId ); |
656 isiMsg.Set8bit( |
671 isiMsg.Set8bit( |
1212 |
1227 |
1213 TInt epocError( CMmStaticUtility::CSCauseToEpocError( |
1228 TInt epocError( CMmStaticUtility::CSCauseToEpocError( |
1214 PN_SMS, |
1229 PN_SMS, |
1215 smsServerCauseType, |
1230 smsServerCauseType, |
1216 smsServerCauseValue ) ); |
1231 smsServerCauseValue ) ); |
1232 |
|
1233 if ( KErrNone == epocError ) |
|
1234 { |
|
1235 // even if client deactivates reception, next time it is activated |
|
1236 // SMS server will ask network to resend all NACKed MT SMs |
|
1237 // only query status does not affect this flag, but this action |
|
1238 // is not used |
|
1239 iMemoryCapacityExceeded = EFalse; |
|
1240 } |
|
1217 |
1241 |
1218 // Compete active reception status |
1242 // Compete active reception status |
1219 if ( SMS_RECEPTION_ACTIVE == receptionStatus ) |
1243 if ( SMS_RECEPTION_ACTIVE == receptionStatus ) |
1220 { |
1244 { |
1221 if ( 0 == trId ) // SMS receiving activated |
1245 if ( 0 == trId ) // SMS receiving activated |
1410 // |
1434 // |
1411 void CMmSmsMessHandler::SmsReceivedMsgInd( const TIsiReceiveC& aIsiMsg ) |
1435 void CMmSmsMessHandler::SmsReceivedMsgInd( const TIsiReceiveC& aIsiMsg ) |
1412 { |
1436 { |
1413 TFLOGSTRING("TSY: CMmSmsMessHandler::SmsReceivedMsgInd"); |
1437 TFLOGSTRING("TSY: CMmSmsMessHandler::SmsReceivedMsgInd"); |
1414 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSPPROUTINGNTF, "CMmSmsMessHandler::SmsReceivedMsgInd" ); |
1438 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSPPROUTINGNTF, "CMmSmsMessHandler::SmsReceivedMsgInd" ); |
1415 TInt ret( KErrNone ); |
1439 |
1416 // Create a package |
1440 if ( iMemoryCapacityExceeded ) |
1417 CMmDataPackage package; |
1441 { |
1418 |
1442 TFLOGSTRING("TSY: CMmSmsMessHandler::SmsReceivedMsgInd no storage - internal NACK"); |
1419 TUint8 replaceTpPid( 0 ); // IsSmsClass2 also fills this |
1443 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSRECEIVEDMSGIND, "CMmSmsMessHandler::SmsReceivedMsgInd no storage - internal NACK" ); |
1420 TBool receivedSmsClass2( IsSmsClass2( aIsiMsg, replaceTpPid ) ); |
1444 // error is ignored |
1421 |
1445 SmsReceivedMsgReportReq( |
1422 // SIM SMS cache: incoming class 2 SMS |
1446 EInternalNack, |
1423 if ( receivedSmsClass2 ) |
1447 NULL, |
1424 { |
1448 KErrGsmSMSMemoryCapacityExceeded ); |
1425 ret = SmsClass2ReceivedMsgInd( aIsiMsg, replaceTpPid ); |
1449 } |
1426 } |
|
1427 // Received SMS is not a class 2 SMS (it is a normal SMS) |
|
1428 else |
1450 else |
1429 { |
1451 { |
1430 ret = SmsClass1ReceivedMsgInd( aIsiMsg ); |
1452 TInt ret( KErrNone ); |
1431 } |
1453 // Create a package |
1432 // There was an error, complete to upper level |
1454 CMmDataPackage package; |
1433 if ( KErrNone != ret ) |
1455 |
1434 { |
1456 TUint8 replaceTpPid( 0 ); // IsSmsClass2 also fills this |
1457 TBool receivedSmsClass2( IsSmsClass2( aIsiMsg, replaceTpPid ) ); |
|
1458 |
|
1459 // SIM SMS cache: incoming class 2 SMS |
|
1460 if ( receivedSmsClass2 ) |
|
1461 { |
|
1462 ret = SmsClass2ReceivedMsgInd( aIsiMsg, replaceTpPid ); |
|
1463 } |
|
1464 // Received SMS is not a class 2 SMS (it is a normal SMS) |
|
1465 else |
|
1466 { |
|
1467 ret = SmsClass1ReceivedMsgInd( aIsiMsg ); |
|
1468 } |
|
1469 // There was an error, complete to upper level |
|
1470 if ( KErrNone != ret ) |
|
1471 { |
|
1435 TFLOGSTRING2("TSY: CMmSmsMessHandler::SmsReceivedMsgInd;ret=%d", ret); |
1472 TFLOGSTRING2("TSY: CMmSmsMessHandler::SmsReceivedMsgInd;ret=%d", ret); |
1436 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_SMSPPROUTINGNTF, "CMmSmsMessHandler::SmsReceivedMsgInd;ret=%d", ret ); |
1473 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_SMSPPROUTINGNTF, "CMmSmsMessHandler::SmsReceivedMsgInd;ret=%d", ret ); |
1437 TBool smsInd( ETrue ); |
1474 TBool smsInd( ETrue ); |
1438 TSmsMsg* nullSms = NULL; |
1475 TSmsMsg* nullSms = NULL; |
1439 |
1476 |
1440 package.PackData( &smsInd, &nullSms ); |
1477 package.PackData( &smsInd, &nullSms ); |
1441 |
1478 |
1442 // Complete request to client |
1479 // Complete request to client |
1443 iMessageRouter->Complete( |
1480 iMessageRouter->Complete( |
1444 EMobileSmsMessagingReceiveMessage, |
1481 EMobileSmsMessagingReceiveMessage, |
1445 &package, |
1482 &package, |
1446 ret ); |
1483 ret ); |
1484 } |
|
1447 } |
1485 } |
1448 } |
1486 } |
1449 |
1487 |
1450 // ----------------------------------------------------------------------------- |
1488 // ----------------------------------------------------------------------------- |
1451 // CMmSmsMessHandler::SmsReceivedMsgReportResp |
1489 // CMmSmsMessHandler::SmsReceivedMsgReportResp |
1461 + SMS_RECEIVED_MSG_REPORT_RESP_OFFSET_SMSCAUSE ) ); |
1499 + SMS_RECEIVED_MSG_REPORT_RESP_OFFSET_SMSCAUSE ) ); |
1462 |
1500 |
1463 TFLOGSTRING3("TSY: CMmSmsMessHandler::SmsReceivedPpReportResp - traId: %d, cause: %d", traId, cause); |
1501 TFLOGSTRING3("TSY: CMmSmsMessHandler::SmsReceivedPpReportResp - traId: %d, cause: %d", traId, cause); |
1464 OstTraceExt2( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSRECEIVEDPPREPORTRESP, "CMmSmsMessHandler::SmsReceivedPpReportResp;traId=%hhu;cause=%hhu", traId, cause ); |
1502 OstTraceExt2( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSRECEIVEDPPREPORTRESP, "CMmSmsMessHandler::SmsReceivedPpReportResp;traId=%hhu;cause=%hhu", traId, cause ); |
1465 |
1503 |
1466 // Response for SmsReceivedPpReportReq (Ack) |
1504 if ( iMemoryCapacityExceeded ) |
1467 if ( ESmsMessagingAckSmsStored == traId ) |
1505 { |
1468 { |
1506 // ignore the response, this is response to self-NACK |
1469 iMessageRouter->Complete( |
1507 // caused by client not having anymore storage space |
1470 EMobileSmsMessagingAckSmsStored, |
1508 TFLOGSTRING("TSY: CMmSmsMessHandler::SmsReceivedPpReportResp - self-NACK"); |
1471 CMmStaticUtility::CSCauseToEpocError( |
1509 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSRECEIVEDMSGREPORTRESP, "CMmSmsMessHandler::SmsReceivedPpReportResp - self-NACK" ); |
1472 PN_SMS, |
|
1473 SMS_CAUSE_TYPE_COMMON, |
|
1474 cause ) ); |
|
1475 } |
|
1476 // Response for SmsReceivedPpReportReq (Nack) |
|
1477 else if ( ESmsMessagingNackSmsStored == traId ) |
|
1478 { |
|
1479 iMessageRouter->Complete( |
|
1480 EMobileSmsMessagingNackSmsStored, |
|
1481 CMmStaticUtility::CSCauseToEpocError( |
|
1482 PN_SMS, |
|
1483 SMS_CAUSE_TYPE_COMMON, |
|
1484 cause ) ); |
|
1485 } |
1510 } |
1486 else |
1511 else |
1487 { |
1512 { |
1513 // Response for SmsReceivedPpReportReq (Ack) |
|
1514 if ( ESmsMessagingAckSmsStored == traId ) |
|
1515 { |
|
1516 iMessageRouter->Complete( |
|
1517 EMobileSmsMessagingAckSmsStored, |
|
1518 CMmStaticUtility::CSCauseToEpocError( |
|
1519 PN_SMS, |
|
1520 SMS_CAUSE_TYPE_COMMON, |
|
1521 cause ) ); |
|
1522 } |
|
1523 // Response for SmsReceivedPpReportReq (Nack) |
|
1524 else if ( ESmsMessagingNackSmsStored == traId || |
|
1525 ESmsMessagingNackSmsStoredCapacityExceeded == traId ) |
|
1526 { |
|
1527 iMessageRouter->Complete( |
|
1528 EMobileSmsMessagingNackSmsStored, |
|
1529 CMmStaticUtility::CSCauseToEpocError( |
|
1530 PN_SMS, |
|
1531 SMS_CAUSE_TYPE_COMMON, |
|
1532 cause ) ); |
|
1533 } |
|
1534 else |
|
1535 { |
|
1488 TFLOGSTRING2("TSY:CMmSmsMessHandler::SmsReceivedPpReportResp:Unexpected transaction ID %d.",traId); |
1536 TFLOGSTRING2("TSY:CMmSmsMessHandler::SmsReceivedPpReportResp:Unexpected transaction ID %d.",traId); |
1489 OstTraceExt1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_SMSRECEIVEDPPREPORTRESP, "CMmSmsMessHandler::SmsReceivedPpReportResp;Unexpected transaction ID=%hhu", traId ); |
1537 OstTraceExt1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_SMSRECEIVEDPPREPORTRESP, "CMmSmsMessHandler::SmsReceivedPpReportResp;Unexpected transaction ID=%hhu", traId ); |
1490 } |
1538 } |
1491 |
1539 |
1492 if ( KErrNone != cause ) |
1540 if ( SMS_OK != cause ) |
1493 { |
1541 { |
1494 //Acknowledging failed. |
1542 //Acknowledging failed. |
1495 //Complete possible receive message request with KErrGeneral and |
1543 //Complete possible receive message request with KErrGeneral and |
1496 //set routing activity to false. SMS Stack makes new ReceiveMessage |
1544 //set routing activity to false. SMS Stack makes new ReceiveMessage |
1497 //request. |
1545 //request. |
1498 TBool smsInd( EFalse ); |
1546 //Client continues receiving MT SM indications if NACKing failed |
1499 TSmsMsg* nullSms = NULL; |
1547 iMemoryCapacityExceeded = EFalse; |
1500 |
1548 |
1501 //Complete request to client |
1549 TBool smsInd( EFalse ); |
1502 CMmDataPackage package; |
1550 TSmsMsg* nullSms = NULL; |
1503 package.PackData( &smsInd, &nullSms ); |
1551 |
1504 iSmsSlotLocation = 0; |
1552 //Complete request to client |
1505 |
1553 CMmDataPackage package; |
1506 // ISI message construction failed or phonet sender |
1554 package.PackData( &smsInd, &nullSms ); |
1507 // returned error |
1555 iSmsSlotLocation = 0; |
1508 iMessageRouter->Complete( |
1556 |
1509 EMobileSmsMessagingReceiveMessage, |
1557 // ISI message construction failed or phonet sender |
1510 &package, |
1558 // returned error |
1511 KErrGeneral ); |
1559 iMessageRouter->Complete( |
1560 EMobileSmsMessagingReceiveMessage, |
|
1561 &package, |
|
1562 KErrGeneral ); |
|
1563 } |
|
1564 else if ( ESmsMessagingNackSmsStoredCapacityExceeded == traId ) |
|
1565 { |
|
1566 // client succeeded NACKing MT SM |
|
1567 // it wont receive any further MT SM indications |
|
1568 iMemoryCapacityExceeded = ETrue; |
|
1569 } |
|
1512 } |
1570 } |
1513 } |
1571 } |
1514 |
1572 |
1515 // ----------------------------------------------------------------------------- |
1573 // ----------------------------------------------------------------------------- |
1516 // CMmSmsMessHandler::BuildScAddress |
1574 // CMmSmsMessHandler::BuildScAddress |
1746 ret = SmsReceiveMessageReq( SMS_RECEPTION_STORAGE_STATUS_UPDATE ); |
1804 ret = SmsReceiveMessageReq( SMS_RECEPTION_STORAGE_STATUS_UPDATE ); |
1747 break; |
1805 break; |
1748 } |
1806 } |
1749 case EMobileSmsMessagingGetSmspListPhase1: |
1807 case EMobileSmsMessagingGetSmspListPhase1: |
1750 { |
1808 { |
1751 // Lets delete TSY's internal temporary SMSP storage |
1809 // Reset internal temporary SMSP storage |
1752 iSmspListArray->ResetAndDestroy(); |
1810 iSmspListArray->ResetAndDestroy(); |
1811 // Start reading SMSP entries |
|
1812 ret = UiccGetSmspEntryReq(); |
|
1753 break; |
1813 break; |
1754 } |
1814 } |
1755 case EMobileSmsMessagingStoreSmspList: |
1815 case EMobileSmsMessagingStoreSmspList: |
1756 { |
1816 { |
1817 ret = UiccSmsUpdateParameterReq( aDataPackage ); |
|
1757 break; |
1818 break; |
1758 } |
1819 } |
1759 case EMobileSmsMessagingAckSmsStored: |
1820 case EMobileSmsMessagingAckSmsStored: |
1760 { |
1821 { |
1761 TDesC8* data; |
1822 TDesC8* data; |
1788 { |
1849 { |
1789 TFLOGSTRING("TSY: CMmSmsMessHandler::ExtFuncL.Internal Nack handling started" ); |
1850 TFLOGSTRING("TSY: CMmSmsMessHandler::ExtFuncL.Internal Nack handling started" ); |
1790 OstTrace0( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_EXTFUNCL, "CMmSmsMessHandler::ExtFuncL, Internal Nack handling started" ); |
1851 OstTrace0( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_EXTFUNCL, "CMmSmsMessHandler::ExtFuncL, Internal Nack handling started" ); |
1791 } |
1852 } |
1792 |
1853 |
1854 // NACK due to lack of storage space causes NTSY to reject further |
|
1855 // MT SMs until client resumes SMS reception |
|
1856 TUint8 traId = KErrGsmSMSMemoryCapacityExceeded == rpCause ? |
|
1857 ESmsMessagingNackSmsStoredCapacityExceeded : ESmsMessagingNackSmsStored; |
|
1793 ret = SmsReceivedMsgReportReq( |
1858 ret = SmsReceivedMsgReportReq( |
1794 ESmsMessagingNackSmsStored, |
1859 traId, |
1795 msgData, |
1860 msgData, |
1796 rpCause ); |
1861 rpCause ); |
1797 break; |
1862 break; |
1798 } |
1863 } |
1799 case EMobilePhoneStoreDelete: |
1864 case EMobilePhoneStoreDelete: |
1801 ret = DeleteSms( aDataPackage ); |
1866 ret = DeleteSms( aDataPackage ); |
1802 break; |
1867 break; |
1803 } |
1868 } |
1804 case EMobilePhoneStoreDeleteAll: |
1869 case EMobilePhoneStoreDeleteAll: |
1805 { |
1870 { |
1871 iRecordId = 1; // Start fron 1st location |
|
1806 ret = DeleteAllSms(); |
1872 ret = DeleteAllSms(); |
1807 break; |
1873 break; |
1808 } |
1874 } |
1809 case EMobilePhoneStoreRead: |
1875 case EMobilePhoneStoreRead: |
1810 { |
1876 { |
1851 RMobileSmsStore::TMobileGsmSmsEntryV1* smsFromCache = |
1917 RMobileSmsStore::TMobileGsmSmsEntryV1* smsFromCache = |
1852 iSmsCache.GetEntry( currentSlot ); |
1918 iSmsCache.GetEntry( currentSlot ); |
1853 |
1919 |
1854 if ( smsFromCache ) |
1920 if ( smsFromCache ) |
1855 { |
1921 { |
1856 delete smsFromCache; |
1922 if ( CheckSCTimestamp( *smsFromCache, scTime ) ) |
1923 { |
|
1924 // Message with the same timestamp found, |
|
1925 // update SIM flag. |
|
1926 UiccUpdateSMSStatus( currentSlot ); |
|
1927 currentSlot = totalSlots; // we're done, exit loop |
|
1928 } |
|
1857 } |
1929 } |
1858 currentSlot++; |
1930 currentSlot++; |
1859 } |
1931 } |
1860 TFLOGSTRING("TSY: CMmSmsMessHandler::ExtFuncL - ECustomSetSimMessageStatusReadIPC done."); |
1932 TFLOGSTRING("TSY: CMmSmsMessHandler::ExtFuncL - ECustomSetSimMessageStatusReadIPC done."); |
1861 OstTrace0( TRACE_NORMAL, DUP5_CMMSMSMESSHANDLER_EXTFUNCL, "CMmSmsMessHandler::ExtFuncL, ECustomSetSimMessageStatusReadIPC done" ); |
1933 OstTrace0( TRACE_NORMAL, DUP5_CMMSMSMESSHANDLER_EXTFUNCL, "CMmSmsMessHandler::ExtFuncL, ECustomSetSimMessageStatusReadIPC done" ); |
1878 } |
1950 } |
1879 } |
1951 } |
1880 return ret; |
1952 return ret; |
1881 } |
1953 } |
1882 |
1954 |
1883 // ----------------------------------------------------------------------------- |
|
1884 // CMmSmsMessHandler::InternalRetrieveSmspListL |
|
1885 // Complete SmsParametersReadREQuest and call GetSmspList |
|
1886 // or CompleteReadSmsp method |
|
1887 // (other items were commented in header) |
|
1888 // ----------------------------------------------------------------------------- |
|
1889 // |
|
1890 void CMmSmsMessHandler::InternalRetrieveSmspListL( TSmsParameters* aParameters ) |
|
1891 { |
|
1892 TFLOGSTRING("TSY: CMmSmsMessHandler::InternalRetrieveSmspListL"); |
|
1893 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_INTERNALRETRIEVESMSPLISTL, "CMmSmsMessHandler::InternalRetrieveSmspListL" ); |
|
1894 // Add parameter sets information to the TSY's internal storage |
|
1895 iSmspListArray->AppendL( aParameters ); |
|
1896 |
|
1897 // Lets read next SMSP set |
|
1898 if ( iLocationOfSmspSet <= iAmountOfSmspSets ) |
|
1899 { |
|
1900 iLocationOfSmspSet++; |
|
1901 } |
|
1902 else // All SMSP sets read |
|
1903 { |
|
1904 //Pack data |
|
1905 CMmDataPackage package; |
|
1906 package.PackData( iSmspListArray ); |
|
1907 |
|
1908 //complete the request, |
|
1909 iMessageRouter->Complete( |
|
1910 EMobileSmsMessagingGetSmspListPhase1, |
|
1911 &package, |
|
1912 KErrNone ); |
|
1913 |
|
1914 //Delete array |
|
1915 iSmspListArray->ResetAndDestroy(); |
|
1916 } |
|
1917 } |
|
1918 |
1955 |
1919 // ----------------------------------------------------------------------------- |
1956 // ----------------------------------------------------------------------------- |
1920 // CMmSmsMessHandler::CheckTpPidAndSenderAndServiceCenter |
1957 // CMmSmsMessHandler::CheckTpPidAndSenderAndServiceCenter |
1921 // Compares TP-PID, sender number and SC number of the received class 2 |
1958 // Compares TP-PID, sender number and SC number of the received class 2 |
1922 // SMS in aReceivedSmsIsiMsg, and the SMS read from SIM in aReadSmsIsiMsg. |
1959 // SMS in aReceivedSmsIsiMsg, and the SMS read from SIM in aReadSmsIsiMsg. |
1937 TInt offset( 1 ); // Set offset to message reference in TPDU |
1974 TInt offset( 1 ); // Set offset to message reference in TPDU |
1938 TUint8 messageReference( aSMSOnSIM->iMsgData[offset] ); |
1975 TUint8 messageReference( aSMSOnSIM->iMsgData[offset] ); |
1939 |
1976 |
1940 // Destination address length is integer representation |
1977 // Destination address length is integer representation |
1941 // of the number of useful semi-octets of address field |
1978 // of the number of useful semi-octets of address field |
1942 messageReference = ( messageReference + 1 ) / 2; |
1979 // Add two mandatory bytes of TP-OA, too. |
1980 |
|
1981 messageReference = ( ( messageReference + 1 ) / 2) + 2; |
|
1943 offset += messageReference; |
1982 offset += messageReference; |
1944 offset += 2; // Set offset to Protocol Id |
1983 |
1945 TUint8 protocolId( aSMSOnSIM->iMsgData[offset] ); |
1984 TUint8 protocolId( aSMSOnSIM->iMsgData[offset] ); |
1946 if ( protocolId == aReceivedTpPid ) |
1985 if ( protocolId == aReceivedTpPid ) |
1947 { |
1986 { |
1948 // this message has the same TP-PID. Now check if it also has |
1987 // this message has the same TP-PID. Now check if it also has |
1949 // same sender number and service center number |
1988 // same sender number and service center number |
2125 if ( KErrNone == iSmsCache.Status() || KErrNoMemory == iSmsCache.Status() ) |
2164 if ( KErrNone == iSmsCache.Status() || KErrNoMemory == iSmsCache.Status() ) |
2126 { |
2165 { |
2127 TInt index( 0 ); |
2166 TInt index( 0 ); |
2128 //unpack data |
2167 //unpack data |
2129 aDataPackage->UnPackData( index ); |
2168 aDataPackage->UnPackData( index ); |
2130 iSmsCache.SetDeleteLocation( index ); |
2169 RMobileSmsStore::TMobileGsmSmsEntryV1* smsData( |
2170 iSmsCache.GetEntry( index ) ); |
|
2171 |
|
2172 if ( smsData ) |
|
2173 { |
|
2174 iSmsCache.SetDeleteLocation( index ); |
|
2175 |
|
2176 // Set parameters for UICC_APPL_CMD_REQ message |
|
2177 TUiccWriteLinearFixed params; |
|
2178 params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
2179 params.trId = ETrIdDeleteSMS; |
|
2180 params.dataOffset = 0; |
|
2181 params.dataAmount = 0; |
|
2182 params.record = index; |
|
2183 |
|
2184 params.fileId = KElemFileShortMessages; |
|
2185 params.fileIdSfi = UICC_SFI_NOT_PRESENT; |
|
2186 params.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED; |
|
2187 |
|
2188 // File id path |
|
2189 params.filePath.Append( KMasterFileId >> 8 ); |
|
2190 params.filePath.Append( KMasterFileId ); |
|
2191 params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
2192 |
|
2193 // Update file data with 0xFF |
|
2194 TBuf8<KSmsElemetaryFileRecordLength> fileDataBuf; |
|
2195 fileDataBuf.AppendFill( 0xFF, KSmsElemetaryFileRecordLength ); |
|
2196 |
|
2197 params.fileData.Append( fileDataBuf ); |
|
2198 |
|
2199 return iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
2200 } |
|
2201 else |
|
2202 { |
|
2203 // Location empty or not in use. |
|
2204 iMessageRouter->Complete( EMobilePhoneStoreDelete, KErrNone ); |
|
2205 } |
|
2131 } |
2206 } |
2132 else |
2207 else |
2133 { |
2208 { |
2134 TFLOGSTRING("TSY: CMmSmsMessHandler::DeleteSms, cache not ready/failed"); |
2209 TFLOGSTRING("TSY: CMmSmsMessHandler::DeleteSms, cache not ready/failed"); |
2135 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_DELETESMS, "CMmSmsMessHandler::DeleteSms, cache not ready/failed" ); |
2210 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_DELETESMS, "CMmSmsMessHandler::DeleteSms, cache not ready/failed" ); |
2149 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_DELETEALLSMS, "CMmSmsMessHandler::DeleteAllSms" ); |
2224 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_DELETEALLSMS, "CMmSmsMessHandler::DeleteAllSms" ); |
2150 TInt ret( KErrNone ); |
2225 TInt ret( KErrNone ); |
2151 // SIM SMS cache: -- EMobilePhoneStoreDeleteAll |
2226 // SIM SMS cache: -- EMobilePhoneStoreDeleteAll |
2152 if ( KErrNone == iSmsCache.Status() ) |
2227 if ( KErrNone == iSmsCache.Status() ) |
2153 { |
2228 { |
2229 if ( 0 < iSmsCache.TotalEntries() ) |
|
2230 { |
|
2231 RMobileSmsStore::TMobileGsmSmsEntryV1* smsData( |
|
2232 iSmsCache.GetEntry( iRecordId ) ); |
|
2233 |
|
2234 if ( smsData ) |
|
2235 { |
|
2236 iSmsCache.SetDeleteLocation( iRecordId ); |
|
2237 |
|
2238 // Set parameters for UICC_APPL_CMD_REQ message |
|
2239 TUiccWriteLinearFixed params; |
|
2240 params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
2241 params.trId = ETrIdDeleteAllSMSs; |
|
2242 params.dataOffset = 0; |
|
2243 params.dataAmount = 0; |
|
2244 params.record = iRecordId; |
|
2245 |
|
2246 params.fileId = KElemFileShortMessages; |
|
2247 params.fileIdSfi = UICC_SFI_NOT_PRESENT; |
|
2248 params.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED; |
|
2249 |
|
2250 // File id path |
|
2251 params.filePath.Append( KMasterFileId >> 8 ); |
|
2252 params.filePath.Append( KMasterFileId ); |
|
2253 params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
2254 |
|
2255 // Update file data with 0xFF |
|
2256 TBuf8<KSmsElemetaryFileRecordLength> fileDataBuf; |
|
2257 fileDataBuf.AppendFill( 0xFF, KSmsElemetaryFileRecordLength ); |
|
2258 |
|
2259 params.fileData.Append( fileDataBuf ); |
|
2260 |
|
2261 return iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
2262 } |
|
2263 else |
|
2264 { |
|
2265 // Location is empty. Check next location |
|
2266 UiccDeleteAllSMSResp( KErrNone ); |
|
2267 } |
|
2268 } |
|
2269 else |
|
2270 { |
|
2271 iMessageRouter->Complete( EMobilePhoneStoreDeleteAll, KErrNone ); |
|
2272 } |
|
2154 } |
2273 } |
2155 else |
2274 else |
2156 { |
2275 { |
2157 TFLOGSTRING("TSY: CMmSmsMessHandler::DeleteAllSms, cache not ready/failed"); |
2276 TFLOGSTRING("TSY: CMmSmsMessHandler::DeleteAllSms, cache not ready/failed"); |
2158 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_DELETEALLSMS, "CMmSmsMessHandler::DeleteAllSms, cache not ready/failed" ); |
2277 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_DELETEALLSMS, "CMmSmsMessHandler::DeleteAllSms, cache not ready/failed" ); |
2957 { |
3076 { |
2958 TFLOGSTRING("TSY:CMmSmsMessHandler::BuildSmsSbUserData"); |
3077 TFLOGSTRING("TSY:CMmSmsMessHandler::BuildSmsSbUserData"); |
2959 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_BUILDSMSSBUSERDATA, "CMmSmsMessHandler::BuildSmsSbUserData" ); |
3078 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_BUILDSMSSBUSERDATA, "CMmSmsMessHandler::BuildSmsSbUserData" ); |
2960 |
3079 |
2961 TUint8 dataLengthInOctets( 0 ); |
3080 TUint8 dataLengthInOctets( 0 ); |
3081 TUint8 subblockLength( 0 ); |
|
2962 |
3082 |
2963 // If data is 7-bit, then TP-UDL is integer representation of |
3083 // If data is 7-bit, then TP-UDL is integer representation of |
2964 // the number of septets within the TP-UD field |
3084 // the number of septets within the TP-UD field |
2965 if ( aDefaultAlphabet ) |
3085 if ( aDefaultAlphabet ) |
2966 { |
3086 { |
2978 TBuf8<SIZE_SMS_SB_USER_DATA + SMS_COMMAND_DATA_MAX_LEN> userDataBuf; |
3098 TBuf8<SIZE_SMS_SB_USER_DATA + SMS_COMMAND_DATA_MAX_LEN> userDataBuf; |
2979 TIsiSubBlock userData( |
3099 TIsiSubBlock userData( |
2980 userDataBuf, |
3100 userDataBuf, |
2981 SMS_SB_USER_DATA, |
3101 SMS_SB_USER_DATA, |
2982 EIsiSubBlockTypeId16Len16 ); |
3102 EIsiSubBlockTypeId16Len16 ); |
2983 userDataBuf.Append( KSmsPadding ); |
3103 userDataBuf.Append( KSmsPadding ); |
2984 userDataBuf.Append( dataLengthInOctets ); |
3104 userDataBuf.Append( dataLengthInOctets ); |
2985 userDataBuf.Append( KSmsPadding ); |
3105 userDataBuf.Append( KSmsPadding ); |
2986 userDataBuf.Append( aTpUdl ); |
3106 userDataBuf.Append( aTpUdl ); |
2987 userDataBuf.Append( dataBytes ); |
3107 userDataBuf.Append( dataBytes ); |
2988 |
3108 |
2989 aIsiMsg.CopyData( aMsgOffset, userData.CompleteSubBlock() ); |
3109 aIsiMsg.CopyData( aMsgOffset, userData.CompleteSubBlock() ); |
3110 |
|
3111 subblockLength = userDataBuf.Length(); |
|
2990 |
3112 |
2991 TFLOGSTRING2( "TSY:CMmSmsMessHandler::BuildSmsSbUserData. User data length in octets: %d", dataLengthInOctets ); |
3113 TFLOGSTRING2( "TSY:CMmSmsMessHandler::BuildSmsSbUserData. User data length in octets: %d", dataLengthInOctets ); |
2992 TFLOGSTRING2( "TSY:CMmSmsMessHandler::BuildSmsSbUserData. User data character count: %d", aTpUdl ); |
3114 TFLOGSTRING2( "TSY:CMmSmsMessHandler::BuildSmsSbUserData. User data character count: %d", aTpUdl ); |
2993 OstTraceExt2( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_BUILDSMSSBUSERDATA, "CMmSmsMessHandler::BuildSmsSbUserData;dataLengthInOctets=%hhu;aTpUdl=%hhu", dataLengthInOctets, aTpUdl ); |
3115 OstTraceExt2( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_BUILDSMSSBUSERDATA, "CMmSmsMessHandler::BuildSmsSbUserData;dataLengthInOctets=%hhu;aTpUdl=%hhu", dataLengthInOctets, aTpUdl ); |
2994 |
3116 TFLOGSTRING2( "TSY:CMmSmsMessHandler::BuildSmsSbUserData. Length of subblock: %d", subblockLength ); |
2995 return dataLengthInOctets + 8; // 8 bytes sub block header data before data bytes |
3117 OstTraceExt1( TRACE_NORMAL, DUP2_CMMSMSMESSHANDLER_BUILDSMSSBUSERDATA, "CMmSmsMessHandler::BuildSmsSbUserData;subblockLength=%hhu", subblockLength ); |
3118 |
|
3119 return subblockLength; |
|
2996 } |
3120 } |
2997 |
3121 |
2998 |
3122 |
2999 // ----------------------------------------------------------------------------- |
3123 // ----------------------------------------------------------------------------- |
3000 // Creates SMS_SB_VALIDITY_PERIOD subblock and appends it to ISI message |
3124 // Creates SMS_SB_VALIDITY_PERIOD subblock and appends it to ISI message |
3067 // ----------------------------------------------------------------------------- |
3191 // ----------------------------------------------------------------------------- |
3068 // |
3192 // |
3069 TInt CMmSmsMessHandler::ProcessUiccMsg( |
3193 TInt CMmSmsMessHandler::ProcessUiccMsg( |
3070 TInt aTraId, |
3194 TInt aTraId, |
3071 TInt aStatus, |
3195 TInt aStatus, |
3196 TUint8 /*aDetails*/, |
|
3072 const TDesC8& aFileData ) |
3197 const TDesC8& aFileData ) |
3073 { |
3198 { |
3074 TFLOGSTRING3("TSY:CMmSmsMessHandler::ProcessUiccMsg, aTraId: %d, status: %d", aTraId, aStatus ); |
3199 TFLOGSTRING3("TSY:CMmSmsMessHandler::ProcessUiccMsg, aTraId: %d, status: %d", aTraId, aStatus ); |
3075 OstTrace1( TRACE_NORMAL, CMMSMSMESSHANDLER_PROCESSUICCMSG, "CMmSmsMessHandler::ProcessUiccMsg;aTraId=%d", aTraId ); |
3200 OstTrace1( TRACE_NORMAL, CMMSMSMESSHANDLER_PROCESSUICCMSG, "CMmSmsMessHandler::ProcessUiccMsg;aTraId=%d", aTraId ); |
3076 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_PROCESSUICCMSG, "CMmSmsMessHandler::ProcessUiccMsg;aStatus=%d", aStatus ); |
3201 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_PROCESSUICCMSG, "CMmSmsMessHandler::ProcessUiccMsg;aStatus=%d", aStatus ); |
3095 break; |
3220 break; |
3096 } |
3221 } |
3097 case ETrIdReadSMSRecordCount: |
3222 case ETrIdReadSMSRecordCount: |
3098 { |
3223 { |
3099 GetNumOfEFSMSRecordsResp( aStatus, aFileData ); |
3224 GetNumOfEFSMSRecordsResp( aStatus, aFileData ); |
3225 break; |
|
3226 } |
|
3227 case ETrIdDeleteSMS: |
|
3228 { |
|
3229 UiccDeleteSMSResp( aStatus ); |
|
3230 break; |
|
3231 } |
|
3232 case ETrIdDeleteAllSMSs: |
|
3233 { |
|
3234 UiccDeleteAllSMSResp( aStatus ); |
|
3235 break; |
|
3236 } |
|
3237 case ETrIdUpdateSMSStatusReadSMS: |
|
3238 { |
|
3239 UiccUpdateSMSStatusReadSMSResp( aStatus, aFileData ); |
|
3240 break; |
|
3241 } |
|
3242 case ETrIdUpdateSMSStatusWriteSMS: |
|
3243 { |
|
3244 UiccUpdateSMSStatusWriteSMSResp( aStatus ); |
|
3245 break; |
|
3246 } |
|
3247 case ETrIdGetSmspEntries: |
|
3248 { |
|
3249 // If status is OK, save the entry and then try to read next record |
|
3250 if ( UICC_STATUS_OK == aStatus ) |
|
3251 { |
|
3252 // Store the entry to the list |
|
3253 ret = UiccStoreSmspEntry( aFileData ); |
|
3254 } |
|
3255 |
|
3256 // If the first record was tried to read, but UICC server returned |
|
3257 // error or data was invalid, error is completed to commontsy |
|
3258 if ( 1 == iSmspRecordNumber && |
|
3259 ( UICC_STATUS_OK != aStatus || KErrNone != ret ) ) |
|
3260 { |
|
3261 iMessageRouter->Complete( |
|
3262 EMobileSmsMessagingGetSmspListPhase1, |
|
3263 KErrNotFound ); |
|
3264 // Reset internal array |
|
3265 iSmspListArray->ResetAndDestroy(); |
|
3266 } |
|
3267 // At least one SMS entry was read and stored successfully |
|
3268 else if( UICC_STATUS_OK != aStatus || KErrNone != ret ) |
|
3269 { |
|
3270 CMmDataPackage package; |
|
3271 package.PackData( iSmspListArray ); |
|
3272 iMessageRouter->Complete( |
|
3273 EMobileSmsMessagingGetSmspListPhase1, |
|
3274 &package, |
|
3275 KErrNone ); |
|
3276 // Reset internal array |
|
3277 iSmspListArray->ResetAndDestroy(); |
|
3278 } |
|
3279 break; |
|
3280 } |
|
3281 case ETrIdWriteSmspEntry: |
|
3282 { |
|
3283 TInt error( KErrNone ); |
|
3284 if ( UICC_STATUS_OK != aStatus ) |
|
3285 { |
|
3286 error = KErrNotFound; |
|
3287 } |
|
3288 iMessageRouter->Complete( EMobileSmsMessagingStoreSmspList, error ); |
|
3100 break; |
3289 break; |
3101 } |
3290 } |
3102 default: |
3291 default: |
3103 { |
3292 { |
3104 TFLOGSTRING("TSY:CMmSmsMessHandler::ProcessUiccMsg - unknown transaction ID" ); |
3293 TFLOGSTRING("TSY:CMmSmsMessHandler::ProcessUiccMsg - unknown transaction ID" ); |
3285 EMobilePhoneStoreGetInfo, |
3474 EMobilePhoneStoreGetInfo, |
3286 &data, |
3475 &data, |
3287 iSmsCache.Status() ); |
3476 iSmsCache.Status() ); |
3288 |
3477 |
3289 // it is possible that re-caching was done due to sim refresh. |
3478 // it is possible that re-caching was done due to sim refresh. |
3290 // iMessageRouter->GetPhoneMessHandler()-> |
3479 iMessageRouter->GetPhoneMessHandler()-> |
3291 // SmsCachingCompleted( iSmsCache.Status() ); |
3480 SmsCachingCompleted( iSmsCache.Status() ); |
3292 |
3481 |
3293 // if cache is up and a message was received while cacheing then resume |
3482 // if cache is up and a message was received while cacheing then resume |
3294 if ( KErrNone == iSmsCache.Status() && iReceivedClass2ToBeReSent ) |
3483 if ( KErrNone == iSmsCache.Status() && iReceivedClass2ToBeReSent ) |
3295 { |
3484 { |
3296 TFLOGSTRING("TSY: CMmSmsMessHandler::UiccReadSMSResp -- resume SMS reception"); |
3485 TFLOGSTRING("TSY: CMmSmsMessHandler::UiccReadSMSResp -- resume SMS reception"); |
3635 } |
3824 } |
3636 } |
3825 } |
3637 } |
3826 } |
3638 |
3827 |
3639 // ----------------------------------------------------------------------------- |
3828 // ----------------------------------------------------------------------------- |
3640 // CMmSmsMessHandler::SimStSmsGetNumOfLocReq |
3829 // CMmSmsMessHandler::GetNumOfEFSMSRecords |
3641 // Construct a SIM_ST_SMS_GET_NUM_OF_LOC_REQ ISI message |
3830 // |
3642 // to the SIM Server |
|
3643 // ----------------------------------------------------------------------------- |
3831 // ----------------------------------------------------------------------------- |
3644 // |
3832 // |
3645 void CMmSmsMessHandler::GetNumOfEFSMSRecords( void ) |
3833 void CMmSmsMessHandler::GetNumOfEFSMSRecords( void ) |
3646 { |
3834 { |
3647 TFLOGSTRING("TSY: CMmSmsMessHandler::GetNumOfEFSMSRecords" ); |
3835 TFLOGSTRING("TSY: CMmSmsMessHandler::GetNumOfEFSMSRecords" ); |
3664 const TDesC8& aFileData ) |
3852 const TDesC8& aFileData ) |
3665 { |
3853 { |
3666 TFLOGSTRING("TSY: CMmSmsMessHandler::GetNumOfEFSMSRecordsResp" ); |
3854 TFLOGSTRING("TSY: CMmSmsMessHandler::GetNumOfEFSMSRecordsResp" ); |
3667 OstTraceExt2( TRACE_NORMAL, CMMSMSMESSHANDLER_GETNUMOFEFSMSRECORDSRESP, "CMmSmsMessHandler::GetNumOfEFSMSRecordsResp;aStatus=%d;aFileData=%s", aStatus, aFileData ); |
3855 OstTraceExt2( TRACE_NORMAL, CMMSMSMESSHANDLER_GETNUMOFEFSMSRECORDSRESP, "CMmSmsMessHandler::GetNumOfEFSMSRecordsResp;aStatus=%d;aFileData=%s", aStatus, aFileData ); |
3668 |
3856 |
3669 TInt offSet( 0 ); |
|
3670 |
|
3671 //Save number of SMS locations on SIM card |
3857 //Save number of SMS locations on SIM card |
3672 TInt smsNumOfLoc( 0 ); |
3858 TInt smsNumOfLoc( 0 ); |
3673 |
3859 |
3674 if ( KErrNone == aStatus ) |
3860 if ( KErrNone == aStatus ) |
3675 { |
3861 { |
3676 offSet = aFileData.Find( &KTagFCIFileDescriptor, 1 ); |
3862 TFci fci( aFileData ); |
3677 if( offSet != KErrNotFound ) |
3863 smsNumOfLoc = fci.GetNumberOfRecords(); |
3678 { |
|
3679 smsNumOfLoc = |
|
3680 aFileData[offSet + UICC_FCI_EF_FDESC_OFFSET_NUM_ENTR]; |
|
3681 } |
|
3682 } |
3864 } |
3683 |
3865 |
3684 // Continue with reading all sms entries from sim |
3866 // Continue with reading all sms entries from sim |
3685 if ( smsNumOfLoc > 0 ) |
3867 if ( smsNumOfLoc > 0 ) |
3686 { |
3868 { |
3710 &data, |
3892 &data, |
3711 KErrNoMemory ); |
3893 KErrNoMemory ); |
3712 } |
3894 } |
3713 } |
3895 } |
3714 |
3896 |
3897 // ----------------------------------------------------------------------------- |
|
3898 // CMmSmsMessHandler::UiccDeleteSMSResp |
|
3899 // |
|
3900 // ----------------------------------------------------------------------------- |
|
3901 // |
|
3902 void CMmSmsMessHandler::UiccDeleteSMSResp( TInt aStatus ) |
|
3903 { |
|
3904 TFLOGSTRING2("TSY: CMmSmsMessHandler::UiccDeleteSMSResp aStatus: %d", aStatus ); |
|
3905 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_UICCDELETESMSRESP, "CMmSmsMessHandler::UiccDeleteSMSResp;aStatus=%d", aStatus ); |
|
3906 |
|
3907 // Create Package |
|
3908 CMmDataPackage package; |
|
3909 |
|
3910 TInt error( CMmStaticUtility::UICCCSCauseToEpocError( aStatus ) ); |
|
3911 |
|
3912 if ( KErrNone == error ) |
|
3913 { |
|
3914 iSmsCache.Delete(); |
|
3915 } |
|
3916 iMessageRouter->Complete( EMobilePhoneStoreDelete, error ); |
|
3917 |
|
3918 } |
|
3919 |
|
3920 // ----------------------------------------------------------------------------- |
|
3921 // CMmSmsMessHandler::UiccDeleteAllSMSResp |
|
3922 // |
|
3923 // ----------------------------------------------------------------------------- |
|
3924 // |
|
3925 void CMmSmsMessHandler::UiccDeleteAllSMSResp( TInt aStatus ) |
|
3926 { |
|
3927 TFLOGSTRING2("TSY: CMmSmsMessHandler::UiccDeleteSMSResp aStatus: %d", aStatus ); |
|
3928 OstTrace1( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCDELETEALLSMSRESP, "CMmSmsMessHandler::UiccDeleteAllSMSResp;aStatus=%d", aStatus ); |
|
3929 |
|
3930 // Create Package |
|
3931 CMmDataPackage package; |
|
3932 |
|
3933 TInt error( CMmStaticUtility::UICCCSCauseToEpocError( aStatus ) ); |
|
3934 |
|
3935 // Delete SMS from SIM one by one and then all from cache. |
|
3936 if ( ( iRecordId < iSmsCache.TotalEntries() ) && |
|
3937 ( KErrNone == error ) ) |
|
3938 { |
|
3939 iRecordId++; // Next record |
|
3940 error = DeleteAllSms(); |
|
3941 |
|
3942 if ( KErrNone != error ) |
|
3943 { |
|
3944 iMessageRouter->Complete( EMobilePhoneStoreDeleteAll, error ); |
|
3945 } |
|
3946 } |
|
3947 else |
|
3948 { |
|
3949 iSmsCache.DeleteAll(); |
|
3950 iMessageRouter->Complete( EMobilePhoneStoreDeleteAll, error ); |
|
3951 } |
|
3952 |
|
3953 } |
|
3954 // ----------------------------------------------------------------------------- |
|
3955 // CMmSmsMessHandler::CheckSCTimestamp |
|
3956 // Returns ETrue if the SC timestamp in this message is equal to |
|
3957 // the client's timestamp in aScTime. |
|
3958 // ----------------------------------------------------------------------------- |
|
3959 // |
|
3960 TBool CMmSmsMessHandler::CheckSCTimestamp( |
|
3961 const RMobileSmsStore::TMobileGsmSmsEntryV1& aEntry, |
|
3962 const TTime& aScTime ) |
|
3963 { |
|
3964 TFLOGSTRING("TSY: CMmSmsMessHandler::CheckSCTimestamp"); |
|
3965 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp" ); |
|
3966 TBool matchFound( EFalse ); |
|
3967 |
|
3968 TInt offset( 1 ); // Message Reference position |
|
3969 TInt messageReference( aEntry.iMsgData[offset] ); |
|
3970 // Destination address length is integer representation |
|
3971 // of the number of useful semi-octets of address field |
|
3972 messageReference = ( messageReference + 1 ) / 2; |
|
3973 offset += messageReference; |
|
3974 offset += 4; // Service Centre Time Stamp |
|
3975 |
|
3976 TBuf8<KSmsScTimeStampMaxLength> scTimeStamp; |
|
3977 scTimeStamp = aEntry.iMsgData.Mid( offset, KSmsScTimeStampMaxLength ); |
|
3978 |
|
3979 // Convert from the semi-octet representation to decimals. |
|
3980 for ( TUint8 i ( 0 ); i < KSmsScTimeStampMaxLength; i++ ) |
|
3981 { |
|
3982 TUint8 lowDigit( static_cast<TUint8>( ( |
|
3983 scTimeStamp[i] & 0xf0 ) >> 4 ) ); |
|
3984 TUint8 highDigit( static_cast<TUint8>( scTimeStamp[i] & 0xf ) ); |
|
3985 scTimeStamp[i] = static_cast<TUint8>( (10 * highDigit) + lowDigit ); |
|
3986 } |
|
3987 |
|
3988 // Ignore this messsage if month or day are zero (should not happen) |
|
3989 if ( ( 0 == scTimeStamp[1] ) || ( 0 == scTimeStamp[2] ) ) |
|
3990 { |
|
3991 TFLOGSTRING("TSY:CMmSmsMessHandler::CheckSCTimestamp:Invalid timestamp found, ignored."); |
|
3992 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp, Invalid timestamp found, ignored" ); |
|
3993 matchFound = ETrue; |
|
3994 } |
|
3995 |
|
3996 if ( !matchFound ) |
|
3997 { |
|
3998 // Construct a string of the form YYYYMMDD:HHMMSS |
|
3999 TBuf<15> timeString; |
|
4000 // This is the same way Symbian GSMU does it, |
|
4001 // see GSMU's method TSmsServiceCenterTimeStamp::DecodeL. |
|
4002 if ( scTimeStamp[0]>95 ) |
|
4003 { |
|
4004 timeString.Append( _L( "19" ) ); |
|
4005 } |
|
4006 else |
|
4007 { |
|
4008 timeString.Append( _L( "20" ) ); |
|
4009 } |
|
4010 //two digits for year, month, day, hour, minute, second |
|
4011 _LIT( KDateFormat, "%02d" ); |
|
4012 //year |
|
4013 timeString.AppendFormat( KDateFormat,scTimeStamp[0] ); |
|
4014 //month, starting at 0 |
|
4015 timeString.AppendFormat( KDateFormat,scTimeStamp[1]-1 ); |
|
4016 //day, starting at 0 |
|
4017 timeString.AppendFormat( KDateFormat,scTimeStamp[2]-1 ); |
|
4018 timeString.Append( _L(":" ) ); |
|
4019 //hour |
|
4020 timeString.AppendFormat( KDateFormat,scTimeStamp[3] ); |
|
4021 //minute |
|
4022 timeString.AppendFormat( KDateFormat,scTimeStamp[4] ); |
|
4023 //second |
|
4024 timeString.AppendFormat( KDateFormat,scTimeStamp[5] ); |
|
4025 |
|
4026 TTime simStoredTime( 0 ); |
|
4027 TInt err( simStoredTime.Set( timeString ) ); |
|
4028 |
|
4029 if ( KErrNone == err ) |
|
4030 { |
|
4031 // Handle the timezone difference. The timezone is found in the |
|
4032 // last byte of the SC timestamp buffer. |
|
4033 TUint8 simTimezoneDiffRaw( scTimeStamp[6] ); |
|
4034 // Highest bit is the algebraic sign (0=positive, 1=negative). |
|
4035 // Timezone is defined in 'quarters of an hour', but we allow |
|
4036 // only whole numbers. |
|
4037 TInt8 simTimezoneSign( ( simTimezoneDiffRaw & 0x80 ) ? -1 : 1 ); |
|
4038 TInt8 simTimezoneDiff( static_cast<TInt8>( |
|
4039 simTimezoneSign * ( simTimezoneDiffRaw & 0x7F) / 4 ) ); |
|
4040 // Substract timezone difference |
|
4041 TTimeIntervalHours simTimezoneInterval( simTimezoneDiff ); |
|
4042 simStoredTime -= simTimezoneInterval; |
|
4043 |
|
4044 #ifdef _DEBUG |
|
4045 // debug print |
|
4046 TDateTime dt = simStoredTime.DateTime(); |
|
4047 TFLOGSTRING("TSY:CMmSmsMessHandler::CheckSCTimestamp:Message stored on SIM:"); |
|
4048 OstTrace0( TRACE_NORMAL, DUP2_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp, Message stored on SIM:" ); |
|
4049 TFLOGSTRING2(" year=%d",dt.Year()); |
|
4050 OstTrace1( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Year=%d", dt.Year() ); |
|
4051 TFLOGSTRING2(" month=%d",dt.Month()+1); |
|
4052 OstTrace1( TRACE_NORMAL, DUP4_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Month=%d", ( dt.Month() + 1 ) ); |
|
4053 TFLOGSTRING2(" day=%d",dt.Day()+1); |
|
4054 OstTrace1( TRACE_NORMAL, DUP5_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Day=%d", ( dt.Day() + 1 ) ); |
|
4055 TFLOGSTRING2(" hour=%d",dt.Hour()); |
|
4056 OstTrace1( TRACE_NORMAL, DUP6_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Hour=%d", dt.Hour() ); |
|
4057 TFLOGSTRING2(" minute=%d",dt.Minute()); |
|
4058 OstTrace1( TRACE_NORMAL, DUP7_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Minute=%d", dt.Minute() ); |
|
4059 TFLOGSTRING2(" second=%d",dt.Second()); |
|
4060 OstTrace1( TRACE_NORMAL, DUP8_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Second=%d", dt.Second() ); |
|
4061 TFLOGSTRING2(" timezone difference=%d",simTimezoneDiff); |
|
4062 OstTraceExt1( TRACE_NORMAL, DUP9_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;simTimezoneDiff=%hhd", simTimezoneDiff ); |
|
4063 dt = aScTime.DateTime(); |
|
4064 TFLOGSTRING("TSY:CMmSmsMessHandler::CheckSCTimestamp:Message opened on client side:"); |
|
4065 OstTrace0( TRACE_NORMAL, DUP10_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp, Message opened on client side:" ); |
|
4066 TFLOGSTRING2(" year=%d",dt.Year()); |
|
4067 OstTrace1( TRACE_NORMAL, DUP11_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Year=%d", ( dt.Year() + 1 ) ); |
|
4068 TFLOGSTRING2(" month=%d",dt.Month()+1); |
|
4069 OstTrace1( TRACE_NORMAL, DUP12_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Month=%d", ( dt.Month() + 1 ) ); |
|
4070 TFLOGSTRING2(" day=%d",dt.Day()+1); |
|
4071 OstTrace1( TRACE_NORMAL, DUP13_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Day=%d", ( dt.Day() + 1 ) ); |
|
4072 TFLOGSTRING2(" hour=%d",dt.Hour()); |
|
4073 OstTrace1( TRACE_NORMAL, DUP14_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Hour=%d", dt.Hour() ); |
|
4074 TFLOGSTRING2(" minute=%d",dt.Minute()); |
|
4075 OstTrace1( TRACE_NORMAL, DUP15_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Minute=%d", dt.Minute() ); |
|
4076 TFLOGSTRING2(" second=%d",dt.Second()); |
|
4077 OstTrace1( TRACE_NORMAL, DUP16_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Second=%d", dt.Second() ); |
|
4078 // debug print |
|
4079 #endif // _DEBUG |
|
4080 |
|
4081 if ( simStoredTime == aScTime ) |
|
4082 { |
|
4083 matchFound = ETrue; |
|
4084 } |
|
4085 } |
|
4086 } |
|
4087 |
|
4088 return matchFound; |
|
4089 |
|
4090 } |
|
4091 |
|
4092 // ----------------------------------------------------------------------------- |
|
4093 // CMmSmsMessHandler::UiccUpdateSMSStatus |
|
4094 // Write SMS to SIM |
|
4095 // ----------------------------------------------------------------------------- |
|
4096 // |
|
4097 TInt CMmSmsMessHandler::UiccUpdateSMSStatus( |
|
4098 const TUint8 aRecordId |
|
4099 ) |
|
4100 { |
|
4101 TFLOGSTRING2("TSY: CMmSmsMessHandler::UiccUpdateSMSStatusReq aRecordId: %d", aRecordId ); |
|
4102 OstTraceExt1( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCUPDATESMSSTATUS, "CMmSmsMessHandler::UiccUpdateSMSStatus;aRecordId=%hhu", aRecordId ); |
|
4103 |
|
4104 // Read parameters from SIM |
|
4105 // Set parameters for UICC_APPL_CMD_REQ message |
|
4106 iRecordId = aRecordId; |
|
4107 TUiccReadLinearFixed params; |
|
4108 params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
4109 params.trId = ETrIdUpdateSMSStatusReadSMS; |
|
4110 params.dataOffset = 0; |
|
4111 params.dataAmount = 0; |
|
4112 params.record = aRecordId; |
|
4113 |
|
4114 params.fileId = KElemFileShortMessages; |
|
4115 params.fileIdSfi = UICC_SFI_NOT_PRESENT; |
|
4116 params.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
4117 |
|
4118 // File id path |
|
4119 params.filePath.Append( KMasterFileId >> 8 ); |
|
4120 params.filePath.Append( KMasterFileId ); |
|
4121 params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
4122 |
|
4123 return iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
4124 |
|
4125 } |
|
4126 |
|
4127 // ----------------------------------------------------------------------------- |
|
4128 // CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp |
|
4129 // |
|
4130 // ----------------------------------------------------------------------------- |
|
4131 // |
|
4132 void CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp( |
|
4133 TInt aStatus, |
|
4134 const TDesC8& aFileData ) |
|
4135 { |
|
4136 TFLOGSTRING("TSY: CMmSmsMessHandler::UiccReadSMSResp" ); |
|
4137 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCUPDATESMSSTATUSREADSMSRESP, "CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp" ); |
|
4138 |
|
4139 if ( KErrNone == aStatus ) |
|
4140 { |
|
4141 if ( 0 != aFileData.Length() ) |
|
4142 { |
|
4143 // Set parameters for UICC_APPL_CMD_REQ message |
|
4144 TUiccWriteLinearFixed params; |
|
4145 params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
4146 params.trId = ETrIdUpdateSMSStatusWriteSMS; |
|
4147 params.dataOffset = 0; |
|
4148 params.dataAmount = 0; |
|
4149 params.record = iRecordId; |
|
4150 |
|
4151 params.fileId = KElemFileShortMessages; |
|
4152 params.fileIdSfi = UICC_SFI_NOT_PRESENT; |
|
4153 params.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED; |
|
4154 |
|
4155 // File id path |
|
4156 params.filePath.Append( KMasterFileId >> 8 ); |
|
4157 params.filePath.Append( KMasterFileId ); |
|
4158 params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
4159 |
|
4160 // Update status as read |
|
4161 // File data to be updated. |
|
4162 TBuf8<KSmsElemetaryFileRecordLength> fileDataBuf; |
|
4163 fileDataBuf = aFileData.Left( aFileData.Length() ); |
|
4164 fileDataBuf[0] = KSimSmsMtRead; |
|
4165 |
|
4166 TInt unfilledLength( fileDataBuf.MaxLength() - aFileData.Length() ); |
|
4167 // Fill unused fields with FF |
|
4168 if ( 0 < unfilledLength ) |
|
4169 { |
|
4170 fileDataBuf.AppendFill( 0xFF, unfilledLength ); |
|
4171 } |
|
4172 |
|
4173 params.fileData.Append( fileDataBuf ); |
|
4174 |
|
4175 TInt ret( iMmUiccMessHandler->CreateUiccApplCmdReq( params ) ); |
|
4176 |
|
4177 if ( KErrNone != ret ) |
|
4178 { |
|
4179 iMessageRouter->Complete( |
|
4180 ECustomSetSimMessageStatusReadIPC, |
|
4181 ret ); |
|
4182 } |
|
4183 } |
|
4184 } |
|
4185 else |
|
4186 { |
|
4187 iMessageRouter->Complete( |
|
4188 ECustomSetSimMessageStatusReadIPC, |
|
4189 CMmStaticUtility::UICCCSCauseToEpocError( aStatus ) ); |
|
4190 } |
|
4191 } |
|
4192 |
|
4193 // ----------------------------------------------------------------------------- |
|
4194 // CMmSmsMessHandler::UiccUpdateSMSStatusWriteSMSResp |
|
4195 // |
|
4196 // ----------------------------------------------------------------------------- |
|
4197 // |
|
4198 void CMmSmsMessHandler::UiccUpdateSMSStatusWriteSMSResp( TInt aStatus ) |
|
4199 { |
|
4200 TFLOGSTRING2("TSY: CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp aStatus: %d", aStatus ); |
|
4201 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_UICCUPDATESMSSTATUSREADSMSRESP, "CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp;aStatus=%d", aStatus ); |
|
4202 |
|
4203 iMessageRouter->Complete( |
|
4204 ECustomSetSimMessageStatusReadIPC, |
|
4205 CMmStaticUtility::UICCCSCauseToEpocError( aStatus ) ); |
|
4206 |
|
4207 // Update the same flag also in TSY's cache. |
|
4208 if ( KErrNone == aStatus ) |
|
4209 { |
|
4210 iSmsCache.SetStorageStatus( iRecordId, RMobileSmsStore::EStoredMessageRead ); |
|
4211 } |
|
4212 |
|
4213 } |
|
4214 |
|
4215 // ----------------------------------------------------------------------------- |
|
4216 // CMmSmsMessHandler::UiccGetSmspEntryReq |
|
4217 // |
|
4218 // ----------------------------------------------------------------------------- |
|
4219 // |
|
4220 TInt CMmSmsMessHandler::UiccGetSmspEntryReq() |
|
4221 { |
|
4222 TFLOGSTRING("TSY: CMmSmsMessHandler::UiccGetSmspEntryReq" ); |
|
4223 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCREADNUMOFSMSPENTRIES, "CMmSmsMessHandler::UiccGetSmspEntryReq" ); |
|
4224 |
|
4225 // Set parameters for UICC_APPL_CMD_REQ message |
|
4226 TUiccReadLinearFixed params; |
|
4227 params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
4228 params.trId = ETrIdGetSmspEntries; |
|
4229 params.dataOffset = 0; |
|
4230 params.dataAmount = 0; |
|
4231 params.record = iSmspRecordNumber; |
|
4232 params.fileId = KElemFileSmsParams; |
|
4233 params.fileIdSfi = UICC_SFI_NOT_PRESENT; |
|
4234 params.serviceType = UICC_APPL_READ_LINEAR_FIXED; |
|
4235 |
|
4236 // File id path |
|
4237 params.filePath.Append( KMasterFileId >> 8 ); |
|
4238 params.filePath.Append( KMasterFileId ); |
|
4239 params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
4240 |
|
4241 return iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
4242 } |
|
4243 |
|
4244 |
|
4245 // ----------------------------------------------------------------------------- |
|
4246 // CMmSmsMessHandler::UiccStoreSmspEntry |
|
4247 // |
|
4248 // ----------------------------------------------------------------------------- |
|
4249 // |
|
4250 TInt CMmSmsMessHandler::UiccStoreSmspEntry( const TDesC8& aFileData ) |
|
4251 { |
|
4252 TFLOGSTRING("TSY: CMmSmsMessHandler::UiccStoreSmspEntry" ); |
|
4253 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCSTORESMSPENTRY, "CMmSmsMessHandler::UiccStoreSmspEntry" ); |
|
4254 |
|
4255 TInt ret( KErrNone ); |
|
4256 TInt dataLength( aFileData.Length() ); |
|
4257 TPtrC8 data( KNullDesC8 ); |
|
4258 TSmsParameters* smsParam = new ( ELeave ) TSmsParameters(); |
|
4259 CleanupStack::PushL( smsParam ); |
|
4260 |
|
4261 // SMS parameters are located in EF smsp, see 3GPP TS 31.102 |
|
4262 // V8.3.0 chapter 4.2.27 EFSMSP (Short message service parameters) |
|
4263 |
|
4264 // Alpha identifier is optional. Check if it exists. |
|
4265 if ( KSmsMandatoryParamsLength < dataLength ) |
|
4266 { |
|
4267 // Copy mandatory fields to different buffer for later use |
|
4268 data.Set( aFileData.Right( KSmsMandatoryParamsLength ) ); |
|
4269 smsParam->iAlphaTagPresent = ETrue; |
|
4270 |
|
4271 // Alpha identifier length |
|
4272 TInt alphaLength( dataLength - KSmsMandatoryParamsLength ); |
|
4273 if ( RMobileSmsMessaging::KMaxSmspTextSize < alphaLength ) |
|
4274 { |
|
4275 alphaLength = RMobileSmsMessaging::KMaxSmspTextSize; |
|
4276 } |
|
4277 |
|
4278 // Copy alpha identifier data as it is in SIM elementary file |
|
4279 TBuf8<RMobileSmsMessaging::KMaxSmspTextSize> alphaIdentifier; |
|
4280 alphaIdentifier.Copy( aFileData.Left( alphaLength ) ); |
|
4281 |
|
4282 // Coding of alpha identifier may be 7-bit default of one of UCS2 code |
|
4283 // options. At first convert data to 16-bit format |
|
4284 TBuf8<RMobileSmsMessaging::KMaxSmspTextSize> alphaIdentifierOutput; |
|
4285 CMmStaticUtility::ConvertGsmDataToUcs2( |
|
4286 alphaIdentifier, |
|
4287 alphaIdentifier.Length(), |
|
4288 alphaIdentifierOutput ); |
|
4289 |
|
4290 // Convert to 16-bit UNICODE string and copy to SMS parameters buffer |
|
4291 TBuf16<RMobileSmsMessaging::KMaxSmspTextSize> alphaBuf; |
|
4292 TIsiUtility::CopyFromBigEndian( alphaIdentifierOutput, alphaBuf ); |
|
4293 smsParam->iAlphaTagData.Copy( alphaBuf ); |
|
4294 } |
|
4295 // Only mandatory 28 bytes are included, no alpha identifier |
|
4296 else if ( KSmsMandatoryParamsLength == dataLength ) |
|
4297 { |
|
4298 smsParam->iAlphaTagPresent = EFalse; |
|
4299 // Copy all the data |
|
4300 data.Set( aFileData ); |
|
4301 } |
|
4302 else |
|
4303 { |
|
4304 ret = KErrNotFound; |
|
4305 } |
|
4306 |
|
4307 if ( KErrNone == ret ) |
|
4308 { |
|
4309 // Parameters indicator. |
|
4310 // In SIM card bit value "0" means that parameter is present, |
|
4311 // in S60 vice versa |
|
4312 TUint8 paramIndicators( data[0] ); |
|
4313 paramIndicators = ~paramIndicators; |
|
4314 paramIndicators &= KSmsGsmParametersIndMask; // Mask 5 LSB |
|
4315 smsParam->iParameterIndicator = paramIndicators; |
|
4316 |
|
4317 // Location where SMS parameters in EFsms were fetched |
|
4318 smsParam->iLocationNumber = iSmspRecordNumber; |
|
4319 |
|
4320 // Service center address |
|
4321 if ( paramIndicators & KServiceCentreAddress ) |
|
4322 { |
|
4323 TBuf8<KSmsMaxAddressLength>scAddress( data. Mid( |
|
4324 KSmsParamsScAddressOffset, KSmsMaxAddressLength ) ); |
|
4325 CMmSmsGsmAddress::GsmConv0411AddrToUnicode( |
|
4326 smsParam->iServiceCenterAddress, |
|
4327 scAddress, |
|
4328 smsParam->iMobileScTON, |
|
4329 smsParam->iMobileScNPI ); |
|
4330 } |
|
4331 |
|
4332 // Destination address |
|
4333 if ( paramIndicators & KDestinationAddress ) |
|
4334 { |
|
4335 TBuf8<KSmsMaxAddressLength>destAddress( data.Mid( |
|
4336 KSmsParamsDestAddressOffset, KSmsMaxAddressLength ) ); |
|
4337 CMmSmsGsmAddress::GsmConv0340AddrToUnicode( |
|
4338 smsParam->iDestinationAddress, |
|
4339 destAddress, |
|
4340 smsParam->iMobileDeTON, |
|
4341 smsParam->iMobileDeNPI ); |
|
4342 } |
|
4343 |
|
4344 // Protocol ID |
|
4345 if ( paramIndicators & KProtocolID ) |
|
4346 { |
|
4347 smsParam->iProtocolId = data[KSmsParamsProtocolIdOffset]; |
|
4348 } |
|
4349 |
|
4350 // Data coding scheme |
|
4351 if ( paramIndicators & KDataCodingScheme ) |
|
4352 { |
|
4353 smsParam->iDataCodingScheme = data[KSmsParamsDcsOffset]; |
|
4354 } |
|
4355 |
|
4356 // Validity period |
|
4357 if ( paramIndicators & KValidityPeriod ) |
|
4358 { |
|
4359 smsParam->iValidityPeriod = data[KSmsParamsValidityPeriodOffset]; |
|
4360 } |
|
4361 |
|
4362 // Add this parameter set to array |
|
4363 iSmspListArray->AppendL( smsParam ); |
|
4364 // Read the next entry |
|
4365 iSmspRecordNumber++; |
|
4366 ret = UiccGetSmspEntryReq(); |
|
4367 } |
|
4368 // Don't reset struct because it may be stored to CArrayPtrFlat. |
|
4369 // All structs will be reseted when request is completed. |
|
4370 CleanupStack::Pop( smsParam ); |
|
4371 return ret; |
|
4372 } |
|
4373 |
|
4374 |
|
4375 // ----------------------------------------------------------------------------- |
|
4376 // CMmSmsMessHandler::UiccSmsUpdateParameterReq |
|
4377 // ----------------------------------------------------------------------------- |
|
4378 // |
|
4379 TInt CMmSmsMessHandler::UiccSmsUpdateParameterReq( |
|
4380 const CMmDataPackage* aDataPackage ) |
|
4381 { |
|
4382 TFLOGSTRING("TSY: CMmSmsMessHandler::UiccSmsUpdateParameterReq"); |
|
4383 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_UICCSTORESMSPENTRY, "CMmSmsMessHandler::UiccStoreSmspEntry" ); |
|
4384 |
|
4385 RMobileSmsMessaging::TMobileSmspEntryV1* smsParameters; |
|
4386 // Unpack data |
|
4387 aDataPackage->UnPackData( &smsParameters ); |
|
4388 |
|
4389 // Buffer for all the file data to be written to UICC |
|
4390 // (possible alpha tag + params ) |
|
4391 TBuf8<KSmsMandatoryParamsLength + KSizeOfAlphaTag> smspBuffer; |
|
4392 |
|
4393 // Check if there is alpha tag |
|
4394 TInt alphaTagLength( smsParameters->iText.Length() ); |
|
4395 // Buffer for alpha tag |
|
4396 if ( 0 < alphaTagLength ) |
|
4397 { |
|
4398 // Temporary buffer for alpha tag |
|
4399 TBuf8<KSizeOfAlphaTag> alphaTagData; |
|
4400 TIsiUtility::CopyToBigEndian( smsParameters->iText, alphaTagData ); |
|
4401 smspBuffer.Append( 0x80 ); // First byte 0x80 means 16-bit UCS coding |
|
4402 smspBuffer.Append( alphaTagData ); |
|
4403 } |
|
4404 |
|
4405 // Temporary buffer for mandatory data, filled by FF (unused bytes) |
|
4406 TBuf8<KSmsMandatoryParamsLength> paramsData; |
|
4407 paramsData.Fill( 0xFF, KSmsMandatoryParamsLength ); |
|
4408 |
|
4409 // Fill SMS parameters to data buffer ( see 3GPP TS 31.102 V8.3.0 |
|
4410 // 4.2.27 EFSMSP (Short message service parameters). Unused parameters |
|
4411 // are filled by 0xFF |
|
4412 |
|
4413 // Parameter indicator |
|
4414 TUint8 paramInd( static_cast<TUint8>( smsParameters->iValidParams ) ); |
|
4415 paramsData[KSmsParamsParamIndicatorOffset] = paramInd; |
|
4416 |
|
4417 // Destination address |
|
4418 if ( KDestinationAddress & paramInd ) |
|
4419 { |
|
4420 TBuf8<KSmsMaxAddressLength> deAddr; |
|
4421 // Fill address by 0x00 at first |
|
4422 BuildDeAddress( smsParameters->iDestination, deAddr ); |
|
4423 // Add address data to buffer |
|
4424 paramsData.Replace( |
|
4425 KSmsParamsDestAddressOffset, |
|
4426 deAddr.Length(), |
|
4427 deAddr ); |
|
4428 } |
|
4429 |
|
4430 // Service center address |
|
4431 if ( KServiceCentreAddress & paramInd ) |
|
4432 { |
|
4433 TBuf8<KSmsMaxAddressLength> scAddr; |
|
4434 // Fill address by 0x00 at first |
|
4435 BuildScAddress( smsParameters->iServiceCentre, scAddr ); |
|
4436 // Add address data to buffer |
|
4437 paramsData.Replace( |
|
4438 KSmsParamsScAddressOffset, |
|
4439 scAddr.Length(), |
|
4440 scAddr ); |
|
4441 } |
|
4442 |
|
4443 // Protocol ID |
|
4444 if ( KProtocolID & paramInd ) |
|
4445 { |
|
4446 paramsData[KSmsParamsProtocolIdOffset] = smsParameters->iProtocolId; |
|
4447 } |
|
4448 |
|
4449 // Data coding scheme |
|
4450 if ( KDataCodingScheme & paramInd ) |
|
4451 { |
|
4452 paramsData[KSmsParamsDcsOffset] = smsParameters->iDcs; |
|
4453 } |
|
4454 |
|
4455 // If validity period is valid, set value |
|
4456 if ( KValidityPeriod & paramInd ) |
|
4457 { |
|
4458 paramsData[KSmsParamsValidityPeriodOffset] = |
|
4459 smsParameters->iValidityPeriod; |
|
4460 } |
|
4461 |
|
4462 smspBuffer.Append( paramsData ); |
|
4463 |
|
4464 // Set parameters for UICC_APPL_CMD_REQ message |
|
4465 TUiccWriteLinearFixed params; |
|
4466 params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
4467 params.trId = ETrIdWriteSmspEntry; |
|
4468 params.dataOffset = 0; |
|
4469 params.dataAmount = 0; |
|
4470 params.record = smsParameters->iIndex; |
|
4471 |
|
4472 params.fileId = KElemFileSmsParams; |
|
4473 params.fileIdSfi = UICC_SFI_NOT_PRESENT; |
|
4474 params.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED; |
|
4475 |
|
4476 // File id path |
|
4477 params.filePath.Append( KMasterFileId >> 8 ); |
|
4478 params.filePath.Append( KMasterFileId ); |
|
4479 params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
4480 |
|
4481 // File data |
|
4482 params.fileData.Append( smspBuffer ); |
|
4483 |
|
4484 return iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
4485 } |
|
4486 |
|
3715 // End of File |
4487 // End of File |