browser/engine/inc/ConnectionManager.h
changeset 0 c316ab048e9d
equal deleted inserted replaced
-1:000000000000 0:c316ab048e9d
       
     1 /*
       
     2  * Name        : ConnectionManager.h
       
     3  * Description : Manages application connection 
       
     4  * Project     : This file is part of OpenMAR, an Open Mobile Augmented Reality browser
       
     5  * Website     : http://OpenMAR.org
       
     6  *
       
     7  * Copyright (c) 2010 David Caabeiro
       
     8  *
       
     9  * All rights reserved. This program and the accompanying materials are made available 
       
    10  * under the terms of the Eclipse Public License v1.0 which accompanies this 
       
    11  * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
       
    12  *
       
    13  */
       
    14 
       
    15 #ifndef CONNECTIONMANAGER_H_
       
    16 #define CONNECTIONMANAGER_H_
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <es_sock.h>
       
    20 #include <rconnmon.h>
       
    21 
       
    22 class CSettingManager;
       
    23 
       
    24 /**
       
    25  * @brief Notifies the status of the started connection
       
    26  */
       
    27 class MConnectionManager
       
    28 {
       
    29 public:
       
    30     virtual void ConnectionStartedL(TInt aError) = 0;
       
    31 };
       
    32 
       
    33 /**
       
    34  * @brief Initializes a working connection
       
    35  * 
       
    36  */
       
    37 class CConnectionManager : public CActive, public MConnectionMonitorObserver
       
    38 {
       
    39 public:
       
    40     static CConnectionManager* NewL(MConnectionManager& aObserver, CSettingManager& aSetting);
       
    41     ~CConnectionManager();
       
    42 
       
    43 protected:
       
    44     CConnectionManager(MConnectionManager& aObserver, CSettingManager& aSetting);
       
    45     void ConstructL();
       
    46 
       
    47     // From CActive
       
    48     void RunL();
       
    49     void DoCancel();
       
    50 
       
    51     // From MConnectionMonitorObserver
       
    52     void EventL(const CConnMonEventBase& aEvent);
       
    53 
       
    54 private:
       
    55     MConnectionManager& iObserver;
       
    56     CSettingManager& iSetting;
       
    57 
       
    58     RSocketServ iSocketServ;
       
    59     RConnection iConnection;
       
    60     RConnectionMonitor iMonitor;
       
    61 
       
    62     TUint32 iIapId;
       
    63 };
       
    64 
       
    65 #endif