adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp
changeset 8 6295dc2169f3
parent 7 fa67e03b87df
child 9 8486d82aef45
equal deleted inserted replaced
7:fa67e03b87df 8:6295dc2169f3
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: 
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
       
    18 
       
    19 
    17 
    20 //  Include Files
    18 //  Include Files
    21 
    19 
    22 #include <ctsy/pluginapi/cmmdatapackage.h>
    20 #include <ctsy/pluginapi/cmmdatapackage.h>
    23 #include <e32std.h>        // error values
    21 #include <e32std.h>        // error values
   111     iIsUssdSendReqOnGoing = EFalse;
   109     iIsUssdSendReqOnGoing = EFalse;
   112     //No pending request
   110     //No pending request
   113     iIsSendReleaseReqPending = EFalse;
   111     iIsSendReleaseReqPending = EFalse;
   114 
   112 
   115     iNoFdnUSSDReq = EFalse;
   113     iNoFdnUSSDReq = EFalse;
       
   114 
       
   115     iLastMtUssdIsRequest = EFalse;
   116     }
   116     }
   117 
   117 
   118 // -----------------------------------------------------------------------------
   118 // -----------------------------------------------------------------------------
   119 // CMmUssdMessHandler::NewL
   119 // CMmUssdMessHandler::NewL
   120 // Two-phased constructor.
   120 // Two-phased constructor.
   219 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdSendReq");
   219 TFLOGSTRING("TSY: CMmUssdMessHandler::SsGsmUssdSendReq");
   220 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq" );
   220 OstTrace0( TRACE_NORMAL, CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq" );
   221     TInt ret ( KErrNone );
   221     TInt ret ( KErrNone );
   222     TBuf8<RMobileUssdMessaging::KGsmUssdDataSize> data( 0 );
   222     TBuf8<RMobileUssdMessaging::KGsmUssdDataSize> data( 0 );
   223     TDes8* attributes( 0 );
   223     TDes8* attributes( 0 );
   224     TUint8 numOfSubblocks( 2 );
   224     TUint8 numOfSubblocks( 0 );
   225 
   225 
   226     aDataPackage->UnPackData( data, attributes );
   226     aDataPackage->UnPackData( data, attributes );
   227 
   227 
   228     RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* msgAttrPck (
   228     RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* msgAttrPck (
   229         (RMobileUssdMessaging::TMobileUssdAttributesV1Pckg*) ( attributes ) );
   229         (RMobileUssdMessaging::TMobileUssdAttributesV1Pckg*) ( attributes ) );
   239         {
   239         {
   240         switch ( msgAttr.iType )
   240         switch ( msgAttr.iType )
   241             {
   241             {
   242             // User has requested to send MO USSD
   242             // User has requested to send MO USSD
   243             case RMobileUssdMessaging::EUssdMORequest:
   243             case RMobileUssdMessaging::EUssdMORequest:
       
   244                 {
       
   245                 ussdType = SS_GSM_USSD_COMMAND;
       
   246                 break;
       
   247                 }
   244             case RMobileUssdMessaging::EUssdMOReply:
   248             case RMobileUssdMessaging::EUssdMOReply:
   245                 {
   249                 {
   246                 ussdType = SS_GSM_USSD_COMMAND;
   250 TFLOGSTRING2("TSY: CMmUssdMessHandler::SsGsmUssdSendReq; iLastMtUssdIsRequest = %d", iLastMtUssdIsRequest);
       
   251 OstTrace1( TRACE_NORMAL, DUP5_CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq;iLastMtUssdIsRequest=%d", iLastMtUssdIsRequest );
       
   252                 if ( iLastMtUssdIsRequest )
       
   253                     {
       
   254                     ussdType = SS_GSM_USSD_MT_REPLY;
       
   255                     }
       
   256                 else
       
   257                     {
       
   258                     ussdType = SS_GSM_USSD_COMMAND;
       
   259                     }
       
   260                 // no need to reset the field, because MT USSD indication
       
   261                 // will always precede this kind of response
   247                 break;
   262                 break;
   248                 }
   263                 }
   249             // User is signing for the MT request
   264             // User is signing for the MT request
   250             case RMobileUssdMessaging::EUssdMOAcknowledgement:
   265             case RMobileUssdMessaging::EUssdMOAcknowledgement:
   251                 {
   266                 {
   301                 SS_GSM_USSD_SEND_REQ );
   316                 SS_GSM_USSD_SEND_REQ );
   302 
   317 
   303             ssGsmUssdSendReq.Set8bit( ISI_HEADER_SIZE +
   318             ssGsmUssdSendReq.Set8bit( ISI_HEADER_SIZE +
   304                 SS_GSM_USSD_SEND_REQ_OFFSET_USSDTYPE, ussdType );
   319                 SS_GSM_USSD_SEND_REQ_OFFSET_USSDTYPE, ussdType );
   305 
   320 
   306             // Create SsGsmUssdString subblock.
   321             if ( SS_GSM_USSD_NOTIFY != ussdType )
   307             // subblock header + ussd string length subblock max length = 164
       
   308 
       
   309             TBuf8<KMaxLengthOfUssdMessage + 3> ssGsmUssdStringSb( 0 );
       
   310 
       
   311             TIsiSubBlock subblockSSGsmUssdString(
       
   312                 ssGsmUssdStringSb, SS_GSM_USSD_STRING, EIsiSubBlockTypeId8Len8 );
       
   313 
       
   314             ssGsmUssdStringSb.Append( codingInfo );
       
   315             ssGsmUssdStringSb.Append( data.Length() );
       
   316             ssGsmUssdStringSb.Append( data );
       
   317 
       
   318             ssGsmUssdSendReq.CopyData( ISI_HEADER_SIZE +
       
   319                 SIZE_SS_GSM_USSD_SEND_REQ,
       
   320                 subblockSSGsmUssdString.CompleteSubBlock() );
       
   321 
       
   322             // create subblock SS_SB_CHECK_INFO
       
   323             TBuf8<SIZE_SS_SB_CHECK_INFO>sbData( 0 );
       
   324             TIsiSubBlock ssCheckInfoSb(
       
   325                 sbData,
       
   326                 SS_SB_CHECK_INFO,
       
   327                 EIsiSubBlockTypeId8Len8 );
       
   328 
       
   329             if( iNoFdnUSSDReq )
       
   330                 {
   322                 {
   331                 sbData.Append( SS_FDN_CHECK_SUPPRESS );
   323                 // Create SsGsmUssdString subblock.
       
   324                 // subblock header + ussd string length subblock max length = 164
       
   325                 TBuf8<KMaxLengthOfUssdMessage + 3> ssGsmUssdStringSb( 0 );
       
   326                 TIsiSubBlock subblockSSGsmUssdString(
       
   327                     ssGsmUssdStringSb, SS_GSM_USSD_STRING, EIsiSubBlockTypeId8Len8 );
       
   328 
       
   329                 ssGsmUssdStringSb.Append( codingInfo );
       
   330                 ssGsmUssdStringSb.Append( data.Length() );
       
   331                 ssGsmUssdStringSb.Append( data );
       
   332 
       
   333                 ssGsmUssdSendReq.CopyData( ISI_HEADER_SIZE +
       
   334                     SIZE_SS_GSM_USSD_SEND_REQ,
       
   335                     subblockSSGsmUssdString.CompleteSubBlock() );
       
   336                 numOfSubblocks++;
       
   337 
       
   338                 if ( SS_GSM_USSD_COMMAND == ussdType )
       
   339                     {
       
   340                     // create subblock SS_SB_CHECK_INFO
       
   341                     TBuf8<SIZE_SS_SB_CHECK_INFO>sbData( 0 );
       
   342                     TIsiSubBlock ssCheckInfoSb(
       
   343                         sbData,
       
   344                         SS_SB_CHECK_INFO,
       
   345                         EIsiSubBlockTypeId8Len8 );
       
   346 
       
   347                     if( iNoFdnUSSDReq )
       
   348                         {
       
   349                         sbData.Append( SS_FDN_CHECK_SUPPRESS );
       
   350                         }
       
   351                     else
       
   352                         {
       
   353                         sbData.Append( SS_NO_FDN_CHECK_SUPPRESS );
       
   354                         }
       
   355 
       
   356                     sbData.Append( SS_NO_RESOURCE_CONTROL_SUPPRESS );
       
   357 
       
   358                     // add the SIZE_SS_SB_CHECK_INFO subblock to service req
       
   359                     ssGsmUssdSendReq.CopyData(
       
   360                         ISI_HEADER_SIZE + SIZE_SS_GSM_USSD_SEND_REQ +
       
   361                         ssGsmUssdStringSb.Length(),
       
   362                         ssCheckInfoSb.CompleteSubBlock( ) );
       
   363                     numOfSubblocks++;
       
   364                     }
   332                 }
   365                 }
   333             else
       
   334                 {
       
   335                 sbData.Append( SS_NO_FDN_CHECK_SUPPRESS );
       
   336                 }
       
   337 
       
   338             sbData.Append( SS_NO_RESOURCE_CONTROL_SUPPRESS );
       
   339 
       
   340             // add the SIZE_SS_SB_CHECK_INFO subblock to service req
       
   341             ssGsmUssdSendReq.CopyData(
       
   342                 ISI_HEADER_SIZE + SIZE_SS_GSM_USSD_SEND_REQ +
       
   343                 ssGsmUssdStringSb.Length(),
       
   344                 ssCheckInfoSb.CompleteSubBlock( ) );
       
   345 
   366 
   346             ssGsmUssdSendReq.Set8bit( ISI_HEADER_SIZE +
   367             ssGsmUssdSendReq.Set8bit( ISI_HEADER_SIZE +
   347                 SS_GSM_USSD_SEND_REQ_OFFSET_SUBBLOCKCOUNT, numOfSubblocks );
   368                 SS_GSM_USSD_SEND_REQ_OFFSET_SUBBLOCKCOUNT, numOfSubblocks );
   348 
       
   349 
   369 
   350             //send message via phonet
   370             //send message via phonet
   351             ret = iPhoNetSender->Send( ssGsmUssdSendReq.Complete() );
   371             ret = iPhoNetSender->Send( ssGsmUssdSendReq.Complete() );
   352             }
   372             }
   353         else
   373         else
   573                 // sw1, sw2 and result is inserted to SS_SB_RESOURCE_CONTROL_INFO
   593                 // sw1, sw2 and result is inserted to SS_SB_RESOURCE_CONTROL_INFO
   574                 // by simatktsy and ther order from first byte is: sw1, sw2 and result
   594                 // by simatktsy and ther order from first byte is: sw1, sw2 and result
   575                 TUint8 sw1 = data[KSw1Index];
   595                 TUint8 sw1 = data[KSw1Index];
   576                 TUint8 sw2 = data[KSw2Index];
   596                 TUint8 sw2 = data[KSw2Index];
   577                 TUint8 result = data[KResultIndex];
   597                 TUint8 result = data[KResultIndex];
   578                 epocError = CMmStaticUtility::MapSw1Sw2ToEpocError( 
   598                 epocError = CMmStaticUtility::MapSw1Sw2ToEpocError(
   579                     sw1, 
   599                     sw1,
   580                     sw2, 
   600                     sw2,
   581                     result );
   601                     result );
   582                 errorMappingNeeded = EFalse;
   602                 errorMappingNeeded = EFalse;
   583                 }
   603                 }
   584             }
   604             }
   585         else
   605         else
   737     switch ( ussdType )
   757     switch ( ussdType )
   738         {
   758         {
   739         case SS_GSM_USSD_REQUEST:
   759         case SS_GSM_USSD_REQUEST:
   740         case SS_GSM_USSD_COMMAND:
   760         case SS_GSM_USSD_COMMAND:
   741             {
   761             {
       
   762             iLastMtUssdIsRequest = SS_GSM_USSD_REQUEST == ussdType;
       
   763 TFLOGSTRING2("TSY: CMmUssdMessHandler::SsGsmUssdSendReq; iLastMtUssdIsRequest = %d", iLastMtUssdIsRequest);
       
   764 OstTrace1( TRACE_NORMAL, DUP3_CMMUSSDMESSHANDLER_SSGSMUSSDRECEIVEIND, "CMmUssdMessHandler::SsGsmUssdReceiveInd;iLastMtUssdIsRequest=%d", iLastMtUssdIsRequest );
   742             receiveUssdMessageAttributes.iType =
   765             receiveUssdMessageAttributes.iType =
   743                 RMobileUssdMessaging::EUssdMTRequest;
   766                 RMobileUssdMessaging::EUssdMTRequest;
   744             break;
   767             break;
   745             }
   768             }
   746         // Set USSD message type to EUssdMTReply if ussdType is .
   769         // Set USSD message type to EUssdMTReply if ussdType is .