telephonyserverplugins/simatktsy/src/CSatNotifyGetChannelStatus.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 "CSatNotifyGetChannelStatusTraces.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 "CSatNotifyGetChannelStatus.h"  // Class header
    31 #include "CSatNotifyGetChannelStatus.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 // -----------------------------------------------------------------------------
    40 CSatNotifyGetChannelStatus* CSatNotifyGetChannelStatus::NewL
    45 CSatNotifyGetChannelStatus* CSatNotifyGetChannelStatus::NewL
    41         ( 
    46         ( 
    42         CSatNotificationsTsy* aNotificationsTsy 
    47         CSatNotificationsTsy* aNotificationsTsy 
    43         )
    48         )
    44     {
    49     {
    45     TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::NewL");
    50     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_NEWL_1, "CSAT: CSatNotifyGetChannelStatus::NewL");
    46    	CSatNotifyGetChannelStatus* const satNotifyGetChannelStatus = 
    51    	CSatNotifyGetChannelStatus* const satNotifyGetChannelStatus = 
    47         new ( ELeave ) CSatNotifyGetChannelStatus( aNotificationsTsy );
    52         new ( ELeave ) CSatNotifyGetChannelStatus( aNotificationsTsy );
    48     CleanupStack::PushL( satNotifyGetChannelStatus );
    53     CleanupStack::PushL( satNotifyGetChannelStatus );
    49     satNotifyGetChannelStatus->ConstructL();
    54     satNotifyGetChannelStatus->ConstructL();
    50     CleanupStack::Pop( satNotifyGetChannelStatus );
    55     CleanupStack::Pop( satNotifyGetChannelStatus );
    51     TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::NewL, end of method");
    56     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_NEWL_2, "CSAT: CSatNotifyGetChannelStatus::NewL, end of method");
    52     return satNotifyGetChannelStatus;
    57     return satNotifyGetChannelStatus;
    53     }
    58     }
    54 
    59 
    55 // -----------------------------------------------------------------------------
    60 // -----------------------------------------------------------------------------
    56 // CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus
    61 // CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus
    60 CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus
    65 CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus
    61         ( 
    66         ( 
    62 		// None
    67 		// None
    63         )
    68         )
    64     {
    69     {
    65     TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus"
    70     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_DTOR_1, "CSAT: CSatNotifyGetChannelStatus::~CSatNotifyGetChannelStatus");
    66         );
       
    67     }
    71     }
    68     
    72     
    69 // -----------------------------------------------------------------------------
    73 // -----------------------------------------------------------------------------
    70 // CSatNotifyGetChannelStatus::CSatNotifyGetChannelStatus
    74 // CSatNotifyGetChannelStatus::CSatNotifyGetChannelStatus
    71 // Default C++ constructor
    75 // Default C++ constructor
    87 void CSatNotifyGetChannelStatus::ConstructL
    91 void CSatNotifyGetChannelStatus::ConstructL
    88         (
    92         (
    89         // None
    93         // None
    90         )
    94         )
    91     {
    95     {
    92     TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::ConstructL, does nothing");
    96     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_CONSTRUCTL_1, "CSAT: CSatNotifyGetChannelStatus::ConstructL, does nothing");
    93     }
    97     }
    94 
    98 
    95 // -----------------------------------------------------------------------------
    99 // -----------------------------------------------------------------------------
    96 // CSatNotifyGetChannelStatus::Notify
   100 // CSatNotifyGetChannelStatus::Notify
    97 // This request allows a client to be notified of a GET CHANNEL STATUS proactive 
   101 // This request allows a client to be notified of a GET CHANNEL STATUS proactive 
   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: CSatNotifyGetChannelStatus::Notify");
   111     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_NOTIFY_1, "CSAT: CSatNotifyGetChannelStatus::Notify");
   108     // Save data pointers to client side for completion
   112     // Save data pointers to client side for completion
   109     iGetChannelStatusRspV2Pckg = reinterpret_cast<RSat::TGetChannelStatusV2Pckg*>( 
   113     iGetChannelStatusRspV2Pckg = reinterpret_cast<RSat::TGetChannelStatusV2Pckg*>( 
   110         aPackage.Des1n() );         
   114         aPackage.Des1n() );         
   111     // Save the request handle
   115     // Save the request handle
   112     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   116     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   125 TInt CSatNotifyGetChannelStatus::CancelNotification
   129 TInt CSatNotifyGetChannelStatus::CancelNotification
   126         (
   130         (
   127         const TTsyReqHandle aTsyReqHandle
   131         const TTsyReqHandle aTsyReqHandle
   128         )
   132         )
   129     {
   133     {
   130     TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::CancelNotification");
   134     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_CANCELNOTIFICATION_1, "CSAT: CSatNotifyGetChannelStatus::CancelNotification");
   131     // Reset the request handle
   135     // Reset the request handle
   132     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   136     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   133         ResetTsyReqHandle( CSatTsy::ESatNotifyGetChannelStatusPCmdReqType );
   137         ResetTsyReqHandle( CSatTsy::ESatNotifyGetChannelStatusPCmdReqType );
   134 	// Reset the data pointers
   138 	// Reset the data pointers
   135 	iGetChannelStatusRspV2Pckg = NULL;	
   139 	iGetChannelStatusRspV2Pckg = NULL;	
   148         (
   152         (
   149         CSatDataPackage* aDataPackage,   
   153         CSatDataPackage* aDataPackage,   
   150         TInt aErrorCode                 
   154         TInt aErrorCode                 
   151         )
   155         )
   152     {
   156     {
   153     TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL");
   157     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_COMPLETENOTIFYL_1, "CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL");
   154 
   158 
   155     TInt ret( KErrNone );	
   159     TInt ret( KErrNone );	
   156     // Unpack parameters
   160     // Unpack parameters
   157     TPtrC8* data;
   161     TPtrC8* data;
   158     aDataPackage->UnPackData( &data );
   162     aDataPackage->UnPackData( &data );
   175     if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
   179     if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
   176         {
   180         {
   177         // Complete right away if error has occured, otherwise continue..
   181         // Complete right away if error has occured, otherwise continue..
   178         if ( KErrNone == aErrorCode )
   182         if ( KErrNone == aErrorCode )
   179             {
   183             {
   180             TFLOGSTRING2("CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL\
   184             OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_COMPLETENOTIFYL_2, "CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL aErrorCode: %d", aErrorCode );
   181                 aErrorCode: %d", aErrorCode );
       
   182 	        // Fill the Get Channel status structure             
   185 	        // Fill the Get Channel status structure             
   183 	        RSat::TGetChannelStatusV2& channelStatusV2 = 
   186 	        RSat::TGetChannelStatusV2& channelStatusV2 = 
   184 	            ( *iGetChannelStatusRspV2Pckg )();
   187 	            ( *iGetChannelStatusRspV2Pckg )();
   185 	        
   188 	        
   186 	        // Store transaction ID
   189 	        // Store transaction ID
   192         	}
   195         	}
   193 		iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );	
   196 		iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );	
   194 		}
   197 		}
   195 	else
   198 	else
   196 		{
   199 		{
   197 		TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL\
   200 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_COMPLETENOTIFYL_3, "CSAT: CSatNotifyGetChannelStatus::CompleteNotifyL Request not ongoing");
   198 		    Request not ongoing");
       
   199    		// Request not on, returning response immediately
   201    		// Request not on, returning response immediately
   200 		TBuf16<1> additionalInfo;
   202 		TBuf16<1> additionalInfo;
   201 		additionalInfo.Append( RSat::KNoSpecificMeProblem );
   203 		additionalInfo.Append( RSat::KNoSpecificMeProblem );
   202     	CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd,
   204     	CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd,
   203     	    additionalInfo );				
   205     	    additionalInfo );				
   215 TInt CSatNotifyGetChannelStatus::TerminalResponseL
   217 TInt CSatNotifyGetChannelStatus::TerminalResponseL
   216         ( 
   218         ( 
   217         TDes8* aRsp
   219         TDes8* aRsp
   218         )
   220         )
   219     {
   221     {
   220     TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::TerminalResponseL");
   222     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_TERMINALRESPONSEL_1, "CSAT: CSatNotifyGetChannelStatus::TerminalResponseL");
   221     TInt   ret( KErrNone );
   223     TInt   ret( KErrNone );
   222     
   224     
   223     TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo;
   225     TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo;
   224 
   226 
   225     RSat::TGetChannelStatusRspV2Pckg* aRspPckg = 
   227     RSat::TGetChannelStatusRspV2Pckg* aRspPckg = 
   239         && ( RSat::KCmdTypeNotUnderstood != rspV2.iGeneralResult )
   241         && ( RSat::KCmdTypeNotUnderstood != rspV2.iGeneralResult )
   240         && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult )
   242         && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult )
   241         && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult )
   243         && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult )
   242         && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) )
   244         && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) )
   243         {
   245         {
   244         TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::TerminalResponseL,\
   246         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_TERMINALRESPONSEL_2, "CSAT: CSatNotifyGetChannelStatus::TerminalResponseL, Invalid General Result");
   245             Invalid General Result");
       
   246         // Invalid general result
   247         // Invalid general result
   247         ret = KErrCorrupt;
   248         ret = KErrCorrupt;
   248         }
   249         }
   249 
   250 
   250     if ( ( RSat::KChannelStatusInfo == rspV2.iInfoType )
   251     if ( ( RSat::KChannelStatusInfo == rspV2.iInfoType )
   251         || ( RSat::KMeProblem == rspV2.iInfoType ) )
   252         || ( RSat::KMeProblem == rspV2.iInfoType ) )
   252         {
   253         {
   253         if ( !rspV2.iAdditionalInfo.Length() )
   254         if ( !rspV2.iAdditionalInfo.Length() )
   254         	{
   255         	{
   255         	TFLOGSTRING("CSAT: CSatNotifyGetChannelStatus::TerminalResponseL,\
   256         	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_TERMINALRESPONSEL_3, "CSAT: CSatNotifyGetChannelStatus::TerminalResponseL, Invalid Additional Info");
   256                 Invalid Additional Info");
       
   257 	        ret = KErrCorrupt;
   257 	        ret = KErrCorrupt;
   258 	        }
   258 	        }
   259 	    else
   259 	    else
   260         	{     	
   260         	{     	
   261         	additionalInfo.Copy(rspV2.iAdditionalInfo);
   261         	additionalInfo.Copy(rspV2.iAdditionalInfo);
   285         TUint8 aPCmdNumber,         
   285         TUint8 aPCmdNumber,         
   286         TUint8 aGeneralResult,      
   286         TUint8 aGeneralResult,      
   287         const TDesC16& aAdditionalInfo
   287         const TDesC16& aAdditionalInfo
   288 		)
   288 		)
   289     {
   289     {
   290     TFLOGSTRING("CSAT: CSatMessHandler::CreateTerminalRespL");
   290     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_CREATETERMINALRESPL_1, "CSAT: CSatMessHandler::CreateTerminalRespL");
   291     TTlv tlvSpecificData;
   291     TTlv tlvSpecificData;
   292     // Append general result tag
   292     // Append general result tag
   293     tlvSpecificData.AddTag( KTlvResultTag );
   293     tlvSpecificData.AddTag( KTlvResultTag );
   294     // Append general result
   294     // Append general result
   295     tlvSpecificData.AddByte( aGeneralResult );
   295     tlvSpecificData.AddByte( aGeneralResult );
   317             tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i] ) );
   317             tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i] ) );
   318             }                 
   318             }                 
   319         }
   319         }
   320    	else
   320    	else
   321    		{
   321    		{
   322     	TFLOGSTRING("CSAT: CSatMessHandler::CreateTerminalRespL - \
   322     	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYGETCHANNELSTATUS_CREATETERMINALRESPL_2, "CSAT: CSatMessHandler::CreateTerminalRespL - mandatory channel status missing");
   323     		 mandatory channel status missing");
       
   324    		}       
   323    		}       
   325 
   324 
   326     // Prepare data
   325     // Prepare data
   327     iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber;
   326     iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber;
   328     TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag();
   327     TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag();