|
1 /* |
|
2 * Copyright (c) 2006-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: file sharing engine active object class definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __UPNPFILESHARINGENGINEAO_H__ |
|
24 #define __UPNPFILESHARINGENGINEAO_H__ |
|
25 |
|
26 |
|
27 // Include Files |
|
28 #include <e32base.h> |
|
29 #include <badesca.h> //for CDesCArray |
|
30 #include <upnpmediaserverclient.h> |
|
31 #include "upnpcontentserverclient.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CUPnPFileSharingEngine; |
|
35 class CUPnPIconConfigurator; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 /** |
|
39 * Active object class for file sharing |
|
40 * Handles starting and stopping of filesharing and upload listener |
|
41 * @lib upnpapplicationengine.lib |
|
42 * @since S60 3.1 |
|
43 */ |
|
44 NONSHARABLE_CLASS( CUPnPFileSharingEngineAO ): public CActive |
|
45 { |
|
46 |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * C++ default constructor. |
|
51 * @since S60 3.1 |
|
52 * @param aEngine File sharing engine |
|
53 * @param aContentServer Handle to upnpcontentserver |
|
54 */ |
|
55 CUPnPFileSharingEngineAO( |
|
56 CUPnPFileSharingEngine& aEngine, |
|
57 RUpnpContentServerClient& aContentServer ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CUPnPFileSharingEngineAO(); |
|
63 |
|
64 private: // From CActive |
|
65 |
|
66 /** |
|
67 * Function is called when active request is ready |
|
68 * @since S60 3.1 |
|
69 */ |
|
70 void RunL(); |
|
71 |
|
72 /** |
|
73 * Handles a leave occurring in the request completion event handler |
|
74 * @since S60 3.1 |
|
75 * @param aError The leave code |
|
76 */ |
|
77 TInt RunError( TInt aError ); |
|
78 |
|
79 /** |
|
80 * Cancels active request |
|
81 * @since S60 3.1 |
|
82 */ |
|
83 void DoCancel(); |
|
84 |
|
85 public: // new functions |
|
86 |
|
87 /** |
|
88 * Starts file sharing process |
|
89 * @since S60 3.1 |
|
90 * @param aState ETrue to enable sharing, otherwise EFalse |
|
91 */ |
|
92 void SetSharingStateL( TBool aState ); |
|
93 |
|
94 /** |
|
95 * Gets file sharing state from local MediaServer |
|
96 * @since S60 3.1 |
|
97 * @return ETrue if sharing is ON otherwise EFalse |
|
98 */ |
|
99 TBool SharingStateL(); |
|
100 |
|
101 /** |
|
102 * Set the internal state of class in case connection is lost |
|
103 * @since S60 3.1 |
|
104 */ |
|
105 void ConnectionLost(); |
|
106 |
|
107 /** |
|
108 * Check that there is enough disk space in c drive |
|
109 * @since S60 3.1 |
|
110 * @return EFalse if there is no disk space |
|
111 */ |
|
112 TBool HasDiskSpace(); |
|
113 |
|
114 /** |
|
115 * Inform that settings of mediaserver icon is complete |
|
116 * @since S60 3.2 |
|
117 * @param aError Error code of the operation |
|
118 */ |
|
119 void SetIconComplete( TInt aError ); |
|
120 |
|
121 private: |
|
122 |
|
123 /** |
|
124 * Open connection to media server |
|
125 * @since S60 3.1 |
|
126 */ |
|
127 TInt OpenMediaServer(); |
|
128 |
|
129 /** |
|
130 *Enables upnp security |
|
131 */ |
|
132 void EnableUpnpSecurityL(); |
|
133 |
|
134 /** |
|
135 * Checks whether mediaserver icons need to be configured |
|
136 */ |
|
137 void CheckMediaserverIconsL(); |
|
138 |
|
139 private: // Data |
|
140 |
|
141 /** |
|
142 * file sharing engine |
|
143 */ |
|
144 CUPnPFileSharingEngine& iEngine; |
|
145 |
|
146 /** |
|
147 * Content server session handle |
|
148 */ |
|
149 RUpnpContentServerClient& iContentServer; |
|
150 |
|
151 /** |
|
152 * mediaserver session handle |
|
153 */ |
|
154 RUpnpMediaServerClient iMediaServer; |
|
155 |
|
156 /** |
|
157 * Internal state |
|
158 */ |
|
159 enum TState |
|
160 { |
|
161 ENotActive, |
|
162 EStartSharing, |
|
163 EStopSharing, |
|
164 ECheckIcon, |
|
165 EWaitSetConMonStateTrue, |
|
166 EWaitSetConMonStateFalse |
|
167 }; |
|
168 TState iState; |
|
169 |
|
170 /** |
|
171 * Cached value of sharing state |
|
172 */ |
|
173 enum TUpnpVisibility |
|
174 { |
|
175 EUnknown = 0, |
|
176 EOnline, |
|
177 EOffline |
|
178 }; |
|
179 TUpnpVisibility iVisibility; |
|
180 |
|
181 /** |
|
182 * handle add icons |
|
183 * owned |
|
184 */ |
|
185 CUPnPIconConfigurator* iIconConfigurator; |
|
186 |
|
187 }; |
|
188 |
|
189 #endif // __UPNPFILESHARINGENGINEAO_H__ |
|
190 |
|
191 // End of file |