|
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 #ifndef BTSDPAGENTREQUESTER_H |
|
17 #define BTSDPAGENTREQUESTER_H |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <bttypes.h> |
|
21 #include "ProtocolWrapper.h" |
|
22 |
|
23 |
|
24 NONSHARABLE_CLASS(CSdpRequesterBase) : public CActive |
|
25 { |
|
26 public: |
|
27 enum TConnectState |
|
28 { |
|
29 EDisconnected, |
|
30 ERequesting, |
|
31 EIdle, |
|
32 }; |
|
33 |
|
34 ~CSdpRequesterBase(); |
|
35 protected: |
|
36 CSdpRequesterBase(RSdpSession& aSdpSession, CSdpAgentEng& aParent); |
|
37 void NewRequestL(const TBTDevAddr& aRemDev); |
|
38 void RetrieveResponseL(); |
|
39 virtual void IssueRequestL() =0; |
|
40 virtual void RequestCompleteL() =0; |
|
41 virtual void Reset(); |
|
42 virtual void DoCancel(); |
|
43 |
|
44 private: |
|
45 void ConnectL(); |
|
46 void Disconnect(); |
|
47 void RunL(); |
|
48 |
|
49 |
|
50 private: |
|
51 // Base functionality |
|
52 TInt iRetryCount; |
|
53 RTimer iIdleTimer; |
|
54 // Response buffer |
|
55 HBufC8* iResponseHBuf; |
|
56 |
|
57 protected: |
|
58 TConnectState iState; |
|
59 RSdpSession& iSdpSession; |
|
60 CSdpAgentEng& iParent; |
|
61 TBTDevAddr iRemoteAddress; |
|
62 RSdpAgent iRequester; |
|
63 // Ptr to the response buffer |
|
64 TInt iResultSize; |
|
65 TPtr8 iResponse; |
|
66 }; |
|
67 |
|
68 |
|
69 NONSHARABLE_CLASS(CSdpSearchRequester) : public CSdpRequesterBase |
|
70 { |
|
71 public: |
|
72 static CSdpSearchRequester* NewL(RSdpSession& aSdpSession, CSdpAgentEng& aParent); |
|
73 ~CSdpSearchRequester(); |
|
74 |
|
75 void SearchRequestL(const TBTDevAddr& aRemoteDev, |
|
76 CSdpSearchPattern& aUUIDFilter, |
|
77 TUint16 aMaxCount, |
|
78 const TDesC8& aContState); |
|
79 private: |
|
80 CSdpSearchRequester(RSdpSession& aSdpSession, CSdpAgentEng& aParent); |
|
81 void ConstructL(); |
|
82 |
|
83 // From CSdpRequesterBase; |
|
84 virtual void IssueRequestL(); |
|
85 virtual void RequestCompleteL(); |
|
86 TInt RunError(TInt aError); |
|
87 void DoCancel(); |
|
88 |
|
89 void SendSearchRequest(); |
|
90 void HandleSearchResponseL(); |
|
91 void Reset(); |
|
92 |
|
93 private: |
|
94 // Current request |
|
95 //CSdpAttrValueDES* iUUIDList; |
|
96 CSdpSearchPattern* iUUIDFilter; |
|
97 TUint16 iMaxRecCount; |
|
98 TPtrC8 iContState; |
|
99 }; |
|
100 |
|
101 |
|
102 |
|
103 NONSHARABLE_CLASS(CSdpAttributeRequester) : public CSdpRequesterBase |
|
104 { |
|
105 public: |
|
106 static CSdpAttributeRequester* NewL(RSdpSession& aSdpSession, CSdpAgentEng& aParent); |
|
107 ~CSdpAttributeRequester(); |
|
108 |
|
109 void AttributeRequestL(const TBTDevAddr& aRemoteDev, |
|
110 TSdpServRecordHandle aHandle, |
|
111 TUint16 aMaxAttrByteCount, |
|
112 CSdpAttrIdMatchList& aMatchList, |
|
113 const TDesC8& aContState); |
|
114 |
|
115 private: |
|
116 CSdpAttributeRequester(RSdpSession& aSdpSession, CSdpAgentEng& aParent); |
|
117 void ConstructL(); |
|
118 |
|
119 // From CSdpRequesterBase; |
|
120 virtual void IssueRequestL(); |
|
121 virtual void RequestCompleteL(); |
|
122 TInt RunError(TInt aError); |
|
123 void DoCancel(); |
|
124 |
|
125 void SendAttributeRequest(); |
|
126 void HandleAttributeResponseL(); |
|
127 void Reset(); |
|
128 |
|
129 private: |
|
130 // Current request |
|
131 TSdpServRecordHandle iHandle; |
|
132 TUint16 iMaxAttrByteCount; |
|
133 CSdpAttrIdMatchList* iMatchList; |
|
134 TPtrC8 iContState; |
|
135 }; |
|
136 |
|
137 #endif |