sysstatemgmt/systemstatemgr/dompolicy/src/domainpolicy2.cpp
changeset 76 cb32bcc88bad
parent 0 4e1aa6a622a0
child 77 8a984d260a2d
--- a/sysstatemgmt/systemstatemgr/dompolicy/src/domainpolicy2.cpp	Wed Sep 29 15:13:21 2010 +0300
+++ b/sysstatemgmt/systemstatemgr/dompolicy/src/domainpolicy2.cpp	Fri Oct 08 14:33:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -15,6 +15,9 @@
 
 #include "ssmdomaindefs.h"
 #include "ssmsubstates.hrh"
+#ifdef SYMBIAN_INCLUDE_APP_CENTRIC
+#include "ssmstates.hrh"
+#endif //SYMBIAN_INCLUDE_APP_CENTRIC
 
 #ifdef __WINS__
 const TInt KStateTransitionTimeout = 30000000; /* 30 seconds */
@@ -22,6 +25,10 @@
 const TInt KStateTransitionTimeout = 10000000; /* 10 seconds */
 #endif
 
+#ifdef SYMBIAN_INCLUDE_APP_CENTRIC
+const TInt KStateDeferredLimit = 1; /* 1 time */
+const TInt KMemberTimeout = 5; /* 5msec */
+#endif //SYMBIAN_INCLUDE_APP_CENTRIC
 /*
 Domain specification and policy for the startup domain hierarchy
 */
@@ -38,10 +45,22 @@
 		{ KSM2UiServicesDomain3,		KSM2AppServicesDomain4,		_INIT_SECURITY_POLICY_PASS,	ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
 		{ KSM2UiApplicationDomain3,		KSM2UiServicesDomain3,		_INIT_SECURITY_POLICY_PASS,	ESsmStartupSubStateUndefined, 	KStateTransitionTimeout },
 		// end of array marker
-		{ KDmIdNone,	KDmIdNone,	_INIT_SECURITY_POLICY_PASS,				0,			0		}
+		TDM_DOMAIN_SPEC_END
 	};
 
+#ifdef SYMBIAN_INCLUDE_APP_CENTRIC
+/**
+ * Note that the transition monitor feature is enabled for states added to StateSpecification array only.
+ */
+static const SDmStateSpecV1 StateSpecification[]=
+    {
+        {(ESsmShutdown << 16 | ESsmShutdownSubStateCritical), KMemberTimeout, KStateDeferredLimit, ETransitionFailureUsePolicyFromOrdinal3},
+        {(ESsmShutdown << 16 | ESsmShutdownSubStateNonCritical), KMemberTimeout, KStateDeferredLimit, ETransitionFailureUsePolicyFromOrdinal3}
+           
+    };
 
+
+#endif //SYMBIAN_INCLUDE_APP_CENTRIC
 /*
 Note that the _INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData) is not used for the root domain, since this refers to the capabilities of
 the SSA components connecting to the Start-up Domain Hierarchy. No capabilities are required by SSA components to attach to the Start-up Domain Hierarchy.
@@ -100,3 +119,43 @@
 	return KErrNone;
 	}
 
+/**
+Retrieves the state specification array.
+The domain manager retrieves the StateSpecification array to read the state for which the transition
+monitoring feature has to be enabled.
+This should be present in the oridinal4 of the domainpolicy def file.
+
+@param aPtr  Will have the state specification structure used in the array .
+@param aNumElements Will hold the number of elements in the array.
+
+@return will return the version of the domain policy if the feature is enabled or else returns KErrNotSupported.
+ */
+#ifdef SYMBIAN_INCLUDE_APP_CENTRIC
+EXPORT_C  TInt DmPolicy::GetStateSpec(TAny*& aPtr, TUint& aNumElements)
+    {
+    TInt version = KErrNotSupported;
+    aPtr = (TAny*) StateSpecification;
+    aNumElements = sizeof(StateSpecification)/sizeof(SDmStateSpecV1);    
+    version = KSDmStateSpecV1;
+    return version;    
+    }
+#else
+EXPORT_C  TInt DmPolicy::GetStateSpec(TAny*& aPtr, TUint& aNumElements)
+    {
+    aPtr = NULL;
+    aNumElements = 0;
+    return KErrNotSupported;  
+    }
+#endif //SYMBIAN_INCLUDE_APP_CENTRIC
+
+/**
+Defines the function type for a static function that is implemented by
+a device's domain policy DLL at ordinal 5. 
+The domain manager uses this function to release the state specification returned by ordinal 4. 
+The implementation may be empty and simply return if no release action needs 
+to be taken.
+ */
+EXPORT_C void DmPolicy::ReleaseStateSpec(TAny* /*aStateSpec*/)
+    {
+    }
+