|
1 /** @file |
|
2 * Copyright (c) 2005-2006 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 ProtocolInfo field wrapper. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPPROTOCOLINFOLOCAL_H |
|
20 #define C_CUPNPPROTOCOLINFOLOCAL_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "upnpdlnaprotocolinfo.h" |
|
24 |
|
25 _LIT8( KOneChar, "1" ); |
|
26 _LIT8( KZeroChar, "0" ); |
|
27 |
|
28 _LIT8( KDEFAULT_1ST_PARAM, "http-get"); |
|
29 _LIT8( KDEFAULT_STAR_PARAM, "*"); |
|
30 |
|
31 const char KDlnaDelimeter = ';'; |
|
32 const char KDlnaTokenizer = '='; |
|
33 const char KDlnaAllStar = '*'; |
|
34 |
|
35 //Length of string from which should be serialized TInt into iDlnaFlags |
|
36 const TInt KMAX_INT_LENGTH_STRING = 8 ; |
|
37 |
|
38 // There are only 4 TInt32 or TUint32 flags serialized in DLNA.ORG_FLAGS parameter. |
|
39 const TInt KDLNA_FLAGS_NUMBER = 4; |
|
40 //to represent the 32-byte-size of TUIn32 |
|
41 const TInt K32BIT = 32; |
|
42 //number of all flags |
|
43 const TInt KDLNA_FLAGS_QUANTITY = KDLNA_FLAGS_NUMBER * K32BIT; |
|
44 |
|
45 _LIT8(KAllValues, "*"); |
|
46 |
|
47 _LIT8( KDLNA_PN, "DLNA.ORG_PN"); |
|
48 _LIT8( KDLNA_OP, "DLNA.ORG_OP"); |
|
49 _LIT8( KDLNA_PS, "DLNA.ORG_PS"); |
|
50 _LIT8( KDLNA_CI, "DLNA.ORG_CI"); |
|
51 _LIT8( KDLNA_FLAGS, "DLNA.ORG_FLAGS"); |
|
52 |
|
53 const char KDLNA_BOOLEAN_FALSE = '0'; |
|
54 const char KDLNA_BOOLEAN_TRUE = '1'; |
|
55 |
|
56 enum ADDITIONAL_INFO |
|
57 { |
|
58 NO_DLNA_DATA = -1, |
|
59 NO_ADDITIONAL_INFO = 0, |
|
60 JPEG_SM = 1, |
|
61 JPEG_MED, |
|
62 JPEG_LRG, |
|
63 JPEG_TN, |
|
64 JPEG_SM_ICO, |
|
65 JPEG_LRG_ICO, |
|
66 PNG_TN, |
|
67 PNG_SM_ICO, |
|
68 PNG_LRG_ICO, |
|
69 PNG_LRG, |
|
70 MP3, |
|
71 }; |
|
72 |
|
73 _LIT8(KMT_IMAGE_JPEG, "image/jpeg"); |
|
74 _LIT8(KMT_IMAGE_PNG, "image/png"); |
|
75 _LIT8(KMT_IMAGE_GIF, "image/gif"); |
|
76 _LIT8(KMT_IMAGE_BMP, "image/bmp"); |
|
77 _LIT8(KMT_AUDIO_MP3, "audio/mpeg"); |
|
78 _LIT8(KMT_TEXT_PLAIN, "text/plain"); |
|
79 |
|
80 _LIT8( KMimeImage, "image" ); |
|
81 _LIT8( KMimeAudio, "audio" ); |
|
82 _LIT8( KMimeVideo, "video" ); |
|
83 |
|
84 _LIT8(KDEFAULT_FOURTH_FIELD_OP_PATTERN, "*DLNA.ORG_OP=??*"); |
|
85 _LIT8(KDEFAULT_FOURTH_FIELD_AVIMAGE_PATTERN, "*DLNA.ORG_FLAGS=????????????????????????????????*"); |
|
86 |
|
87 class CUpnpProtocolInfoLocal: public CUpnpDlnaProtocolInfo |
|
88 { |
|
89 |
|
90 private: |
|
91 /** |
|
92 * Constructor of the class |
|
93 */ |
|
94 CUpnpProtocolInfoLocal(); |
|
95 |
|
96 |
|
97 public: |
|
98 |
|
99 /** |
|
100 * Destructor of the class. |
|
101 */ |
|
102 virtual ~CUpnpProtocolInfoLocal(); |
|
103 |
|
104 /** |
|
105 * Method for creating instance of class. |
|
106 * aInputString has to contain protocolInfo string. |
|
107 */ |
|
108 IMPORT_C static CUpnpProtocolInfoLocal* NewL(const TDesC8& aInputString); |
|
109 |
|
110 /** |
|
111 * Creates Default value of ProtocolInfo containing DLNA.ORG_PN specific data. |
|
112 * aMimeType - name of mime type for file. |
|
113 * aAdditionalInfo - additional information about what DLNA.ORG_PN type should be used. |
|
114 * Default behaviour is choosen according to aMimeType, when aAdditionalInfo is equal to NO_ADDITIONAL_INFO. |
|
115 * image/jpeg ---- JPEG_LRG |
|
116 * image/png ---- PNG_LRG |
|
117 * audio/mp3 ---- MP3 |
|
118 * rest not defined. |
|
119 */ |
|
120 IMPORT_C static CUpnpProtocolInfoLocal* NewL(const TDesC8& aMimeType, TInt aAdditionalInfo); |
|
121 IMPORT_C static CUpnpProtocolInfoLocal* NewL(const TDesC8& aMimeType, const TDesC8& aDlnaPn); |
|
122 |
|
123 //MEMBER METHODS used internally |
|
124 private: |
|
125 |
|
126 /** |
|
127 * Method for creating instance of class. |
|
128 * aInputString has to contain protocolInfo string. |
|
129 */ |
|
130 void ConstructL(const TDesC8& aInputString); |
|
131 void ConstructFromDlnaPnL(const TDesC8& aMimeType, const TDesC8& aDlnaPn); |
|
132 |
|
133 /** |
|
134 * Creates object for further use. |
|
135 * uses DefaultValue. |
|
136 * aMimeType - mime type will be compared case insensitive. |
|
137 * aAdditionalInfo - flag saying which specific DLNA.ORG_PN should be used. |
|
138 * values taken from ADDITIONAL_INFO |
|
139 */ |
|
140 void ConstructL(const TDesC8& aMimeType, TInt aAdditionalInfo); |
|
141 |
|
142 private: |
|
143 |
|
144 /** |
|
145 * Main function for creating from mime type. |
|
146 * See ConstructL(TDesC8&, TInt) |
|
147 */ |
|
148 void ChooseDlnaL(const TDesC8& aMimeType, TInt aAdditionalInfo); |
|
149 |
|
150 /** |
|
151 * Fills up default values to create protocolInfo in form: "http-get:*:*:*" |
|
152 */ |
|
153 void DefaultValuesL(); |
|
154 |
|
155 /** |
|
156 * Fills dlna parameters according only to additionalInfo which is int value. |
|
157 * aAdditionalInfo - int value denoting value which should be taken into consideration. |
|
158 */ |
|
159 void FillAccordingToAddInfoL(TInt aAdditionalInfo); |
|
160 |
|
161 /** |
|
162 * Fills dlna parameters according only to info in mime type. |
|
163 * aMimeType - name of a mime type. |
|
164 */ |
|
165 void FillAccordingToMimeL(const TDesC8& aMimeType); |
|
166 |
|
167 /** |
|
168 * Does nothing. |
|
169 */ |
|
170 void ZeroParameters(); |
|
171 |
|
172 /** |
|
173 * This member function sets defult values for optional parameters |
|
174 * of 4-th field of protocolInfo |
|
175 * Value for Audio/Video: |
|
176 * DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01500000000000000000000000000000 |
|
177 * Value for Image : |
|
178 * DLNA.ORG_OP=01;DLNA.ORG_FLAGS=00D00000000000000000000000000000 |
|
179 * |
|
180 */ |
|
181 void SetDefaultFourthField(); |
|
182 |
|
183 /** |
|
184 * This function produces a string containing all info taken from fourth ProtocolInfo field |
|
185 * aBuffer - on this variable values are appended. |
|
186 */ |
|
187 virtual void GetFourthParameterInternalL(TDes8& aBuffer); |
|
188 }; |
|
189 |
|
190 #endif // C_CUPNPPROTOCOLINFOLOCAL_H |
|
191 // End of file |