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