upnpavcontroller/upnpavcontrollerclient/inc/upnpavcontrolleractive.h
changeset 0 7f85d04be362
child 38 5360b7ddc251
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 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:      AO for monitoring device events
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef C_UPNPAVCONTROLLERACTIVE_H
       
    25 #define C_UPNPAVCONTROLLERACTIVE_H
       
    26 
       
    27 // INCLUDE FILES
       
    28 #include <e32base.h>
       
    29 #include "upnpavcontroller.h"
       
    30 
       
    31 #include "upnpconnectionmonitorobserver.h"
       
    32 #include "upnpavcontrollerclient.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class MUPnPAVDeviceObserver;
       
    36 
       
    37 class CUPnPAVBrowsingSessionImpl;
       
    38 class CUPnPAVRenderingSessionImpl;
       
    39 class CUPnPAVDeviceActive;
       
    40 class CUPnPAVConnectionActive;
       
    41 class MUPnPFileDownloadSession;
       
    42 class MUPnPFileUploadSession;
       
    43 class CUPnPFileUploadSessionImpl;
       
    44 class CUPnPFileDownloadSessionImpl;
       
    45 
       
    46 /**
       
    47  *  Implements the AV Controller interface
       
    48  *
       
    49  *  This class implements the AV Controller interface. Provides methods to
       
    50  *  get devices and to start and stop rendering and browsing sessions.
       
    51  *
       
    52  *  @lib upnpavcontrollerclient.lib
       
    53  *  @since S60 v3.1
       
    54  */
       
    55 class CUPnPAVControllerActive : public CActive,
       
    56                                 public MUPnPAVController,
       
    57                                 public MUPnPConnectionMonitorObserver
       
    58     {
       
    59 
       
    60 private:
       
    61 
       
    62     /**
       
    63      * Release (delete) state. Declares state variables to determine if
       
    64      * deletion is safe.
       
    65      */    
       
    66     enum TReleaseState
       
    67         {
       
    68         EStateReleasable = 0,
       
    69         EStateWLANLost,
       
    70         EStateWaitingForRelease
       
    71         };
       
    72 
       
    73 public:
       
    74 
       
    75     /**
       
    76      * Static constructor
       
    77      *
       
    78      * @param nonr
       
    79      * @return a new av controller instance
       
    80      */
       
    81     static CUPnPAVControllerActive* NewL();
       
    82 
       
    83     /**
       
    84      * Static constructor
       
    85      *
       
    86      * @param nonr
       
    87      * @return a new av controller instance
       
    88      */    
       
    89     static CUPnPAVControllerActive* NewLC();
       
    90        
       
    91     /**
       
    92      * Destructor. Ensures safe deletion (also during WLAN disconnection).
       
    93      */    
       
    94     virtual void Release();
       
    95     
       
    96     /**
       
    97      * Destructor
       
    98      * DEPRACATED, usage of Release() recommended. Will be removed in the
       
    99      * future. Safe deletion is not guaranteed.
       
   100      */    
       
   101     virtual ~CUPnPAVControllerActive();
       
   102     
       
   103 private:
       
   104 
       
   105     /**
       
   106      * 2nd phase construct
       
   107      */    
       
   108     CUPnPAVControllerActive();    
       
   109 
       
   110     /**
       
   111      * 2nd phase construct
       
   112      */        
       
   113     void ConstructL();
       
   114     
       
   115 protected: // From CActive
       
   116 
       
   117     void RunL();
       
   118     
       
   119     void DoCancel();
       
   120     
       
   121     TInt RunError( TInt aError );
       
   122 
       
   123 protected: // From MUPnPAVController
       
   124 
       
   125     /**
       
   126      * See upnpavcontroller.h
       
   127      */
       
   128     void SetDeviceObserver( MUPnPAVDeviceObserver& aObserver );
       
   129 
       
   130     /**
       
   131      * See upnpavcontroller.h
       
   132      */
       
   133     void RemoveDeviceObserver();
       
   134 
       
   135     /**
       
   136      * See upnpavcontroller.h
       
   137      */
       
   138     MUPnPAVDeviceObserver* DeviceObserver();
       
   139 
       
   140     /**
       
   141      * See upnpavcontroller.h
       
   142      */
       
   143     CUpnpAVDeviceList* GetMediaServersL();
       
   144 
       
   145     /**
       
   146      * See upnpavcontroller.h
       
   147      */
       
   148     CUpnpAVDeviceList* GetMediaRenderersL();
       
   149     
       
   150     /**
       
   151      * See upnpavcontroller.h
       
   152      */
       
   153     MUPnPAVBrowsingSession& StartBrowsingSessionL(
       
   154         const CUpnpAVDevice& aDevice );
       
   155 
       
   156     /**
       
   157      * See upnpavcontroller.h
       
   158      */
       
   159     void StopBrowsingSession( MUPnPAVBrowsingSession& aSession );
       
   160     
       
   161     /**
       
   162      * See upnpavcontroller.h
       
   163      */
       
   164     MUPnPAVRenderingSession& StartRenderingSessionL(
       
   165         const CUpnpAVDevice& aDevice );
       
   166     
       
   167     /**
       
   168      * See upnpavcontroller.h
       
   169      */
       
   170     void StopRenderingSession( MUPnPAVRenderingSession& aSession );
       
   171 
       
   172     /**
       
   173      * See upnpavcontroller.h
       
   174      */
       
   175     MUPnPFileUploadSession& StartUploadSessionL(
       
   176         const CUpnpAVDevice& aDevice );
       
   177     
       
   178     /**
       
   179      * See upnpavcontroller.h
       
   180      */
       
   181     void StopUploadSession( MUPnPFileUploadSession& aSession );    
       
   182 
       
   183     /**
       
   184      * See upnpavcontroller.h
       
   185      */
       
   186     MUPnPFileDownloadSession& StartDownloadSessionL(
       
   187         const CUpnpAVDevice& aDevice );
       
   188     
       
   189     /**
       
   190      * See upnpavcontroller.h
       
   191      */
       
   192     void StopDownloadSession( MUPnPFileDownloadSession& aSession );
       
   193     
       
   194 protected: // From CUPnPConnectionMonitorObserver
       
   195 
       
   196     void ConnectionLost();    
       
   197 
       
   198 private:
       
   199     
       
   200     MUPnPAVDeviceObserver*                      iDeviceObserver; // not owned
       
   201     
       
   202     CUPnPAVConnectionActive*                    iConnectionActive; // owned
       
   203     
       
   204     RUPnPAVControllerClient                     iServer;
       
   205     
       
   206     RPointerArray<CUPnPAVBrowsingSessionImpl>   iBrowsingSessions;
       
   207     
       
   208     RPointerArray<CUPnPAVRenderingSessionImpl>  iRenderingSessions;
       
   209 
       
   210     RPointerArray<CUPnPFileUploadSessionImpl>   iUploadSessions;
       
   211     
       
   212     RPointerArray<CUPnPFileDownloadSessionImpl> iDownloadSessions;
       
   213     
       
   214     TInt                                        iRespBufSize;           
       
   215     TPckg<TInt>                                 iRespBufSizePkg;
       
   216     
       
   217     TAVControllerDeviceDiscovery                iDiscovered;
       
   218     TPckg<TAVControllerDeviceDiscovery>         iDiscoveredPkg;
       
   219     
       
   220     TBool iAlive;
       
   221     
       
   222     CActiveSchedulerWait                        iWait;
       
   223     
       
   224     TReleaseState                               iReleaseState;
       
   225 
       
   226     };
       
   227 
       
   228 #endif // C_UPNPAVCONTROLLERACTIVE_H