32
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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: Server part of basic printing profile
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef BTSBPP_OBJECT_SERVER_H
|
|
21 |
#define BTSBPP_OBJECT_SERVER_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
//#include "BTSBPPPasskeyRequest.h"
|
|
25 |
|
|
26 |
#include <obex.h> // Obex
|
|
27 |
#include <badesca.h> // CDesCArray
|
|
28 |
#include <btengdiscovery.h>
|
|
29 |
#include "BTServiceStarter.h"
|
|
30 |
|
|
31 |
// FORWARD DECLARATIONS
|
|
32 |
class CBTSBPPObjectRequest;
|
|
33 |
|
|
34 |
// CLASS DECLARATION
|
|
35 |
|
|
36 |
/**
|
|
37 |
* An interface used to inform about CBTSBPPObjectServer events.
|
|
38 |
*/
|
|
39 |
class MBTSBPPObjectServerObserver
|
|
40 |
{
|
|
41 |
public:
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Informs the observer that an error has been occurred.
|
|
45 |
* @param aError The error.
|
|
46 |
* @return None.
|
|
47 |
*/
|
|
48 |
virtual void ServerError( TInt aError ) = 0;
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Informs the observer that the server connection has been established.
|
|
52 |
* @param None.
|
|
53 |
* @return None.
|
|
54 |
*/
|
|
55 |
virtual void ServerConnectionEstablished() = 0;
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Informs the observer that the server connection has been closed.
|
|
59 |
* @param None.
|
|
60 |
* @return None.
|
|
61 |
*/
|
|
62 |
virtual void ServerConnectionClosed() = 0;
|
|
63 |
};
|
|
64 |
|
|
65 |
// CLASS DECLARATION
|
|
66 |
|
|
67 |
/**
|
|
68 |
* A class managing the Obex Server.
|
|
69 |
*/
|
|
70 |
NONSHARABLE_CLASS (CBTSBPPObjectServer) : public CBase,
|
|
71 |
public MObexServerNotify,
|
|
72 |
public MObexAuthChallengeHandler
|
|
73 |
{
|
|
74 |
public: // Constructors and destructor
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Two-phased constructor.
|
|
78 |
*/
|
|
79 |
static CBTSBPPObjectServer* NewL( MBTSBPPObjectServerObserver* aObserver,
|
|
80 |
CBTEngDiscovery* aBTEngDiscoveryPtr,
|
|
81 |
const TBTDevAddr& aExpectedClient );
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Destructor.
|
|
85 |
*/
|
|
86 |
virtual ~CBTSBPPObjectServer();
|
|
87 |
|
|
88 |
public: // New functions
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Gives the server a list of referenced objects that can be requested.
|
|
92 |
* by the printer. This method should be called always before sending
|
|
93 |
* any documents.
|
|
94 |
* @param aRefObjectList A pointer to the list.
|
|
95 |
* @return None.
|
|
96 |
*/
|
|
97 |
void SetReferencedObjectList( const CDesCArray* aRefObjectList );
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Tells whether the current referenced object list has any items.
|
|
101 |
* @param aRefObjectList A pointer to the list.
|
|
102 |
* @return None.
|
|
103 |
*/
|
|
104 |
TBool HasReferencedObjects();
|
|
105 |
|
|
106 |
private: // Functions from base classes
|
|
107 |
|
|
108 |
/**
|
|
109 |
* From MObexAuthChallengeHandler Get's called when Obex Password is
|
|
110 |
* requested.
|
|
111 |
* @param aRealm The realm/challenge specified by the unit forcing
|
|
112 |
* the authentication.
|
|
113 |
* @return None.
|
|
114 |
*/
|
|
115 |
void GetUserPasswordL( const TDesC& aRealm );
|
|
116 |
|
|
117 |
private: // Functions from MObexServerNotify
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Informs about an error in Obex connection.
|
|
121 |
* @param aError The occurred error.
|
|
122 |
* @return None.
|
|
123 |
*/
|
|
124 |
void ErrorIndication( TInt aError );
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Informs that Obex transport layer is up.
|
|
128 |
* @return None.
|
|
129 |
*/
|
|
130 |
void TransportUpIndication();
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Informs that Obex transport layer is down.
|
|
134 |
* @return None.
|
|
135 |
*/
|
|
136 |
void TransportDownIndication();
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Informs about Obex connect request.
|
|
140 |
* @param aRemoteInfo Information about the remote party.
|
|
141 |
* @param aInfo Information about the connection request.
|
|
142 |
* @return Symbian OS error code.
|
|
143 |
*/
|
|
144 |
TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo,
|
|
145 |
const TDesC8& aInfo );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Informs about Obex disconnect request.
|
|
149 |
* @param aInfo Information about the disconnect request.
|
|
150 |
* @return None.
|
|
151 |
*/
|
|
152 |
void ObexDisconnectIndication( const TDesC8& aInfo );
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Informs about Obex put request.
|
|
156 |
* @return The requested object or NULL;
|
|
157 |
*/
|
|
158 |
CObexBufObject* PutRequestIndication();
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Informs that part of the put object is sent.
|
|
162 |
* @return Symbian OS error code.
|
|
163 |
*/
|
|
164 |
TInt PutPacketIndication();
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Informs that the put request is completed.
|
|
168 |
* @return Symbian OS error code.
|
|
169 |
*/
|
|
170 |
TInt PutCompleteIndication();
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Informs about Obex put request.
|
|
174 |
* @param aRequiredObject The Get request object.
|
|
175 |
* @return The response object or NULL;
|
|
176 |
*/
|
|
177 |
CObexBufObject* GetRequestIndication(
|
|
178 |
CObexBaseObject* aRequiredObject );
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Informs that part of the get response object is sent.
|
|
182 |
* @return Symbian OS error code.
|
|
183 |
*/
|
|
184 |
TInt GetPacketIndication();
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Informs that the get request is completed.
|
|
188 |
* @return Symbian OS error code.
|
|
189 |
*/
|
|
190 |
TInt GetCompleteIndication();
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Informs about Obex Set Path request.
|
|
194 |
* @param aPathInfo Information about the path.
|
|
195 |
* @param aInfo Information about the Set Path request.
|
|
196 |
* @return Symbian OS error code.
|
|
197 |
*/
|
|
198 |
TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
|
|
199 |
const TDesC8& aInfo );
|
|
200 |
|
|
201 |
/**
|
|
202 |
* Informs about Obex Abort operation.
|
|
203 |
* @return None.
|
|
204 |
*/
|
|
205 |
void AbortIndication();
|
|
206 |
|
|
207 |
private:
|
|
208 |
|
|
209 |
/**
|
|
210 |
* C++ default constructor.
|
|
211 |
*/
|
|
212 |
CBTSBPPObjectServer( MBTSBPPObjectServerObserver* aObserver,
|
|
213 |
CBTEngDiscovery* aBTEngDiscoveryPtr,
|
|
214 |
const TBTDevAddr& aExpectedClient );
|
|
215 |
|
|
216 |
/**
|
|
217 |
* By default Symbian 2nd phase constructor is private.
|
|
218 |
*/
|
|
219 |
void ConstructL();
|
|
220 |
|
|
221 |
private: // Data
|
|
222 |
|
|
223 |
TInt iObjectChannel;
|
|
224 |
TSdpServRecordHandle iSDPHandle;
|
|
225 |
|
|
226 |
CObexServer* iServer;
|
|
227 |
CBTSBPPObjectRequest* iObjectRequest;
|
|
228 |
//CBTSBPPPasskeyRequest* iPasskeyRequest;
|
|
229 |
|
|
230 |
// Not owned
|
|
231 |
//
|
|
232 |
const CDesCArray* iObjectListPtr;
|
|
233 |
const TBTDevAddr* iExpectedClientPtr;
|
|
234 |
CBTEngDiscovery* iBTEngDiscoveryPtr;
|
|
235 |
MBTSBPPObjectServerObserver* iObserverPtr;
|
|
236 |
};
|
|
237 |
|
|
238 |
#endif // BTSBPP_OBJECT_SERVER_H
|
|
239 |
|
|
240 |
// End of File
|