|
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: Java RemCon Observer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef JAVAREMCONMANAGER_H |
|
20 #define JAVAREMCONMANAGER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <remconcoreapitargetobserver.h> |
|
24 #include "javaremconobserver.h" |
|
25 |
|
26 class CRemConInterfaceSelector; |
|
27 class CRemConCoreApiTarget; |
|
28 |
|
29 |
|
30 /** |
|
31 * Class provides common access to CRemConInterfaceSelector for Java components |
|
32 * |
|
33 * Java RunTime needs to listen to various events like volume key press, |
|
34 * media key press and so on. For this purpose, various modules |
|
35 * in Java middleware register with CRemConCoreApiTarget to get events |
|
36 * to the observer MRemConCoreApiTargetObserver. |
|
37 * For this to happen, a target session has to be opened to RemCon, |
|
38 * which is done via CRemConInterfaceSelector::OpenTargetL(). At present, |
|
39 * whichever module wants it (say MMAPI, LCDUI etc) goes ahead and registers |
|
40 * by calling CRemConInterfaceSelector::OpenTargetL(). However when someother |
|
41 * module also calls the same, the OpenTargetL() returns KErrInUse as in |
|
42 * Java all modules are in one single process and one process can have |
|
43 * only one target session open to RemCon. This means that only one of the |
|
44 * required modules will get the events needed. |
|
45 * |
|
46 * Class provides common access to the target session to RemCon |
|
47 * which can be used by any module in Java. |
|
48 * The user of CRemConCoreApiTarget will need to use this class for the purpose |
|
49 * instead of creating themselves. |
|
50 * |
|
51 * @lib javaremconobserver |
|
52 * @since S60 v3.2 |
|
53 */ |
|
54 class CJavaRemConManager : public CBase |
|
55 { |
|
56 public: |
|
57 |
|
58 IMPORT_C static CJavaRemConManager* NewL(); |
|
59 |
|
60 IMPORT_C static CJavaRemConManager* NewLC(); |
|
61 |
|
62 virtual ~CJavaRemConManager(); |
|
63 |
|
64 public: |
|
65 |
|
66 /** |
|
67 * Set Observer |
|
68 * |
|
69 * @since S60 v3.2 |
|
70 * @param aObserver Set observer, not owned |
|
71 */ |
|
72 IMPORT_C void SetObserverL(CJavaRemConObserver &aObserver); |
|
73 |
|
74 /** |
|
75 * Remove Observer |
|
76 * |
|
77 * @since S60 v3.2 |
|
78 * @param aObserver Removed observer, not owned |
|
79 */ |
|
80 IMPORT_C void RemoveObserver(CJavaRemConObserver &aObserver); |
|
81 |
|
82 private: |
|
83 |
|
84 CJavaRemConManager(); |
|
85 |
|
86 void ConstructL(); |
|
87 |
|
88 private: // data |
|
89 |
|
90 /** |
|
91 * Is observer set? |
|
92 */ |
|
93 TBool iSet; |
|
94 TThreadId iCreatorThreadId; |
|
95 }; |
|
96 |
|
97 |
|
98 #endif // JAVAREMCONMANAGER_H |