telephonyserverplugins/simatktsy/src/CSatNotifyMoreTime.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name        : CSatNotifyMoreTime.cpp
       
    15 // Part of     : Common SIM ATK TSY / commonsimatktsy
       
    16 // More time notification functionality of Sat Tsy
       
    17 // Version     : 1.0
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 //INCLUDES
       
    23 #include <satcs.h>                  // Etel SAT IPC definitions
       
    24 #include "CSatTsy.h"                // Tsy class header
       
    25 #include "CSatNotifyMoreTime.h"  	// Class header
       
    26 #include "CSatNotificationsTsy.h"   // Tsy class header
       
    27 #include "CBerTlv.h"                // Ber Tlv data handling
       
    28 #include "TTlv.h"					// TTlv class
       
    29 #include "CSatDataPackage.h"        // Parameter packing 
       
    30 #include "TfLogger.h"               // For TFLOGSTRING
       
    31 #include "TSatUtility.h"            // Utilities
       
    32 #include "CSatTsyReqHandleStore.h"  // Request handle class
       
    33 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CSatNotifyMoreTime::NewL
       
    37 // Two-phased constructor.
       
    38 // -----------------------------------------------------------------------------
       
    39 //  
       
    40 CSatNotifyMoreTime* CSatNotifyMoreTime::NewL
       
    41         ( 
       
    42         CSatNotificationsTsy* aNotificationsTsy 
       
    43         )
       
    44     {
       
    45     TFLOGSTRING("CSAT: CSatNotifyMoreTime::NewL");
       
    46    	CSatNotifyMoreTime* const satNotifyMoreTime = 
       
    47         new ( ELeave ) CSatNotifyMoreTime( aNotificationsTsy );
       
    48     CleanupStack::PushL( satNotifyMoreTime );
       
    49     satNotifyMoreTime->ConstructL();
       
    50     CleanupStack::Pop( satNotifyMoreTime );
       
    51     TFLOGSTRING("CSAT: CSatNotifyMoreTime::NewL, end of method");
       
    52     return satNotifyMoreTime;
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CSatNotifyMoreTime::~CSatNotifyMoreTime
       
    57 // Destructor
       
    58 // -----------------------------------------------------------------------------
       
    59 //  
       
    60 CSatNotifyMoreTime::~CSatNotifyMoreTime
       
    61         ( 
       
    62 		// None
       
    63         )
       
    64     {
       
    65     TFLOGSTRING("CSAT: CSatNotifyMoreTime::~CSatNotifyMoreTime");
       
    66     }
       
    67     
       
    68 // -----------------------------------------------------------------------------
       
    69 // CSatNotifyMoreTime::CSatNotifyMoreTime
       
    70 // Default C++ constructor
       
    71 // -----------------------------------------------------------------------------
       
    72 //  
       
    73 CSatNotifyMoreTime::CSatNotifyMoreTime
       
    74         ( 
       
    75         CSatNotificationsTsy* aNotificationsTsy 
       
    76         ) : iNotificationsTsy ( aNotificationsTsy )
       
    77     {
       
    78     // None
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CSatNotifyMoreTime::ConstructL
       
    83 // Symbian 2nd phase constructor
       
    84 // -----------------------------------------------------------------------------
       
    85 //  
       
    86 void CSatNotifyMoreTime::ConstructL
       
    87         (
       
    88         // None
       
    89         )
       
    90     {
       
    91     TFLOGSTRING("CSAT: CSatNotifyMoreTime::ConstructL, does nothing");
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CSatNotifyMoreTime::CompleteNotifyL
       
    96 // This method completes an outstanding asynchronous NotifyMoreTime request. 
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 TInt CSatNotifyMoreTime::CompleteNotifyL
       
   100         (
       
   101         CSatDataPackage* aDataPackage,
       
   102         TInt /*aErrorCode*/              
       
   103         )
       
   104     {
       
   105     TFLOGSTRING("CSAT: CSatNotifyMoreTime::CompleteNotifyL");
       
   106     TInt ret( KErrNone );
       
   107     // Unpack parameters
       
   108     TPtrC8* data;
       
   109     aDataPackage->UnPackData( &data );    
       
   110     // Get ber tlv 
       
   111     CBerTlv berTlv;
       
   112     berTlv.SetData( *data );
       
   113     // Get command details tlv
       
   114     CTlv commandDetails;
       
   115     berTlv.TlvByTagValue( &commandDetails, KTlvCommandDetailsTag );
       
   116     // Store command details tlv
       
   117     iNotificationsTsy->iTerminalRespData.iCommandDetails.Copy( 
       
   118     	commandDetails.Data() );
       
   119 	// Get command number
       
   120 	TUint8 pCmdNumber( commandDetails.GetShortInfo( ETLV_CommandNumber ) );
       
   121 	
       
   122     CreateTerminalRespL( pCmdNumber, RSat::KSuccess );
       
   123 
       
   124     return ret;
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CSatNotifyMoreTime::CreateTerminalRespL
       
   129 // Constructs more time specific part of terminal response and calls 
       
   130 // DOS to send the actual message.
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 TInt CSatNotifyMoreTime::CreateTerminalRespL
       
   134         ( 
       
   135         TUint8 aPCmdNumber,         
       
   136         TUint8 aGeneralResult			 
       
   137 		)
       
   138     {
       
   139     TFLOGSTRING("CSAT: CSatNotifyMoreTime::CreateTerminalRespL");
       
   140     // Create and append response data
       
   141     TTlv tlvSpecificData;
       
   142 	// General result
       
   143     tlvSpecificData.AddTag( KTlvResultTag );   
       
   144     tlvSpecificData.AddByte( aGeneralResult );	
       
   145     // Prepare data
       
   146     iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber;
       
   147     TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag();
       
   148     // Pack data
       
   149     CSatDataPackage dataPackage;
       
   150 	dataPackage.PackData( &iNotificationsTsy->iTerminalRespData, &data );
       
   151     // Forward request to the DOS
       
   152     return iNotificationsTsy->iSatTsy->MessageManager()->HandleRequestL( 
       
   153 		ESatTerminalRsp, &dataPackage );		
       
   154     }
       
   155     
       
   156 // End of file
       
   157