sysstatemgmt/ssmpolicyplugins/ssmstatepolicybase/inc/ssmstatepolicybase.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2009 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: Declaration of CSsmStatePolicyBase class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_SSMSTATEPOLICYBASE_H
       
    19 #define C_SSMSTATEPOLICYBASE_H
       
    20 
       
    21 #include <ssm/ssmstatepolicy.h>
       
    22 
       
    23 #include "ssmpolicybase.h"
       
    24 
       
    25 /**
       
    26 *  Base class for SSM state policy plugins
       
    27 *
       
    28 */
       
    29 class CSsmStatePolicyBase : public CSsmPolicyBase, public MSsmStatePolicy
       
    30     {
       
    31 
       
    32 public:
       
    33 
       
    34     /**
       
    35     * First phase constructor.
       
    36     */
       
    37     IMPORT_C CSsmStatePolicyBase();
       
    38 
       
    39     /**
       
    40     * Destructor.
       
    41     */
       
    42     IMPORT_C virtual ~CSsmStatePolicyBase();
       
    43 
       
    44 protected: // From MSsmStatePolicy
       
    45 
       
    46 	/**
       
    47     * This function is guaranteed to be called before this System State Policy
       
    48     * is used. It is intended for e.g. opening resource files or if you need to
       
    49     * initialize hardware or talk to a domestic OS.
       
    50 	*/
       
    51     IMPORT_C virtual void Initialize( TRequestStatus& aStatus );
       
    52 
       
    53 	/**
       
    54     * Used to inform the policy DLL to Cancel an asynchronous Initialize
       
    55     * operation. Typically used to inform a MCommandListProvider that any open
       
    56     * resource files should be closed.
       
    57 	*/
       
    58     IMPORT_C virtual void InitializeCancel();
       
    59 
       
    60 	/**
       
    61     * Used to determine if an incoming request should be accepted or rejected.
       
    62 	*
       
    63 	* @param aRequest Contains information about the new request
       
    64 	* @param aCurrent Contains NULL or the first accepted but not yet completed transition request
       
    65 	* @param aQueued Contains NULL or a second accepted but not yet started transition request
       
    66     * @param aMessage Message sent by SSM server, used to check if the client has 'ECapabilityPowerMgmt'
       
    67 	* @return The decision
       
    68 	*/
       
    69     IMPORT_C virtual TResponse TransitionAllowed(
       
    70         const TSsmStateTransition& aRequest,
       
    71         TSsmStateTransition const* aCurrent,
       
    72         TSsmStateTransition const* aQueued,
       
    73         const RMessagePtr2& aMessage );
       
    74 
       
    75 	/**
       
    76     * Used to create the command list associated with a minor state transition.
       
    77 	*
       
    78     * @param aState	Contains the state that identifies the command list to create
       
    79 	* @param aReason Contains the reason as given by the request
       
    80 	* @param aStatus to complete when the operation has finished
       
    81 	*/
       
    82     IMPORT_C virtual void PrepareCommandList(
       
    83         TSsmState aState,
       
    84         TInt aReason,
       
    85         TRequestStatus& aStatus );
       
    86 
       
    87 	/**
       
    88     * Used to inform the policy DLL that the pending asynchronous
       
    89     * PrepareCommandList operation needs to be cancelled.
       
    90 	*/
       
    91     IMPORT_C virtual void PrepareCommandListCancel();
       
    92 
       
    93 	/**
       
    94     * Used to retrieve the command list once the  PrepareCommandList has
       
    95     * completed. Ownership of the returned command list is transferred to the
       
    96     * caller.
       
    97     *
       
    98     * @return The command list created during the preceding PrepareCommandList step
       
    99 	*/
       
   100     IMPORT_C virtual CSsmCommandList* CommandList();
       
   101 
       
   102 	/**
       
   103     * It is expected that Release will usually just call "delete this" on the
       
   104     * object, but this will depend on the implementation of each policy.
       
   105 	*/
       
   106     IMPORT_C virtual void Release();
       
   107 
       
   108 protected:
       
   109 
       
   110 	/**
       
   111     * Used to determine if an incoming request to change state should be accepted or rejected.
       
   112 	*/
       
   113     virtual TBool IsAllowedTargetState( const TSsmStateTransition& aRequest ) const = 0;
       
   114 
       
   115 	/**
       
   116     * On return contains target substate - modified or requested.
       
   117 	*/
       
   118     virtual TUint16 TargetSubState( const TUint16 aRequestedSubState ) = 0;
       
   119 
       
   120     };
       
   121 
       
   122 #endif // C_SSMSTATEPOLICYBASE_H