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