sipplugins/sippsystemstatemonitor/inc/sipsnapavailabilitymonitor.h
branchRCL_3
changeset 4 c2e8c8b73582
parent 0 307788aac0a8
equal deleted inserted replaced
3:dc4cddf5f2f8 4:c2e8c8b73582
    17 
    17 
    18 #ifndef CSIPSNAPAVAILABILITYMONITOR_H
    18 #ifndef CSIPSNAPAVAILABILITYMONITOR_H
    19 #define CSIPSNAPAVAILABILITYMONITOR_H
    19 #define CSIPSNAPAVAILABILITYMONITOR_H
    20 
    20 
    21 // INCLUDES
    21 // INCLUDES
    22 #include "MSystemStateConnUsagePermissionObserver.h"
       
    23 #include <sipsystemstatemonitor.h>
    22 #include <sipsystemstatemonitor.h>
    24 #include <rconnmon.h>
    23 #include <rconnmon.h>
    25 #include <e32base.h>
    24 #include <e32base.h>
    26 
    25 
    27 // FORWARD DECLARATIONS
    26 // FORWARD DECLARATIONS
    31 /**
    30 /**
    32 * A class for monitoring the availability of a SNAP.
    31 * A class for monitoring the availability of a SNAP.
    33 */
    32 */
    34 class CSipSnapAvailabilityMonitor : 
    33 class CSipSnapAvailabilityMonitor : 
    35     public CActive, 
    34     public CActive, 
    36     public MConnectionMonitorObserver,
    35     public MConnectionMonitorObserver
    37     public MSystemStateConnUsagePermissionObserver
       
    38     {
    36     {
    39     public:    // Constructors and destructor
    37     public:    // Constructors and destructor
    40 
    38 
    41         /**
    39         /**
    42         * Static constructor
    40         * Static constructor
    45         * @param aObserver observer to be notified about SNAP availability
    43         * @param aObserver observer to be notified about SNAP availability
    46         * @return An initialized instance of this class.
    44         * @return An initialized instance of this class.
    47         */
    45         */
    48         static CSipSnapAvailabilityMonitor* NewL( 
    46         static CSipSnapAvailabilityMonitor* NewL( 
    49             TUint32 aSnapId,
    47             TUint32 aSnapId,
    50             TBool aPermissionToUseNetwork,
       
    51             MSipSystemStateObserver& aObserver );
    48             MSipSystemStateObserver& aObserver );
    52 
    49 
    53         /**
    50         /**
    54         * Static constructor
    51         * Static constructor
    55         * @param aSnapId the ID of the SNAP to be monitored
    52         * @param aSnapId the ID of the SNAP to be monitored
    56         * @param aPermissionToUseNetwork the current permission to use network
    53         * @param aPermissionToUseNetwork the current permission to use network
    57         * @param aObserver observer to be notified about SNAP availability        
    54         * @param aObserver observer to be notified about SNAP availability        
    58         * @return An initialized instance of this class.
    55         * @return An initialized instance of this class.
    59         */
    56         */
    60         static CSipSnapAvailabilityMonitor* NewLC( 
    57         static CSipSnapAvailabilityMonitor* NewLC( 
    61             TUint32 aSnapId,
    58             TUint32 aSnapId,           
    62             TBool aPermissionToUseNetwork,
       
    63             MSipSystemStateObserver& aObserver );
    59             MSipSystemStateObserver& aObserver );
    64 
    60 
    65         /// Destructor
    61         /// Destructor
    66         ~CSipSnapAvailabilityMonitor();
    62         ~CSipSnapAvailabilityMonitor();
    67 
    63 
    71 
    67 
    72         void DoCancel();
    68         void DoCancel();
    73 
    69 
    74     public: // From MConnectionMonitorObserver
    70     public: // From MConnectionMonitorObserver
    75 
    71 
    76         void EventL( const CConnMonEventBase &aConnMonEvent );
    72         void EventL( const CConnMonEventBase &aConnMonEvent ); 
    77 
    73          
    78     public: // from MSystemStateConnUsagePermissionObserver
       
    79     
       
    80         void UsagePermissionChanged( TBool aPermissionToUse, TInt aError );
       
    81         
       
    82     public: // New functions
    74     public: // New functions
    83     
    75     
    84         TUint32 SnapId() const;
    76         TUint32 SnapId() const;
    85 
    77 
    86         CSipSystemStateMonitor::TSnapAvailability SnapAvailability() const;
    78         CSipSystemStateMonitor::TSnapAvailability SnapAvailability() const;
    91 
    83 
    92         TBool HasObservers() const;
    84         TBool HasObservers() const;
    93 
    85 
    94     private: // Constructors
    86     private: // Constructors
    95 
    87 
    96         CSipSnapAvailabilityMonitor( 
    88         CSipSnapAvailabilityMonitor( TUint32 aSnapId );
    97             TUint32 aSnapId,
       
    98             TBool aPermissionToUseNetwork );
       
    99             
    89             
   100         void ConstructL( MSipSystemStateObserver& aObserver );
    90         void ConstructL( MSipSystemStateObserver& aObserver );
   101         
    91         
   102     private: // Private methods
    92     private: // Private methods
   103 
    93 
   105             const TConnMonSNAPInfo& aSnapInfo, 
    95             const TConnMonSNAPInfo& aSnapInfo, 
   106             TUint32 aSnapId ) const;
    96             TUint32 aSnapId ) const;
   107             
    97             
   108         void NotifyObservers() const;
    98         void NotifyObservers() const;
   109         
    99         
   110         TBool SetCurrentState( 
   100         TBool SetCurrentState( TBool aSnapAvailable );        
   111             TBool aPermissionToUseNetwork,
       
   112             TBool aSnapAvailable );        
       
   113 
   101 
   114         TBool CanSnapBeUsed() const;
   102         TBool CanSnapBeUsed() const;
   115 
   103 
   116     private: // Data
   104     private: // Data
   117 
   105 
   118         TUint32 iSnapId;
   106         TUint32 iSnapId;
   119         TBool iPermissionToUseNetwork;
       
   120         TBool iSnapAvailable;
   107         TBool iSnapAvailable;
   121         // Observers not owned
   108         // Observers not owned
   122         RPointerArray<MSipSystemStateObserver> iObservers; 
   109         RPointerArray<MSipSystemStateObserver> iObservers; 
   123         /// Connection monitor session. Owned.
   110         /// Connection monitor session. Owned.
   124         RConnectionMonitor iConnMon;
   111         RConnectionMonitor iConnMon;