|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * Listens Commands via Mediator component. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPHONEMEDIATORCOMMANDLISTENER_H |
|
21 #define CPHONEMEDIATORCOMMANDLISTENER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <coemain.h> |
|
26 #include <MediatorCommandResponder.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MPhoneMenuAndCbaEvents; |
|
30 class MPhoneEngineMessageSender; |
|
31 class MPEEngineInfo; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 class CPhoneMediatorCommandListener : public CCoeStatic, |
|
36 public MMediatorCommandObserver |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * First call initializes the singleton object. Subsequent calls return |
|
42 * instance. |
|
43 * @param None. |
|
44 * @return Pointer to the one and only instance of Phone Mediator |
|
45 * Command Listener -object. |
|
46 */ |
|
47 static CPhoneMediatorCommandListener* Instance(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CPhoneMediatorCommandListener(); |
|
53 |
|
54 /** |
|
55 * Initializes command listener singleton for use. Mandotory to call before first use. |
|
56 * @param aMenuAndCbaEventHandler - Interface to receive converted events. |
|
57 * @param aMessageSender - Interface for sending messages |
|
58 * @param aEngineInfo - Interface for setting Phone Engine specific information |
|
59 */ |
|
60 void Initialize( |
|
61 MPhoneMenuAndCbaEvents* aMenuAndCbaEventHandler, |
|
62 MPhoneEngineMessageSender* aMessageSender, |
|
63 MPEEngineInfo* aEngineInfo ); |
|
64 |
|
65 /** |
|
66 * A Mediator Service command. |
|
67 * |
|
68 * @since Series 60 3.1 |
|
69 * @param aDomain The identifier of the domain |
|
70 * @param aCategory The identifier of the category. |
|
71 * @param aCommandId The identifier of the command. |
|
72 * @param aVersion The version information of the command. |
|
73 * @param aData The parameters of the command. |
|
74 * @return None. |
|
75 */ |
|
76 void MediatorCommandL( TUid aDomain, |
|
77 TUid aCategory, |
|
78 TInt aCommandId, |
|
79 TVersion aVersion, |
|
80 const TDesC8& aData ); |
|
81 |
|
82 /** |
|
83 * Cancel a Mediator Service command. |
|
84 * |
|
85 * @since Series 60 3.1 |
|
86 * @param aDomain The identifier of the domain |
|
87 * @param aCategory The identifier of the category. |
|
88 * @param aCommandId The identifier of the command. |
|
89 * @return None. |
|
90 */ |
|
91 void CancelMediatorCommand( TUid aDomain, |
|
92 TUid aCategory, |
|
93 TInt aCommandId ); |
|
94 |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * Protected constructor because of Singleton Pattern |
|
100 */ |
|
101 CPhoneMediatorCommandListener(); |
|
102 |
|
103 /** |
|
104 * Instantiates this class and returns a pointer to us |
|
105 */ |
|
106 static CPhoneMediatorCommandListener* NewL(); |
|
107 |
|
108 /** |
|
109 * By default EPOC constructor is private. |
|
110 */ |
|
111 void ConstructL(); |
|
112 |
|
113 /** |
|
114 * Registers all Mediator Commands that this class listens to. |
|
115 */ |
|
116 void RegisterMediatorCommandsL(); |
|
117 |
|
118 /** |
|
119 * Registers Audio Mediator Commands. |
|
120 */ |
|
121 void RegisterAudioMediatorCommands(); |
|
122 |
|
123 /** |
|
124 * Registers Generic Mediator Commands. |
|
125 */ |
|
126 void RegisterGenericMediatorCommands(); |
|
127 |
|
128 /** |
|
129 * Registers Video Telephony specific Mediator Commands. |
|
130 */ |
|
131 void RegisterVideoTelephonyMediatorCommands(); |
|
132 |
|
133 /** |
|
134 * Sends Mediator Response for the received Command. |
|
135 * @param aDomain - The identifier of the domain. |
|
136 * @param aCategory - The identifier of the category. |
|
137 * @param aCommandId - The identifier of the command. |
|
138 */ |
|
139 void SendResponse( TUid aDomain, TUid aCategory, TInt aCommandId ); |
|
140 |
|
141 /** |
|
142 * Handles Video Telephony specific Mediator Commands. |
|
143 * @param aCommandId - The identifier of the command |
|
144 * @param aVersion - Used interface version |
|
145 */ |
|
146 void VideoTelephonyCommandL( TInt aCommandId, TVersion aVersion ); |
|
147 |
|
148 /** |
|
149 * Handles Audio specific Mediator Commands. |
|
150 * @param aCommandId - The identifier of the command |
|
151 * @param aVersion - Used interface version |
|
152 */ |
|
153 void AudioCommandL( TInt aCommandId, TVersion aVersion ); |
|
154 |
|
155 /** |
|
156 * Handles generic Mediator Commands. |
|
157 * @param aCommandId - The identifier of the command |
|
158 * @param aVersion - Used interface version |
|
159 */ |
|
160 void GenericCommandL( TInt aCommandId, TVersion aVersion ); |
|
161 |
|
162 |
|
163 private: |
|
164 |
|
165 // For mapping commands to CBA and Menu selections |
|
166 MPhoneMenuAndCbaEvents* iMenuAndCbaHandler; |
|
167 |
|
168 // For mapping commands to Phone Engine messages |
|
169 MPhoneEngineMessageSender* iMessageSender; |
|
170 |
|
171 // For setting needed Phone Engine information |
|
172 MPEEngineInfo* iEngineInfo; |
|
173 |
|
174 CMediatorCommandResponder* iCommandResponder; |
|
175 MediatorService::RCommandList iVideoTelCommands; |
|
176 MediatorService::RCommandList iAudioCommands; |
|
177 MediatorService::RCommandList iGenericCommands; |
|
178 }; |
|
179 |
|
180 #endif // CPHONEMEDIATORCOMMANDLISTENER_H |
|
181 |
|
182 // End of File |