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