phoneclientserver/inc/rphcltemergencycall.h
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     1 /*
       
     2 * Copyright (c) 2002-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:  Client side access to emergency call
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef RPhCltEmergencyCall_H
       
    20 #define RPhCltEmergencyCall_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32std.h>
       
    24 #include "phclttypes.h" 
       
    25 #include "rphcltserver.h" 
       
    26 
       
    27 /**
       
    28 * Emergency number query mode
       
    29 */
       
    30 enum TPhCltEmergencyNumberQueryMode
       
    31     {
       
    32     EPhCltEmergencyNumberQueryModeNormal = 0,  // Normal mode
       
    33     EPhCltEmergencyNumberQueryModeAdvanced,    // advanced mode
       
    34     EPhCltEmergencyNumberQueryModeNormalWriteback   // Same as "normal", but writes back emergency number
       
    35     };
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 *  Client side access to emergency call
       
    43 *
       
    44 *  @lib phoneclient.lib
       
    45 *  @since Series60_1.0
       
    46 */
       
    47 class RPhCltEmergencyCall : public RSubSessionBase
       
    48     {
       
    49     public:  // Constructors and destructor
       
    50 
       
    51         /**
       
    52         * C++ default constructor.
       
    53         */
       
    54         RPhCltEmergencyCall();
       
    55 
       
    56 
       
    57     public:  // New functions
       
    58 
       
    59         /**
       
    60         * Opens the subsession.
       
    61         *
       
    62         * @param aServer It is the session of which subsession this is.
       
    63         * @return Returns error code.
       
    64         */
       
    65         TInt Open( RPhCltServer& aServer );
       
    66 
       
    67         /**
       
    68          * Closes the subsession.
       
    69          */
       
    70         void Close();
       
    71 
       
    72 
       
    73     public:
       
    74 
       
    75        /**
       
    76         * Returns information whether the number specified was an emergency number.
       
    77         * 
       
    78         * @param aNumber Number to be queried. aNumber might contain prefix (SS code)
       
    79         *                and/or postfix (DTMF part).  
       
    80         *                The aNumber parameter should be a buffer and the 
       
    81         *                clients are provided with a typedef called 
       
    82         *                TPhCltEmergencyNumber, which is equivalent to a 
       
    83         *                TBuf< KPhCltEmergencyNumberSize > where 
       
    84         *                KPhCltEmergencyNumberSize is defined as 100. 
       
    85         *
       
    86         * @param aIsEmergencyNumber If ETrue, then the aNumber 
       
    87         *                           parameter included emergency number.
       
    88         * @return Returns error code of the success of the operation.
       
    89         */
       
    90         TInt IsEmergencyPhoneNumber(
       
    91             const TDesC& aNumber, 
       
    92             TBool& aIsEmergencyNumber );
       
    93 
       
    94         /**
       
    95         * Method can be used to check if the number specified contains 
       
    96         * a valid emergency number in the end of the number.
       
    97         * 
       
    98         * @param aNumber Number to be queried, matched emergency number 
       
    99         *                is returned in this parameter.
       
   100         *                The aNumber parameter should be a buffer and the 
       
   101         *                clients are provided with a typedef called 
       
   102         *                TPhCltTelephoneNumberwhich is equivalent to a 
       
   103         *                TBuf< KPhCltTelephoneNumberLength > where 
       
   104         *                KPhCltTelephoneNumberLength is defined as 100. 
       
   105         *             
       
   106         * @param aIsEmergencyNumber If ETrue, then the aNumber parameter 
       
   107         *                           was emergency number. 
       
   108         * @return Returns error code of the success of the operation.
       
   109         */
       
   110         TInt FindEmergencyPhoneNumber(
       
   111             TDes& aNumber, 
       
   112             TBool& aIsEmergencyNumber );
       
   113 
       
   114         /**
       
   115         * Initiates an emergency call.
       
   116         *
       
   117         * @param aReqStatus On return, KErrNone if the emergency call successfully reaches 
       
   118         *                   the connected state. If the call set-up fails, the function 
       
   119         *                   member will complete with an error.
       
   120         *
       
   121         * @param aNumber Emergency number to be dialed (optional).
       
   122         *                The aNumber parameter should be a buffer and the 
       
   123         *                clients are provided with a typedef called 
       
   124         *                TPhCltEmergencyNumber,which is equivalent to a 
       
   125         *                TBuf< KPhCltEmergencyNumberSize > where 
       
   126         *                KPhCltEmergencyNumberSize is defined as 100. 
       
   127         *
       
   128         *                If the aNumber parameter supplies an "empty" buffer 
       
   129         *                the call is created either dialing the default emergency 
       
   130         *                phone number or use the SET UP EMERGENCY request  
       
   131         *                that does not contain a dialling number.               
       
   132         *
       
   133         * @pre IsActive() returns EFalse, otherwise leaves with KErrInUse.
       
   134         */
       
   135         void DialEmergencyCall( TRequestStatus& aReqStatus, TDesC8& aNumber );
       
   136         
       
   137         /**
       
   138         * Cancels an emergency call.
       
   139         *
       
   140         */
       
   141         void CancelDialEmergencyCall();
       
   142         
       
   143         /**
       
   144         * Returns information whether the number specified was an emergency 
       
   145         * number and also returns the plain emergency number.
       
   146         * 
       
   147         * @param aNumber Number to be queried.aNumber might contain prefix (SS code)
       
   148         *                and/or postfix (DTMF part).
       
   149         *                The aNumber parameter should be a buffer and the 
       
   150         *                clients are provided with a typedef called 
       
   151         *                TPhCltEmergencyNumberwhich is equivalent to a 
       
   152         *                TBuf< KPhCltEmergencyNumberSize > where 
       
   153         *                KPhCltEmergencyNumberSize is defined as 100. 
       
   154         *
       
   155         * @param aMatchedEmergencyNumber Matched emergencynumber without prefix or 
       
   156         *                postfix is returned in this parameter. The aMatchedEmergencyNumber 
       
   157         *                parameter should be a buffer and the clients are
       
   158         *                provided with atypedef called TPhCltEmergencyNumber,
       
   159         *                which is equivalent to a TBuf< KPhCltEmergencyNumberSize > 
       
   160         *                where KPhCltEmergencyNumberSize is defined as 100.
       
   161         * 
       
   162         * @param aIsEmergencyNumber If ETrue, then the aNumber 
       
   163         *                           parameter included emergency number.
       
   164         *
       
   165         * @return Returns error code of the success of the operation.
       
   166         */
       
   167         TInt IsEmergencyPhoneNumber(
       
   168             const TDesC& aNumber,
       
   169             TDes& aMatchedEmergencyNumber, 
       
   170             TBool& aIsEmergencyNumber );                    
       
   171         
       
   172        private:            
       
   173            
       
   174         /**
       
   175          * Extract telephone number from string. If EFalse is returned
       
   176          * then aString does not contain valid emergency number
       
   177          * 
       
   178          * @param aString string from which those characters are removed.
       
   179          *
       
   180          * @return ETrue - aString can be emergency number and aString
       
   181          *                 contains a telephone number
       
   182          *         EFalse - aString cannot be emergency number and aString
       
   183          *                  does not contain a number that can be emergency number
       
   184          */
       
   185         TBool ExtractTelephoneNumber( TDes& aString );
       
   186         
       
   187         /**
       
   188         * Finds start of dtmf string in string.
       
   189         *
       
   190         * @param   aString      Telephone number
       
   191         *
       
   192         * @return  Index where dtmf string starts or KErrNotFound if no
       
   193         * dtmf found.
       
   194         *
       
   195         */
       
   196         TInt FindStartOfDtmfString( const TDesC& aString );
       
   197         
       
   198         /**
       
   199         * Removes CLIR ss code from beginning of the string if CLIR is
       
   200         * found from string.
       
   201         *
       
   202         * @param    aString Telephone number
       
   203         */
       
   204         void RemoveCLIR( TDes& aString );
       
   205         
       
   206         /**
       
   207          * Removes DTMF string from string.
       
   208          * 
       
   209          * @param aString Telephone number.
       
   210          */
       
   211         void RemoveDTMF( TDes& aString );
       
   212         
       
   213         /**
       
   214         * Executes checks to given phone number to find out if it is a valid 
       
   215         * emergency number. 
       
   216         *
       
   217         * @param    aString             Telephone number
       
   218         * @param    aIsEmergencyNumber  If ETrue, then the aNumber parameter 
       
   219         *                               was a valid emergency number.
       
   220         *
       
   221         * @return Returns error code of the success of the operation.
       
   222         *
       
   223         */
       
   224         TInt ValidateNumber( TDes& aString, TBool& aIsEmergencyNumber, 
       
   225                             const TBool aWriteEmergencyNumBack );
       
   226                             
       
   227                                  
       
   228 
       
   229     };
       
   230 
       
   231 #endif // RPhCltEmergencyCall_H
       
   232 
       
   233 // End of File