sipplugins/sippsystemstatemonitor/inc/sipdevicestateaware.h
changeset 0 307788aac0a8
child 9 1e1cc61f56c3
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Class aware of Device System State Changes and perform processing
       
    15  *                  related to profile registration/deregistration
       
    16  *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef SIPDEVICESYSTEMSTATEAWARE_H_
       
    21 #define SIPDEVICESYSTEMSTATEAWARE_H_
       
    22 
       
    23 // INCLUDES
       
    24 #include <ssm/ssmstateawaresession.h>
       
    25 #include <sipsystemstatemonitor.h>
       
    26 #include <e32base.h>
       
    27 //Forward Declarations
       
    28 class MSipSystemStateObserver;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 /**
       
    32 * The default implementation for SIP DeviceSystemStateAware Class.
       
    33 */
       
    34 class CSipDeviceStateAware: public CActive
       
    35     {
       
    36     public:
       
    37         
       
    38          //Constructors and Destructor
       
    39         static CSipDeviceStateAware* NewL();
       
    40         
       
    41         /**
       
    42          * SIP sub-components should call this function in order
       
    43          * to get notified in case of system state changes
       
    44          */
       
    45 		void AddObserverL( MSipSystemStateObserver& aObserver );
       
    46 		
       
    47 		/**
       
    48 		 * SIP sub-components should call this function in order
       
    49          * to stop themselves getting notified for system state changes 
       
    50 		 */
       
    51         void RemoveObserver( MSipSystemStateObserver& aObserver );
       
    52         
       
    53         /**
       
    54          * In case if profile de-registration could not be completed by
       
    55          * observers, TimerExpiredL will call this function to indicate 
       
    56          * that event processing is complete and further notification will
       
    57          * be given to the System State Manager. 
       
    58          */
       
    59 		void EventProcessingCompleted();
       
    60 		
       
    61 		/**
       
    62 		 * In case if the profiles de-registration is completed within the 
       
    63 		 * timer started, this function will be called from Observers to indicate
       
    64 		 * that the  procession has been done. This function notifies to the SSM
       
    65 		 * that event processing is done.
       
    66 		 */
       
    67 		void EventProcessingCompleted(MSipSystemStateObserver& aObserver);
       
    68 		
       
    69 		/**
       
    70 		 * When the Notification for Offline is received, timer will be started for
       
    71 		 * a given time, after which the notification of the event will be given
       
    72 		 * back to the System State Manager
       
    73 		 */
       
    74 		static TInt TimerExpired(TAny* aSelf);
       
    75         
       
    76         //Destructor
       
    77         ~CSipDeviceStateAware();
       
    78     private:
       
    79         //Default Construtor
       
    80         CSipDeviceStateAware();
       
    81         //Second Phase Constructor
       
    82         void ConstructL();
       
    83         //From CActive
       
    84         void RunL();
       
    85         TInt RunError( TInt aError );
       
    86         void DoCancel();
       
    87         
       
    88         /**
       
    89          * This function will notify all the observers when the
       
    90          * state of the phone changes
       
    91          */
       
    92         void NotifyObservers(CSipSystemStateMonitor::TSystemState aState) const;
       
    93     private:
       
    94         
       
    95         //List of observers who have opted for system state changes
       
    96         RPointerArray<MSipSystemStateObserver> iObservers;
       
    97         //SystemAwareSession object used for monitoring system state
       
    98         RSsmStateAwareSession iStateAwareSession;
       
    99         //Variable depicting state of the phone
       
   100         CSipSystemStateMonitor::TSystemState iState;
       
   101 		//Timer after which Acknowledgement of Notification will be given
       
   102 		CPeriodic* iGuardTimer;
       
   103 		//Keeps the count of observers
       
   104 		TInt iCount;
       
   105     private: // For testing purposes        
       
   106         friend class CSipDeviceStateAwareTest;
       
   107     };
       
   108 
       
   109 #endif /* SIPDEVICESYSTEMSTATEAWARE_H_ */