upnp/upnpstack/upnpconnectionmanagersession/inc/upnpconnectionmanagerproxy.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2005-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:  CUpnpConnectionProxy
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CUPNPCONNECTIONPROXY_H
       
    19 #define C_CUPNPCONNECTIONPROXY_H
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32base.h>
       
    23 #include <es_sock.h>
       
    24 #include <es_enum.h>
       
    25 #include <in_sock.h>
       
    26 #include "upnpconnectionmanagersession.h"
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 class CUpnpConnectionManagerNetworkEventProvider;
       
    31 class MUpnpNetworkEventObserver;
       
    32 
       
    33 /**
       
    34  * This class is a client handle to CUpnpConnectionManager.
       
    35  * One should use it rather than RUpnpConnectionManagerSession directly
       
    36  * @since S60 5.0
       
    37  */
       
    38 NONSHARABLE_CLASS( CUpnpConnectionManagerProxy ) : public CBase
       
    39     {
       
    40 public: // Constructors and destructor
       
    41 
       
    42     /**
       
    43      * Two-phased constructor.
       
    44      * @param aSocketServ Pointer to used Socket Server.
       
    45      * @param aIap the IAP ID of the connection.
       
    46      * @since Series60 3.2
       
    47      * @return A new CUpnpConnectionProxy object.
       
    48      */
       
    49     IMPORT_C static CUpnpConnectionManagerProxy* NewL( RSocketServ& aSocketServer );
       
    50 
       
    51     /**
       
    52      * Two-phased constructor.
       
    53      * @param aSocketServ Pointer to used Socket Server.
       
    54      * @param aIap the IAP ID of the connection.
       
    55      * @since Series60 3.2
       
    56      * @return A new CUpnpConnectionProxy object.
       
    57      */
       
    58     IMPORT_C static CUpnpConnectionManagerProxy* NewLC( RSocketServ& aSocketServer );
       
    59 
       
    60     /**
       
    61      * Destructor.
       
    62      * @since Series60 3.2
       
    63      */
       
    64     virtual ~CUpnpConnectionManagerProxy();
       
    65 
       
    66 public: // New functions
       
    67 
       
    68     /**
       
    69      * After call of this method the caller is sure that
       
    70      * RConnection was started.
       
    71      */
       
    72     IMPORT_C TInt EnsureStart();
       
    73 
       
    74     /**
       
    75      * Returns RConnection instance.
       
    76      * Leaves only if ensure start wasn't invoked, and
       
    77      * internal EnsureStart call fail
       
    78      */
       
    79     IMPORT_C RConnection& ConnectionL();
       
    80 
       
    81     /**
       
    82      * Returns active connection IAP.
       
    83      */
       
    84     IMPORT_C TInt ActiveIap();
       
    85 
       
    86     /**
       
    87      * Returns active connection IP address.
       
    88      */
       
    89     IMPORT_C TInetAddr LocalAddress();
       
    90 
       
    91     /**
       
    92      * Subscribes for network events nitifications.
       
    93      */
       
    94     IMPORT_C void SubscribeForNetworkEventsL( MUpnpNetworkEventObserver *aObserver );
       
    95     
       
    96     /**
       
    97      * Static function for querying of active connection IAP
       
    98      * without creating new object (it is created and closed internally)
       
    99      * @return KErrNontFound if connection is not started else active IAP,
       
   100      *         in case of Always ask (IAP=0) IAP selected by user (IAP>0)
       
   101      */
       
   102     IMPORT_C static TInt GetActiveIapL();
       
   103     
       
   104 private:
       
   105 
       
   106     /**
       
   107      * Constructor.
       
   108      * @since Series60 3.2
       
   109      */
       
   110     CUpnpConnectionManagerProxy();
       
   111 
       
   112     /**
       
   113      * By default Symbian 2nd phase constructor is private.
       
   114      * @param aSocketServ Pointer to used Socket Server.
       
   115      */
       
   116     void ConstructL( RSocketServ& aSocketServer );
       
   117 
       
   118     /**
       
   119      * Attaches connection
       
   120      */
       
   121     TInt Attach( TInt aAccessPoint );
       
   122 
       
   123     /**
       
   124      * Checks whether EnsureStart has been invoked.
       
   125      */
       
   126     TBool IsStarted();
       
   127 
       
   128 private: 
       
   129 
       
   130     // Connection
       
   131     RConnection iConnection;
       
   132 
       
   133     // Session to ConnectionManager in MessageHandler process
       
   134     RUpnpConnectionManagerSession iConnectionManagerSession;
       
   135 
       
   136     // Active Iap variable.
       
   137     TInt iActiveIap;
       
   138     
       
   139     // Class used for network event notifications.
       
   140     CUpnpConnectionManagerNetworkEventProvider *iNetworkEventProvider;
       
   141     };
       
   142 
       
   143 #endif // C_CUPNPCONNECTIONPROXY_H
       
   144 
       
   145 // End of file