satengine/SatServer/Commands/SendSSCmd/src/csatsendssrequestcompletehandler.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Handler for the SS Request Complete notification
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include    "CSendSsHandler.h"
       
    20 #include    "csatsendssrequestcompletehandler.h"
       
    21 #include    "SatLog.h"
       
    22 
       
    23 // ================= MEMBER FUNCTIONS =======================
       
    24 
       
    25 // The class constructor.
       
    26 CSatSendSsRequestCompleteHandler::CSatSendSsRequestCompleteHandler(
       
    27     TInt aPriority, RMmCustomAPI& aPhone,
       
    28     CSendSSHandler* aDispatcher )
       
    29     : CActive( aPriority ), iPhone( aPhone ),
       
    30     iDispatcher( aDispatcher )
       
    31     {
       
    32     LOG( SIMPLE,
       
    33         "CSatSendSsRequestCompleteHandler::CSatSendSsRequestCompleteHandler \
       
    34         calling" )
       
    35 
       
    36     // Add to active scheduler
       
    37     CActiveScheduler::Add( this );
       
    38 
       
    39     LOG( SIMPLE,
       
    40         "CSatSendSsRequestCompleteHandler::CSatSendSsRequestCompleteHandler \
       
    41         exiting" )
       
    42     }
       
    43 
       
    44 // Two-phased constructor.
       
    45 CSatSendSsRequestCompleteHandler* CSatSendSsRequestCompleteHandler::NewL(
       
    46     RMmCustomAPI& aPhone, CSendSSHandler* aDispatcher )
       
    47     {
       
    48     LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::NewL calling" )
       
    49 
       
    50     // Perform construction
       
    51     CSatSendSsRequestCompleteHandler* self =
       
    52         new ( ELeave ) CSatSendSsRequestCompleteHandler(
       
    53             EPriorityLow, aPhone, aDispatcher );
       
    54 
       
    55     LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::NewL exiting" )
       
    56     return self;
       
    57     }
       
    58 
       
    59 // Destructor
       
    60 CSatSendSsRequestCompleteHandler::~CSatSendSsRequestCompleteHandler()
       
    61     {
       
    62     LOG( SIMPLE,
       
    63         "CSatSendSsRequestCompleteHandler::~CSatSendSsRequestCompleteHandler \
       
    64         calling" )
       
    65 
       
    66     // Cancel any outstanding requests.
       
    67     Cancel();
       
    68 
       
    69     LOG( SIMPLE,
       
    70         "CSatSendSsRequestCompleteHandler::~CSatSendSsRequestCompleteHandler \
       
    71         exiting" )
       
    72     iDispatcher = NULL;
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CSatSendSsRequestCompleteHandler::Start
       
    77 // Starts the handler.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 void CSatSendSsRequestCompleteHandler::Start()
       
    81     {
       
    82     LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::Start calling" )
       
    83 
       
    84     if ( !IsActive() )
       
    85         {
       
    86         LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::Start set active" )
       
    87         // Request the notification.
       
    88         iPhone.SsRequestCompleteNotification( iStatus, iSsStatus );
       
    89         // Set to active so that requests can be received.
       
    90         SetActive();
       
    91         }
       
    92 
       
    93     LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::Start exiting" )
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CSatSendSsRequestCompleteHandler::RunL
       
    98 // Handles the command.
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 void CSatSendSsRequestCompleteHandler::RunL()
       
   102     {
       
   103     LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::RunL calling" )
       
   104 
       
   105     // Check the status of the asnychronous operation
       
   106     if ( iStatus == KErrNone )
       
   107         {
       
   108         LOG( NORMAL, " iStatus == KErrNone" )
       
   109         iDispatcher->DispatchSsRequestComplete( iSsStatus );
       
   110         // Renew the notification request.
       
   111         Start();
       
   112         }
       
   113     else
       
   114         {
       
   115         LOG2( NORMAL, "  iStatus == %i", iStatus.Int() )
       
   116         iDispatcher->DispatchSsRequestComplete( KErrGeneral );
       
   117         }
       
   118 
       
   119     LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::RunL exiting" )
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CSatSendSsRequestCompleteHandler::DoCancel
       
   124 // Cancels the pending request.
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 void CSatSendSsRequestCompleteHandler::DoCancel()
       
   128    {
       
   129    LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::DoCancel calling" )
       
   130 
       
   131    // Cancel the outstanding request.
       
   132    iPhone.CancelAsyncRequest( ECustomNotifySsRequestCompleteIPC );
       
   133 
       
   134    LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::DoCancel exiting" )
       
   135    }
       
   136 
       
   137 //  End of File