satengine/SatServer/Commands/SendSmCmd/src/CSatSSendMessageNoLoggingHandler.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2008 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:  This is the handler for the SIM Application Toolkit
       
    15 *                Send Message No logging.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include    <e32base.h>
       
    23 #include    "MSatApi.h"
       
    24 #include    "CSatSSendMessageNoLoggingHandler.h"
       
    25 #include    "MSatSmsObserver.h"
       
    26 #include    "SatLog.h"
       
    27 
       
    28 // ================= MEMBER FUNCTIONS ==========================================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CSatSSendMessageNoLoggingHandler::CSatSSendMessageNoLoggingHandler
       
    32 // The class constructor.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CSatSSendMessageNoLoggingHandler::CSatSSendMessageNoLoggingHandler(
       
    36     MSatApi& aSatApi,
       
    37     MSatSmsObserver& aObserver ) :
       
    38     CActive( CActive::EPriorityStandard ),
       
    39     iSmsData(),
       
    40     iSmsPckg( iSmsData ),
       
    41     iSatApi( aSatApi ),
       
    42     iObserver( aObserver )
       
    43     {
       
    44     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::\
       
    45         CSatSSendMessageNoLoggingHandler calling" )
       
    46 
       
    47     CActiveScheduler::Add( this );
       
    48 
       
    49     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::\
       
    50         CSatSSendMessageNoLoggingHandler exiting" )
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CSatSSendMessageNoLoggingHandler::NewL
       
    55 // Two-phased constructor.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CSatSSendMessageNoLoggingHandler* CSatSSendMessageNoLoggingHandler::NewL(
       
    59     MSatApi& aSatApi,
       
    60     MSatSmsObserver& aObserver )
       
    61     {
       
    62     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::NewL calling" )
       
    63 
       
    64     CSatSSendMessageNoLoggingHandler* self =
       
    65         new ( ELeave ) CSatSSendMessageNoLoggingHandler( aSatApi, aObserver );
       
    66 
       
    67     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::NewL exiting" )
       
    68     return self;
       
    69     }
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // CSatSSendMessageNoLoggingHandler::~CSatSSendMessageNoLoggingHandler
       
    73 // Destructor.
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 CSatSSendMessageNoLoggingHandler::~CSatSSendMessageNoLoggingHandler()
       
    77     {
       
    78     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::\
       
    79         ~CSatSSendMessageNoLoggingHandler calling" )
       
    80 
       
    81     Cancel();
       
    82 
       
    83     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::\
       
    84         ~CSatSSendMessageNoLoggingHandler exiting" )
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CSatSSendMessageNoLoggingHandler::Start
       
    89 // Starts the handler.
       
    90 // (other items were commented in a header).
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 void CSatSSendMessageNoLoggingHandler::Start(
       
    94     const RSat::TSendSmV1& aSendSmData )
       
    95     {
       
    96     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::Start calling" )
       
    97 
       
    98     iSmsData.iServiceCenter = aSendSmData.iAddress;
       
    99     iSmsData.iBuf = aSendSmData.iSmsTpdu;
       
   100 
       
   101     if ( !IsActive() )
       
   102         {
       
   103         iSatApi.SendMessageNoLogging( iStatus, iSmsPckg, iMessageRef );
       
   104         SetActive();
       
   105         }
       
   106     else
       
   107         {
       
   108         LOG( SIMPLE, " Sms sender already active!" )
       
   109         }
       
   110 
       
   111     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::Start exiting" )
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CSatSSendMessageNoLoggingHandler::RunL
       
   116 // Handles the command.
       
   117 // (other items were commented in a header).
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 void CSatSSendMessageNoLoggingHandler::RunL()
       
   121     {
       
   122     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::RunL calling" )
       
   123 
       
   124     iObserver.SmsSent( iStatus.Int() );
       
   125 
       
   126     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::RunL exiting" )
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CSatSSendMessageNoLoggingHandler::DoCancel
       
   131 // Cancels the pending request.
       
   132 // (other items were commented in a header).
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 void CSatSSendMessageNoLoggingHandler::DoCancel()
       
   136     {
       
   137     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::DoCancel calling" )
       
   138 
       
   139     // Cancel the outstanding request.
       
   140     iSatApi.SendMessageNoLoggingCancel();
       
   141 
       
   142     LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::DoCancel exiting" )
       
   143     }
       
   144 
       
   145 //  End of File