devicediagnosticsfw/diagframework/inc/diagenginecallhandler.h
changeset 46 c15b68295419
parent 40 588ad05716be
child 47 dd41e7de3375
equal deleted inserted replaced
40:588ad05716be 46:c15b68295419
     1 /*
       
     2 * Copyright (c) 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:  Class declaration for DiagFwInternal::TEvent
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGENGINECALLHANDLER_H
       
    20 #define DIAGENGINECALLHANDLER_H
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <etel3rdparty.h>       // CTelephony and its T classes
       
    24 #include <badesca.h>            // CDesCArrayFlat - needed since its a typedef
       
    25 
       
    26 // USER INCLUDES
       
    27 #include "diagenginecallhandlerstates.h"    // TDiagEngineCallHandlerState
       
    28 
       
    29 // FORWARD DECLARATION
       
    30 class MDiagEngineCallHandlerObserver;
       
    31 
       
    32 
       
    33 /**
       
    34 *  Call Handler.
       
    35 *  
       
    36 *   This component is responsible for checking both MO and MT voice calls.
       
    37 *   If new calls are made, this component will let the observer know that
       
    38 *   call status has changed.
       
    39 *
       
    40 *   It also maintains a list of acceptable phone numbers that can be ignored.
       
    41 *   The list can be changed dynamically.
       
    42 *   
       
    43 *  @since S60 v5.0
       
    44 */
       
    45 NONSHARABLE_CLASS( CDiagEngineCallHandler ) : public CActive
       
    46     {
       
    47 public:
       
    48     /**
       
    49     * Two-phased constructor
       
    50     * 
       
    51     * @param aObserver - Reference to object interested in voice call events.
       
    52     * @return New instance of CDiagEngineCallHandler
       
    53     */
       
    54     static CDiagEngineCallHandler* NewL( MDiagEngineCallHandlerObserver& aObserver );
       
    55 
       
    56     /**
       
    57     * C++ Destructor
       
    58     * 
       
    59     */
       
    60     virtual ~CDiagEngineCallHandler();
       
    61 
       
    62     /**
       
    63     * Add a new phone number to a ignore list. If a new call is made, and
       
    64     * it is in the ignore list, state chaneg will not occur.
       
    65     *
       
    66     * Note that if the number specified is already in-call, adding the 
       
    67     * numebr will not cause the state to be changed. Only new calls
       
    68     * are watched.
       
    69     * 
       
    70     * @param aNumber - Phone number to ignore
       
    71     */
       
    72     void AddIgnoreNumberL( const TDesC& aNumber );
       
    73 
       
    74     /**
       
    75     * Remove a number from the ignore list. Number must match exactly to
       
    76     * be successful. If entry is not found, this function will leave
       
    77     * vith KErrNotFound.
       
    78     *
       
    79     * Note that if the number specified is already in call, removing 
       
    80     * the number will not generate state change event. Only new
       
    81     * calls are handled.
       
    82     * 
       
    83     * @param aNumber - Phone number to ignore
       
    84     */
       
    85     void RemoveIgnoreNumberL( const TDesC& aNumber );
       
    86 
       
    87     /**
       
    88     * Returns current call handler state.
       
    89     *
       
    90     * @return Current call handler state.
       
    91     */
       
    92     TDiagEngineCallHandlerState CurrentState() const;
       
    93 
       
    94 private:    // from CActive
       
    95     /**
       
    96     * @see CActive::RunL()
       
    97     */
       
    98     virtual void RunL();
       
    99 
       
   100     /**
       
   101     * @see CActive::DoCancel()
       
   102     */
       
   103     virtual void DoCancel();
       
   104 
       
   105 private:    // private functions
       
   106     /**
       
   107     * C++ Constructor
       
   108     *
       
   109     * @param aObserver - reference to observer.
       
   110     */
       
   111     CDiagEngineCallHandler( MDiagEngineCallHandlerObserver& aObserver );
       
   112 
       
   113     /**
       
   114     * Second phase constructor.
       
   115     *
       
   116     */
       
   117     void ConstructL();
       
   118 
       
   119     /**
       
   120     * Request from the telephony to receive phone status change indication.
       
   121     * This function must be called every time status update happens in
       
   122     * order to continue to receive new state change.
       
   123     *
       
   124     */
       
   125     void RequestNotify();
       
   126 
       
   127     /**
       
   128     * Handle CTelephony::EStatusIdle case.
       
   129     *
       
   130     * @return ETrue if state is changed, and observer should be notified.
       
   131     */
       
   132     TBool HandleIdle();
       
   133 
       
   134     /**
       
   135     * Handle CTelephony::EStatusDialling and CTelephony::EStatusRinning case.
       
   136     *
       
   137     * @return ETrue if state is changed, and observer should be notified.
       
   138     */
       
   139     TBool HandleCall();
       
   140 
       
   141     /**
       
   142     * Debugging function that logs a human readable text of current 
       
   143     * call status.
       
   144     *
       
   145     * This function does not do anything in DEBUG builds.
       
   146     */
       
   147     void LogCallStatus() const;
       
   148 
       
   149 private:
       
   150     /**
       
   151     * iObserver - Observers call handle status.
       
   152     */
       
   153     MDiagEngineCallHandlerObserver& iObserver;          
       
   154 
       
   155     /**
       
   156     * iTelephony - Used to receive call status changed indication.
       
   157     * Owns.
       
   158     */
       
   159     CTelephony* iTelephony;
       
   160 
       
   161     /**
       
   162     * iCallStatus - This is where call status data is updated.
       
   163     */
       
   164     CTelephony::TCallStatusV1 iCallStatus;
       
   165 
       
   166     /**
       
   167     * iCallStatusPckg - packaged version of iCallStatus
       
   168     */
       
   169     CTelephony::TCallStatusV1Pckg iCallStatusPckg;
       
   170 
       
   171     /**
       
   172     * iCallIgnoreList - List of numbers to ignore.
       
   173     * Owns.
       
   174     */
       
   175     CDesCArrayFlat* iCallIgnoreList;    
       
   176 
       
   177     /**
       
   178     * iState - internal state.
       
   179     */
       
   180     TDiagEngineCallHandlerState iState;
       
   181     };
       
   182 
       
   183 #endif // DIAGENGINECALLHANDLER_H
       
   184 
       
   185 // End of File
       
   186