telephonyserverplugins/simatktsy/src/CSatNotifyDisplayText.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 "CSatNotifyDisplayTextTraces.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 "CSatNotifyDisplayText.h"  // Class header
    31 #include "CSatNotifyDisplayText.h"  // Class header
    26 #include "CSatNotificationsTsy.h"   // Tsy class header
    32 #include "CSatNotificationsTsy.h"   // Tsy 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 
    41 CSatNotifyDisplayText* CSatNotifyDisplayText::NewL
    46 CSatNotifyDisplayText* CSatNotifyDisplayText::NewL
    42         ( 
    47         ( 
    43         CSatNotificationsTsy* aNotificationsTsy 
    48         CSatNotificationsTsy* aNotificationsTsy 
    44         )  
    49         )  
    45     {
    50     {
    46     TFLOGSTRING("CSAT: CSatNotifyDisplayText::NewL");
    51     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_NEWL_1, "CSAT: CSatNotifyDisplayText::NewL");
    47    	CSatNotifyDisplayText* const satNotifyDisplayText = 
    52    	CSatNotifyDisplayText* const satNotifyDisplayText = 
    48         new ( ELeave ) CSatNotifyDisplayText( aNotificationsTsy );
    53         new ( ELeave ) CSatNotifyDisplayText( aNotificationsTsy );
    49     CleanupStack::PushL( satNotifyDisplayText );
    54     CleanupStack::PushL( satNotifyDisplayText );
    50     satNotifyDisplayText->ConstructL();
    55     satNotifyDisplayText->ConstructL();
    51     CleanupStack::Pop( satNotifyDisplayText );
    56     CleanupStack::Pop( satNotifyDisplayText );
    52     TFLOGSTRING("CSAT: CSatNotifyDisplayText::NewL, end of method");
    57     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_NEWL_2, "CSAT: CSatNotifyDisplayText::NewL, end of method");
    53     return satNotifyDisplayText;
    58     return satNotifyDisplayText;
    54     }
    59     }
    55 
    60 
    56 // -----------------------------------------------------------------------------
    61 // -----------------------------------------------------------------------------
    57 // CSatNotifyDisplayText::~CSatNotifyDisplayText
    62 // CSatNotifyDisplayText::~CSatNotifyDisplayText
    58 // Destructor
    63 // Destructor
    59 // -----------------------------------------------------------------------------
    64 // -----------------------------------------------------------------------------
    60 //  
    65 //  
    61 CSatNotifyDisplayText::~CSatNotifyDisplayText()
    66 CSatNotifyDisplayText::~CSatNotifyDisplayText()
    62     {
    67     {
    63     TFLOGSTRING("CSAT: CSatNotifyDisplayText::~CSatNotifyDisplayText");
    68     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_DTOR_1, "CSAT: CSatNotifyDisplayText::~CSatNotifyDisplayText");
    64     }
    69     }
    65         
    70         
    66 // -----------------------------------------------------------------------------
    71 // -----------------------------------------------------------------------------
    67 // CSatNotifyDisplayText::CSatNotifyDisplayText
    72 // CSatNotifyDisplayText::CSatNotifyDisplayText
    68 // Constructor
    73 // Constructor
    84 void CSatNotifyDisplayText::ConstructL
    89 void CSatNotifyDisplayText::ConstructL
    85         (    
    90         (    
    86         void
    91         void
    87         )
    92         )
    88 	{
    93 	{
    89 	TFLOGSTRING("CSAT: CSatNotifyDisplayText::ConstructL");
    94 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_CONSTRUCTL_1, "CSAT: CSatNotifyDisplayText::ConstructL");
    90 	}
    95 	}
    91        	
    96        	
    92 // -----------------------------------------------------------------------------
    97 // -----------------------------------------------------------------------------
    93 // CSatNotifyDisplayText::Notify
    98 // CSatNotifyDisplayText::Notify
    94 // This request allows a client to be notified of a DISPLAY TEXT proactive 
    99 // This request allows a client to be notified of a DISPLAY TEXT proactive 
    99         (
   104         (
   100         const TTsyReqHandle aTsyReqHandle,
   105         const TTsyReqHandle aTsyReqHandle,
   101         const TDataPackage& aPackage 
   106         const TDataPackage& aPackage 
   102         )
   107         )
   103     {
   108     {
   104     TFLOGSTRING("CSAT: CSatNotifyDisplayText::Notify");
   109     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_NOTIFY_1, "CSAT: CSatNotifyDisplayText::Notify");
   105     // Save data pointer to client side for completion
   110     // Save data pointer to client side for completion
   106     iDisplayTextV2Pckg = reinterpret_cast<RSat::TDisplayTextV2Pckg*>( 
   111     iDisplayTextV2Pckg = reinterpret_cast<RSat::TDisplayTextV2Pckg*>( 
   107         aPackage.Des1n() );    
   112         aPackage.Des1n() );    
   108     // Save the request handle
   113     // Save the request handle
   109     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   114     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   122 TInt CSatNotifyDisplayText::CancelNotification
   127 TInt CSatNotifyDisplayText::CancelNotification
   123         (
   128         (
   124         const TTsyReqHandle aTsyReqHandle
   129         const TTsyReqHandle aTsyReqHandle
   125         )
   130         )
   126     {
   131     {
   127     TFLOGSTRING("CSAT: CSatNotifyDisplayText::CancelNotification");    
   132     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_CANCELNOTIFICATION_1, "CSAT: CSatNotifyDisplayText::CancelNotification");
   128     // Reset the request handle
   133     // Reset the request handle
   129     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   134     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   130         ResetTsyReqHandle( CSatTsy::ESatNotifyDisplayTextPCmdReqType );
   135         ResetTsyReqHandle( CSatTsy::ESatNotifyDisplayTextPCmdReqType );
   131 	// Reset the data pointer
   136 	// Reset the data pointer
   132 	iDisplayTextV2Pckg = NULL;
   137 	iDisplayTextV2Pckg = NULL;
   145         (
   150         (
   146         CSatDataPackage* aDataPackage,   
   151         CSatDataPackage* aDataPackage,   
   147         TInt aErrorCode                  
   152         TInt aErrorCode                  
   148         )
   153         )
   149     {
   154     {
   150     TFLOGSTRING("CSAT: CSatNotifyDisplayText::CompleteNotifyL");
   155     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_COMPLETENOTIFYL_1, "CSAT: CSatNotifyDisplayText::CompleteNotifyL");
   151     TInt ret( KErrNone );
   156     TInt ret( KErrNone );
   152 
   157 
   153     // Unpack parameters
   158     // Unpack parameters
   154     TPtrC8* data;
   159     TPtrC8* data;
   155     aDataPackage->UnPackData( &data );
   160     aDataPackage->UnPackData( &data );
   156     TFLOGSTRING2("CSAT: CSatNotifyDisplayText::CompleteNotifyL, dataLength: \
   161     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_COMPLETENOTIFYL_2, "CSAT: CSatNotifyDisplayText::CompleteNotifyL, dataLength: %d", data->Length());
   157         %d", data->Length());
       
   158     // Reset req handle. Returns the deleted req handle
   162     // Reset req handle. Returns the deleted req handle
   159     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   163     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   160         ResetTsyReqHandle( 
   164         ResetTsyReqHandle( 
   161 		CSatTsy::ESatNotifyDisplayTextPCmdReqType );
   165 		CSatTsy::ESatNotifyDisplayTextPCmdReqType );
   162 		
   166 		
   245                     }
   249                     }
   246                 // Text string is a null data object.
   250                 // Text string is a null data object.
   247                 // Return terminal response immediately.
   251                 // Return terminal response immediately.
   248                 else
   252                 else
   249                     {            
   253                     {            
   250                     TFLOGSTRING("CSAT: CSatNotifyDisplayText::CompleteNotifyL,\
   254                     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_COMPLETENOTIFYL_3, "CSAT: CSatNotifyDisplayText::CompleteNotifyL, Text string empty");
   251                         Text string empty");  
       
   252 					CreateTerminalRespL( pCmdNumber, 
   255 					CreateTerminalRespL( pCmdNumber, 
   253 					    RSat::KCmdDataNotUnderstood, KNullDesC16 );
   256 					    RSat::KCmdDataNotUnderstood, KNullDesC16 );
   254 					// Indicate Client that response was corrupted
   257 					// Indicate Client that response was corrupted
   255                     ret = KErrCorrupt;
   258                     ret = KErrCorrupt;
   256                     }
   259                     }
   257                 }    
   260                 }    
   258 			else
   261 			else
   259                 {
   262                 {
   260                 TFLOGSTRING("CSAT: CSatNotifyDisplayText::CompleteNotifyL,\
   263                 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_COMPLETENOTIFYL_4, "CSAT: CSatNotifyDisplayText::CompleteNotifyL, Test string missing");
   261                     Test string missing");
       
   262 	            CreateTerminalRespL( 
   264 	            CreateTerminalRespL( 
   263 					pCmdNumber, RSat::KErrorRequiredValuesMissing,  
   265 					pCmdNumber, RSat::KErrorRequiredValuesMissing,  
   264 					KNullDesC16 );
   266 					KNullDesC16 );
   265 				// Indicate Client that response was corrupted
   267 				// Indicate Client that response was corrupted
   266                 ret = KErrCorrupt;
   268                 ret = KErrCorrupt;
   283         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
   285         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
   284 
   286 
   285         } // End of if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
   287         } // End of if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
   286     else 
   288     else 
   287         {
   289         {
   288         TFLOGSTRING("CSAT: CSatNotifyDisplayText::CompleteNotifyL,\
   290         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_COMPLETENOTIFYL_5, "CSAT: CSatNotifyDisplayText::CompleteNotifyL, Request not ongoing");
   289             Request not ongoing");
       
   290     	TBuf16<1> additionalInfo;
   291     	TBuf16<1> additionalInfo;
   291         // Request not on, returning response immediately
   292         // Request not on, returning response immediately
   292         additionalInfo.Append( RSat::KNoSpecificMeProblem );
   293         additionalInfo.Append( RSat::KNoSpecificMeProblem );
   293 		CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
   294 		CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, 
   294 		    additionalInfo );					
   295 		    additionalInfo );					
   304 TInt CSatNotifyDisplayText::TerminalResponseL
   305 TInt CSatNotifyDisplayText::TerminalResponseL
   305         ( 
   306         ( 
   306         TDes8* aRsp  
   307         TDes8* aRsp  
   307         )
   308         )
   308     {
   309     {
   309     TFLOGSTRING("CSAT: CSatNotifyDisplayText::TerminalResponseL");
   310     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_TERMINALRESPONSEL_1, "CSAT: CSatNotifyDisplayText::TerminalResponseL");
   310 
   311 
   311     TInt ret( KErrNone );
   312     TInt ret( KErrNone );
   312     TBuf16<1> additionalInfo;
   313     TBuf16<1> additionalInfo;
   313 
   314 
   314     RSat::TDisplayTextRspV1Pckg* aRspPckg = 
   315     RSat::TDisplayTextRspV1Pckg* aRspPckg = 
   326         && ( RSat::KNoResponseFromUser != rspV1.iGeneralResult )
   327         && ( RSat::KNoResponseFromUser != rspV1.iGeneralResult )
   327         && ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult )
   328         && ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult )
   328         && ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult )
   329         && ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult )
   329         )
   330         )
   330         {
   331         {
   331         TFLOGSTRING("CSAT: CSatNotifyDisplayText::TerminalResponseL,\
   332         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_TERMINALRESPONSEL_2, "CSAT: CSatNotifyDisplayText::TerminalResponseL, Invalid General Result");
   332             Invalid General Result");
       
   333         // Invalid general result
   333         // Invalid general result
   334         ret = KErrCorrupt;
   334         ret = KErrCorrupt;
   335         }
   335         }
   336 
   336 
   337     // If there is ME (Mobile Equipment) error, additional info is needed
   337     // If there is ME (Mobile Equipment) error, additional info is needed
   342             {
   342             {
   343             additionalInfo.Append( rspV1.iAdditionalInfo[0] );
   343             additionalInfo.Append( rspV1.iAdditionalInfo[0] );
   344 			}
   344 			}
   345         else
   345         else
   346             {
   346             {
   347             TFLOGSTRING("CSAT: CSatNotifyDisplayText::TerminalResponseL,\
   347             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_TERMINALRESPONSEL_3, "CSAT: CSatNotifyDisplayText::TerminalResponseL, Invalid Additional Info");
   348                 Invalid Additional Info");
       
   349             // Invalid additional info field
   348             // Invalid additional info field
   350             ret = KErrCorrupt;
   349             ret = KErrCorrupt;
   351             }
   350             }
   352         }
   351         }
   353 	
   352 	
   368         TUint8 aPCmdNumber,         
   367         TUint8 aPCmdNumber,         
   369         TUint8 aGeneralResult,      
   368         TUint8 aGeneralResult,      
   370         const TDesC16& aAdditionalInfo
   369         const TDesC16& aAdditionalInfo
   371 		)
   370 		)
   372     {
   371     {
   373     TFLOGSTRING("CSAT: CSatNotifyDisplayText::CreateTerminalRespL");
   372     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYDISPLAYTEXT_CREATETERMINALRESPL_1, "CSAT: CSatNotifyDisplayText::CreateTerminalRespL");
   374     TTlv tlvSpecificData;
   373     TTlv tlvSpecificData;
   375     // Create General Result TLV here
   374     // Create General Result TLV here
   376     tlvSpecificData.AddTag( KTlvResultTag );
   375     tlvSpecificData.AddTag( KTlvResultTag );
   377     // General result
   376     // General result
   378     tlvSpecificData.AddByte( aGeneralResult );
   377     tlvSpecificData.AddByte( aGeneralResult );