telephonyserverplugins/simatktsy/src/CSatNotifyGetInkey.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65: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 "CSatNotifyGetInkeyTraces.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 "CSatNotifyGetInkey.h"     // Tsy class header
    31 #include "CSatNotifyGetInkey.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 CSatNotifyGetInkey* CSatNotifyGetInkey::NewL
    45 CSatNotifyGetInkey* CSatNotifyGetInkey::NewL
    41         ( 
    46         ( 
    42         CSatNotificationsTsy* aNotificationsTsy 
    47         CSatNotificationsTsy* aNotificationsTsy 
    43         )
    48         )
    44     {
    49     {
    45     TFLOGSTRING("CSAT: CSatNotifyGetInkey::NewL");
    50     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_NEWL_1, "CSAT: CSatNotifyGetInkey::NewL");
    46    	CSatNotifyGetInkey* const satNotifyGetInkey = 
    51    	CSatNotifyGetInkey* const satNotifyGetInkey = 
    47         new ( ELeave ) CSatNotifyGetInkey( aNotificationsTsy );
    52         new ( ELeave ) CSatNotifyGetInkey( aNotificationsTsy );
    48     CleanupStack::PushL( satNotifyGetInkey );
    53     CleanupStack::PushL( satNotifyGetInkey );
    49     satNotifyGetInkey->ConstructL();
    54     satNotifyGetInkey->ConstructL();
    50     CleanupStack::Pop( satNotifyGetInkey );
    55     CleanupStack::Pop( satNotifyGetInkey );
    51     TFLOGSTRING("CSAT: CSatNotifyGetInkey::NewL, end of method");
    56     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_NEWL_2, "CSAT: CSatNotifyGetInkey::NewL, end of method");
    52     return satNotifyGetInkey;
    57     return satNotifyGetInkey;
    53     }
    58     }
    54 
    59 
    55 // -----------------------------------------------------------------------------
    60 // -----------------------------------------------------------------------------
    56 // CSatNotifyGetInkey::~CSatNotifyGetInkey
    61 // CSatNotifyGetInkey::~CSatNotifyGetInkey
    60 CSatNotifyGetInkey::~CSatNotifyGetInkey
    65 CSatNotifyGetInkey::~CSatNotifyGetInkey
    61         ( 
    66         ( 
    62 		// None
    67 		// None
    63         )
    68         )
    64     {
    69     {
    65     TFLOGSTRING("CSAT: CSatNotifyGetInkey::~CSatNotifyGetInkey");
    70     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_DTOR_1, "CSAT: CSatNotifyGetInkey::~CSatNotifyGetInkey");
    66     }
    71     }
    67     
    72     
    68 // -----------------------------------------------------------------------------
    73 // -----------------------------------------------------------------------------
    69 // CSatNotifyGetInkey::CSatNotifyGetInkey
    74 // CSatNotifyGetInkey::CSatNotifyGetInkey
    70 // Default C++ constructor
    75 // Default C++ constructor
    86 void CSatNotifyGetInkey::ConstructL
    91 void CSatNotifyGetInkey::ConstructL
    87         (
    92         (
    88         // None
    93         // None
    89         )
    94         )
    90     {
    95     {
    91     TFLOGSTRING("CSAT: CSatNotifyGetInkey::ConstructL");
    96     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_CONSTRUCTL_1, "CSAT: CSatNotifyGetInkey::ConstructL");
    92     }
    97     }
    93     
    98     
    94 // -----------------------------------------------------------------------------
    99 // -----------------------------------------------------------------------------
    95 // CSatNotifyGetInkey::Notify
   100 // CSatNotifyGetInkey::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: CSatNotifyGetInkey::Notify");
   110     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_NOTIFY_1, "CSAT: CSatNotifyGetInkey::Notify");
   106     // Save data pointer to client side for completion
   111     // Save data pointer to client side for completion
   107     iGetInkeyV2Pckg = reinterpret_cast<RSat::TGetInkeyV2Pckg*>( 
   112     iGetInkeyV2Pckg = reinterpret_cast<RSat::TGetInkeyV2Pckg*>( 
   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, 
   125 TInt CSatNotifyGetInkey::CancelNotification
   130 TInt CSatNotifyGetInkey::CancelNotification
   126         (
   131         (
   127         const TTsyReqHandle aTsyReqHandle
   132         const TTsyReqHandle aTsyReqHandle
   128         )
   133         )
   129     {
   134     {
   130     TFLOGSTRING("CSAT: CSatNotifyGetInkey::CancelNotification");
   135     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_CANCELNOTIFICATION_1, "CSAT: CSatNotifyGetInkey::CancelNotification");
   131     // Reset the request handle
   136     // Reset the request handle
   132     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   137     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   133         ResetTsyReqHandle( CSatTsy::ESatNotifyGetInkeyPCmdReqType );
   138         ResetTsyReqHandle( CSatTsy::ESatNotifyGetInkeyPCmdReqType );
   134     // Reset the data pointer
   139     // Reset the data pointer
   135     iGetInkeyV2Pckg = NULL;
   140     iGetInkeyV2Pckg = NULL;
   147         ( 
   152         ( 
   148         CSatDataPackage* aDataPackage, 
   153         CSatDataPackage* aDataPackage, 
   149         TInt aErrorCode  
   154         TInt aErrorCode  
   150         ) 
   155         ) 
   151     {
   156     {
   152     TFLOGSTRING("CSAT: CSatNotifyGetInkey::CompleteNotifyL");
   157     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_COMPLETENOTIFYL_1, "CSAT: CSatNotifyGetInkey::CompleteNotifyL");
   153     TInt ret( KErrNone );
   158     TInt ret( KErrNone );
   154     TInt returnValue( KErrNone );
   159     TInt returnValue( KErrNone );
   155 
   160 
   156     // Unpack parameters
   161     // Unpack parameters
   157     TPtrC8* data;
   162     TPtrC8* data;
   228                 // Help information available
   233                 // Help information available
   229                 getInkeyV2.iHelp = RSat::EHelpAvailable;
   234                 getInkeyV2.iHelp = RSat::EHelpAvailable;
   230                 }
   235                 }
   231             else
   236             else
   232                 {
   237                 {
   233                 TFLOGSTRING("CSAT: CSatNotifyGetInkey::CompleteNotifyL,\
   238                 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_COMPLETENOTIFYL_2, "CSAT: CSatNotifyGetInkey::CompleteNotifyL, No Help available");
   234                     No Help available");
       
   235                 // No help
   239                 // No help
   236                 getInkeyV2.iHelp = RSat::ENoHelpAvailable;
   240                 getInkeyV2.iHelp = RSat::ENoHelpAvailable;
   237                 }
   241                 }
   238 
   242 
   239             // Response Mode
   243             // Response Mode
   257                 // Convert and set text
   261                 // Convert and set text
   258                 TSatUtility::SetText( textString, getInkeyV2.iText );
   262                 TSatUtility::SetText( textString, getInkeyV2.iText );
   259                 }
   263                 }
   260             else
   264             else
   261                 {
   265                 {
   262                 TFLOGSTRING("CSAT: CSatNotifyGetInkey::CompleteNotifyL,\
   266                 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_COMPLETENOTIFYL_3, "CSAT: CSatNotifyGetInkey::CompleteNotifyL, Required values missing");
   263                     Required values missing");
       
   264                 additionalInfo.Zero();
   267                 additionalInfo.Zero();
   265                 additionalInfo.Append( KNoCause );
   268                 additionalInfo.Append( KNoCause );
   266                 CreateTerminalRespL( pCmdNumber, 
   269                 CreateTerminalRespL( pCmdNumber, 
   267                     RSat::KErrorRequiredValuesMissing, additionalInfo );
   270                     RSat::KErrorRequiredValuesMissing, additionalInfo );
   268 
   271 
   281         
   284         
   282         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
   285         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
   283         }
   286         }
   284     else
   287     else
   285         {
   288         {
   286         TFLOGSTRING("CSAT: CSatNotifyGetInkey::CompleteNotifyL,\
   289         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_COMPLETENOTIFYL_4, "CSAT: CSatNotifyGetInkey::CompleteNotifyL, Request not ongoing");
   287             Request not ongoing");
       
   288 		additionalInfo.Zero();
   290 		additionalInfo.Zero();
   289         additionalInfo.Append( KNoCause );
   291         additionalInfo.Append( KNoCause );
   290         CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
   292         CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
   291             additionalInfo ); 
   293             additionalInfo ); 
   292         }
   294         }
   302 TInt CSatNotifyGetInkey::TerminalResponseL
   304 TInt CSatNotifyGetInkey::TerminalResponseL
   303         ( 
   305         ( 
   304         TDes8* aRsp
   306         TDes8* aRsp
   305         )
   307         )
   306     {   
   308     {   
   307 	TFLOGSTRING("CSAT: CSatNotifyGetInkey::TerminalResponseL");
   309 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_TERMINALRESPONSEL_1, "CSAT: CSatNotifyGetInkey::TerminalResponseL");
   308     
   310     
   309 	TInt ret( KErrNone );
   311 	TInt ret( KErrNone );
   310 
   312 
   311     RSat::TGetInkeyRspV2Pckg* aRspPckg = 
   313     RSat::TGetInkeyRspV2Pckg* aRspPckg = 
   312             reinterpret_cast<RSat::TGetInkeyRspV2Pckg*>( aRsp );
   314             reinterpret_cast<RSat::TGetInkeyRspV2Pckg*>( aRsp );
   317     // Checking that infotype is valid
   319     // Checking that infotype is valid
   318     if ( ( RSat::KMeProblem != rspV2.iInfoType ) && 
   320     if ( ( RSat::KMeProblem != rspV2.iInfoType ) && 
   319          ( RSat::KTextString != rspV2.iInfoType ) && 
   321          ( RSat::KTextString != rspV2.iInfoType ) && 
   320          ( RSat::KNoAdditionalInfo != rspV2.iInfoType ) )
   322          ( RSat::KNoAdditionalInfo != rspV2.iInfoType ) )
   321         {
   323         {
   322         TFLOGSTRING("CSAT: CSatNotifyGetInkey::TerminalResponseL,\
   324         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_TERMINALRESPONSEL_2, "CSAT: CSatNotifyGetInkey::TerminalResponseL, Invalid Infotype");
   323             Invalid Infotype");
       
   324         ret = KErrCorrupt;
   325         ret = KErrCorrupt;
   325         }
   326         }
   326 
   327 
   327     // Checking that the response type is valid
   328     // Checking that the response type is valid
   328     if ( ( RSat::EDigitOnly != rspV2.iRspFormat )&& 
   329     if ( ( RSat::EDigitOnly != rspV2.iRspFormat )&& 
   329          ( RSat::ECharSmsDefaultAlphabet != rspV2.iRspFormat ) && 
   330          ( RSat::ECharSmsDefaultAlphabet != rspV2.iRspFormat ) && 
   330          ( RSat::ECharUcs2Alphabet  != rspV2.iRspFormat ) && 
   331          ( RSat::ECharUcs2Alphabet  != rspV2.iRspFormat ) && 
   331          ( RSat::EYesNo != rspV2.iRspFormat ) )
   332          ( RSat::EYesNo != rspV2.iRspFormat ) )
   332         {
   333         {
   333         TFLOGSTRING("CSAT: CSatNotifyGetInkey::TerminalResponseL,\
   334         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_TERMINALRESPONSEL_3, "CSAT: CSatNotifyGetInkey::TerminalResponseL, Invalid Response Format");
   334             Invalid Response Format");
       
   335         ret = KErrCorrupt;
   335         ret = KErrCorrupt;
   336         }
   336         }
   337     
   337     
   338     // Check that general result value is valid
   338     // Check that general result value is valid
   339     if ( ( RSat::KSuccess != rspV2.iGeneralResult ) && 
   339     if ( ( RSat::KSuccess != rspV2.iGeneralResult ) && 
   344          ( RSat::KMeUnableToProcessCmd != rspV2.iGeneralResult ) && 
   344          ( RSat::KMeUnableToProcessCmd != rspV2.iGeneralResult ) && 
   345          ( RSat::KCmdBeyondMeCapabilities != rspV2.iGeneralResult ) && 
   345          ( RSat::KCmdBeyondMeCapabilities != rspV2.iGeneralResult ) && 
   346          ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) &&
   346          ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) &&
   347          ( RSat::KSuccessRequestedIconNotDisplayed != rspV2.iGeneralResult ))
   347          ( RSat::KSuccessRequestedIconNotDisplayed != rspV2.iGeneralResult ))
   348         {
   348         {
   349         TFLOGSTRING("CSAT: CSatNotifyGetInkey::TerminalResponseL,\
   349         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_TERMINALRESPONSEL_4, "CSAT: CSatNotifyGetInkey::TerminalResponseL, Invalid General Result");
   350             Invalid General Result");
       
   351         // Invalid general result
   350         // Invalid general result
   352         ret = KErrCorrupt;
   351         ret = KErrCorrupt;
   353         }
   352         }
   354     
   353     
   355     // If there is Me (Mobile Entity) error, additional info is needed
   354     // If there is Me (Mobile Entity) error, additional info is needed
   356     if ( ( RSat::KMeProblem == rspV2.iInfoType ) &&  
   355     if ( ( RSat::KMeProblem == rspV2.iInfoType ) &&  
   357          ( NULL == rspV2.iAdditionalInfo.Length() ) )
   356          ( NULL == rspV2.iAdditionalInfo.Length() ) )
   358         {
   357         {
   359         TFLOGSTRING("CSAT: CSatNotifyGetInkey::TerminalResponseL,\
   358         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_TERMINALRESPONSEL_5, "CSAT: CSatNotifyGetInkey::TerminalResponseL, Invalid Additional Info, ME Problem");
   360             Invalid Additional Info, ME Problem");
       
   361         // Invalid additional info field
   359         // Invalid additional info field
   362         ret = KErrCorrupt;
   360         ret = KErrCorrupt;
   363         }
   361         }
   364 
   362 
   365     if ( ( RSat::KTextString == rspV2.iInfoType ) && 
   363     if ( ( RSat::KTextString == rspV2.iInfoType ) && 
   366          ( NULL == rspV2.iAdditionalInfo.Length() ) )
   364          ( NULL == rspV2.iAdditionalInfo.Length() ) )
   367         {
   365         {
   368         TFLOGSTRING("CSAT: CSatNotifyGetInkey::TerminalResponseL,\
   366         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_TERMINALRESPONSEL_6, "CSAT: CSatNotifyGetInkey::TerminalResponseL, Invalid Additional Info");
   369             Invalid Additional Info");
       
   370         ret = KErrCorrupt;
   367         ret = KErrCorrupt;
   371         }
   368         }
   372 	
   369 	
   373 	else
   370 	else
   374 		{
   371 		{
   393         TUint8  aGeneralResult,      
   390         TUint8  aGeneralResult,      
   394         TDesC16& aAdditionalInfo,  
   391         TDesC16& aAdditionalInfo,  
   395         TUint8  aDcs          
   392         TUint8  aDcs          
   396 		)
   393 		)
   397     {
   394     {
   398 	TFLOGSTRING("CSAT: CSatNotifyGetInkey::CreateTerminalRespL");
   395 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_CREATETERMINALRESPL_1, "CSAT: CSatNotifyGetInkey::CreateTerminalRespL");
   399 
   396 
   400 	TTlv tlvSpecificData;
   397 	TTlv tlvSpecificData;
   401     tlvSpecificData.AddTag( KTlvResultTag );  
   398     tlvSpecificData.AddTag( KTlvResultTag );  
   402 	// General result
   399 	// General result
   403     tlvSpecificData.AddByte( aGeneralResult );
   400     tlvSpecificData.AddByte( aGeneralResult );
   434 
   431 
   435         if ( aDcs & KUCS2DCS )
   432         if ( aDcs & KUCS2DCS )
   436             {
   433             {
   437             TSatUtility::Copy16to8LE( aAdditionalInfo, character);
   434             TSatUtility::Copy16to8LE( aAdditionalInfo, character);
   438             tlvSpecificData.AddData( character );
   435             tlvSpecificData.AddData( character );
   439             TFLOGSTRING2("CSAT:CSatNotifyGetInkey::CreateTerminalRespL, %s \
   436             OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETINKEY_CREATETERMINALRESPL_2, "CSAT:CSatNotifyGetInkey::CreateTerminalRespL, %s character", character );
   440             	character", &character );
       
   441             }
   437             }
   442         else
   438         else
   443             {
   439             {
   444             if ( NULL != aAdditionalInfo.Length())
   440             if ( NULL != aAdditionalInfo.Length())
   445                 {
   441                 {