phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerControl.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2005 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: Declaration of CPhoneHandlerControl class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHONEHANDLERCONTROL_H
       
    20 #define CPHONEHANDLERCONTROL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "phonehandlerservice.h" 
       
    24 #include <RemConExtensionApi.h> 
       
    25 #include <RemConCallHandlingTargetObserver.h> 
       
    26 #include <e32base.h>
       
    27 #include <phclttypes.h> 
       
    28 #include <e32property.h> 
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 
       
    40 // CLASS DECLARATION
       
    41 class CRemConInterfaceSelector;
       
    42 class CRemConCallHandlingTarget;
       
    43 class CPhoneHandlerResponse;
       
    44 class CPhoneHandlerCallState;
       
    45 
       
    46 /**
       
    47 * Receives call handling related key presses from accessories and executes 
       
    48 * them.
       
    49 *
       
    50 *  @lib PhoneCmdHandler
       
    51 *  @since S60 3.1
       
    52 */
       
    53 NONSHARABLE_CLASS( CPhoneHandlerControl ) : public CBase,
       
    54                                             public MRemConCallHandlingTargetObserver
       
    55     {
       
    56     public:  // Constructors and destructor
       
    57     
       
    58         /**
       
    59         * Two-phased constructor.
       
    60         */
       
    61         static CPhoneHandlerControl* NewL( 
       
    62             CRemConInterfaceSelector* aIfSelector = NULL );
       
    63 
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         virtual ~CPhoneHandlerControl();
       
    68 
       
    69     public: // New functions
       
    70     
       
    71         /**
       
    72         * Returns phone number for dial or speed dial.
       
    73         * @since S60 3.1
       
    74         * @param void
       
    75         * @return TPhCltTelephoneNumber phone number
       
    76         */
       
    77         const TPhCltTelephoneNumber& TelephoneNumber() const;
       
    78         
       
    79         /**
       
    80         * Returns voice dial status for voice dial.
       
    81         * @since S60 3.1
       
    82         * @param void
       
    83         * @return TBool status
       
    84         */
       
    85         const TBool& VoiceDialStatus() const;
       
    86         
       
    87         /**
       
    88         * Returns CHLD command for multiparty call.
       
    89         * @since S60 3.1
       
    90         * @param void
       
    91         * @return TInt CHLD command
       
    92         */
       
    93         const TInt& ChldCommand() const;
       
    94         
       
    95         /**
       
    96         * Returns CHLD call number for multiparty call.
       
    97         * @since S60 3.1
       
    98         * @param void
       
    99         * @return TInt CHLD command number
       
   100         */
       
   101         const TInt& ChldCallNumber() const;
       
   102         
       
   103         /**
       
   104         * Returns DTMF tone to be sent.
       
   105         * @since S60 3.1
       
   106         * @param void
       
   107         * @return TChar DTMF tone
       
   108         */
       
   109         const TChar& Tone() const;
       
   110         
       
   111         /**
       
   112         * Returns reference to API used to communicate with accessory who 
       
   113         * initiated key press.
       
   114         * @since S60 3.1
       
   115         * @param void
       
   116         * @return CRemConCallHandlingTarget& reference to API
       
   117         */  
       
   118         CRemConCallHandlingTarget& CommandInitiator() const;
       
   119         
       
   120         /**
       
   121         * Informs the latest call state.
       
   122         * @since S60 3.1
       
   123         * @param aState Call state from KTelephonyCallState P&S key
       
   124         * @return void
       
   125         */
       
   126         void NotifyCallState( const TInt aState );
       
   127 
       
   128         /**
       
   129         * Get iSwitchCall flag, if this flag is ETrue, it means
       
   130         * "Send" key in remote target is pressed in multiparty call,
       
   131         * otherwise EFalse
       
   132         * @since S60 3.1
       
   133         * @return TBool
       
   134         */
       
   135         TBool SwitchCall();
       
   136 
       
   137                     
       
   138     public: // Functions from base classes
       
   139                 
       
   140     protected:  // New functions
       
   141         
       
   142     protected:  // Functions from base classes
       
   143     
       
   144     private:
       
   145 
       
   146         /**
       
   147         * C++ default constructor.
       
   148         */
       
   149         CPhoneHandlerControl();
       
   150 
       
   151         /**
       
   152         * By default Symbian 2nd phase constructor is private.
       
   153         */
       
   154         void ConstructL( CRemConInterfaceSelector* aIfSelector = NULL );
       
   155                 
       
   156         /**
       
   157         * From MRemConCallHandlingTargetObserver. Answer an incoming phone call.
       
   158         */
       
   159         virtual void AnswerCall();
       
   160 
       
   161         /**
       
   162         * From MRemConCallHandlingTargetObserver. End an incoming/ongoing 
       
   163         * phone call.
       
   164         */
       
   165         virtual void EndCall();
       
   166     
       
   167         /**
       
   168         * From MRemConCallHandlingTargetObserver. Answer an incoming phone call, 
       
   169         * or end an ongoing call according to call status. 
       
   170         */
       
   171         virtual void AnswerEndCall();
       
   172         
       
   173         /**
       
   174         * From MRemConCallHandlingTargetObserver. Make a voice call.
       
   175         */
       
   176         virtual void VoiceDial( const TBool aActivate );
       
   177     
       
   178         /**
       
   179         * From MRemConCallHandlingTargetObserver. Redial last phone call.
       
   180         */
       
   181         virtual void LastNumberRedial();
       
   182     
       
   183         /**
       
   184         * From MRemConCallHandlingTargetObserver. Dial a phone call.
       
   185         */
       
   186         virtual void DialCall( const TDesC8& aTelNumber );
       
   187     
       
   188         /**
       
   189         * From MRemConCallHandlingTargetObserver. Make multiparty call.
       
   190         */
       
   191         virtual void MultipartyCalling( const TDesC8& aData );
       
   192     
       
   193         /**
       
   194         * Generates DTMF signal.
       
   195         */
       
   196         virtual void GenerateDTMF( const TChar aChar );
       
   197     
       
   198         /**
       
   199         * From MRemConCallHandlingTargetObserver. Make a speed dial call.
       
   200         */
       
   201         virtual void SpeedDial( const TInt aIndex );
       
   202         
       
   203         /**
       
   204         * Starts processing service corresponding to key press.
       
   205         */
       
   206         void StartProcessing( 
       
   207             const TRemConExtCallHandlingApiOperationId aOperation );
       
   208         
       
   209         /**
       
   210         * Creates service.
       
   211         */
       
   212         MPhoneHandlerService* CreateServiceL( 
       
   213             const TRemConExtCallHandlingApiOperationId aOperation );
       
   214         
       
   215         /**
       
   216         * Returns call status.
       
   217         */
       
   218         void CallStatusL( RPhone::TLineInfo& aLineInfo );
       
   219         
       
   220                 
       
   221     private:    // Data
       
   222         
       
   223         // Provides e.g. service to listen accessory key presses.
       
   224         CRemConInterfaceSelector* iInterfaceSelector;   // owned
       
   225         
       
   226         //  API notifying PhoneCmdHandler about call handling key presses.
       
   227         CRemConCallHandlingTarget* iTarget; // owned
       
   228                 
       
   229         // Phone number for dial call/speed dial.
       
   230         TPhCltTelephoneNumber iTelNumber;
       
   231         
       
   232         // Voice recognition status
       
   233         TBool iActivate;
       
   234         
       
   235         // Multiparty call command
       
   236         TInt iChldCommand;
       
   237         
       
   238         // Multiparty call number
       
   239         TInt iChldCallNumber;
       
   240         
       
   241         // Type of DTMF tone
       
   242         TChar iChar;
       
   243         
       
   244         //  Speed dial index.
       
   245         TInt iIndex;
       
   246                 
       
   247         // Sends responses to RemCon FW
       
   248         CPhoneHandlerResponse* iResponse;
       
   249         
       
   250         // Interface to P&S key that returns call state
       
   251         RProperty iProperty;
       
   252         
       
   253         // Previous call state
       
   254         TInt iPrevState;
       
   255         
       
   256         // Number of active calls
       
   257         // Used to determine whether there's a multicall case when call state
       
   258         TInt iActiveCalls;
       
   259         
       
   260         // switch phonecall by press "Send" key
       
   261         TBool iSwitchCall;
       
   262         
       
   263         // Listens to phone call state changes.
       
   264         CPhoneHandlerCallState* iCallStateObserver;
       
   265         
       
   266                     
       
   267     public:     // Friend classes
       
   268     
       
   269     protected:  // Friend classes
       
   270     
       
   271     private:    // Friend classes
       
   272     
       
   273     };
       
   274 
       
   275 #endif      // CPHONEHANDLERCONTROL_H   
       
   276             
       
   277 // End of File