|
1 /* |
|
2 * Copyright (c) 2005 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: An implementation class for issuing Mediator Service commands. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MEDIATORCOMMANDINITIATORBODY_H |
|
19 #define MEDIATORCOMMANDINITIATORBODY_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "MediatorCommandInitiator.h" |
|
25 #include "MediatorServerClient.h" |
|
26 |
|
27 // CLASS DECLARATION |
|
28 |
|
29 /** |
|
30 * A class used to issue Mediator Service commands. |
|
31 * |
|
32 * @lib MediatorClient.lib |
|
33 * @since S60 3.1 |
|
34 */ |
|
35 NONSHARABLE_CLASS(CMediatorCommandInitiatorBody) : public CActive |
|
36 { |
|
37 public: // Constructors and destructor |
|
38 |
|
39 /** |
|
40 * Two-phased constructor. |
|
41 * |
|
42 * @param aObserver command response observer |
|
43 * @return a new MMediatorCommandResponseObserver instance. |
|
44 */ |
|
45 static CMediatorCommandInitiatorBody* NewL( |
|
46 MMediatorCommandResponseObserver* aObserver ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CMediatorCommandInitiatorBody(); |
|
52 |
|
53 public: // Command initiating |
|
54 |
|
55 /** |
|
56 * Issue a Mediator Service command. |
|
57 * |
|
58 * @since S60 3.1 |
|
59 * @param aDomain The identifier of the domain |
|
60 * @param aCategory The identifier of the category. |
|
61 * @param aCommandId The identifier of the command. |
|
62 * @param aVersion The version information for the command. |
|
63 * @param aData The parameters of the command. |
|
64 * @return TInt an error code |
|
65 */ |
|
66 TInt IssueCommand( TUid aDomain, |
|
67 TUid aCategory, |
|
68 TInt aCommandId, |
|
69 TVersion aVersion, |
|
70 const TDesC8& aData ); |
|
71 |
|
72 /** |
|
73 * Cancel a Mediator Service command. |
|
74 * |
|
75 * @since S60 3.1 |
|
76 * @param aDomain The identifier of the domain |
|
77 * @param aCategory The identifier of the category. |
|
78 * @param aCommandId The identifier of the command. |
|
79 * @return None. |
|
80 */ |
|
81 void CancelCommand( TUid aDomain, |
|
82 TUid aCategory, |
|
83 TInt aCommandId ); |
|
84 |
|
85 protected: // Functions from base classes |
|
86 |
|
87 /** |
|
88 * From CActive::RunL |
|
89 */ |
|
90 void RunL(); |
|
91 |
|
92 /** |
|
93 * From CActive::DoCancel() |
|
94 */ |
|
95 void DoCancel(); |
|
96 |
|
97 private: // new functions |
|
98 /** |
|
99 * Start to wait command response asynchronously |
|
100 * |
|
101 * @since S60 3.1 |
|
102 * @return None. |
|
103 */ |
|
104 void WaitForCommandResponse(); |
|
105 |
|
106 /** |
|
107 * Re-init return data buffer |
|
108 * |
|
109 * @since S60 3.1 |
|
110 * @param aSize size of the buffer |
|
111 * @return None. |
|
112 */ |
|
113 void ResetDataBufferL( TInt aSize ); |
|
114 |
|
115 private: |
|
116 |
|
117 /** |
|
118 * C++ default constructor. |
|
119 * |
|
120 * @param aObserver command response observer |
|
121 */ |
|
122 CMediatorCommandInitiatorBody( |
|
123 MMediatorCommandResponseObserver* aObserver ); |
|
124 |
|
125 /** |
|
126 * By default Symbian 2nd phase constructor is private. |
|
127 */ |
|
128 void ConstructL(); |
|
129 |
|
130 private: // Data |
|
131 |
|
132 // A session class to mediator server |
|
133 RMediatorServer iMediatorServer; |
|
134 |
|
135 // Command response observer |
|
136 MMediatorCommandResponseObserver* iObserver; |
|
137 |
|
138 // Buffer for Command parameter data |
|
139 HBufC8* iCommandData; |
|
140 TPtr8 iCommandDataPtr; |
|
141 |
|
142 // For category information |
|
143 TMediatorCategory iCategory; |
|
144 TMediatorCategoryRetBuffer iCategoryBuffer; |
|
145 |
|
146 // For status information |
|
147 TInt iResponseStatus; |
|
148 TPckg<TInt> iStatusBuffer; |
|
149 |
|
150 // For command information |
|
151 MediatorService::TCommand iCommand; |
|
152 TCommandRetBuffer iCommandBuffer; |
|
153 |
|
154 }; |
|
155 |
|
156 #endif // MEDIATORCOMMANDINITIATORBODY_H |
|
157 |
|
158 // End of File |