telephonyserverplugins/simatktsy/src/CSatNotifySetUpIdleModeText.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 "CSatNotifySetUpIdleModeTextTraces.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 "CSatNotifySetUpIdleModeText.h"// Tsy class header
    25 #include "CSatNotifySetUpIdleModeText.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 CSatNotifySetUpIdleModeText* CSatNotifySetUpIdleModeText::NewL
    40 CSatNotifySetUpIdleModeText* CSatNotifySetUpIdleModeText::NewL
    46         ( 
    41         ( 
    47         CSatNotificationsTsy* aNotificationsTsy 
    42         CSatNotificationsTsy* aNotificationsTsy 
    48         )
    43         )
    49     {
    44     {
    50     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_NEWL_1, "CSAT: CSatNotifySetUpIdleModeText::NewL");
    45     TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::NewL");
    51    	CSatNotifySetUpIdleModeText* const satNotifySetUpIdleModeText = 
    46    	CSatNotifySetUpIdleModeText* const satNotifySetUpIdleModeText = 
    52         new ( ELeave ) CSatNotifySetUpIdleModeText( aNotificationsTsy );
    47         new ( ELeave ) CSatNotifySetUpIdleModeText( aNotificationsTsy );
    53     CleanupStack::PushL( satNotifySetUpIdleModeText );
    48     CleanupStack::PushL( satNotifySetUpIdleModeText );
    54     satNotifySetUpIdleModeText->ConstructL();
    49     satNotifySetUpIdleModeText->ConstructL();
    55     CleanupStack::Pop( satNotifySetUpIdleModeText );
    50     CleanupStack::Pop( satNotifySetUpIdleModeText );
    56     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_NEWL_2, "CSAT: CSatNotifySetUpIdleModeText::NewL, end of method");
    51     TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::NewL, end of method");
    57     return satNotifySetUpIdleModeText;
    52     return satNotifySetUpIdleModeText;
    58     }
    53     }
    59 
    54 
    60 // -----------------------------------------------------------------------------
    55 // -----------------------------------------------------------------------------
    61 // CSatNotifySetUpIdleModeText::~CSatNotifySetUpIdleModeText
    56 // CSatNotifySetUpIdleModeText::~CSatNotifySetUpIdleModeText
    65 CSatNotifySetUpIdleModeText::~CSatNotifySetUpIdleModeText
    60 CSatNotifySetUpIdleModeText::~CSatNotifySetUpIdleModeText
    66         ( 
    61         ( 
    67 		// None
    62 		// None
    68         )
    63         )
    69     {
    64     {
    70     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_DTOR_1, "CSAT: CSatNotifySetUpIdleModeText::~CSatNotifySetUpIdleModeText");
    65     TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::\
       
    66         ~CSatNotifySetUpIdleModeText");
    71     }
    67     }
    72     
    68     
    73 // -----------------------------------------------------------------------------
    69 // -----------------------------------------------------------------------------
    74 // CSatNotifySetUpIdleModeText::CSatNotifySetUpIdleModeText
    70 // CSatNotifySetUpIdleModeText::CSatNotifySetUpIdleModeText
    75 // Default C++ constructor
    71 // Default C++ constructor
    91 void CSatNotifySetUpIdleModeText::ConstructL
    87 void CSatNotifySetUpIdleModeText::ConstructL
    92         (
    88         (
    93         // None
    89         // None
    94         )
    90         )
    95     {
    91     {
    96     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_CONSTRUCTL_1, "CSAT: CSatNotifySetUpIdleModeText::ConstructL");
    92     TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::ConstructL");
    97     }
    93     }
    98 
    94 
    99 // -----------------------------------------------------------------------------
    95 // -----------------------------------------------------------------------------
   100 // CSatNotifySetUpIdleModeText::Notify
    96 // CSatNotifySetUpIdleModeText::Notify
   101 // This request allows a client to be notified of a Set Up Idle Mode Text 
    97 // This request allows a client to be notified of a Set Up Idle Mode Text 
   106         (
   102         (
   107         const TTsyReqHandle aTsyReqHandle,
   103         const TTsyReqHandle aTsyReqHandle,
   108         const TDataPackage& aPackage    
   104         const TDataPackage& aPackage    
   109         )
   105         )
   110     {
   106     {
   111     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_NOTIFY_1, "CSAT: CSatNotifySetUpIdleModeText::Notify");
   107     TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::Notify");
   112     // Save data pointer to client side for completion
   108     // Save data pointer to client side for completion
   113     iSetUpIdleModeTextV1Pckg = reinterpret_cast<RSat::
   109     iSetUpIdleModeTextV1Pckg = reinterpret_cast<RSat::
   114     	TSetUpIdleModeTextV1Pckg*>( aPackage.Des1n() );
   110     	TSetUpIdleModeTextV1Pckg*>( aPackage.Des1n() );
   115     // Save the request handle
   111     // Save the request handle
   116     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   112     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   131 TInt CSatNotifySetUpIdleModeText::CancelNotification
   127 TInt CSatNotifySetUpIdleModeText::CancelNotification
   132         (
   128         (
   133         const TTsyReqHandle aTsyReqHandle
   129         const TTsyReqHandle aTsyReqHandle
   134         )
   130         )
   135     {
   131     {
   136     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_CANCELNOTIFICATION_1, "CSAT: CSatNotifySetUpIdleModeText::CancelNotification");
   132     TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::CancelNotification");
   137     
   133     
   138     // Reset the request handle
   134     // Reset the request handle
   139     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   135     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   140         ResetTsyReqHandle( CSatTsy::ESatNotifySetUpIdleModeTextPCmdReqType );
   136         ResetTsyReqHandle( CSatTsy::ESatNotifySetUpIdleModeTextPCmdReqType );
   141 	// Reset the data pointer
   137 	// Reset the data pointer
   156         (
   152         (
   157         CSatDataPackage* aDataPackage,  
   153         CSatDataPackage* aDataPackage,  
   158         TInt aErrorCode                  
   154         TInt aErrorCode                  
   159         )
   155         )
   160     {   
   156     {   
   161 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_COMPLETENOTIFYL_1, "CSAT: CSatNotifySetUpIdleModeText::CompleteNotifyL");
   157 	TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::CompleteNotifyL");
   162     TInt ret( KErrNone );
   158     TInt ret( KErrNone );
   163 	TInt returnValue( KErrNone );
   159 	TInt returnValue( KErrNone );
   164 	TBuf<1> additionalInfo;	
   160 	TBuf<1> additionalInfo;	
   165     // Unpack parameters
   161     // Unpack parameters
   166     TPtrC8* data;
   162     TPtrC8* data;
   226 			
   222 			
   227 			if( (KErrNone != returnValue) ||
   223 			if( (KErrNone != returnValue) ||
   228 				( ( RSat::ERemoveExistingIdleModeText == setUpIdleModeTextV1.iType) && 
   224 				( ( RSat::ERemoveExistingIdleModeText == setUpIdleModeTextV1.iType) && 
   229 				  ( RSat::ENotSelfExplanatory==setUpIdleModeTextV1.iIconId.iQualifier)) )
   225 				  ( RSat::ENotSelfExplanatory==setUpIdleModeTextV1.iIconId.iQualifier)) )
   230 				{
   226 				{
   231 				OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_COMPLETENOTIFYL_2, "CSAT: CSatNotifySetUpIdleModeText::CompleteNotifyL, Invalid Data");
   227 				TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::\
       
   228 								    CompleteNotifyL, Invalid Data");
   232 				additionalInfo.Zero();
   229 				additionalInfo.Zero();
   233                 additionalInfo.Append( KNoCause );
   230                 additionalInfo.Append( KNoCause );
   234 				CreateTerminalRespL( pCmdNumber, RSat::KCmdDataNotUnderstood, 
   231 				CreateTerminalRespL( pCmdNumber, RSat::KCmdDataNotUnderstood, 
   235 					additionalInfo );                         				
   232 					additionalInfo );                         				
   236 				ret = KErrCorrupt;
   233 				ret = KErrCorrupt;
   245 
   242 
   246         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
   243         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
   247         } // End of if ( reqHandle != CSatTsy::ESatReqHandleUnknown )
   244         } // End of if ( reqHandle != CSatTsy::ESatReqHandleUnknown )
   248     else 
   245     else 
   249         {
   246         {
   250         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_COMPLETENOTIFYL_3, "CSAT: CSatNotifySetUpIdleModeText::CompleteNotifyL, Request not ongoing");
   247         TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::CompleteNotifyL,\
       
   248             Request not ongoing");
   251         // Request not on, returning response immediately
   249         // Request not on, returning response immediately
   252 		additionalInfo.Zero();
   250 		additionalInfo.Zero();
   253         additionalInfo.Append( KNoCause );
   251         additionalInfo.Append( KNoCause );
   254 		CreateTerminalRespL(
   252 		CreateTerminalRespL(
   255 			pCmdNumber, RSat::KMeUnableToProcessCmd,       
   253 			pCmdNumber, RSat::KMeUnableToProcessCmd,       
   268 TInt CSatNotifySetUpIdleModeText::TerminalResponseL
   266 TInt CSatNotifySetUpIdleModeText::TerminalResponseL
   269         ( 
   267         ( 
   270         TDes8* aRsp 
   268         TDes8* aRsp 
   271         )
   269         )
   272     {
   270     {
   273     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_TERMINALRESPONSEL_1, "CSAT: CSatNotifySetUpIdleModeText::TerminalResponseL");
   271     TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::TerminalResponseL");
   274 
   272 
   275 	TInt   ret( KErrNone );
   273 	TInt   ret( KErrNone );
   276     TBuf<1> additionalInfo;
   274     TBuf<1> additionalInfo;
   277     additionalInfo.Zero();
   275     additionalInfo.Zero();
   278     RSat::TSetUpIdleModeTextRspV1Pckg* aRspPckg = 
   276     RSat::TSetUpIdleModeTextRspV1Pckg* aRspPckg = 
   289          ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult ) && 
   287          ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult ) && 
   290          ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult ) && 
   288          ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult ) && 
   291          ( RSat::KCmdDataNotUnderstood != rspV1.iGeneralResult ) &&
   289          ( RSat::KCmdDataNotUnderstood != rspV1.iGeneralResult ) &&
   292          ( RSat::KSuccessRequestedIconNotDisplayed != rspV1.iGeneralResult ) )
   290          ( RSat::KSuccessRequestedIconNotDisplayed != rspV1.iGeneralResult ) )
   293         {
   291         {
   294         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_TERMINALRESPONSEL_2, "CSAT: CSatNotifySetUpIdleModeText::TerminalResponseL, Invalid General Result");
   292         TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::TerminalResponseL,\
       
   293             Invalid General Result");
   295         // Invalid general result
   294         // Invalid general result
   296         ret = KErrCorrupt;
   295         ret = KErrCorrupt;
   297         }
   296         }
   298 
   297 
   299     // If there is Me (Mobile Equipment) error, additional info is needed
   298     // If there is Me (Mobile Equipment) error, additional info is needed
   304             {
   303             {
   305             additionalInfo.Append( ( TUint8 ) rspV1.iAdditionalInfo[0] );
   304             additionalInfo.Append( ( TUint8 ) rspV1.iAdditionalInfo[0] );
   306 			}
   305 			}
   307         else
   306         else
   308             {
   307             {
   309             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_TERMINALRESPONSEL_3, "CSAT: CSatNotifySetUpIdleModeText::TerminalResponseL, Invalid Additional Info");
   308             TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::TerminalResponseL,\
       
   309                 Invalid Additional Info");
   310             // Invalid additional info field
   310             // Invalid additional info field
   311             ret = KErrCorrupt;
   311             ret = KErrCorrupt;
   312             }
   312             }
   313         }
   313         }
   314         
   314         
   329         TUint8 aPCmdNumber,       
   329         TUint8 aPCmdNumber,       
   330         TUint8 aGeneralResult,      
   330         TUint8 aGeneralResult,      
   331         TDesC16& aAdditionalInfo			
   331         TDesC16& aAdditionalInfo			
   332 		)
   332 		)
   333     {
   333     {
   334 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSETUPIDLEMODETEXT_CREATETERMINALRESPL_1, "CSAT: CSatNotifySetUpIdleModeText::CreateTerminalRespL");
   334 	TFLOGSTRING("CSAT: CSatNotifySetUpIdleModeText::CreateTerminalRespL");
   335 	TTlv tlvSpecificData;
   335 	TTlv tlvSpecificData;
   336     // Create General Result TLV here
   336     // Create General Result TLV here
   337     tlvSpecificData.AddTag( KTlvResultTag );
   337     tlvSpecificData.AddTag( KTlvResultTag );
   338     // General result
   338     // General result
   339     tlvSpecificData.AddByte( aGeneralResult );
   339     tlvSpecificData.AddByte( aGeneralResult );