phoneapp/phoneuicontrol/inc/cphonebtaadisconnecthandler.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Bluetooth audio disconnection handler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHONEBTAADISCONNECTHANDLER_H
       
    20 #define CPHONEBTAADISCONNECTHANDLER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <coemain.h>
       
    24 #include "mphonetimer.h"
       
    25  
       
    26 // CLASS DECLARATION
       
    27 class CPhoneTimer;
       
    28 class MPhoneStateMachine;
       
    29 class MPhoneViewCommandHandle;
       
    30  
       
    31 /**
       
    32 *  It waits for bluetooth audio disconnection and
       
    33 *  shows query when it happens.
       
    34 *
       
    35 */
       
    36 class CPhoneBtaaDisconnectHandler : public CCoeStatic, protected MPhoneTimer
       
    37     {
       
    38     public:
       
    39         
       
    40         /**
       
    41          * Returns the bluetooth accessory disconnect handler singleton, constructing it if needed.
       
    42          * 
       
    43          * @return  Bluetooth accessory disconnect handler instance.
       
    44          */
       
    45         static CPhoneBtaaDisconnectHandler* InstanceL();
       
    46         
       
    47         /**
       
    48         * Handles connection lost situation.
       
    49         */
       
    50         void HandleConnectionLostL();
       
    51  
       
    52         /**
       
    53         * Handles query dismissal.
       
    54         * @param aCommand command selected.
       
    55         */
       
    56         void HandleQueryDismissL( TInt aCommand );
       
    57 
       
    58         /**
       
    59         * Cancels current operation.
       
    60         */
       
    61         void Cancel();
       
    62         
       
    63         /**
       
    64         * Return query status
       
    65         */
       
    66         TBool IsQuery();
       
    67         
       
    68     protected: //from base class
       
    69 
       
    70         /**
       
    71         * @see CPhoneTimer, handles timeout.
       
    72         */
       
    73         virtual void HandleTimeOutL();
       
    74         
       
    75     private:
       
    76 
       
    77         /**
       
    78         * C++ constructor.
       
    79         */
       
    80         CPhoneBtaaDisconnectHandler();
       
    81 
       
    82         /**
       
    83         * Destructor.
       
    84         */
       
    85         ~CPhoneBtaaDisconnectHandler();
       
    86         
       
    87         /**
       
    88         * Lauches query.
       
    89         */
       
    90         void LaunchQueryL();
       
    91 
       
    92         /**
       
    93         * Deletes all temporary instances.
       
    94         */
       
    95         void DeleteAll();
       
    96 
       
    97         /**
       
    98         * Terminate all calls.
       
    99         */
       
   100         void TerminateAllCallsL(); 
       
   101       
       
   102         /**
       
   103         * Show query
       
   104         * @param aResourceId resource id to be resolved
       
   105         */      
       
   106         void ShowQueryL( TInt aResourceId );
       
   107         
       
   108         /**
       
   109         * Set mute
       
   110         * @param aStatus ETrue if muted else unmute
       
   111         */
       
   112         void SetMuteL( TBool aStatus );
       
   113 
       
   114     protected:  // Data        
       
   115         /**
       
   116         * Phone UI View command handle
       
   117         */
       
   118         MPhoneViewCommandHandle* iViewCommandHandle;
       
   119         
       
   120         // Interface for setting and getting active state
       
   121         MPhoneStateMachine* iStateMachine;
       
   122 
       
   123     private:    // Data  
       
   124        
       
   125         /**
       
   126         * Enumerates states.
       
   127         *
       
   128         * EIdle - idle, waiting for disconnection.
       
   129         * ELaunchQuery - query to be launched.
       
   130         */
       
   131         enum TState
       
   132             {
       
   133             EIdle,
       
   134             ELaunchQuery,
       
   135             };
       
   136 
       
   137         // Current state.
       
   138         TState iState;
       
   139 
       
   140         // Timer.
       
   141         CPhoneTimer* iTimer;
       
   142      
       
   143         // Old mute state.
       
   144         TBool iOldMuted;
       
   145 
       
   146         // Indicates if call is supposed to be continued in 
       
   147         // handset or loudspeaker. ETrue corresponds to loudspeaker,
       
   148         // while EFalse corresponds to handset.
       
   149         TBool iVideoCallStatus;
       
   150 
       
   151     };
       
   152 
       
   153 #endif      // CPHONEBTAADISCONNECTHANDLER_H   
       
   154             
       
   155 // End of File