|
1 /* |
|
2 * Copyright (c) 2007 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: Header file for the UpnpCommand plugin implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef UPNP_COMMAND_IMPLEMENTATION_H |
|
20 #define UPNP_COMMAND_IMPLEMENTATION_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "upnpcommandcons.h" |
|
24 #include "upnpcommand.h" |
|
25 #include "upnptaskhandler.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CUpnpFilePipe; |
|
29 class CUpnpCommandParameters; |
|
30 class CUpnpTask; |
|
31 class CUpnpNoteHandler; |
|
32 class MUpnpCommandCallback; |
|
33 |
|
34 /** |
|
35 * This class provides an easy to use ECom plugin interface to access the |
|
36 * features of the Upnp Framework. |
|
37 */ |
|
38 class CUpnpCommandImplementation : public CUpnpCommand, |
|
39 public MUpnpTaskHandler |
|
40 { |
|
41 public: // Instantiation methods |
|
42 |
|
43 /** |
|
44 * Creates an instance of UpnpCommand implementation. Upnp Fw |
|
45 * resources are not allowated yet at this point. |
|
46 * |
|
47 * @return instance of this class. |
|
48 */ |
|
49 static CUpnpCommandImplementation* NewL(); |
|
50 |
|
51 public: // Business logic methods, from CUpnpCommand |
|
52 |
|
53 /** |
|
54 * Checks if the command is available for execution. |
|
55 */ |
|
56 TBool IsAvailableL(); |
|
57 |
|
58 /** |
|
59 * Checks if given command is available for execution. |
|
60 */ |
|
61 TBool IsAvailableL( UpnpCommand::TUpnpCommandId aCommandId ); |
|
62 |
|
63 /** |
|
64 * Allocates the Upnp Framework resources. |
|
65 */ |
|
66 void AllocateResourcesL(); |
|
67 |
|
68 /** |
|
69 * Releases the Upnp Framework resources. Stops command execution if |
|
70 * it is ongoing. |
|
71 */ |
|
72 void ReleaseResources(); |
|
73 |
|
74 /** |
|
75 * Executes the command. If Upnp Framework resources are not yet |
|
76 * allocated, they are allocated. |
|
77 */ |
|
78 void ExecuteL(); |
|
79 |
|
80 /** |
|
81 * Sets a parameter. |
|
82 * |
|
83 * @param aParamType the parameter category |
|
84 * @param aParamValue value of the parameter |
|
85 */ |
|
86 void SetParameterL( UpnpCommand::TUpnpParameterType aParamType, |
|
87 const TDesC& aParamValue ); |
|
88 |
|
89 /** |
|
90 * Returns a parameter |
|
91 * |
|
92 * @param aParamType (UpnpCommand::TUpnpParameterType) |
|
93 * @return value of the parameter |
|
94 */ |
|
95 const TDesC& Parameter( |
|
96 UpnpCommand::TUpnpParameterType aParamType ); |
|
97 |
|
98 /** |
|
99 * Resets parameteres. |
|
100 */ |
|
101 void ResetParameters(); |
|
102 |
|
103 /** |
|
104 * Pushes one file into the file pipe. |
|
105 * |
|
106 * @param aFilename (const TDesC&) parameter value |
|
107 */ |
|
108 void PushFileL( const TDesC& aFilename ); |
|
109 |
|
110 /** |
|
111 * number of files in the file pipe |
|
112 * |
|
113 * @return number of files in the pipe |
|
114 */ |
|
115 TInt FileCount(); |
|
116 |
|
117 /** |
|
118 * Returns a file in the file pipe |
|
119 * |
|
120 * @param aIndex index of the file in pipe |
|
121 * @return the file reference |
|
122 */ |
|
123 const TDesC& File( TInt aIndex ); |
|
124 |
|
125 /** |
|
126 * Resets all files in the pipe |
|
127 */ |
|
128 void ResetFiles(); |
|
129 |
|
130 /** |
|
131 * Returns the state of the command. |
|
132 * |
|
133 * @return UpnpCommand::TUpnpCommandState the state |
|
134 */ |
|
135 UpnpCommand::TUpnpCommandState State(); |
|
136 |
|
137 public: // From MUpnpTaskHandler |
|
138 |
|
139 /** |
|
140 * Destroys the ongoing task. |
|
141 */ |
|
142 void DestroyTask(); |
|
143 |
|
144 public: // Methods for UpnpCommand internal use, from CUpnpCommand |
|
145 |
|
146 /** |
|
147 * Sets the command ID. Leaves with KErrNotSupported if the given |
|
148 * is not supported. |
|
149 * |
|
150 * @param aCommandId (UpnpCommand::TUpnpCommandId) the command ID |
|
151 */ |
|
152 void SetCommandIdL( UpnpCommand::TUpnpCommandId aCommandId ); |
|
153 |
|
154 /** |
|
155 * Sets the observer. |
|
156 * |
|
157 * @param aCallback the callback interface |
|
158 */ |
|
159 void SetObserver( MUpnpCommandCallback* aCallback ); |
|
160 |
|
161 private: // Private construction methods |
|
162 |
|
163 /** |
|
164 * Perform the first phase of two phase construction. |
|
165 */ |
|
166 CUpnpCommandImplementation(); |
|
167 |
|
168 /** |
|
169 * Destructor. |
|
170 */ |
|
171 virtual ~CUpnpCommandImplementation(); |
|
172 |
|
173 /** |
|
174 * Perform the second phase of two phase construction. |
|
175 */ |
|
176 void ConstructL(); |
|
177 |
|
178 private: // methods for own use |
|
179 |
|
180 TBool IsUpnpConfiguredL(); |
|
181 |
|
182 private: // Data members |
|
183 |
|
184 /** |
|
185 * The Id of the command. |
|
186 */ |
|
187 UpnpCommand::TUpnpCommandId iCommandId; |
|
188 |
|
189 /** |
|
190 * The state of the command. |
|
191 */ |
|
192 UpnpCommand::TUpnpCommandState iState; |
|
193 |
|
194 /** |
|
195 * Pointer to the file pipe. Owned. |
|
196 */ |
|
197 CUpnpFilePipe* iFilePipe; |
|
198 |
|
199 /** |
|
200 * Pointer to the command parameters. Owned. |
|
201 */ |
|
202 CUpnpCommandParameters* iParameters; |
|
203 |
|
204 /** |
|
205 * Pointer to the note handler. Owned. |
|
206 */ |
|
207 CUpnpNoteHandler* iNoteHandler; |
|
208 |
|
209 /** |
|
210 * Pointer to the command task. Owned. |
|
211 */ |
|
212 CUpnpTask* iTask; |
|
213 |
|
214 /** |
|
215 * A boolean value indicating the state of the DRM note showing. |
|
216 * The note is shown only once per session. |
|
217 */ |
|
218 TBool iDrmNoteShown; |
|
219 |
|
220 }; |
|
221 |
|
222 #endif // UPNP_COMMAND_IMPLEMENTATION_H |
|
223 |
|
224 // End of File |