|
1 // Copyright (c) 2003-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 @publishedAll |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef __OBEXCLIENT_H |
|
23 #define __OBEXCLIENT_H |
|
24 |
|
25 #include <obextypes.h> |
|
26 #include <obexbase.h> |
|
27 |
|
28 class CObexPacket; |
|
29 class MObexFinalPacketObserver; |
|
30 class CObexPacketSignaller; |
|
31 class CObexPacketTimer; |
|
32 class CObexErrorEngine; |
|
33 |
|
34 /** |
|
35 Client side functionality. Connection based. |
|
36 Supports ... |
|
37 - Opening IrDA TTP sockets for the OBEX session. |
|
38 - Opening an OBEX session over a connected socket |
|
39 - Standard OBEX (spec. version 1.2) operations. |
|
40 |
|
41 This class is not designed for user derivation. |
|
42 |
|
43 @publishedAll |
|
44 @released |
|
45 */ |
|
46 NONSHARABLE_CLASS(CObexClient) : public CObex |
|
47 { |
|
48 public: |
|
49 IMPORT_C ~CObexClient(); |
|
50 IMPORT_C static CObexClient* NewL(TObexProtocolInfo& aObexProtocolInfoPtr); |
|
51 IMPORT_C static CObexClient* NewL(TObexProtocolInfo& aObexProtocolInfoPtr, TObexProtocolPolicy& aObexProtocolPolicy); |
|
52 IMPORT_C static CObexClient* NewL(TObexTransportInfo& aObexTransportInfo); |
|
53 IMPORT_C void Connect(TRequestStatus& aStatus); |
|
54 IMPORT_C void Connect(CObexBaseObject& aObject, TRequestStatus& aStatus); |
|
55 IMPORT_C void ConnectL(CObexBaseObject& aObject, const TDesC& aPassword, TRequestStatus& aStatus); |
|
56 IMPORT_C void ConnectL(const TDesC& aPassword, TRequestStatus& aStatus); |
|
57 IMPORT_C void Disconnect(TRequestStatus& aStatus); |
|
58 IMPORT_C void Put(CObexBaseObject& aObject, TRequestStatus& aStatus); |
|
59 IMPORT_C void Get(CObexBaseObject& aObject, TRequestStatus& aStatus); |
|
60 IMPORT_C void SetPath(TSetPathInfo& aPathInfo, TRequestStatus& aStatus); |
|
61 IMPORT_C void Abort(); |
|
62 IMPORT_C void UserPasswordL( const TDesC& aPassword); |
|
63 IMPORT_C const CObexHeaderSet& GetPutFinalResponseHeaders(); |
|
64 IMPORT_C void SetFinalPacketObserver(MObexFinalPacketObserver* aObserver); |
|
65 IMPORT_C TObexResponse LastServerResponseCode() const; |
|
66 IMPORT_C void SetCommandTimeOut(TTimeIntervalMicroSeconds32 aTimeOut); |
|
67 IMPORT_C TAny* ExtensionInterface(TUid aUid); |
|
68 |
|
69 public: // Called from CObexNotifyExtendClient |
|
70 void SignalPacketProcessEvent(TInt aEvent); |
|
71 void TimeOutCompletion(); |
|
72 |
|
73 private: |
|
74 CObexClient(); |
|
75 void ConstructL(TObexTransportInfo& aObexTransportInfo); |
|
76 TBool AlreadyActive(TRequestStatus& aStatus); |
|
77 void ClientCommandL(TOperation aOp, TAny* aParam, TRequestStatus& aStatus); |
|
78 // Implementation of CObex Events |
|
79 virtual void OnPacketReceive(CObexPacket& aPacket); |
|
80 virtual void OnError(TInt aError); |
|
81 virtual void OnTransportUp(); |
|
82 virtual void OnTransportDown(); |
|
83 void SetRequest(TRequestStatus& aStatus, TOperation aOperation); |
|
84 void CompleteRequest(const TInt aCompletion); |
|
85 TInt PrepareConnectPacket(CObexPacket& aPacket); // Should be members of TConnectInfo |
|
86 TInt ParseConnectPacket(CObexPacket& aPacket); |
|
87 void ResetConnectionID(); |
|
88 void SetConnectionID(TUint32 aConnectionID); |
|
89 void EmptyHeaderSet(); |
|
90 void SendRequestPacket(); |
|
91 void SendRequestPacket(TObexOpcode aObexOpcode); |
|
92 |
|
93 private: |
|
94 TRequestStatus* iPendingRequest; |
|
95 CObexBaseObject* iCurrentObject; |
|
96 TUint32 iConnectionID; |
|
97 TBool iConnectionIdSet; |
|
98 CObexHeaderSet* iHeaderSet; |
|
99 CObexHeader* iHeader; |
|
100 CObexPacketSignaller* iPacketProcessSignaller; |
|
101 TObexResponse iLastReceivedResponseOpcode; |
|
102 CObexErrorEngine* iErrorEngine; |
|
103 TBool iIsLastErrorSet; |
|
104 TTimeIntervalMicroSeconds32 iCmdTimeOutDuration; |
|
105 CObexPacketTimer* iPacketTimer; |
|
106 }; |
|
107 |
|
108 #endif // __OBEXCLIENT_H |