telephonyserverplugins/simatktsy/src/CSatNotifyCallControlRequest.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-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        : CSatNotifyCallControlRequest.cpp
       
    15 // Part of     : Common SIM ATK TSY / commonsimatktsy
       
    16 // Get inkey 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 "CSatNotifyCallControlRequest.h"   // Tsy class header
       
    26 #include "CSatNotificationsTsy.h"			// Class header
       
    27 #include "CBerTlv.h"						// Ber Tlv data handling
       
    28 #include "CSatDataPackage.h"				// Parameter packing 
       
    29 #include "TfLogger.h"						// For TFLOGSTRING
       
    30 #include "TSatUtility.h"					// Utilities
       
    31 #include "CSatTsyReqHandleStore.h"			// Request handle class
       
    32 #include "cmmmessagemanagerbase.h"			// Message manager class for forwarding req.
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CSatNotifyCallControlRequest::NewL
       
    36 // Two-phased constructor.
       
    37 // -----------------------------------------------------------------------------
       
    38 //  
       
    39 CSatNotifyCallControlRequest* CSatNotifyCallControlRequest::NewL
       
    40         ( 
       
    41         CSatNotificationsTsy* aNotificationsTsy 
       
    42         )
       
    43     {
       
    44     TFLOGSTRING("CSAT: CSatNotifyCallControlRequest::NewL");
       
    45    	CSatNotifyCallControlRequest* const satNotifyCallControlRequest = 
       
    46         new ( ELeave ) CSatNotifyCallControlRequest( aNotificationsTsy );
       
    47     CleanupStack::PushL( satNotifyCallControlRequest );
       
    48     satNotifyCallControlRequest->ConstructL();
       
    49     CleanupStack::Pop( satNotifyCallControlRequest );
       
    50     TFLOGSTRING("CSAT: CSatNotifyCallControlRequest::NewL, end of method");
       
    51     return satNotifyCallControlRequest;
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CSatNotifyCallControlRequest::~CSatNotifyCallControlRequest
       
    56 // Destructor
       
    57 // -----------------------------------------------------------------------------
       
    58 //  
       
    59 CSatNotifyCallControlRequest::~CSatNotifyCallControlRequest
       
    60         ( 
       
    61 		// None
       
    62         )
       
    63     {
       
    64     TFLOGSTRING("CSAT: CSatNotifyCallControlRequest::\
       
    65         ~CSatNotifyCallControlRequest");
       
    66     }
       
    67     
       
    68 // -----------------------------------------------------------------------------
       
    69 // CSatNotifyCallControlRequest::CSatNotifyCallControlRequest
       
    70 // Default C++ constructor
       
    71 // -----------------------------------------------------------------------------
       
    72 //  
       
    73 CSatNotifyCallControlRequest::CSatNotifyCallControlRequest
       
    74         ( 
       
    75         CSatNotificationsTsy* aNotificationsTsy 
       
    76         ) : iNotificationsTsy ( aNotificationsTsy )
       
    77     {
       
    78     // None
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CSatNotifyCallControlRequest::ConstructL
       
    83 // Symbian 2nd phase constructor
       
    84 // -----------------------------------------------------------------------------
       
    85 //  
       
    86 void CSatNotifyCallControlRequest::ConstructL
       
    87         (
       
    88         // None
       
    89         )
       
    90     {
       
    91     TFLOGSTRING("CSAT: CSatNotifyCallControlRequest::ConstructL");
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CSatNotifyCallControlRequest::Notify
       
    96 // This request allows a client to be notified of a Call Control Request proactive 
       
    97 // command
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 TInt CSatNotifyCallControlRequest::Notify
       
   101         (
       
   102         const TTsyReqHandle aTsyReqHandle,
       
   103         const TDataPackage& aPackage 
       
   104         )
       
   105     {
       
   106     TFLOGSTRING("CSAT: CSatNotifyCallControlRequest::Notify");
       
   107 
       
   108     // Save data pointer to client side for completion
       
   109     iCallControlV2Pckg = reinterpret_cast<RSat::TCallControlV2Pckg*>( 
       
   110         aPackage.Des1n() ); 
       
   111     // Save the request handle
       
   112     iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, 
       
   113 		CSatTsy::ESatNotifyCallControlRequestPCmdReqType );
       
   114 
       
   115     return KErrNone;
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CSatNotifyCallControlRequest::CancelNotification
       
   120 // This method cancels an outstanding asynchronous 
       
   121 // NotifyDisplayText request.
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 TInt CSatNotifyCallControlRequest::CancelNotification
       
   125         (
       
   126         const TTsyReqHandle aTsyReqHandle // Tsy request handle
       
   127         )
       
   128     {
       
   129     TFLOGSTRING("CSAT: CSatNotifyCallControlRequest::CancelNotification");   
       
   130     // Reset the request handle
       
   131     iNotificationsTsy->iSatReqHandleStore->
       
   132         ResetTsyReqHandle( CSatTsy::ESatNotifyCallControlRequestPCmdReqType );
       
   133     iCallControlV2Pckg = NULL;
       
   134     // Complete the request with KErrCancel
       
   135     iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel );
       
   136     return KErrNone;    
       
   137     }
       
   138     
       
   139 // -----------------------------------------------------------------------------
       
   140 // CSatNotifyCallControlRequest::CompleteNotifyL
       
   141 // This method unpacks the parameters and requests for completion
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 TInt CSatNotifyCallControlRequest::CompleteNotifyL 
       
   145         (
       
   146         CSatDataPackage* aDataPackage,   
       
   147         TInt aErrorCode 
       
   148         )
       
   149     {
       
   150     TFLOGSTRING("CSAT: CSatNotifyCallControlRequest::CompleteNotifyL");   
       
   151     RSat::TAlphaIdBuf alphaId;
       
   152     RSat::TControlResult result;
       
   153 	// Unpack data
       
   154 	aDataPackage->UnPackData( alphaId, result ); 
       
   155 	CompleteAlphaId( alphaId, result, aErrorCode );
       
   156 	return KErrNone;
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CSatNotifyCallControlRequest::CompleteAlphaId
       
   161 // This method completes an outstanding asynchronous 
       
   162 // NotifyCallControlRequest request. 
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 void CSatNotifyCallControlRequest::CompleteAlphaId
       
   166         (
       
   167         RSat::TAlphaIdBuf& aAlphaId, 
       
   168         RSat::TControlResult aResult,
       
   169         TInt aErrorCode                
       
   170         )
       
   171     {
       
   172     TFLOGSTRING("CSAT: CSatNotifyCallControlRequest::CompleteAlphaId");	
       
   173 
       
   174 	// Reset req handle. Returns the deleted req handle
       
   175     TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
       
   176 		ResetTsyReqHandle( CSatTsy::ESatNotifyCallControlRequestPCmdReqType );
       
   177 		
       
   178     // Check that someone has requested this notification
       
   179     if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
       
   180         {
       
   181         if ( KErrNone == aErrorCode )
       
   182             {
       
   183             // Temporary storage for Alpha Id 
       
   184             RSat::TAlphaId alphaIdTemp;
       
   185             // Alpha ID validity
       
   186             RSat::TAlphaIdValidity validity( RSat::EValidAlpaId );
       
   187             alphaIdTemp.iStatus = RSat::EAlphaIdProvided;
       
   188             alphaIdTemp.iAlphaId.Copy( aAlphaId );
       
   189             // Fill the call control structure
       
   190             RSat::TCallControlV2& callControlV2 = ( *iCallControlV2Pckg )();
       
   191             // Set default control result
       
   192             callControlV2.SetCcGeneralResult( aResult );          
       
   193             callControlV2.SetAlphaId( validity, alphaIdTemp );  
       
   194             }
       
   195         TFLOGSTRING( "CSAT: CSatNotifyCallControlRequest::CompleteAlphaId\
       
   196             completing" );
       
   197         // Complete notification
       
   198         iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, aErrorCode );
       
   199         }
       
   200     else
       
   201         {
       
   202         TFLOGSTRING( "CSAT: CSatNotifyCallControlRequest::CompleteAlphaId\
       
   203             Request not ongoing" );
       
   204         }
       
   205     }
       
   206 
       
   207 // End of file