telephonyserverplugins/simatktsy/src/CSatNotifySendDtmf.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 //
    18 //
    19 
    19 
    20 
    20 
    21  
    21  
    22 //INCLUDES
    22 //INCLUDES
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "CSatNotifySendDtmfTraces.h"
       
    27 #endif
       
    28 
       
    29 #include <satcs.h>                  // Etel SAT IPC definitions
    23 #include <satcs.h>                  // Etel SAT IPC definitions
    30 #include "CSatTsy.h"                // Tsy class header
    24 #include "CSatTsy.h"                // Tsy class header
    31 #include "CSatNotifySendDtmf.h"     // Tsy class header
    25 #include "CSatNotifySendDtmf.h"     // Tsy class header
    32 #include "CSatNotificationsTsy.h"   // Class header
    26 #include "CSatNotificationsTsy.h"   // Class header
    33 #include "CBerTlv.h"                // Ber Tlv data handling
    27 #include "CBerTlv.h"                // Ber Tlv data handling
    34 #include "TTlv.h"					// TTlv class
    28 #include "TTlv.h"					// TTlv class
    35 #include "CSatDataPackage.h"        // Parameter packing 
    29 #include "CSatDataPackage.h"        // Parameter packing 
       
    30 #include "TfLogger.h"               // For TFLOGSTRING
    36 #include "TSatUtility.h"            // Utilities
    31 #include "TSatUtility.h"            // Utilities
    37 #include "CSatTsyReqHandleStore.h"  // Request handle class
    32 #include "CSatTsyReqHandleStore.h"  // Request handle class
    38 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
    33 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
    39 
    34 
    40 // -----------------------------------------------------------------------------
    35 // -----------------------------------------------------------------------------
    45 CSatNotifySendDtmf* CSatNotifySendDtmf::NewL
    40 CSatNotifySendDtmf* CSatNotifySendDtmf::NewL
    46         ( 
    41         ( 
    47         CSatNotificationsTsy* aNotificationsTsy 
    42         CSatNotificationsTsy* aNotificationsTsy 
    48         )
    43         )
    49     {
    44     {
    50     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_NEWL_1, "CSAT: CSatNotifySendDtmf::NewL");
    45     TFLOGSTRING("CSAT: CSatNotifySendDtmf::NewL");  
    51    	CSatNotifySendDtmf* const satNotifySendDtmf = 
    46    	CSatNotifySendDtmf* const satNotifySendDtmf = 
    52         new ( ELeave ) CSatNotifySendDtmf( aNotificationsTsy );
    47         new ( ELeave ) CSatNotifySendDtmf( aNotificationsTsy );
    53     CleanupStack::PushL( satNotifySendDtmf );
    48     CleanupStack::PushL( satNotifySendDtmf );
    54     satNotifySendDtmf->ConstructL();
    49     satNotifySendDtmf->ConstructL();
    55     CleanupStack::Pop( satNotifySendDtmf );
    50     CleanupStack::Pop( satNotifySendDtmf );
    56     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_NEWL_2, "CSAT: CSatNotifySendDtmf::NewL, end of method");
    51     TFLOGSTRING("CSAT: CSatNotifySendDtmf::NewL, end of method");  
    57     return satNotifySendDtmf;
    52     return satNotifySendDtmf;
    58     }
    53     }
    59 
    54 
    60 // -----------------------------------------------------------------------------
    55 // -----------------------------------------------------------------------------
    61 // CSatNotifySendDtmf::~CSatNotifySendDtmf
    56 // CSatNotifySendDtmf::~CSatNotifySendDtmf
    65 CSatNotifySendDtmf::~CSatNotifySendDtmf
    60 CSatNotifySendDtmf::~CSatNotifySendDtmf
    66         ( 
    61         ( 
    67 		// None
    62 		// None
    68         )
    63         )
    69     { 
    64     { 
    70     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_DTOR_1, "CSAT: CSatNotifySendDtmf::~CSatNotifySendDtmf");
    65     TFLOGSTRING("CSAT: CSatNotifySendDtmf::~CSatNotifySendDtmf");  
    71     }
    66     }
    72     
    67     
    73 // -----------------------------------------------------------------------------
    68 // -----------------------------------------------------------------------------
    74 // CSatNotifySendDtmf::CSatNotifySendDtmf
    69 // CSatNotifySendDtmf::CSatNotifySendDtmf
    75 // Default C++ constructor
    70 // Default C++ constructor
    91 void CSatNotifySendDtmf::ConstructL
    86 void CSatNotifySendDtmf::ConstructL
    92         (
    87         (
    93         // None
    88         // None
    94         )
    89         )
    95     {
    90     {
    96     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_CONSTRUCTL_1, "CSAT: CSatNotifySendDtmf::ConstructL, does nothing");
    91     TFLOGSTRING("CSAT: CSatNotifySendDtmf::ConstructL, does nothing");  
    97     }
    92     }
    98 
    93 
    99 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
   100 // CSatNotifySendDtmf::Notify
    95 // CSatNotifySendDtmf::Notify
   101 // Save the request handle type for notification requested by ETel server
    96 // Save the request handle type for notification requested by ETel server
   105         ( 
   100         ( 
   106         const TTsyReqHandle aTsyReqHandle,
   101         const TTsyReqHandle aTsyReqHandle,
   107         const TDataPackage& aPackage   
   102         const TDataPackage& aPackage   
   108         )
   103         )
   109     {
   104     {
   110     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_NOTIFY_1, "CSAT: CSatNotifySendDtmf::Notify");
   105     TFLOGSTRING("CSAT: CSatNotifySendDtmf::Notify");  
   111     // Save data pointer to client side for completion
   106     // Save data pointer to client side for completion
   112     iSendDtmfV1Pckg = reinterpret_cast<RSat::TSendDtmfV1Pckg*>( 
   107     iSendDtmfV1Pckg = reinterpret_cast<RSat::TSendDtmfV1Pckg*>( 
   113         aPackage.Des1n() );
   108         aPackage.Des1n() );
   114     // Save the request handle
   109     // Save the request handle
   115     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   110     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   131 TInt CSatNotifySendDtmf::CancelNotification
   126 TInt CSatNotifySendDtmf::CancelNotification
   132         (
   127         (
   133         const TTsyReqHandle aTsyReqHandle 
   128         const TTsyReqHandle aTsyReqHandle 
   134         )
   129         )
   135     {
   130     {
   136     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_CANCELNOTIFICATION_1, "CSAT: CSatNotifySendDtmf::CancelNotification");
   131     TFLOGSTRING("CSAT: CSatNotifySendDtmf::CancelNotification"); 
   137     // Reset the request handle
   132     // Reset the request handle
   138     iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle( 
   133     iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle( 
   139         CSatTsy::ESatNotifySendDtmfPCmdReqType );
   134         CSatTsy::ESatNotifySendDtmfPCmdReqType );
   140     // Reset the data pointer
   135     // Reset the data pointer
   141     iSendDtmfV1Pckg = NULL;
   136     iSendDtmfV1Pckg = NULL;
   155         ( 
   150         ( 
   156         CSatDataPackage* aDataPackage,
   151         CSatDataPackage* aDataPackage,
   157         TInt aErrorCode  
   152         TInt aErrorCode  
   158         ) 
   153         ) 
   159     {
   154     {
   160     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_COMPLETENOTIFYL_1, "CSAT: CSatNotifySendDtmf::CompleteNotifyL");
   155     TFLOGSTRING("CSAT: CSatNotifySendDtmf::CompleteNotifyL"); 
   161     TInt returnValue( KErrNone );
   156     TInt returnValue( KErrNone );
   162     TInt ret( KErrNone );
   157     TInt ret( KErrNone );
   163     // Unpack parameters
   158     // Unpack parameters
   164     TPtrC8* data;
   159     TPtrC8* data;
   165     aDataPackage->UnPackData( &data );
   160     aDataPackage->UnPackData( &data );
   201                 {
   196                 {
   202                 TUint16 alphaIdLength = alphaIdentifier.GetLength();
   197                 TUint16 alphaIdLength = alphaIdentifier.GetLength();
   203     
   198     
   204                 if ( RSat::KAlphaIdMaxSize < alphaIdLength )
   199                 if ( RSat::KAlphaIdMaxSize < alphaIdLength )
   205                     {
   200                     {
   206                     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_COMPLETENOTIFYL_2, "CSAT: CSatNotifySendDtmf::CompleteNotifyL, Alpha ID length exceeded");
   201                     TFLOGSTRING("CSAT: CSatNotifySendDtmf::CompleteNotifyL,\
       
   202                         Alpha ID length exceeded"); 
   207                     // String too long
   203                     // String too long
   208                     additionalInfo.Zero();
   204                     additionalInfo.Zero();
   209                     additionalInfo.Append( KNoCause );                  
   205                     additionalInfo.Append( KNoCause );                  
   210                     CreateTerminalRespL( pCmdNumber, 
   206                     CreateTerminalRespL( pCmdNumber, 
   211                         RSat::KCmdBeyondMeCapabilities, additionalInfo );                    
   207                         RSat::KCmdBeyondMeCapabilities, additionalInfo );                    
   222                         sendDtmfV1.iAlphaId.iAlphaId );
   218                         sendDtmfV1.iAlphaId.iAlphaId );
   223                     sendDtmfV1.iAlphaId.iStatus = RSat::EAlphaIdProvided;
   219                     sendDtmfV1.iAlphaId.iStatus = RSat::EAlphaIdProvided;
   224                     }
   220                     }
   225                 else
   221                 else
   226                 	{
   222                 	{
   227                 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_COMPLETENOTIFYL_3, "CSAT: CSatNotifySendDtmf::CompleteNotifyL, Alpha ID is NULL");
   223                 	TFLOGSTRING("CSAT: CSatNotifySendDtmf::CompleteNotifyL,\
       
   224                         Alpha ID is NULL"); 
   228                     sendDtmfV1.iAlphaId.iStatus = RSat::EAlphaIdNull;                     
   225                     sendDtmfV1.iAlphaId.iStatus = RSat::EAlphaIdNull;                     
   229                     }
   226                     }
   230                 }
   227                 }
   231             // Alpha id not present
   228             // Alpha id not present
   232             else 
   229             else 
   233                 {
   230                 {
   234                 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_COMPLETENOTIFYL_4, "CSAT: CSatNotifySendDtmf::CompleteNotifyL, Alpha ID not present");
   231                 TFLOGSTRING("CSAT: CSatNotifySendDtmf::CompleteNotifyL,\
       
   232                     Alpha ID not present"); 
   235                 sendDtmfV1.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;
   233                 sendDtmfV1.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;
   236                 }
   234                 }
   237 
   235 
   238             // Dtmf string length, 8-bit string, mandatory
   236             // Dtmf string length, 8-bit string, mandatory
   239             sendDtmfV1.iDtmfString.Zero();
   237             sendDtmfV1.iDtmfString.Zero();
   250 	            // If first byte of the dtmf string is 0xFF it means that dtmf string
   248 	            // If first byte of the dtmf string is 0xFF it means that dtmf string
   251 	            // is empty and we have to return general result 
   249 	            // is empty and we have to return general result 
   252 	            if ( ( dtmfStringLength && ( sendDtmf.Data()[2] == 0xFF ) ) ||
   250 	            if ( ( dtmfStringLength && ( sendDtmf.Data()[2] == 0xFF ) ) ||
   253 	                !dtmfStringLength )
   251 	                !dtmfStringLength )
   254 	                {
   252 	                {
   255 	                OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_COMPLETENOTIFYL_5, "CSAT: CSatNotifySendDtmf::CompleteNotifyL, Data not understood");
   253 	                TFLOGSTRING("CSAT: CSatNotifySendDtmf::CompleteNotifyL,\
       
   254                         Data not understood"); 
   256 	                generalResult = RSat::KCmdDataNotUnderstood; 
   255 	                generalResult = RSat::KCmdDataNotUnderstood; 
   257 	                ret = KErrCorrupt;
   256 	                ret = KErrCorrupt;
   258 	                }
   257 	                }
   259 	            else if( RSat::KDtmfStringMaxSize < dtmfStringLength )
   258 	            else if( RSat::KDtmfStringMaxSize < dtmfStringLength )
   260 	                {
   259 	                {
   261 	                OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_COMPLETENOTIFYL_6, "CSAT: CSatNotifySendDtmf::CompleteNotifyL, Cmd beyond ME capabilities");
   260 	                TFLOGSTRING("CSAT: CSatNotifySendDtmf::CompleteNotifyL,\
       
   261                         Cmd beyond ME capabilities"); 
   262 	                generalResult = RSat::KCmdBeyondMeCapabilities;
   262 	                generalResult = RSat::KCmdBeyondMeCapabilities;
   263 	                ret = KErrCorrupt;
   263 	                ret = KErrCorrupt;
   264 	                }
   264 	                }
   265 	            else
   265 	            else
   266 	                {
   266 	                {
   267 	                sendDtmfV1.iDtmfString.Append( sendDtmf.GetData( ETLV_DtmfString ) );
   267 	                sendDtmfV1.iDtmfString.Append( sendDtmf.GetData( ETLV_DtmfString ) );
   268 	                }
   268 	                }
   269 
   269 
   270 	            if( KErrCorrupt == ret )
   270 	            if( KErrCorrupt == ret )
   271 	                {
   271 	                {
   272 	                OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_COMPLETENOTIFYL_7, "CSAT: CSatNotifySendDtmf::CompleteNotifyL, DTMF length exceeded");
   272 	                TFLOGSTRING("CSAT: CSatNotifySendDtmf::CompleteNotifyL,\
       
   273                         DTMF length exceeded"); 
   273                     // String too long
   274                     // String too long
   274                     additionalInfo.Zero();
   275                     additionalInfo.Zero();
   275                     additionalInfo.Append( KNoCause );
   276                     additionalInfo.Append( KNoCause );
   276                     CreateTerminalRespL( pCmdNumber, generalResult, 
   277                     CreateTerminalRespL( pCmdNumber, generalResult, 
   277                         additionalInfo );
   278                         additionalInfo );
   316 TInt CSatNotifySendDtmf::TerminalResponseL
   317 TInt CSatNotifySendDtmf::TerminalResponseL
   317         ( 
   318         ( 
   318         TDes8* aRsp 
   319         TDes8* aRsp 
   319         )
   320         )
   320     {
   321     {
   321     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_TERMINALRESPONSEL_1, "CSAT:CSatNotifySendDtmf::TerminalResponseL");
   322     TFLOGSTRING("CSAT:CSatNotifySendDtmf::TerminalResponseL");
   322     
   323     
   323     TInt ret( KErrNone );
   324     TInt ret( KErrNone );
   324     TBuf<1> additionalInfo;
   325     TBuf<1> additionalInfo;
   325 
   326 
   326     RSat::TSendDtmfRspV1Pckg* aRspPckg = 
   327     RSat::TSendDtmfRspV1Pckg* aRspPckg = 
   340          ( RSat::KMissingInformation != rspV1.iGeneralResult ) && 
   341          ( RSat::KMissingInformation != rspV1.iGeneralResult ) && 
   341          ( RSat::KSuccessRequestedIconNotDisplayed != rspV1.iGeneralResult ) && 
   342          ( RSat::KSuccessRequestedIconNotDisplayed != rspV1.iGeneralResult ) && 
   342          ( RSat::KPSessionTerminatedByUser != rspV1.iGeneralResult ) && 
   343          ( RSat::KPSessionTerminatedByUser != rspV1.iGeneralResult ) && 
   343          ( RSat::KErrorRequiredValuesMissing != rspV1.iGeneralResult ) )
   344          ( RSat::KErrorRequiredValuesMissing != rspV1.iGeneralResult ) )
   344         {
   345         {
   345         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_TERMINALRESPONSEL_2, "CSAT:CSatNotifySendDtmf::TerminalResponseL, Invalid General result");
   346         TFLOGSTRING("CSAT:CSatNotifySendDtmf::TerminalResponseL,\
       
   347                 Invalid General result");
   346         ret = KErrCorrupt;
   348         ret = KErrCorrupt;
   347         }
   349         }
   348         
   350         
   349     if( RSat::KMeProblem == rspV1.iInfoType )
   351     if( RSat::KMeProblem == rspV1.iInfoType )
   350         {
   352         {
   353             additionalInfo.Zero();
   355             additionalInfo.Zero();
   354         	additionalInfo.Append( rspV1.iAdditionalInfo[0] );
   356         	additionalInfo.Append( rspV1.iAdditionalInfo[0] );
   355             }
   357             }
   356         else
   358         else
   357             {
   359             {
   358             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_TERMINALRESPONSEL_3, "CSAT:CSatNotifySendDtmf::TerminalResponseL, Invalid Info Type");
   360             TFLOGSTRING("CSAT:CSatNotifySendDtmf::TerminalResponseL,\
       
   361                 Invalid Info Type");
   359             ret = KErrCorrupt;
   362             ret = KErrCorrupt;
   360             }
   363             }
   361         }
   364         }
   362 
   365 
   363     // Creating the terminal response message
   366     // Creating the terminal response message
   383         TUint8  aPCmdNumber,         
   386         TUint8  aPCmdNumber,         
   384         TUint8  aGeneralResult,      
   387         TUint8  aGeneralResult,      
   385         TDesC16& aAdditionalInfo          
   388         TDesC16& aAdditionalInfo          
   386 		)
   389 		)
   387     {
   390     {
   388     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDTMF_CREATETERMINALRESPL_1, "CSAT: CSatNotifySendDtmf::CreateTerminalRespL");
   391     TFLOGSTRING("CSAT: CSatNotifySendDtmf::CreateTerminalRespL");   
   389     
   392     
   390     TTlv tlvSpecificData;
   393     TTlv tlvSpecificData;
   391     // Append general result tag
   394     // Append general result tag
   392     tlvSpecificData.AddTag( KTlvResultTag );
   395     tlvSpecificData.AddTag( KTlvResultTag );
   393     // Append general result
   396     // Append general result