telephonyserverplugins/simatktsy/src/CSatNotifyCloseChannel.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
equal deleted inserted replaced
19:630d2f34d719 20: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 "CSatNotifyCloseChannelTraces.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 "CSatNotifyCloseChannel.h" // Class header
    25 #include "CSatNotifyCloseChannel.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 // -----------------------------------------------------------------------------
    45 CSatNotifyCloseChannel* CSatNotifyCloseChannel::NewL
    40 CSatNotifyCloseChannel* CSatNotifyCloseChannel::NewL
    46         ( 
    41         ( 
    47         CSatNotificationsTsy* aNotificationsTsy 
    42         CSatNotificationsTsy* aNotificationsTsy 
    48         )
    43         )
    49     {
    44     {
    50     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_NEWL_1, "CSAT: CSatNotifyCloseChannel::NewL");
    45     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::NewL");
    51    	CSatNotifyCloseChannel* const satNotifyCloseChannel = 
    46    	CSatNotifyCloseChannel* const satNotifyCloseChannel = 
    52         new ( ELeave ) CSatNotifyCloseChannel( aNotificationsTsy );
    47         new ( ELeave ) CSatNotifyCloseChannel( aNotificationsTsy );
    53     CleanupStack::PushL( satNotifyCloseChannel );
    48     CleanupStack::PushL( satNotifyCloseChannel );
    54     satNotifyCloseChannel->ConstructL();
    49     satNotifyCloseChannel->ConstructL();
    55     CleanupStack::Pop( satNotifyCloseChannel );
    50     CleanupStack::Pop( satNotifyCloseChannel );
    56     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_NEWL_2, "CSAT: CSatNotifyCloseChannel::NewL, end of method");
    51     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::NewL, end of method");
    57     return satNotifyCloseChannel;
    52     return satNotifyCloseChannel;
    58     }
    53     }
    59 
    54 
    60 // -----------------------------------------------------------------------------
    55 // -----------------------------------------------------------------------------
    61 // CSatNotifyCloseChannel::~CSatNotifyCloseChannel
    56 // CSatNotifyCloseChannel::~CSatNotifyCloseChannel
    65 CSatNotifyCloseChannel::~CSatNotifyCloseChannel
    60 CSatNotifyCloseChannel::~CSatNotifyCloseChannel
    66         ( 
    61         ( 
    67 		// None
    62 		// None
    68         )
    63         )
    69     {
    64     {
    70     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_DTOR_1, "CSAT: CSatNotifyCloseChannel::~CSatNotifyCloseChannel");
    65     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::~CSatNotifyCloseChannel");
    71     }
    66     }
    72     
    67     
    73 // -----------------------------------------------------------------------------
    68 // -----------------------------------------------------------------------------
    74 // CSatNotifyCloseChannel::CSatNotifyCloseChannel
    69 // CSatNotifyCloseChannel::CSatNotifyCloseChannel
    75 // Default C++ constructor
    70 // Default C++ constructor
    91 void CSatNotifyCloseChannel::ConstructL
    86 void CSatNotifyCloseChannel::ConstructL
    92         (
    87         (
    93         // None
    88         // None
    94         )
    89         )
    95     {
    90     {
    96     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_CONSTRUCTL_1, "CSAT: CSatNotifyCloseChannel::~CSatNotifyCloseChannel, does nothing");
    91     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::~CSatNotifyCloseChannel, \
       
    92     	does nothing");
    97     }
    93     }
    98 
    94 
    99 // -----------------------------------------------------------------------------
    95 // -----------------------------------------------------------------------------
   100 // CSatNotifyCloseChannel::Notify
    96 // CSatNotifyCloseChannel::Notify
   101 // This request allows a client to be notified of a CLOSE CHANNEL proactive 
    97 // This request allows a client to be notified of a CLOSE CHANNEL proactive 
   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, CSATNOTIFYCLOSECHANNEL_NOTIFY_1, "CSAT: CSatNotifyCloseChannel::Notify");
   107     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::Notify");
   112 
   108 
   113     // Save data pointer to client side for completion
   109     // Save data pointer to client side for completion
   114     iCloseChannelRspV2Pckg = reinterpret_cast<RSat::TCloseChannelV2Pckg*>( 
   110     iCloseChannelRspV2Pckg = reinterpret_cast<RSat::TCloseChannelV2Pckg*>( 
   115         aPackage.Des1n() );     
   111         aPackage.Des1n() );     
   116     // Save the request handle
   112     // Save the request handle
   131 TInt CSatNotifyCloseChannel::CancelNotification
   127 TInt CSatNotifyCloseChannel::CancelNotification
   132         (
   128         (
   133         const TTsyReqHandle aTsyReqHandle 
   129         const TTsyReqHandle aTsyReqHandle 
   134         )
   130         )
   135     {
   131     {
   136     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_CANCELNOTIFICATION_1, "CSAT: CSatNotifyCloseChannel::CancelNotification");
   132     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CancelNotification");
   137     // Reset the request handle
   133     // Reset the request handle
   138     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   134     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   139         ResetTsyReqHandle( CSatTsy::ESatNotifyCloseChannelPCmdReqType );
   135         ResetTsyReqHandle( CSatTsy::ESatNotifyCloseChannelPCmdReqType );
   140 	// Reset the data pointers
   136 	// Reset the data pointers
   141 	iCloseChannelRspV2Pckg = NULL;	
   137 	iCloseChannelRspV2Pckg = NULL;	
   154         (
   150         (
   155         CSatDataPackage* aDataPackage,  
   151         CSatDataPackage* aDataPackage,  
   156         TInt aErrorCode                  
   152         TInt aErrorCode                  
   157         )
   153         )
   158     {
   154     {
   159     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_1, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL");
   155     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL");
   160     TInt ret( KErrNone );
   156     TInt ret( KErrNone );
   161     // Unpack parameters
   157     // Unpack parameters
   162     TPtrC8* data;
   158     TPtrC8* data;
   163     aDataPackage->UnPackData( &data );
   159     aDataPackage->UnPackData( &data );
   164     // Reset req handle. Returns the deleted req handle
   160     // Reset req handle. Returns the deleted req handle
   204 		        returnValue = berTlv.TlvByTagValue( &alphaIdentifier, 
   200 		        returnValue = berTlv.TlvByTagValue( &alphaIdentifier, 
   205 		            KTlvAlphaIdentifierTag ) ;
   201 		            KTlvAlphaIdentifierTag ) ;
   206 	            closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;            
   202 	            closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;            
   207 		        if ( KErrNotFound != returnValue )
   203 		        if ( KErrNotFound != returnValue )
   208 		            {
   204 		            {
   209 		            OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_2, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Alpha ID present");
   205 		            TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL\
       
   206 		            	Alpha ID present");
   210 		            TUint16 alphaIdLength = alphaIdentifier.GetLength();
   207 		            TUint16 alphaIdLength = alphaIdentifier.GetLength();
   211 		            if ( alphaIdLength )
   208 		            if ( alphaIdLength )
   212 		                {
   209 		                {
   213 		                // Get the alpha id
   210 		                // Get the alpha id
   214 		                TPtrC8 sourceString;
   211 		                TPtrC8 sourceString;
   224 		                {
   221 		                {
   225 		                closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdProvided;
   222 		                closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdProvided;
   226 		                }
   223 		                }
   227 		            else
   224 		            else
   228 		                {
   225 		                {
   229 		                OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_3, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Alpha ID is NULL");
   226 		                TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL\
       
   227 		                	Alpha ID is NULL");
   230 		                closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNull;
   228 		                closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNull;
   231 		                }
   229 		                }
   232 		            }
   230 		            }
   233 	
   231 	
   234 		        // Icon Id (Optional)
   232 		        // Icon Id (Optional)
   236 		            closeChannelV2.iIconId );
   234 		            closeChannelV2.iIconId );
   237             	} // if ( KErrNone == returnValue )
   235             	} // if ( KErrNone == returnValue )
   238         	else
   236         	else
   239         		{
   237         		{
   240             	// Required values missing
   238             	// Required values missing
   241             	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_4, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL, required values missing (Device Identities)");
   239             	TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL,\
       
   240             	    required values missing (Device Identities)");
   242             	ret = KErrCorrupt;
   241             	ret = KErrCorrupt;
   243 	            CreateTerminalRespL( pCmdNumber, RSat::KErrorRequiredValuesMissing, KNullDesC16 );
   242 	            CreateTerminalRespL( pCmdNumber, RSat::KErrorRequiredValuesMissing, KNullDesC16 );
   244         		}
   243         		}
   245 	        }  // if ( KErrNone == aErrorCode )
   244 	        }  // if ( KErrNone == aErrorCode )
   246         else
   245         else
   250         // Complete request
   249         // Complete request
   251         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
   250         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
   252         }
   251         }
   253 	else
   252 	else
   254 		{
   253 		{
   255 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_5, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Request not ongoing");
   254 		TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL\
       
   255 			Request not ongoing");
   256 		// Request not on, returning response immediately
   256 		// Request not on, returning response immediately
   257 		TBuf16<1> additionalInfo;	
   257 		TBuf16<1> additionalInfo;	
   258         additionalInfo.Append ( RSat::KNoSpecificMeProblem );
   258         additionalInfo.Append ( RSat::KNoSpecificMeProblem );
   259         CreateTerminalRespL( pCmdNumber,RSat::KMeUnableToProcessCmd, 
   259         CreateTerminalRespL( pCmdNumber,RSat::KMeUnableToProcessCmd, 
   260         					additionalInfo );
   260         					additionalInfo );
   271 TInt CSatNotifyCloseChannel::TerminalResponseL
   271 TInt CSatNotifyCloseChannel::TerminalResponseL
   272         ( 
   272         ( 
   273         TDes8* aRsp 
   273         TDes8* aRsp 
   274         )
   274         )
   275     {
   275     {
   276     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_1, "CSAT: CSatNotifyCloseChannel::TerminalResponseL");
   276     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL");
   277     TInt   ret( KErrNone );
   277     TInt   ret( KErrNone );
   278     
   278     
   279     TBuf16<1> additionalInfo;
   279     TBuf16<1> additionalInfo;
   280     RSat::TCloseChannelRspV2Pckg* aRspPckg = 
   280     RSat::TCloseChannelRspV2Pckg* aRspPckg = 
   281             reinterpret_cast<RSat::TCloseChannelRspV2Pckg*>( aRsp );
   281             reinterpret_cast<RSat::TCloseChannelRspV2Pckg*>( aRsp );
   296         && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult )
   296         && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult )
   297         && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult )
   297         && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult )
   298         && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) 
   298         && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) 
   299         && ( RSat::KFramesError != rspV2.iGeneralResult ))
   299         && ( RSat::KFramesError != rspV2.iGeneralResult ))
   300         {
   300         {
   301         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_2, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid General Result");
   301         TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL\
       
   302         	Invalid General Result");
   302         // Invalid general result
   303         // Invalid general result
   303         ret = KErrCorrupt;
   304         ret = KErrCorrupt;
   304         }
   305         }
   305 
   306 
   306     if ( RSat::KMeProblem == rspV2.iInfoType )
   307     if ( RSat::KMeProblem == rspV2.iInfoType )
   309         	{
   310         	{
   310         	additionalInfo.Append( rspV2.iAdditionalInfo[0] );
   311         	additionalInfo.Append( rspV2.iAdditionalInfo[0] );
   311         	}
   312         	}
   312     	else
   313     	else
   313         	{
   314         	{
   314         	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_3, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid Additional Info");
   315         	TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL\
       
   316         		Invalid Additional Info");
   315         	ret = KErrCorrupt;
   317         	ret = KErrCorrupt;
   316         	}
   318         	}
   317         }
   319         }
   318     else if (RSat::KNoAdditionalInfo == rspV2.iInfoType )
   320     else if (RSat::KNoAdditionalInfo == rspV2.iInfoType )
   319     	{
   321     	{
   320     	// do nothing
   322     	// do nothing
   321     	}
   323     	}
   322     else
   324     else
   323     	{
   325     	{
   324     	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_4, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid Additional Info type");
   326     	TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL\
       
   327     		Invalid Additional Info type");
   325     	ret = KErrCorrupt;
   328     	ret = KErrCorrupt;
   326     	}
   329     	}
   327             
   330             
   328     TInt response = CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( 
   331     TInt response = CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( 
   329     	rspV2.iGeneralResult ),	additionalInfo );
   332     	rspV2.iGeneralResult ),	additionalInfo );
   345         TUint8 aPCmdNumber,         
   348         TUint8 aPCmdNumber,         
   346         TUint8 aGeneralResult,     
   349         TUint8 aGeneralResult,     
   347         const TDesC16& aAdditionalInfo	
   350         const TDesC16& aAdditionalInfo	
   348 		)
   351 		)
   349     {
   352     {
   350     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_CREATETERMINALRESPL_1, "CSAT: CSatNotifyCloseChannel::CreateTerminalRespL");
   353     TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CreateTerminalRespL");
   351     TTlv tlvSpecificData;
   354     TTlv tlvSpecificData;
   352     // Append general result tag
   355     // Append general result tag
   353     tlvSpecificData.AddTag( KTlvResultTag );
   356     tlvSpecificData.AddTag( KTlvResultTag );
   354     // Append general result
   357     // Append general result
   355     tlvSpecificData.AddByte( aGeneralResult );
   358     tlvSpecificData.AddByte( aGeneralResult );
   362         || ( RSat::KFramesError == aGeneralResult ))
   365         || ( RSat::KFramesError == aGeneralResult ))
   363         {
   366         {
   364         // Unsuccessful result requires an additional info byte
   367         // Unsuccessful result requires an additional info byte
   365         for ( TInt i = 0; i < aAdditionalInfo.Length(); i++ )
   368         for ( TInt i = 0; i < aAdditionalInfo.Length(); i++ )
   366         	{
   369         	{
   367         	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_CREATETERMINALRESPL_2, "CSAT: CSatNotifyCloseChannel::CreateTerminalRespL, Unsuccessful result");
   370         	TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CreateTerminalRespL,\
       
   371         	    Unsuccessful result");
   368         	tlvSpecificData.AddByte( static_cast<TUint8>( 
   372         	tlvSpecificData.AddByte( static_cast<TUint8>( 
   369         	    aAdditionalInfo[i] ) );
   373         	    aAdditionalInfo[i] ) );
   370         	}
   374         	}
   371         }
   375         }
   372     
   376