|
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 SDPSERVICERECORD_H |
|
22 #define SDPSERVICERECORD_H |
|
23 |
|
24 // CSDPAttribute |
|
25 #include <btsdp.h> |
|
26 #include "EncoderVisitor.h" |
|
27 #include "SDPAttribute.h" |
|
28 #include "sdputil.h" |
|
29 |
|
30 class CSdpServRecord; |
|
31 |
|
32 typedef TOrderedQue<CSdpServRecord> TServRecordList; |
|
33 typedef TDblQueIter<CSdpServRecord> TServRecordIter; |
|
34 |
|
35 NONSHARABLE_CLASS(CSdpServRecord) : public CBase, public MSdpElementBuilder |
|
36 { |
|
37 public: |
|
38 IMPORT_C static CSdpServRecord* NewL(); |
|
39 IMPORT_C static CSdpServRecord* NewServerSideL(const TUid& aUid); |
|
40 ~CSdpServRecord(); |
|
41 |
|
42 // all universal attr getters |
|
43 IMPORT_C TSdpServRecordHandle Handle() const; |
|
44 IMPORT_C TUid ClientUid() const; |
|
45 //void Description(); |
|
46 //void ProtocolList(); |
|
47 //void Icon(); |
|
48 IMPORT_C void AddAttribute(CSdpAttr* aAttr); |
|
49 IMPORT_C void RecordStateChange(); |
|
50 |
|
51 inline TBool operator>(const CSdpServRecord& aRec) const; |
|
52 inline TServAttrIter AttributeIter(); |
|
53 inline static TInt LinkOffset(); |
|
54 |
|
55 // MSdpElementBuilder interface definition |
|
56 // Most functions are errors, so not implemented |
|
57 virtual MSdpElementBuilder* BuildUintL(const TDesC8& aUint); |
|
58 private: |
|
59 CSdpServRecord(const TUid& aClientUid); |
|
60 void ConstructL(); |
|
61 private: |
|
62 TServAttrList iAttributes; |
|
63 TDblQueLink iLink; |
|
64 //TUint16 iHandle; // UPGRADE: Get this out of attributes?? |
|
65 TUid iClientUid; |
|
66 CSdpAttrValueUint* iRecordState;// This value is used to update a state attribute whenever the |
|
67 // record is modified to aid caching by remotes. |
|
68 CAttrEncoderVisitor* iEncoderVisitor; // We maintain a pre-alloced encoder visitor so we can update |
|
69 // attributes without having to allocate memory. |
|
70 RBuf8 iEncodeBuf; // Used by the encoder to encode into |
|
71 }; |
|
72 |
|
73 inline TBool CSdpServRecord::operator>(const CSdpServRecord& aRec) const |
|
74 { |
|
75 return Handle() > aRec.Handle(); |
|
76 } |
|
77 |
|
78 /** |
|
79 @see RecordStateChange |
|
80 */ |
|
81 inline TServAttrIter CSdpServRecord::AttributeIter() |
|
82 { |
|
83 return TServAttrIter(iAttributes); |
|
84 } |
|
85 |
|
86 inline TInt CSdpServRecord::LinkOffset() |
|
87 { |
|
88 return _FOFF(CSdpServRecord, iLink); |
|
89 } |
|
90 |
|
91 // new class to decode stuff from encoded records. |
|
92 NONSHARABLE_CLASS(CRecordAttr) : public CBase, public MSdpElementBuilder |
|
93 { |
|
94 public: |
|
95 IMPORT_C CRecordAttr(); |
|
96 IMPORT_C ~CRecordAttr(); |
|
97 |
|
98 inline TUint GetUInt(); |
|
99 // MSdpElementBuilder interface definition |
|
100 // Most functions are errors, so not implemented |
|
101 virtual MSdpElementBuilder* BuildUintL(const TDesC8& aUint); |
|
102 private: |
|
103 TUint iValue; |
|
104 }; |
|
105 |
|
106 inline TUint CRecordAttr::GetUInt() |
|
107 { |
|
108 return iValue; |
|
109 } |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 #endif |