|
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 __SSMSWPREQUESTHANDLER_H__ |
|
17 #define __SSMSWPREQUESTHANDLER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <ssm/ssmswppolicy.h> |
|
21 |
|
22 class TSsmSwp; |
|
23 class CSsmSwpTransitionScheduler; |
|
24 class MSsmSwpPolicyResolverProxy; |
|
25 class MCleSessionProxy; |
|
26 |
|
27 /** |
|
28 This helper Interface can be used for testing or to monitor the progress of the tranisitons |
|
29 by wrapping the scheduler and registering the wrapper class as a monitor. |
|
30 |
|
31 @internalComponent |
|
32 @released |
|
33 |
|
34 */ |
|
35 class MSwpHandlerMonitor |
|
36 { |
|
37 public: |
|
38 virtual void SwpRequestMade(const TSsmSwp& aRequest) = 0; |
|
39 }; |
|
40 |
|
41 /** |
|
42 The handler class is responsible for receiving requests, seeking approval and then scheduling |
|
43 them to run according to the current strategy. |
|
44 The current strategy is fixed in this implementation (this could change in future). |
|
45 The strategy is to queue all requests to run sequencially using a transition scheduler. |
|
46 @internalComponent |
|
47 @released |
|
48 */ |
|
49 class CSsmSwpRequestHandler : public CBase |
|
50 { |
|
51 |
|
52 public: // methods |
|
53 static CSsmSwpRequestHandler* NewL(); |
|
54 static CSsmSwpRequestHandler* NewLC(); |
|
55 ~CSsmSwpRequestHandler(); |
|
56 |
|
57 void SubmitRequestL(const TSsmSwp& aRequest); |
|
58 void SubmitRequestL(const TSsmSwp& aRequest, const RMessage2& aMessage); |
|
59 void Cancel(CSession2* aSession); |
|
60 |
|
61 inline CSsmSwpTransitionScheduler& SwpTransitionScheduler() const {return *iSwpTransitionScheduler;} |
|
62 |
|
63 void SetSwpHandlerMonitor(MSwpHandlerMonitor* aMonitor); |
|
64 void SetSwpPolicyResolverProxy(MSsmSwpPolicyResolverProxy* aPolicyResolverProxy); |
|
65 void SetCleSessionProxy(MCleSessionProxy* aCleSessionProxy); |
|
66 void PerformCommandListValidation(TBool aSetting); |
|
67 #ifdef _DEBUG |
|
68 void CleanupSwpTransitionScheduler(); |
|
69 #endif |
|
70 |
|
71 private: // methods |
|
72 CSsmSwpRequestHandler(); // only accessible from factory methods |
|
73 void ConstructL(); |
|
74 void DoSubmitRequestL(const TSsmSwp& aRequest, const RMessage2* aMessage); |
|
75 |
|
76 void NotifyRequestMade(const TSsmSwp& aRequest); |
|
77 |
|
78 private: // members |
|
79 |
|
80 /** the scheduler that hold pending requests */ |
|
81 CSsmSwpTransitionScheduler* iSwpTransitionScheduler; |
|
82 |
|
83 /** Optional Monitor handling functions */ |
|
84 MSwpHandlerMonitor* iSwpHandlerMonitor; |
|
85 MSsmSwpPolicyResolverProxy* iSwpPolicyResolverProxy; |
|
86 MCleSessionProxy* iCleSessionProxy; |
|
87 TBool iPerformCommandListValidation; |
|
88 }; |
|
89 |
|
90 #endif |