|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef CMTPSERVICEINFO_H_ |
|
22 #define CMTPSERVICEINFO_H_ |
|
23 |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <e32des8.h> |
|
27 #include <e32cmn.h> |
|
28 |
|
29 |
|
30 #include <mtp/tmtptypeuint128.h> |
|
31 #include <mtp/tmtptypeguid.h> |
|
32 |
|
33 #include "mtpdebug.h" |
|
34 |
|
35 |
|
36 /** |
|
37 Implements the MTP service configure interface. |
|
38 @internalComponent |
|
39 |
|
40 */ |
|
41 |
|
42 |
|
43 class TPKeyPair |
|
44 { |
|
45 public: |
|
46 TPKeyPair( const TMTPTypeGuid& aNamespace, const TUint aID ); |
|
47 public: |
|
48 TMTPTypeGuid iNamespace; |
|
49 TUint iPKeyId; |
|
50 }; |
|
51 |
|
52 class CServiceElementBase : public CBase |
|
53 { |
|
54 public: |
|
55 virtual ~CServiceElementBase(); |
|
56 IMPORT_C virtual TBool IsUsed(); |
|
57 IMPORT_C virtual TUint Code() const; |
|
58 IMPORT_C virtual const TDesC& Name() const; |
|
59 IMPORT_C virtual const TMTPTypeGuid& GUID() const; |
|
60 |
|
61 virtual void SetCode( const TUint aCode ); |
|
62 virtual TInt Compare( const CServiceElementBase& aR ) const; |
|
63 |
|
64 protected: |
|
65 CServiceElementBase(const TMTPTypeGuid& aGUID, HBufC* aName); |
|
66 |
|
67 protected: |
|
68 TUint16 iCode; |
|
69 TMTPTypeGuid iGUID; |
|
70 HBufC* iName; |
|
71 }; |
|
72 |
|
73 class CServiceProperty : public CServiceElementBase |
|
74 { |
|
75 public: |
|
76 static CServiceProperty* NewLC(const TMTPTypeGuid& aGUID, const TUint aPkeyID, HBufC* aName, const TUint aDataType, const TUint aGetSet, const TUint aFormFlag); |
|
77 |
|
78 IMPORT_C const TMTPTypeGuid& Namespace() const; |
|
79 IMPORT_C TUint PKeyID() const; |
|
80 IMPORT_C TUint DataType() const; |
|
81 IMPORT_C TUint GetSet() const; |
|
82 IMPORT_C TUint FormFlag() const; |
|
83 |
|
84 |
|
85 private: |
|
86 CServiceProperty( const TMTPTypeGuid& aGUID, const TUint aPkeyID, HBufC* aName, const TUint aDataType, const TUint aGetSet, const TUint aFormFlag ); |
|
87 void ConstructL(); |
|
88 |
|
89 private: |
|
90 TUint iPKeyId; |
|
91 TUint16 iDataType; |
|
92 TUint8 iGetSet; |
|
93 TUint8 iFormFlag; |
|
94 }; |
|
95 |
|
96 |
|
97 class CServiceFormat : public CServiceElementBase |
|
98 { |
|
99 public: |
|
100 static CServiceFormat* NewLC(const TMTPTypeGuid& aGUID, HBufC* aName, const TUint aBaseFormat, HBufC* aMime ); |
|
101 IMPORT_C TUint FormatBase() const; |
|
102 IMPORT_C const TDesC& MIMEType1() const; |
|
103 ~CServiceFormat(); |
|
104 |
|
105 private: |
|
106 CServiceFormat( const TMTPTypeGuid& aGUID, HBufC* aName, const TUint aBaseFormat, HBufC* aMime ); |
|
107 void ConstructL(); |
|
108 |
|
109 private: |
|
110 TUint16 iFormatBase; |
|
111 HBufC* iMIMEType1; |
|
112 }; |
|
113 |
|
114 |
|
115 class CServiceMethod: public CServiceElementBase |
|
116 { |
|
117 public: |
|
118 static CServiceMethod* NewLC(const TMTPTypeGuid& aGUID, HBufC* aName, const TUint aAssFormat); |
|
119 IMPORT_C TUint ObjAssociateFormatCode() const; |
|
120 |
|
121 private: |
|
122 CServiceMethod(const TMTPTypeGuid& aGUID, HBufC* aName, const TUint aAssFormat); |
|
123 void ConstructL(); |
|
124 |
|
125 private: |
|
126 TUint16 iObjAssociateFormatCode; |
|
127 }; |
|
128 |
|
129 class CServiceEvent : public CServiceElementBase |
|
130 { |
|
131 public: |
|
132 static CServiceEvent* NewLC(const TUint aCode, const TMTPTypeGuid& aGUID, HBufC* aName); |
|
133 |
|
134 private: |
|
135 CServiceEvent(const TUint aCode, const TMTPTypeGuid& aGUID, HBufC* aName); |
|
136 void ConstructL(); |
|
137 |
|
138 }; |
|
139 |
|
140 |
|
141 class CMTPServiceInfo : |
|
142 public CBase |
|
143 { |
|
144 public: |
|
145 static CMTPServiceInfo* NewLC(); |
|
146 ~CMTPServiceInfo(); |
|
147 |
|
148 private: |
|
149 CMTPServiceInfo(); |
|
150 void ConstructL(); |
|
151 |
|
152 public: |
|
153 static TInt ServicePropertyOrderFromAscending( const CServiceProperty& aL, const CServiceProperty& aR); |
|
154 static TInt ServicePropertyOrderFromKeyAscending( const TPKeyPair* aL, const CServiceProperty& aR); |
|
155 |
|
156 static TInt ServiceElementBaseOrderFromAscending( const CServiceElementBase& aL, const CServiceElementBase& aR); |
|
157 static TInt ServiceElementBaseOrderFromKeyAscending( const TMTPTypeGuid* aL, const CServiceElementBase& aR ); |
|
158 |
|
159 static TInt ServiceFormatOrderFromAscending( const CServiceFormat& aL, const CServiceFormat& aR); |
|
160 static TInt ServiceFormatOrderFromKeyAscending( const TMTPTypeGuid* aL, const CServiceFormat& aR ); |
|
161 |
|
162 static TInt ServiceMethodOrderFromAscending( const CServiceMethod& aL, const CServiceMethod& aR ); |
|
163 static TInt ServiceMethodOrderFromKeyAscending( const TMTPTypeGuid* aL, const CServiceMethod& aR ); |
|
164 |
|
165 static TInt ServiceEventOrderFromAscending( const CServiceEvent& aL, const CServiceEvent& aR ); |
|
166 |
|
167 |
|
168 public: |
|
169 void SetServiceID( TUint aServiceID ); |
|
170 void SetServiceStorageID( TUint aStorageID ); |
|
171 void SetPersistentGUIDL( const TMTPTypeGuid& aGUID ); |
|
172 void SetServiceVersion( TUint aVersion ); |
|
173 void SetServiceGUIDL( const TMTPTypeGuid& aGUID ); |
|
174 void SetServiceName( HBufC* aName ); |
|
175 void SetServiceType( TUint aServiceType ); |
|
176 void SetBaseServiceID( TUint aID ); |
|
177 void AppendUserServiceL( const TMTPTypeGuid& aServiceGUID ); |
|
178 void InsertPropertyL( const CServiceProperty* aProperty ); |
|
179 void InsertFormatL( const CServiceFormat* aFormat ); |
|
180 void InsertMethodL( const CServiceMethod* aMethod ); |
|
181 void InsertEventL( const CServiceEvent* aEvent ); |
|
182 void AppendDataGUIDL( const TMTPTypeGuid& aGUID ); |
|
183 |
|
184 IMPORT_C TUint ServiceID() const; |
|
185 IMPORT_C TUint ServiceStorageID() const; |
|
186 IMPORT_C const TMTPTypeGuid& ServicePersistentGUID()const; |
|
187 IMPORT_C TUint ServiceVersion() const; |
|
188 IMPORT_C const TMTPTypeGuid& ServiceGUID() const; |
|
189 IMPORT_C const TDesC& ServiceName() const; |
|
190 IMPORT_C TUint ServiceType() const; |
|
191 IMPORT_C TUint BaseServiceID() const; |
|
192 |
|
193 CServiceProperty* ServiceProperty( const TMTPTypeGuid& aPKNamespace, const TUint aPKID ) const; |
|
194 CServiceFormat* ServiceFormat( const TMTPTypeGuid& aGUID ) const; |
|
195 CServiceMethod* ServiceMethod( const TMTPTypeGuid& aGUID ) const; |
|
196 |
|
197 IMPORT_C const RArray<TMTPTypeGuid>& UsedServiceGUIDs() const; |
|
198 IMPORT_C const RPointerArray<CServiceProperty>& ServiceProperties() const; |
|
199 IMPORT_C const RPointerArray<CServiceFormat>& ServiceFormats() const; |
|
200 IMPORT_C const RPointerArray<CServiceMethod>& ServiceMethods() const; |
|
201 IMPORT_C const RPointerArray<CServiceEvent>& ServiceEvents() const; |
|
202 IMPORT_C const RArray<TMTPTypeGuid>& DataBlockGUIDs() const; |
|
203 |
|
204 |
|
205 private: |
|
206 TUint iServiceId; |
|
207 TUint iServiceStorageId; |
|
208 TMTPTypeGuid iPersistentGUID; |
|
209 TUint iServiceVersion; |
|
210 TMTPTypeGuid iServiceGUID; |
|
211 HBufC* iServiceName; |
|
212 TUint iServiceType; |
|
213 TUint iBaseServiceId; |
|
214 |
|
215 RArray<TMTPTypeGuid> iUsedServiceGUIDs; |
|
216 RPointerArray<CServiceProperty> iServiceProperties; |
|
217 RPointerArray<CServiceFormat> iServiceFormats; |
|
218 RPointerArray<CServiceMethod> iServiceMethods; |
|
219 RPointerArray<CServiceEvent> iServiceEvents; |
|
220 RArray<TMTPTypeGuid> iDataBlock; |
|
221 /** |
|
222 FLOGGER debug trace member variable. |
|
223 */ |
|
224 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
225 |
|
226 }; |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 #endif /* CMTPSERVICEINFO_H_ */ |