telephonyserverplugins/simatktsy/src/CSatNotifyReceiveData.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 "CSatNotifyReceiveDataTraces.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 "CSatNotifyReceiveData.h" 	// Class header
    25 #include "CSatNotifyReceiveData.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 CSatNotifyReceiveData* CSatNotifyReceiveData::NewL
    40 CSatNotifyReceiveData* CSatNotifyReceiveData::NewL
    46         ( 
    41         ( 
    47         CSatNotificationsTsy* aNotificationsTsy 
    42         CSatNotificationsTsy* aNotificationsTsy 
    48         )
    43         )
    49     {
    44     {
    50     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_NEWL_1, "CSAT: CSatNotifyMoreTime::NewL");
    45     TFLOGSTRING("CSAT: CSatNotifyMoreTime::NewL");
    51    	CSatNotifyReceiveData* const satNotifyReceiveData = 
    46    	CSatNotifyReceiveData* const satNotifyReceiveData = 
    52         new ( ELeave ) CSatNotifyReceiveData( aNotificationsTsy );
    47         new ( ELeave ) CSatNotifyReceiveData( aNotificationsTsy );
    53     CleanupStack::PushL( satNotifyReceiveData );
    48     CleanupStack::PushL( satNotifyReceiveData );
    54     satNotifyReceiveData->ConstructL();
    49     satNotifyReceiveData->ConstructL();
    55     CleanupStack::Pop( satNotifyReceiveData );
    50     CleanupStack::Pop( satNotifyReceiveData );
    56     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_NEWL_2, "CSAT: CSatNotifyMoreTime::NewL, end of method");
    51     TFLOGSTRING("CSAT: CSatNotifyMoreTime::NewL, end of method");
    57     return satNotifyReceiveData;
    52     return satNotifyReceiveData;
    58     }
    53     }
    59 
    54 
    60 // -----------------------------------------------------------------------------
    55 // -----------------------------------------------------------------------------
    61 // CSatNotifyReceiveData::~CSatNotifyReceiveData
    56 // CSatNotifyReceiveData::~CSatNotifyReceiveData
    65 CSatNotifyReceiveData::~CSatNotifyReceiveData
    60 CSatNotifyReceiveData::~CSatNotifyReceiveData
    66         ( 
    61         ( 
    67 		// None
    62 		// None
    68         )
    63         )
    69     {
    64     {
    70     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_DTOR_1, "CSAT: CSatNotifyMoreTime::~CSatNotifyReceiveData");
    65     TFLOGSTRING("CSAT: CSatNotifyMoreTime::~CSatNotifyReceiveData");
    71     }
    66     }
    72     
    67     
    73 // -----------------------------------------------------------------------------
    68 // -----------------------------------------------------------------------------
    74 // CSatNotifyReceiveData::CSatNotifyReceiveData
    69 // CSatNotifyReceiveData::CSatNotifyReceiveData
    75 // Default C++ constructor
    70 // Default C++ constructor
    91 void CSatNotifyReceiveData::ConstructL
    86 void CSatNotifyReceiveData::ConstructL
    92         (
    87         (
    93         // None
    88         // None
    94         )
    89         )
    95     {
    90     {
    96     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_CONSTRUCTL_1, "CSAT: CSatNotifyMoreTime::ConstructL, does nothing");
    91     TFLOGSTRING("CSAT: CSatNotifyMoreTime::ConstructL, does nothing");
    97     }
    92     }
    98 
    93 
    99 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
   100 // CSatNotifyReceiveData::Notify
    95 // CSatNotifyReceiveData::Notify
   101 // This request allows a client to be notified of a RECEIVE DATA proactive 
    96 // This request allows a client to be notified of a RECEIVE DATA proactive 
   106         (
   101         (
   107         const TTsyReqHandle aTsyReqHandle,
   102         const TTsyReqHandle aTsyReqHandle,
   108         const TDataPackage& aPackage    
   103         const TDataPackage& aPackage    
   109         )
   104         )
   110     {
   105     {
   111     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_NOTIFY_1, "CSAT: CSatNotifyReceiveData::Notify");
   106     TFLOGSTRING("CSAT: CSatNotifyReceiveData::Notify");
   112     // Save data pointer to client side for completion
   107     // Save data pointer to client side for completion
   113     iReceiveDataRspV2Pckg = reinterpret_cast<RSat::TReceiveDataV2Pckg*>( 
   108     iReceiveDataRspV2Pckg = reinterpret_cast<RSat::TReceiveDataV2Pckg*>( 
   114         aPackage.Des1n() );     
   109         aPackage.Des1n() );     
   115     // Save the request handle
   110     // Save the request handle
   116     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   111     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
   129 TInt CSatNotifyReceiveData::CancelNotification
   124 TInt CSatNotifyReceiveData::CancelNotification
   130         (
   125         (
   131         const TTsyReqHandle aTsyReqHandle
   126         const TTsyReqHandle aTsyReqHandle
   132         )
   127         )
   133     {
   128     {
   134     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_CANCELNOTIFICATION_1, "CSAT: CSatNotifyReceiveData::CancelNotification");
   129     TFLOGSTRING("CSAT: CSatNotifyReceiveData::CancelNotification");
   135     // Reset the request handle
   130     // Reset the request handle
   136     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   131     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
   137         ResetTsyReqHandle( CSatTsy::ESatNotifyReceiveDataPCmdReqType );
   132         ResetTsyReqHandle( CSatTsy::ESatNotifyReceiveDataPCmdReqType );
   138 	// Reset the data pointers
   133 	// Reset the data pointers
   139 	iReceiveDataRspV2Pckg = NULL;	
   134 	iReceiveDataRspV2Pckg = NULL;	
   152         (
   147         (
   153         CSatDataPackage* aDataPackage,   
   148         CSatDataPackage* aDataPackage,   
   154         TInt aErrorCode                  
   149         TInt aErrorCode                  
   155         )
   150         )
   156     {
   151     {
   157     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_COMPLETENOTIFYL_1, "CSAT: CSatNotifyReceiveData::CompleteNotifyL");
   152     TFLOGSTRING("CSAT: CSatNotifyReceiveData::CompleteNotifyL");
   158     TInt ret( KErrNone );
   153     TInt ret( KErrNone );
   159 	TBuf<1> noAdditionalInfo( 0 );
   154 	TBuf<1> noAdditionalInfo( 0 );
   160     // Unpack parameters
   155     // Unpack parameters
   161     TPtrC8* data;
   156     TPtrC8* data;
   162     aDataPackage->UnPackData( &data );
   157     aDataPackage->UnPackData( &data );
   227 	                        receiveDataV2.iAlphaId.iAlphaId ); 
   222 	                        receiveDataV2.iAlphaId.iAlphaId ); 
   228 	                    receiveDataV2.iAlphaId.iStatus = RSat::EAlphaIdProvided;
   223 	                    receiveDataV2.iAlphaId.iStatus = RSat::EAlphaIdProvided;
   229 	                    }
   224 	                    }
   230 	                else
   225 	                else
   231 	                    {
   226 	                    {
   232 	                    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_COMPLETENOTIFYL_2, "CSAT: CSatNotifyReceiveData::CompleteNotifyL, Alpha ID is NULL");
   227 	                    TFLOGSTRING("CSAT: CSatNotifyReceiveData::\
       
   228 	                    	CompleteNotifyL, Alpha ID is NULL");
   233 	                    receiveDataV2.iAlphaId.iStatus = RSat::EAlphaIdNull;
   229 	                    receiveDataV2.iAlphaId.iStatus = RSat::EAlphaIdNull;
   234 	                    }
   230 	                    }
   235 	                }
   231 	                }
   236 
   232 
   237 	            // Icon Id (Optional)
   233 	            // Icon Id (Optional)
   239 	                receiveDataV2.iIconId );
   235 	                receiveDataV2.iIconId );
   240 
   236 
   241 	            }
   237 	            }
   242 	        else
   238 	        else
   243 	            {
   239 	            {
   244 	            OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_COMPLETENOTIFYL_3, "CSAT: CSatNotifyReceiveData::CompleteNotifyL, Required values missing");
   240 	            TFLOGSTRING("CSAT: CSatNotifyReceiveData::CompleteNotifyL, \
       
   241 	            	Required values missing");
   245 	            // Required values missing
   242 	            // Required values missing
   246 	            TUint8 channelDataLength( 0 );
   243 	            TUint8 channelDataLength( 0 );
   247 	            CreateTerminalRespL( 
   244 	            CreateTerminalRespL( 
   248 	                 pCmdNumber, RSat::KErrorRequiredValuesMissing,
   245 	                 pCmdNumber, RSat::KErrorRequiredValuesMissing,
   249 	                 KNullDesC16, channelDataLength );
   246 	                 KNullDesC16, channelDataLength );
   258 		// Complete request
   255 		// Complete request
   259 	    iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );        
   256 	    iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );        
   260         }
   257         }
   261 	else
   258 	else
   262 		{
   259 		{
   263 		OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_COMPLETENOTIFYL_4, "CSAT: CSatNotifyReceiveData::CompleteNotifyL, Request not ongoing");
   260 		TFLOGSTRING("CSAT: CSatNotifyReceiveData::CompleteNotifyL, \
       
   261 			Request not ongoing");
   264 		// Request not on, returning response immediately
   262 		// Request not on, returning response immediately
   265     	TUint8 channelDataLength( 0 );
   263     	TUint8 channelDataLength( 0 );
   266 		TBuf16<1> additionalInfo;
   264 		TBuf16<1> additionalInfo;
   267         additionalInfo.Append ( RSat::KNoSpecificMeProblem );
   265         additionalInfo.Append ( RSat::KNoSpecificMeProblem );
   268     	CreateTerminalRespL( 
   266     	CreateTerminalRespL( 
   282 TInt CSatNotifyReceiveData::TerminalResponseL
   280 TInt CSatNotifyReceiveData::TerminalResponseL
   283         ( 
   281         ( 
   284         TDes8* aRsp
   282         TDes8* aRsp
   285         )
   283         )
   286     {
   284     {
   287     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_TERMINALRESPONSEL_1, "CSAT: CSatNotifyReceiveData::TerminalResponseL");
   285     TFLOGSTRING("CSAT: CSatNotifyReceiveData::TerminalResponseL");
   288 
   286 
   289     TInt ret( KErrNone );
   287     TInt ret( KErrNone );
   290     
   288     
   291     TBuf<RSat::KAdditionalInfoMaxSize> additionalInfo;
   289     TBuf<RSat::KAdditionalInfoMaxSize> additionalInfo;
   292     additionalInfo.Zero();
   290     additionalInfo.Zero();
   309         && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult )
   307         && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult )
   310         && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult )
   308         && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult )
   311         && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult )
   309         && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult )
   312         && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) )
   310         && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) )
   313         {
   311         {
   314         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_TERMINALRESPONSEL_2, "CSAT: CSatNotifyReceiveData::TerminalResponseL, Invalid general result");
   312         TFLOGSTRING("CSAT: CSatNotifyReceiveData::TerminalResponseL, \
       
   313 			Invalid general result");
   315         ret = KErrCorrupt;
   314         ret = KErrCorrupt;
   316         }
   315         }
   317 
   316 
   318     if ( ( RSat::KMeProblem == rspV2.iInfoType )
   317     if ( ( RSat::KMeProblem == rspV2.iInfoType )
   319         || ( RSat::KChannelData == rspV2.iInfoType ) )
   318         || ( RSat::KChannelData == rspV2.iInfoType ) )
   324         	// received in unicode format: 0x00XX where XX is meaningful.
   323         	// received in unicode format: 0x00XX where XX is meaningful.
   325         	additionalInfo.Copy( rspV2.iAdditionalInfo );
   324         	additionalInfo.Copy( rspV2.iAdditionalInfo );
   326         	}
   325         	}
   327     	else
   326     	else
   328         	{
   327         	{
   329         	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_TERMINALRESPONSEL_3, "CSAT: CSatNotifyReceiveData::TerminalResponseL, Additional Info is Corrupted");
   328         	TFLOGSTRING("CSAT: CSatNotifyReceiveData::TerminalResponseL, \
       
   329 			Additional Info is Corrupted");
   330         	ret = KErrCorrupt;
   330         	ret = KErrCorrupt;
   331         	}
   331         	}
   332         }
   332         }
   333         
   333         
   334     CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( 
   334     CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( 
   349         TUint8 aGeneralResult,      
   349         TUint8 aGeneralResult,      
   350         const TDesC16& aAdditionalInfo, 
   350         const TDesC16& aAdditionalInfo, 
   351         TUint8 aChannelDataLength
   351         TUint8 aChannelDataLength
   352 		)
   352 		)
   353 	{   	
   353 	{   	
   354     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYRECEIVEDATA_CREATETERMINALRESPL_1, "CSAT: CSatNotifyReceiveData::CreateTerminalRespL");
   354     TFLOGSTRING("CSAT: CSatNotifyReceiveData::CreateTerminalRespL");
   355     TTlv tlvSpecificData;
   355     TTlv tlvSpecificData;
   356     // Append general result tag
   356     // Append general result tag
   357     tlvSpecificData.AddTag( KTlvResultTag );
   357     tlvSpecificData.AddTag( KTlvResultTag );
   358     // Append general result
   358     // Append general result
   359     tlvSpecificData.AddByte( aGeneralResult );
   359     tlvSpecificData.AddByte( aGeneralResult );