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