cbs/CbsServer/ServerSrc/CCbsSetFilterSettingHandler.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2003 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 module contains the implementation of CCbsSetFilterSettingHandler 
       
    15 *                class member functions
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDE FILES
       
    21 		/*****************************************************
       
    22 		*	Series 60 Customer / ETel
       
    23 		*	Series 60  ETel API
       
    24 		*****************************************************/
       
    25 #include <etelmm.h>
       
    26 #include <mmlist.h>
       
    27 #include "CCbsSetFilterSettingHandler.h"
       
    28 #include "CCbsRecEtel.h"
       
    29 #include "CCbsRecEtelMonitor.h"
       
    30 #include "CbsServerConstants.h"
       
    31 #include "CbsServerPanic.h"
       
    32 #include "CbsLogger.h"
       
    33 
       
    34 
       
    35 // ==================== LOCAL FUNCTIONS =====================================
       
    36 
       
    37 
       
    38 // ================= MEMBER FUNCTIONS =======================================
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CCbsSetFilterSettingHandler::CCbsSetFilterSettingHandler
       
    42 // C++ default constructor can NOT contain any code, that
       
    43 // might leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CCbsSetFilterSettingHandler::CCbsSetFilterSettingHandler( 
       
    47     CCbsRecEtel& aEtel, 
       
    48     MCbsEtelMessaging& aMessaging 
       
    49     ) : CActive( EPriorityStandard ),
       
    50     iEtel( aEtel ),
       
    51     iSmsMessaging( aMessaging )
       
    52     {
       
    53     CActiveScheduler::Add( this );
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CCbsSetFilterSettingHandler::ConstructL
       
    58 // Symbian 2nd phase constructor can leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 void CCbsSetFilterSettingHandler::ConstructL()
       
    62     {
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CCbsSetFilterSettingHandler::NewL
       
    67 // Two-phased constructor.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CCbsSetFilterSettingHandler* CCbsSetFilterSettingHandler::NewL( 
       
    71     CCbsRecEtel& aEtel, 
       
    72     MCbsEtelMessaging& aMessaging )
       
    73     {
       
    74     CCbsSetFilterSettingHandler* self = 
       
    75         new ( ELeave ) CCbsSetFilterSettingHandler( aEtel, aMessaging );
       
    76     CleanupStack::PushL( self );
       
    77     self->ConstructL();
       
    78     CleanupStack::Pop();
       
    79     return self;
       
    80     }
       
    81     
       
    82 // Destructor
       
    83 CCbsSetFilterSettingHandler::~CCbsSetFilterSettingHandler()
       
    84     {
       
    85     CBSLOGSTRING("CBSSERVER: >>> CCbsSetFilterSettingHandler::~CCbsSetFilterSettingHandler()"); 
       
    86     Cancel();
       
    87     CBSLOGSTRING("CBSSERVER: <<< CCbsSetFilterSettingHandler::~CCbsSetFilterSettingHandler()"); 
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CCbsSetFilterSettingHandler::SetFilterSetting
       
    92 // Requests ETel to change the filter setting.
       
    93 // (other items were commented in a header).
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 		/*****************************************************
       
    97 		*	Series 60 Customer / ETel
       
    98 		*	Series 60  ETel API
       
    99 		*****************************************************/
       
   100 void CCbsSetFilterSettingHandler::SetFilterSetting( 
       
   101     RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aSetting )
       
   102     {
       
   103     if ( IsActive() )
       
   104         {
       
   105         Cancel();
       
   106         }
       
   107     iSmsMessaging.SetFilterSetting( iStatus, aSetting );
       
   108     SetActive();
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CCbsSetFilterSettingHandler::RunL
       
   113 // Called after ETel has completed the SetFilterSetting request.
       
   114 // (other items were commented in a header).
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CCbsSetFilterSettingHandler::RunL()   
       
   118     {
       
   119     if ( iStatus != KErrNone )
       
   120         {        
       
   121         // Causes a call to RunError()
       
   122         User::Leave( iStatus.Int() );
       
   123         }
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CCbsSetFilterSettingHandler::DoCancel
       
   128 // Cancels an outstanding SetFilterSetting request.
       
   129 // (other items were commented in a header).
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 void CCbsSetFilterSettingHandler::DoCancel()   
       
   133     {
       
   134     iSmsMessaging.SetFilterSettingCancel();
       
   135     }
       
   136     
       
   137 // -----------------------------------------------------------------------------
       
   138 // CCbsSetFilterSettingHandler::RunError
       
   139 // Is called if RunL() leaves.
       
   140 // (other items were commented in a header).
       
   141 // -----------------------------------------------------------------------------
       
   142 //    
       
   143 TInt CCbsSetFilterSettingHandler::RunError( TInt aError )
       
   144     {
       
   145     CBSLOGSTRING2("CBSSERVER: >>> CCbsSetFilterSettingHandler::RunError(): Error code: %d", aError ); 
       
   146     CBSLOGSTRING("CBSSERVER: <<< CCbsSetFilterSettingHandler::RunError(), returning KErrNone." );
       
   147     
       
   148     // To prevent ARMV5 compiler warnings
       
   149     if ( aError )
       
   150         {
       
   151         aError = KErrNone;
       
   152         }
       
   153     return KErrNone; 
       
   154     }
       
   155 
       
   156 
       
   157 // ================= OTHER EXPORTED FUNCTIONS ===============================
       
   158 
       
   159 
       
   160 //  End of File