sysstatemgmt/systemstateplugins/adptplugin/inc/stateadaptationref.h
changeset 0 4e1aa6a622a0
child 41 c87e5f80c17d
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __STATEADAPTATIONREF_H__
       
    17 #define __STATEADAPTATIONREF_H__
       
    18 
       
    19 #include <ssm/ssmadaptation.h>
       
    20 
       
    21 /**
       
    22 
       
    23  CStateAdaptationRefEventHandler acts as a dummy event notifier in the absence of Cooperating system
       
    24 
       
    25   *********Need for the class*********
       
    26   
       
    27   On a device when NotifyCoopSysEvent is called, State Adaptation Plug-in would request for notification 
       
    28   from the Cooperating System for 'aEvent'.
       
    29   
       
    30   On HRP/Techview,the reference implementation has to complete the notification request with KErrNotSupported
       
    31   since there is no Cooperating System on HRP/Techview.
       
    32   
       
    33   But this implementation will cause problems in the following scenario.
       
    34   
       
    35   *********Problem*********
       
    36   
       
    37   This API is used by Adaptation server to service the clients which request for notifications .
       
    38   This is done as follows.
       
    39   
       
    40   Adaptation server always tracks the events by calling NotifyCoopSysEvent during the whole life time 
       
    41   of the server.It first calls this API in the startup of the server and subsequently whenever an event 
       
    42   is notified(by completing the call NotifyCoopSysEvent) adaptation server resubmits the request 
       
    43   by calling NotifyCoopSysEvent .
       
    44   
       
    45   In this context if NotifyCoopSysEvent just completes the message immediately this results in a infinite 
       
    46   loop and starves other active objects with same priority.
       
    47   
       
    48   This makes testing of Adaptation servers notification functionality impossible on HRP/Techview.
       
    49   
       
    50   *********Solution*********
       
    51 
       
    52   To solve this problem NotifyCoopSysEvent will forward the notification request from adaptation server 
       
    53   to the test active object(CStateAdaptationRefEventHandler) which has lesser priority compared to 
       
    54   adaptation servers active object.
       
    55   In the RunL() method of this test active object the notification request is completed.  
       
    56   
       
    57   This will delay the completion of notification message till all the servers active objects 
       
    58   which have higher priority are run.
       
    59   
       
    60   @internalComponent
       
    61   
       
    62    
       
    63 */
       
    64 
       
    65 
       
    66 class CStateRefAdaptationTimer : public CTimer
       
    67 	{
       
    68 public:
       
    69 	CStateRefAdaptationTimer();
       
    70 	~CStateRefAdaptationTimer();
       
    71 	static CStateRefAdaptationTimer* NewL();
       
    72 	void After(TTimeIntervalMicroSeconds32 aCancelDelay, TRequestStatus& aStatus);	
       
    73 	void DoCancel();
       
    74 private:
       
    75 	virtual void RunL();
       
    76 
       
    77 private:
       
    78 	TRequestStatus* iReqStatus;
       
    79 	};
       
    80 
       
    81 
       
    82 // C Class
       
    83 class CStateAdaptationRef : public CBase, public MStateAdaptation
       
    84 	{
       
    85 public:
       
    86 	static CStateAdaptationRef* NewL();
       
    87 	~CStateAdaptationRef();
       
    88 
       
    89 	//from MStateAdaptation
       
    90 	void Release();
       
    91 	void RequestCoopSysStateChange(TSsmState aState, TRequestStatus& aStatus);
       
    92 	void RequestCoopSysSelfTest(TRequestStatus& aStatus);
       
    93 	void RequestCoopSysPerformRestartActions(TInt aReason, TRequestStatus& aStatus);
       
    94 	void RequestCoopSysPerformShutdownActions(TInt aReason, TRequestStatus& aStatus);
       
    95 	void RequestCoopSysPerformRfsActions(TSsmRfsType aRfsType, TRequestStatus& aStatus);
       
    96 	void RequestCancel();
       
    97 
       
    98 	void NotifyCoopSysEvent(TDes8& aEvent, TRequestStatus& aStatus);
       
    99 	void NotifyCancel();
       
   100 
       
   101 private:
       
   102 	CStateAdaptationRef();
       
   103 	void ConstructL();
       
   104 
       
   105 private:
       
   106 	CStateRefAdaptationTimer* iTimer;	
       
   107 	};
       
   108 
       
   109 
       
   110 
       
   111 
       
   112 
       
   113 #endif // __STATEADAPTATIONREF_H__