sipvoipprovider/inc/svpemergencyconnection.h
branchRCL_3
changeset 22 d38647835c2e
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Provides connection for emergency call when necessary
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_SVPEMERGENCYCONNECTION_H
       
    20 #define C_SVPEMERGENCYCONNECTION_H
       
    21 
       
    22 
       
    23 #include <es_sock.h>                // For RSocketServ, RConnection
       
    24 #include <commdbconnpref.h>         // For TCommDbConnPref
       
    25 #include <comms-infras/es_config.h> // For TSipServerAddrBuf
       
    26 
       
    27 #include "svpemergencyconnectionobserver.h"
       
    28 #include "svputdefs.h"
       
    29 
       
    30 /**
       
    31  *  Connection for emergency call.
       
    32  *  Asynchronous services: IAP and SNAP connect, retrieval of used IAP ID of 
       
    33  *  SNAP connection, and retrieval of SIP proxy address.
       
    34  *
       
    35  *  @lib svp.dll
       
    36  *  @since S60 v3.2
       
    37  */
       
    38 class CSVPEmergencyConnection : public CActive
       
    39     {
       
    40 
       
    41 public:
       
    42 
       
    43     /** Request type */
       
    44     enum TSVPRequestType
       
    45         {
       
    46         ESVPNone, 
       
    47         ESVPSnapConnect, 
       
    48         ESVPConnect, 
       
    49         ESVPSipProxyAddress,
       
    50         ESVPSipDomainAddress
       
    51         };
       
    52 
       
    53     /**
       
    54      * Two-phased constructor.
       
    55      * @param aPriority Active object priority
       
    56      * @param aObserver Observer
       
    57      */
       
    58     static CSVPEmergencyConnection* NewL( 
       
    59         TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver );
       
    60     
       
    61     static CSVPEmergencyConnection* NewLC( 
       
    62         TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver );
       
    63     
       
    64     /**
       
    65      * Destructor.
       
    66      */
       
    67     virtual ~CSVPEmergencyConnection();
       
    68 
       
    69     /**
       
    70      * Connects with SNAP ID
       
    71      *
       
    72      * @since S60 v3.2
       
    73      * @param aSnapId SNAP ID
       
    74      */
       
    75     void ConnectWithSnapIdL( TUint32 aSnapId );
       
    76 
       
    77     /**
       
    78      * Returns the IAP ID used by the SNAP connection
       
    79      *
       
    80      * @since S60 v3.2
       
    81      * @param aIapId IAP ID 
       
    82      * @return Error code
       
    83      */
       
    84     TInt IapId( TUint32& aIapId );
       
    85 
       
    86     /**
       
    87      * Connects with IAP ID
       
    88      *
       
    89      * @since S60 v3.2
       
    90      * @param aIapId IAP ID 
       
    91      */
       
    92     void ConnectL( TUint32 aIapId );
       
    93 
       
    94     /**
       
    95      * Requests for SIP proxy address
       
    96      *
       
    97      * @since S60 v3.2
       
    98      * @param aIapId IAP ID
       
    99      */
       
   100     void RequestSipProxyAddressL( TUint32 aIapId );
       
   101 
       
   102 private:
       
   103 
       
   104     CSVPEmergencyConnection( 
       
   105         TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver );
       
   106 
       
   107     void ConstructL();
       
   108     
       
   109 // from base class CActive
       
   110 
       
   111     void DoCancel();
       
   112     
       
   113     void RunL();
       
   114     
       
   115     TInt RunError( TInt aError );
       
   116     
       
   117     void RequestSipServerDomainL();
       
   118     
       
   119 private: // data
       
   120 
       
   121     /**
       
   122      * Observer
       
   123      */
       
   124     MSVPEmergencyConnectionObserver& iObserver;
       
   125 
       
   126     /**
       
   127      * Request type
       
   128      */
       
   129     TSVPRequestType iRequestType;
       
   130 
       
   131     /**
       
   132      * Snap connection preference
       
   133      */    
       
   134     TCommSnapPref iSnapConnPref;
       
   135 
       
   136     /**
       
   137      * Connection preference overrider
       
   138      */
       
   139     TCommDbConnPref iConnPref;
       
   140     
       
   141     /**
       
   142      * SIP server address buffer
       
   143      */
       
   144     TSipServerAddrBuf iSipServerAddrBuf;
       
   145     
       
   146     /**
       
   147      * SIP server domain name buffer
       
   148      */
       
   149     TSipServerDomainBuf iSipServerDomainBuf;
       
   150 
       
   151     /**
       
   152      * Connection
       
   153      */
       
   154     RConnection iConnection;
       
   155 
       
   156     /**
       
   157      * Socket server
       
   158      */
       
   159     RSocketServ iSocketServer;
       
   160 
       
   161 private:
       
   162 
       
   163     // For testing
       
   164     SVP_UT_DEFS
       
   165 
       
   166     };
       
   167 
       
   168 #endif // C_SVPEMERGENCYCONNECTION_H