24
|
1 |
/**
|
|
2 |
* Copyright (c) 2010 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: CUpnpAppFilterInfo class implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "upnpappfilterinfo.h"
|
|
21 |
#include "OstTraceDefinitions.h"
|
|
22 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
23 |
#include "upnpappfilterinfoTraces.h"
|
|
24 |
#endif
|
|
25 |
|
|
26 |
//Literals
|
|
27 |
_LIT8(KAppName, "name");
|
|
28 |
_LIT8(KAppDesc, "description");
|
|
29 |
_LIT8(KMimeType, "mimetype");
|
|
30 |
_LIT8(KWidth, "width");
|
|
31 |
_LIT8(KHeight, "height");
|
|
32 |
_LIT8(KDepth, "depth");
|
|
33 |
_LIT8(KAllowedProfileIds, "allowedProfileIDs");
|
|
34 |
_LIT8(KRscStatus, "resourceStatus");
|
|
35 |
_LIT8(KSignature, "signature");
|
|
36 |
|
|
37 |
|
|
38 |
// ============================ MEMBER FUNCTIONS ===================================
|
|
39 |
|
|
40 |
// ---------------------------------------------------------------------------------
|
|
41 |
// CUpnpAppFilterInfo::NewL
|
|
42 |
// Two-phased constructor.
|
|
43 |
// ---------------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
CUpnpAppFilterInfo* CUpnpAppFilterInfo::NewL( )
|
|
46 |
{
|
|
47 |
OstTraceFunctionEntry0( CUPNPAPPFILTERINFO_NEWL_ENTRY );
|
|
48 |
return ( new (ELeave) CUpnpAppFilterInfo() );
|
|
49 |
}
|
|
50 |
|
|
51 |
// ---------------------------------------------------------------------------------
|
|
52 |
// CUpnpAppFilterInfo::CUpnpAppFilterInfo
|
|
53 |
// C++ default constructor can NOT contain any code, that
|
|
54 |
// might leave.
|
|
55 |
// ---------------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
CUpnpAppFilterInfo::CUpnpAppFilterInfo( )
|
|
58 |
{
|
|
59 |
iAppName = NULL;
|
|
60 |
iAppDesc = NULL;
|
|
61 |
iMimeType = NULL;
|
|
62 |
iWidth = NULL;
|
|
63 |
iHeight = NULL;
|
|
64 |
iDepth = NULL;
|
|
65 |
iAllowedIdList = NULL;
|
|
66 |
iProtocolId = NULL;
|
|
67 |
iFormat = NULL;
|
|
68 |
iDirection = NULL;
|
|
69 |
iAppCategory = NULL;
|
|
70 |
iAppTrustLevel = NULL;
|
|
71 |
iContCategory = NULL;
|
|
72 |
iContentRules = NULL;
|
|
73 |
iContTrustLevel = NULL;
|
|
74 |
iAudioType = NULL;
|
|
75 |
iRscStatus = NULL;
|
|
76 |
iSignature = NULL;
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------------
|
|
80 |
// CUpnpAppFilterInfo::~CUpnpAppFilterInfo
|
|
81 |
// C++ default destructor
|
|
82 |
// ---------------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
CUpnpAppFilterInfo::~CUpnpAppFilterInfo()
|
|
85 |
{
|
|
86 |
OstTraceFunctionEntry0( CUPNPAPPFILTERINFO_CUPNPAPPFILTERINFO_ENTRY );
|
|
87 |
delete iAppName;
|
|
88 |
delete iAppDesc;
|
|
89 |
delete iMimeType;
|
|
90 |
delete iWidth;
|
|
91 |
delete iHeight;
|
|
92 |
delete iDepth;
|
|
93 |
delete iAllowedIdList;
|
|
94 |
delete iProtocolId;
|
|
95 |
delete iFormat;
|
|
96 |
delete iDirection;
|
|
97 |
delete iAppCategory;
|
|
98 |
delete iAppTrustLevel;
|
|
99 |
delete iContCategory;
|
|
100 |
delete iContentRules;
|
|
101 |
delete iContTrustLevel;
|
|
102 |
delete iAudioType;
|
|
103 |
delete iRscStatus;
|
|
104 |
delete iSignature;
|
|
105 |
OstTraceFunctionExit0( CUPNPAPPFILTERINFO_CUPNPAPPFILTERINFO_EXIT );
|
|
106 |
}
|
|
107 |
|
|
108 |
// ---------------------------------------------------------------------------------
|
|
109 |
// CUpnpAppFilterInfo::SetFilterInfoL
|
|
110 |
// It compares the key with the individual elements and if it matches with none then it
|
|
111 |
// returns invalid argument as an error.
|
|
112 |
// @param aKey Key name
|
|
113 |
// @param aValue Value of the key
|
26
|
114 |
// @param aDisplayInfoFlag True if info type is displayInfo, false otherwise.
|
|
115 |
// Default is false. It is used to distinguish "trustLevel" element
|
|
116 |
// of appInfo and displayInfo.
|
24
|
117 |
// @param aErr Terminal Mode error code
|
|
118 |
// ---------------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
void CUpnpAppFilterInfo::SetFilterInfoL( const TDesC8& aKey, const TDesC8& aValue,
|
|
121 |
TTerminalModeErrorCode& aErr, TBool aDisplayInfoFlag )
|
|
122 |
{
|
|
123 |
OstTraceFunctionEntry0( CUPNPAPPFILTERINFO_SETFILTERINFOL_ENTRY );
|
|
124 |
aErr = ETerminalModeInvalidArgument;
|
|
125 |
if ( aKey.Compare(KAppName) == KErrNone )
|
|
126 |
{
|
|
127 |
delete iAppName;
|
|
128 |
iAppName = NULL;
|
|
129 |
iAppName = aValue.AllocL();
|
|
130 |
aErr = ETerminalModeSuccess;
|
|
131 |
}
|
|
132 |
else if ( aKey.Compare(KAppDesc) == KErrNone )
|
|
133 |
{
|
|
134 |
delete iAppDesc;
|
|
135 |
iAppDesc = NULL;
|
|
136 |
iAppDesc = aValue.AllocL();
|
|
137 |
aErr = ETerminalModeSuccess;
|
|
138 |
}
|
|
139 |
else if ( aKey.Compare(KMimeType) == KErrNone )
|
|
140 |
{
|
|
141 |
delete iMimeType;
|
|
142 |
iMimeType = NULL;
|
|
143 |
iMimeType = aValue.AllocL();
|
|
144 |
aErr = ETerminalModeSuccess;
|
|
145 |
}
|
|
146 |
else if ( aKey.Compare(KWidth) == KErrNone )
|
|
147 |
{
|
|
148 |
delete iWidth;
|
|
149 |
iWidth = NULL;
|
|
150 |
iWidth = aValue.AllocL();
|
|
151 |
aErr = ETerminalModeSuccess;
|
|
152 |
}
|
|
153 |
else if ( aKey.Compare(KHeight) == KErrNone )
|
|
154 |
{
|
|
155 |
delete iHeight;
|
|
156 |
iHeight = NULL;
|
|
157 |
iHeight = aValue.AllocL();
|
|
158 |
aErr = ETerminalModeSuccess;
|
|
159 |
}
|
|
160 |
else if ( aKey.Compare(KDepth) == KErrNone )
|
|
161 |
{
|
|
162 |
delete iDepth;
|
|
163 |
iDepth = NULL;
|
|
164 |
iDepth = aValue.AllocL();
|
|
165 |
aErr = ETerminalModeSuccess;
|
|
166 |
}
|
|
167 |
else if ( aKey.Compare(KAllowedProfileIds) == KErrNone )
|
|
168 |
{
|
|
169 |
delete iAllowedIdList;
|
|
170 |
iAllowedIdList = NULL;
|
|
171 |
iAllowedIdList = aValue.AllocL();
|
|
172 |
aErr = ETerminalModeSuccess;
|
|
173 |
}
|
|
174 |
else if ( aKey.Compare(KProtocolId) == KErrNone )
|
|
175 |
{
|
|
176 |
delete iProtocolId;
|
|
177 |
iProtocolId = NULL;
|
|
178 |
iProtocolId = aValue.AllocL();
|
|
179 |
aErr = ETerminalModeSuccess;
|
|
180 |
}
|
|
181 |
else if ( aKey.Compare(KFormat) == KErrNone )
|
|
182 |
{
|
|
183 |
delete iFormat;
|
|
184 |
iFormat = NULL;
|
|
185 |
iFormat = aValue.AllocL();
|
|
186 |
aErr = ETerminalModeSuccess;
|
|
187 |
}
|
|
188 |
else if ( aKey.Compare(KRemotingDirection) == KErrNone )
|
|
189 |
{
|
|
190 |
delete iDirection;
|
|
191 |
iDirection = NULL;
|
|
192 |
iDirection = aValue.AllocL();
|
|
193 |
aErr = ETerminalModeSuccess;
|
|
194 |
}
|
|
195 |
else if ( aKey.Compare(KAppCategory) == KErrNone )
|
|
196 |
{
|
|
197 |
delete iAppCategory;
|
|
198 |
iAppCategory = NULL;
|
|
199 |
iAppCategory = aValue.AllocL();
|
|
200 |
aErr = ETerminalModeSuccess;
|
|
201 |
}
|
26
|
202 |
else if (( aKey.Compare(KTrustLevel) == KErrNone ) && ( !aDisplayInfoFlag ))
|
24
|
203 |
{
|
|
204 |
delete iAppTrustLevel;
|
|
205 |
iAppTrustLevel = NULL;
|
|
206 |
iAppTrustLevel = aValue.AllocL();
|
|
207 |
aErr = ETerminalModeSuccess;
|
|
208 |
}
|
|
209 |
else if ( aKey.Compare(KContCategory) == KErrNone )
|
|
210 |
{
|
|
211 |
delete iContCategory;
|
|
212 |
iContCategory = NULL;
|
|
213 |
iContCategory = aValue.AllocL();
|
|
214 |
aErr = ETerminalModeSuccess;
|
|
215 |
}
|
|
216 |
else if ( aKey.Compare(KContentRules) == KErrNone )
|
|
217 |
{
|
|
218 |
delete iContentRules;
|
|
219 |
iContentRules = NULL;
|
|
220 |
iContentRules = aValue.AllocL();
|
|
221 |
aErr = ETerminalModeSuccess;
|
|
222 |
}
|
26
|
223 |
else if (( aKey.Compare(KTrustLevel) == KErrNone ) && ( aDisplayInfoFlag ))
|
24
|
224 |
{
|
|
225 |
delete iContTrustLevel;
|
|
226 |
iContTrustLevel = NULL;
|
|
227 |
iContTrustLevel = aValue.AllocL();
|
|
228 |
aErr = ETerminalModeSuccess;
|
|
229 |
}
|
|
230 |
else if ( aKey.Compare(KAudioType) == KErrNone )
|
|
231 |
{
|
|
232 |
delete iAudioType;
|
|
233 |
iAudioType = NULL;
|
|
234 |
iAudioType = aValue.AllocL();
|
|
235 |
aErr = ETerminalModeSuccess;
|
|
236 |
}
|
|
237 |
else if ( aKey.Compare(KRscStatus) == KErrNone )
|
|
238 |
{
|
|
239 |
delete iRscStatus;
|
|
240 |
iRscStatus = NULL;
|
|
241 |
iRscStatus = aValue.AllocL();
|
|
242 |
aErr = ETerminalModeSuccess;
|
|
243 |
}
|
|
244 |
else if ( aKey.Compare(KSignature) == KErrNone )
|
|
245 |
{
|
|
246 |
delete iSignature;
|
|
247 |
iSignature = NULL;
|
|
248 |
iSignature = aValue.AllocL();
|
|
249 |
aErr = ETerminalModeSuccess;
|
|
250 |
}
|
|
251 |
OstTraceFunctionExit0( CUPNPAPPFILTERINFO_SETFILTERINFOL_EXIT );
|
|
252 |
}
|
|
253 |
|
|
254 |
// End of File
|