adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp
changeset 8 6295dc2169f3
parent 7 fa67e03b87df
child 9 8486d82aef45
equal deleted inserted replaced
7:fa67e03b87df 8:6295dc2169f3
    64     4 +     //CALL_MODEM_SB_CAUSE
    64     4 +     //CALL_MODEM_SB_CAUSE
    65     4;      //CALL_MODEM_SB_CAUSE
    65     4;      //CALL_MODEM_SB_CAUSE
    66 
    66 
    67 const TUint8 KMSBMask = 0x80;
    67 const TUint8 KMSBMask = 0x80;
    68 const TUint8 KSw1Sw2Unknown = 0;
    68 const TUint8 KSw1Sw2Unknown = 0;
       
    69 const TUint8 KValidTonNpi   = 0x3F;
    69 
    70 
    70 
    71 
    71 // ==================== MEMBER FUNCTIONS ====================================
    72 // ==================== MEMBER FUNCTIONS ====================================
    72 
    73 
    73 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
  1148     TFLOGSTRING("TSY: CSatCC::SendCallModemResourceReq");
  1149     TFLOGSTRING("TSY: CSatCC::SendCallModemResourceReq");
  1149     OstTrace0( TRACE_NORMAL, CSATCC_SENDCALLMODEMRESOURCEREQ, "CSatCC::SendCallModemResourceReq" );
  1150     OstTrace0( TRACE_NORMAL, CSATCC_SENDCALLMODEMRESOURCEREQ, "CSatCC::SendCallModemResourceReq" );
  1150 
  1151 
  1151     TBuf8<KMaximumCcBufferSize> isiMessage;
  1152     TBuf8<KMaximumCcBufferSize> isiMessage;
  1152     TInt ret( KErrNotFound );
  1153     TInt ret( KErrNotFound );
       
  1154     TBool checkInfoNeeded( EFalse );
       
  1155     TUint8 checkInfoParams( 0 );
  1153     CBerTlv response;
  1156     CBerTlv response;
  1154     response.SetData( aApduData );
  1157     response.SetData( aApduData );
  1155     // Set initial cc result, e.g. the SIM has responded with sw1/sw2 90 00
  1158     // Set initial cc result, e.g. the SIM has responded with sw1/sw2 90 00
  1156     // without any additional data. In error case reject the initiated action.
  1159     // without any additional data. In error case reject the initiated action.
  1157     TUint8 ccresult( KAllowed == aResult ?
  1160     TUint8 ccresult( KAllowed == aResult ?
  1225                 {
  1228                 {
  1226                 // Other parameters have been changed
  1229                 // Other parameters have been changed
  1227                 isiMessage.Append( CALL_MODEM_RESOURCE_ALLOWED );
  1230                 isiMessage.Append( CALL_MODEM_RESOURCE_ALLOWED );
  1228                 isiMessage.Append( KPadding );
  1231                 isiMessage.Append( KPadding );
  1229                 internalCcResult = KModified;
  1232                 internalCcResult = KModified;
       
  1233                 checkInfoNeeded = ETrue;
       
  1234                 checkInfoParams += CALL_MODEM_CHK_DISABLE_FDN;
  1230                 }
  1235                 }
  1231             break;
  1236             break;
  1232             }
  1237             }
  1233         default:
  1238         default:
  1234             {
  1239             {
  1294         CTlv addressTlv;
  1299         CTlv addressTlv;
  1295         ret = response.TlvByTagValue( &addressTlv, KTlvAddressTag );
  1300         ret = response.TlvByTagValue( &addressTlv, KTlvAddressTag );
  1296         if ( KErrNone == ret  )
  1301         if ( KErrNone == ret  )
  1297             {
  1302             {
  1298             // CALL_MODEM_ADDRESS_TYPE, mask MSB off
  1303             // CALL_MODEM_ADDRESS_TYPE, mask MSB off
  1299             isiMessage.Append( addressTlv.GetValue()[ 0 ] ^KMSBMask );
  1304             TUint8 tonNpi( addressTlv.GetValue()[ 0 ] ^ KMSBMask );
       
  1305 
       
  1306             // check if valid TON/NPI
       
  1307             if( KValidTonNpi >= tonNpi )
       
  1308                 {
       
  1309                 isiMessage.Append( tonNpi );
       
  1310                 }
       
  1311             else
       
  1312                 {
       
  1313                 // use default TON/NPI in reserved cases
       
  1314                 isiMessage.Append( 
       
  1315                     CALL_MODEM_NBR_TYPE_UNKNOWN | 
       
  1316                     CALL_MODEM_NBR_PLAN_ISDN_TELEPHONY );
       
  1317                 }
       
  1318 
  1300             isiMessage.Append( KPadding );
  1319             isiMessage.Append( KPadding );
  1301             isiMessage.Append( KPadding );
  1320             isiMessage.Append( KPadding );
  1302 
  1321 
  1303             // Temp storage for address
  1322             // Temp storage for address
  1304             TBuf8<2 * KCallServerMaxAddressLenght> asciiAddress;
  1323             TBuf8<2 * KCallServerMaxAddressLenght> asciiAddress;
  1305             TSatUtility::BCDToAscii( addressTlv.GetValue().Mid( 1 ),
  1324             TSatUtility::BCDToAscii( addressTlv.GetValue().Mid( 1 ),
  1306                 asciiAddress );
  1325                 asciiAddress );
       
  1326 
       
  1327             // let's check is new number "112". This because of if number 
       
  1328             // is "112" emergency call is needed to establish. otherwise 
       
  1329             // normal call needs to be established, even new number is found 
       
  1330             // from EFecc. So if number is not "112" we need to add subblock 
       
  1331             // CALL_MODEM_CHECK_INFO with CALL_MODEM_CHK_DISABLE_EMERG
       
  1332             _LIT8(KEccNbr, "112");
       
  1333             if( 0 != asciiAddress.Compare( KEccNbr ) )
       
  1334                 {
       
  1335                 checkInfoNeeded = ETrue;
       
  1336                 checkInfoParams += CALL_MODEM_CHK_DISABLE_EMERG;
       
  1337                 }
  1307 
  1338 
  1308             //add the number string as unicode.
  1339             //add the number string as unicode.
  1309             TBuf16<KCallServerMaxAddressLenght> unicodeNumber;
  1340             TBuf16<KCallServerMaxAddressLenght> unicodeNumber;
  1310             TSatUtility::ConvertSms7ToUnicode16( unicodeNumber, asciiAddress );
  1341             TSatUtility::ConvertSms7ToUnicode16( unicodeNumber, asciiAddress );
  1311             TBuf8<2 * KCallServerMaxAddressLenght> temp;
  1342             TBuf8<2 * KCallServerMaxAddressLenght> temp;
  1348 
  1379 
  1349     // CALL_MODEM_SB_CHECK_INFO[O]: bitfield saying if some checks
  1380     // CALL_MODEM_SB_CHECK_INFO[O]: bitfield saying if some checks
  1350     // should be ignored in Call Modem Server
  1381     // should be ignored in Call Modem Server
  1351     if ( aTcc.iCheckInfo.Length() )
  1382     if ( aTcc.iCheckInfo.Length() )
  1352         {
  1383         {
  1353         isiMessage.Append( aTcc.iCheckInfo );
       
  1354         sbcount++;
  1384         sbcount++;
  1355         }
  1385         if( checkInfoNeeded )
       
  1386             {
       
  1387             TUint8 oldInfo( aTcc.iCheckInfo[CALL_MODEM_SB_CHECK_INFO_OFFSET_CHECKINFO] );
       
  1388             TUint8 newInfo( checkInfoParams | oldInfo );
       
  1389             TIsiSubBlock checkInfo(
       
  1390                 isiMessage,
       
  1391                 CALL_MODEM_SB_CHECK_INFO,
       
  1392                 EIsiSubBlockTypeId8Len8 );
       
  1393             isiMessage.Append( newInfo );
       
  1394             checkInfo.CompleteSubBlock();
       
  1395             }
       
  1396         else
       
  1397             {
       
  1398             isiMessage.Append( aTcc.iCheckInfo );
       
  1399             }
       
  1400         }
       
  1401     else if( checkInfoNeeded )
       
  1402         {
       
  1403         sbcount++;
       
  1404         TIsiSubBlock checkInfo(
       
  1405             isiMessage,
       
  1406             CALL_MODEM_SB_CHECK_INFO,
       
  1407             EIsiSubBlockTypeId8Len8 );
       
  1408         isiMessage.Append( checkInfoParams );
       
  1409         checkInfo.CompleteSubBlock();
       
  1410         }
       
  1411     // no else
       
  1412 
  1356     TBuf8<1> numOfSubblocks;
  1413     TBuf8<1> numOfSubblocks;
  1357     numOfSubblocks.Append( sbcount);
  1414     numOfSubblocks.Append( sbcount);
  1358     isiMessage.Insert( 1, numOfSubblocks );
  1415     isiMessage.Insert( 1, numOfSubblocks );
  1359 
  1416 
  1360     // before sending the call control result to call server,
  1417     // before sending the call control result to call server,