|
1 /** @file |
|
2 * Copyright (c) 2007-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: Declares storage for devices known by control point. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPCPBDEVICEREPOSITORY_H |
|
20 #define C_CUPNPCPBDEVICEREPOSITORY_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CUpnpDevice; |
|
27 |
|
28 /** |
|
29 * Storage for devices known by control point |
|
30 * |
|
31 * @lib controlpointbase.lib |
|
32 * @since S60 v5.0 |
|
33 */ |
|
34 NONSHARABLE_CLASS( CUpnpCpbDeviceRepository ) : public CBase |
|
35 { |
|
36 public: |
|
37 /** |
|
38 * Two-phased constructor |
|
39 * @since S60 v5.0 |
|
40 */ |
|
41 static CUpnpCpbDeviceRepository* CUpnpCpbDeviceRepository::NewL( |
|
42 const CDesC8Array& aTargetDeviceTypes ); |
|
43 |
|
44 /** |
|
45 * Destructor |
|
46 * @since S60 v5.0 |
|
47 */ |
|
48 ~CUpnpCpbDeviceRepository(); |
|
49 |
|
50 /** |
|
51 * Check if device type is interesting for control point |
|
52 * |
|
53 * @since S60 v5.0 |
|
54 * @param aDevice Device type that should be match |
|
55 * @return ETrue if type is correct one, EFalse if not |
|
56 */ |
|
57 TBool MatchTargetDevice(const TDesC8& aDeviceType); |
|
58 |
|
59 /** |
|
60 * Check if device is in repository |
|
61 * |
|
62 * @since S60 v5.0 |
|
63 * @param aDevice Device uuid that should be match |
|
64 * @return ETrue if device is know, EFalse if not |
|
65 */ |
|
66 TBool IsKnownDevice(const TDesC8& aDeviceUuid); |
|
67 |
|
68 /** |
|
69 * Check if device is discovered already |
|
70 * |
|
71 * @since S60 v5.0 |
|
72 * @param aDevice Device uuid that should be match |
|
73 * @return ETrue if device is know, EFalse if not |
|
74 */ |
|
75 TBool IsDiscoveredDevice(const TDesC8& aDeviceUuid); |
|
76 |
|
77 /** |
|
78 * Check if device is discovered but type is not matching |
|
79 * needed devices types |
|
80 * |
|
81 * @since S60 v5.0 |
|
82 * @param aDevice Device uuid that should be match |
|
83 * @return ETrue if device is know, EFalse if not |
|
84 */ |
|
85 TBool IsUninterestingDevice(const TDesC8& aDeviceUuid); |
|
86 |
|
87 /** |
|
88 * Check if device is unneded (type is different then needed). |
|
89 * |
|
90 * @since S60 v5.0 |
|
91 * @param aDevice Device uuid that should be match |
|
92 * @return ETrue if device is know, FALSE if not |
|
93 */ |
|
94 TBool IsUnneededDevice(const TDesC8& aDeviceUuid); |
|
95 |
|
96 /** |
|
97 * Add device to discovered device list |
|
98 * |
|
99 * @since S60 v5.0 |
|
100 * @param aDevice Target device |
|
101 * @return ETrue if device was added |
|
102 */ |
|
103 TBool AddDiscoveredDeviceL(CUpnpDevice* aDevice); |
|
104 |
|
105 /** |
|
106 * Add device to unneded device list |
|
107 * |
|
108 * @since S60 v5.0 |
|
109 * @param aDevice Target device |
|
110 * @return ETrue if device was added |
|
111 */ |
|
112 TBool AddUnneddedDeviceL(CUpnpDevice* aDevice); |
|
113 |
|
114 /** |
|
115 * Add device to incomlite root device list |
|
116 * |
|
117 * @since S60 v5.0 |
|
118 * @param aDevice Target device |
|
119 * @return ETrue if device was added |
|
120 */ |
|
121 TBool AddIncompliteDeviceL(CUpnpDevice* aDevice); |
|
122 |
|
123 /** |
|
124 * Add device to discovered device list |
|
125 * |
|
126 * @since S60 v5.0 |
|
127 * @param aDevices Target device |
|
128 */ |
|
129 void AddDiscoveredDevicesL(RPointerArray<CUpnpDevice>& aDevices); |
|
130 |
|
131 /** |
|
132 * Add device to unneded device list |
|
133 * |
|
134 * @since S60 v5.0 |
|
135 * @param aDevices Target device |
|
136 */ |
|
137 void AddUninterestingDevicesL(RPointerArray<CUpnpDevice>& aDevices); |
|
138 |
|
139 /** |
|
140 * Add device to unneded device list |
|
141 * |
|
142 * @since S60 v5.0 |
|
143 * @param aDevices Target device |
|
144 */ |
|
145 void AddUnneddedDevicesL(RPointerArray<CUpnpDevice>& aDevices); |
|
146 |
|
147 /** |
|
148 * Getter. Returns discovered device list. |
|
149 * |
|
150 * @since S60 v5.0 |
|
151 * @return List with discovered devices. |
|
152 */ |
|
153 const RPointerArray<CUpnpDevice>& DiscoveredDeviceList() const; |
|
154 |
|
155 /** |
|
156 * Getter. Returns unnedded device list. |
|
157 * |
|
158 * @since S60 v5.0 |
|
159 * @return List with unnedded devices. |
|
160 */ |
|
161 const RPointerArray<CUpnpDevice>& UnneddedDeviceList() const; |
|
162 |
|
163 /** |
|
164 * Getter. Returns uninteresting device list. |
|
165 * |
|
166 * @since S60 v5.0 |
|
167 * @return List with uninteresting devices. |
|
168 */ |
|
169 const RPointerArray<CUpnpDevice>& UninterestingDeviceList() const; |
|
170 |
|
171 /** |
|
172 * Getter. Returns incomplite root device list. |
|
173 * |
|
174 * @since S60 v5.0 |
|
175 * @return List with incomplite root devices. |
|
176 */ |
|
177 const RPointerArray<CUpnpDevice>& IncompliteDeviceList() const; |
|
178 |
|
179 /** |
|
180 * Getter. Find device in repository. |
|
181 * |
|
182 * @since S60 v5.0 |
|
183 * @return Device pointer if found. |
|
184 */ |
|
185 CUpnpDevice* FindDevice( const TDesC8& aDeviceUuid ); |
|
186 |
|
187 /** |
|
188 * Getter. Find incomplite device in repository. |
|
189 * |
|
190 * @since S60 v5.0 |
|
191 * @return Device pointer if found. |
|
192 */ |
|
193 CUpnpDevice* FindIncompliteDevice(const TDesC8& aDeviceUuid); |
|
194 |
|
195 /** |
|
196 * Remove device from all list |
|
197 * |
|
198 * @since S60 v5.0 |
|
199 * @param aDevice Target device |
|
200 */ |
|
201 void RemoveDevice( CUpnpDevice* aDevice ); |
|
202 |
|
203 /** |
|
204 * Add device incoming from SSDP layer |
|
205 * final device built from device description is synchronized with that |
|
206 * |
|
207 * @since S60 v5.0 |
|
208 * @param aDevice Target device |
|
209 */ |
|
210 TBool AddIncomingDeviceL( CUpnpDevice* aDevice ); |
|
211 |
|
212 /** |
|
213 * Remove device from incoming list |
|
214 * |
|
215 * @since S60 v5.0 |
|
216 * @param aDevice Target device |
|
217 */ |
|
218 CUpnpDevice* RemoveIncomingDevice( const TDesC8& aUuid ); |
|
219 |
|
220 /** |
|
221 * Finds root of given device among dicovered and being discovered devices |
|
222 * @since Series60 3.2 |
|
223 * @param aDeviceUuid UUID of device |
|
224 * @return Device if found or NULL |
|
225 */ |
|
226 CUpnpDevice* FindRoot( const TDesC8& aDeviceUuid ); |
|
227 |
|
228 |
|
229 private: |
|
230 /** |
|
231 * Constructor |
|
232 * @since S60 v5.0 |
|
233 */ |
|
234 CUpnpCpbDeviceRepository(); |
|
235 |
|
236 /** |
|
237 * Second phase constructor |
|
238 * @since S60 v5.0 |
|
239 */ |
|
240 void ConstructL(const CDesC8Array& aTargetDeviceTypes); |
|
241 |
|
242 private: |
|
243 |
|
244 // Target device types |
|
245 CDesC8ArrayFlat* iTargetDeviceTypes; |
|
246 // List with discovered devices (only device that match target types) |
|
247 RPointerArray<CUpnpDevice> iDiscoveredDevices; |
|
248 // List with discovered devices but not metching target types |
|
249 // As subdevices of interesting devices needs to be discovered |
|
250 RPointerArray<CUpnpDevice> iUninterestingDevices; |
|
251 // List with devices that was not discovered as type |
|
252 // is not interesting |
|
253 RPointerArray<CUpnpDevice> iUnneededDevices; |
|
254 // List with inclomplite root devices (some sub devices are |
|
255 // discovered so we need to remember also root device) |
|
256 RPointerArray<CUpnpDevice> iIncomliteRootDevices; |
|
257 // List with inclomplite root devices (some sub devices are |
|
258 // discovered so we need to remember also root device) |
|
259 RPointerArray<CUpnpDevice> iIncomingDevices; |
|
260 }; |
|
261 |
|
262 |
|
263 #endif // C_CUPNPCPBDEVICEREPOSITORY_H |