|
1 /* |
|
2 * Copyright (c) 2010 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: Implementation of CSsmNonCriticalSwpPolicy class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <ssm/ssmswp.h> |
|
19 #include <ssm/ssmstate.h> |
|
20 |
|
21 #include "ssmnoncriticalswppolicy.h" |
|
22 #include "ssmswp.hrh" |
|
23 #include "ssmmapperutility.h" |
|
24 #include "trace.h" |
|
25 #include "ssmsubstateext.hrh" |
|
26 |
|
27 /** |
|
28 * SWP noncritical phase policy resource file path format : "\private\<SID of SSM>\swpnoncritical\" |
|
29 */ |
|
30 _LIT( KCommandListPath, "Z:\\private\\2000D75B\\swpnoncritical\\" ); |
|
31 |
|
32 // ======== MEMBER FUNCTIONS ======== |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // CSsmNonCriticalSwpPolicy::NewL |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 EXPORT_C MSsmSwpPolicy* CSsmNonCriticalSwpPolicy::NewL() |
|
39 { |
|
40 FUNC_LOG; |
|
41 |
|
42 CSsmNonCriticalSwpPolicy* self = new( ELeave ) CSsmNonCriticalSwpPolicy; |
|
43 CleanupStack::PushL( self ); |
|
44 self->BaseConstructL(); |
|
45 CleanupStack::Pop( self ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CSsmNonCriticalSwpPolicy::~CSsmNonCriticalSwpPolicy |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CSsmNonCriticalSwpPolicy::~CSsmNonCriticalSwpPolicy() |
|
55 { |
|
56 FUNC_LOG; |
|
57 } |
|
58 |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CSsmNonCriticalSwpPolicy::GetCommandListPathL |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void CSsmNonCriticalSwpPolicy::GetCommandListPathL( TDes& aCmdListPath ) |
|
65 { |
|
66 FUNC_LOG; |
|
67 |
|
68 aCmdListPath = KCommandListPath; |
|
69 iUtil->GetCommandListPath( aCmdListPath ); |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CSsmNonCriticalSwpPolicy::TransitionAllowed |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 MSsmSwpPolicy::TResponse CSsmNonCriticalSwpPolicy::TransitionAllowed( |
|
78 const TSsmSwp& aSwp, |
|
79 const RMessagePtr2& aMessage ) |
|
80 { |
|
81 FUNC_LOG; |
|
82 INFO_2( "Requested SWP transition: 0x%08x::0x%08x", aSwp.Key(), aSwp.Value() ); |
|
83 |
|
84 TResponse response = ENotAllowed; |
|
85 if ( iUtil->CheckCaps( aMessage ) ) |
|
86 { |
|
87 TSsmState currentState; |
|
88 const TInt errorCode = GetCurrentState(currentState); |
|
89 ERROR( errorCode, "Failed to get current state" ); |
|
90 |
|
91 // this SwP transition would be allowed only once per boot(during the system startup). |
|
92 if ((KErrNone == errorCode) && (ESsmStartup == currentState.MainState()) && (aSwp.Value() == ESsmNonCriticalPhaseStarted)) |
|
93 { |
|
94 response = EAllowed; |
|
95 } |
|
96 else |
|
97 { |
|
98 INFO( "Requested SWP transition not allowed" ); |
|
99 } |
|
100 } |
|
101 else |
|
102 { |
|
103 INFO( "Capability Check Failed" ); |
|
104 } |
|
105 |
|
106 return response; |
|
107 } |
|
108 |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // CSsmNonCriticalSwpPolicy::CSsmNonCriticalSwpPolicy |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 CSsmNonCriticalSwpPolicy::CSsmNonCriticalSwpPolicy() |
|
115 { |
|
116 FUNC_LOG; |
|
117 } |