|
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 simple device description process. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPCPBEMBEDDEDDEVICEDESCRIPTION_H |
|
20 #define C_CUPNPCPBEMBEDDEDDEVICEDESCRIPTION_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "upnpcpbdevicedescription.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CUpnpDevice; |
|
29 class CUpnpContentHandlersController; |
|
30 class CUpnpCpbDeviceRepository; |
|
31 |
|
32 /** |
|
33 * Class handling discovery process of simple device. |
|
34 * It is checking only services of device. Subdevices are not processed. |
|
35 * |
|
36 * @lib controlpointbase.lib |
|
37 * @since S60 v5.0 |
|
38 */ |
|
39 NONSHARABLE_CLASS( CUpnpCpbEmbeddedDeviceDescription ) : public CUpnpCpbDeviceDescription |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Two-phased constructor |
|
44 * @since S60 v5.0 |
|
45 */ |
|
46 static CUpnpCpbEmbeddedDeviceDescription* |
|
47 CUpnpCpbEmbeddedDeviceDescription::NewL(MUpnpCpbHttpMessageController& aMessanger, |
|
48 CUpnpCpbDeviceRepository& aRepository); |
|
49 |
|
50 /** |
|
51 * Start processing device. |
|
52 * |
|
53 * @since S60 v5.0 |
|
54 * @param aDevice Device that should be discovered |
|
55 * @return 0 - if discovery process is finished correctly |
|
56 * 1 - if discovery was not finished correctly |
|
57 * 2 - if discovery is in progress |
|
58 */ |
|
59 TInt DiscoverDeviceL(CUpnpDevice* aDevice); |
|
60 |
|
61 /** |
|
62 * Function processing service description. |
|
63 * |
|
64 * @since S60 v5.0 |
|
65 * @param aMsg Service message |
|
66 * @return 0 - if discovery process is finished correctly |
|
67 * 1 - if discovery was not finished correctly |
|
68 * 2 - if discovery is in progress |
|
69 */ |
|
70 TInt ServiceDescriptionL(CUpnpHttpMessage* aMsg); |
|
71 |
|
72 /** |
|
73 * Append discovered devices to array |
|
74 * |
|
75 * @since S60 v5.0 |
|
76 * @param aArray array where devices should be appended |
|
77 */ |
|
78 void GetDiscoveredDeviceL(RPointerArray<CUpnpDevice>& aArray, TBool aRemove = EFalse ); |
|
79 |
|
80 /** |
|
81 * Append not discovered (does not match the type) devices to array |
|
82 * |
|
83 * @since S60 v5.0 |
|
84 * @param aArray array where devices should be appended |
|
85 */ |
|
86 void GetUnnededDeviceL(RPointerArray<CUpnpDevice>& aArray, TBool aRemove = EFalse ); |
|
87 |
|
88 /** |
|
89 * Append discovered but not metching target types devices to array |
|
90 * |
|
91 * @since S60 v5.0 |
|
92 * @param aArray array where devices should be appended |
|
93 */ |
|
94 void GetUninterestingDeviceL(RPointerArray<CUpnpDevice>& aArray, TBool aRemove = EFalse ); |
|
95 |
|
96 /** |
|
97 * Destructor |
|
98 * @since S60 v5.0 |
|
99 */ |
|
100 ~CUpnpCpbEmbeddedDeviceDescription(); |
|
101 |
|
102 private: |
|
103 /** |
|
104 * Constructor |
|
105 * @since S60 v5.0 |
|
106 */ |
|
107 CUpnpCpbEmbeddedDeviceDescription(MUpnpCpbHttpMessageController& aMessanger, |
|
108 CUpnpCpbDeviceRepository& aRepository); |
|
109 |
|
110 /** |
|
111 * Parses service description and add it to device |
|
112 * |
|
113 * @since S60 v5.0 |
|
114 * @param aMsg Service message |
|
115 * @return 0 - if discovery process is finished correctly |
|
116 * 1 - if discovery was not finished correctly |
|
117 * 2 - if discovery is in progress |
|
118 */ |
|
119 TInt ProcessServiceDescriptionL(CUpnpDevice* aDevice, CUpnpHttpMessage* aMsg); |
|
120 |
|
121 /** |
|
122 * Second phase constructor |
|
123 * @since S60 v5.0 |
|
124 */ |
|
125 void ConstructL(); |
|
126 |
|
127 /** |
|
128 * Build interesting device list |
|
129 * @since S60 v5.0 |
|
130 * @param aDevice Target device |
|
131 */ |
|
132 void BuildDevicesListL(CUpnpDevice* aDevice); |
|
133 |
|
134 /** |
|
135 * Get first service description |
|
136 * @since S60 v5.0 |
|
137 * @param aDevice Target device |
|
138 */ |
|
139 void GetServiceDescriptionL(CUpnpDevice* aDevice); |
|
140 |
|
141 /** |
|
142 * Get currently processed device, if it is inclomplete one. |
|
143 * |
|
144 * @since S60 v5.0 |
|
145 * @return Pointer to processed device |
|
146 */ |
|
147 CUpnpDevice* GetIncompliteRootDevice(); |
|
148 |
|
149 /** |
|
150 * Build result list |
|
151 * @since S60 v5.0 |
|
152 * @param aDevice Target device |
|
153 * @return TRUE if device is discovered correctly |
|
154 */ |
|
155 TBool CUpnpCpbEmbeddedDeviceDescription::BuildResultListsL(CUpnpDevice* aDevice); |
|
156 |
|
157 /** |
|
158 * Count result and create Uuids |
|
159 * @since S60 v5.0 |
|
160 */ |
|
161 void CreateUuidsL(); |
|
162 |
|
163 private: |
|
164 // List with discovered devices (only device that match target types) |
|
165 RPointerArray<CUpnpDevice> iDiscoveredDevices; |
|
166 // List with all devices in current target |
|
167 RPointerArray<CUpnpDevice> iAllDevicesInRoot; |
|
168 // List with devices not needed for correct discovery |
|
169 // (not matching type and not being subdevice) |
|
170 RPointerArray<CUpnpDevice> iNotNeededDevices; |
|
171 }; |
|
172 |
|
173 #endif // C_CUPNPCPBEMBEDDEDDEVICEDESCRIPTION_H |