|
1 // Copyright (c) 2000-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 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef SDPDATABASE_H |
|
22 #define SDPDATABASE_H |
|
23 |
|
24 #include <btsdp.h> |
|
25 #include "SDPServiceRecord.h" |
|
26 #include "sdpconsts.h" |
|
27 #include "sdputil.h" |
|
28 #include "MAttributeVisitor.h" |
|
29 |
|
30 // Size of 16/128 bit UUIDs in bytes |
|
31 const TInt KSizeOf16BitUUID = 2; |
|
32 const TInt KSizeOf32BitUUID = 4; |
|
33 const TInt KSizeOf128BitUUID = 16; |
|
34 |
|
35 // Class representing the SDP database |
|
36 NONSHARABLE_CLASS(CSdpDatabase) : public CBase |
|
37 { |
|
38 public: |
|
39 IMPORT_C static CSdpDatabase* NewLC(); |
|
40 IMPORT_C static CSdpDatabase* NewL(); |
|
41 IMPORT_C ~CSdpDatabase(); |
|
42 IMPORT_C void AddRecord(CSdpServRecord *aRecord); |
|
43 IMPORT_C CSdpServRecord* NewRecordL(); |
|
44 IMPORT_C void EncodeDbL(); |
|
45 IMPORT_C void ParseDbL_Obscelete_DoesNothing(); |
|
46 IMPORT_C TSdpServRecordHandle NextFreeHandle(); |
|
47 TBool ReviseNextFreeHandle(); |
|
48 inline TServRecordIter RecordIter(); |
|
49 |
|
50 private: |
|
51 CSdpDatabase(); |
|
52 void ConstructL(); |
|
53 |
|
54 private: |
|
55 TBool iCanAddRecord; |
|
56 TServRecordList iRecords; |
|
57 TSdpServRecordHandle iNextFreeHandle; |
|
58 }; |
|
59 |
|
60 inline TServRecordIter CSdpDatabase::RecordIter() |
|
61 { |
|
62 return TServRecordIter(iRecords); |
|
63 } |
|
64 |
|
65 |
|
66 //********************************** |
|
67 // CAttrUUidVisitor |
|
68 //********************************** |
|
69 /** |
|
70 Provides vistor functionalities to retrieve UUIDs from CSdpAttr |
|
71 **/ |
|
72 NONSHARABLE_CLASS(CAttrUuidVisitor) : public CBase, public MAttributeVisitor |
|
73 { |
|
74 public: |
|
75 IMPORT_C static CAttrUuidVisitor *NewL(); |
|
76 IMPORT_C ~CAttrUuidVisitor(); |
|
77 IMPORT_C RUUIDContainer& GetUuids(); |
|
78 |
|
79 private: |
|
80 // Implementation of MAttributeVisitor interface |
|
81 void EncodeAttributeL(CSdpAttrValue &aSrcAttr); |
|
82 void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType); |
|
83 void StartListL(CSdpAttrValueList &aList); |
|
84 void EndListL(); |
|
85 |
|
86 private: |
|
87 CAttrUuidVisitor(); |
|
88 void ConstructL(); |
|
89 |
|
90 // Implementation of MAttributeVisitor interface |
|
91 void VisitAttributeL(CSdpAttr &aAttribute); |
|
92 |
|
93 private: |
|
94 RUUIDContainer iUuidContainer; |
|
95 }; |
|
96 |
|
97 enum TSdpDatabasePanics |
|
98 { |
|
99 ESdpDatabaseVisitAttributeLErroneouslyCalled = 0, |
|
100 ESdpDatabaseUnexpectedAttributeType = 1, |
|
101 }; |
|
102 _LIT(KSdpDatabasePanicName, "SdpDatabase"); |
|
103 |
|
104 #endif // SDPDATABASE_H |