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 // Defines the interface to an obex connector |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __OBEXCONNECTOR_H__ |
|
19 #define __OBEXCONNECTOR_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 class MObexTransportNotify; |
|
24 |
|
25 /** |
|
26 @publishedPartner |
|
27 @released |
|
28 */ |
|
29 struct TObexConnectionInfo |
|
30 { |
|
31 enum TSocketType |
|
32 { |
|
33 ESocketPacket, |
|
34 ESocketStream, |
|
35 EUsbStream, |
|
36 }; |
|
37 TSocketType iSocketType; |
|
38 TInt iMaxSendSize; |
|
39 TInt iMaxRecvSize; |
|
40 }; |
|
41 |
|
42 /** |
|
43 Base type for OBEX connectors |
|
44 To make an OBEX protocol connector: Derive from this class and override the |
|
45 pure virtual functions with the relevent implementation |
|
46 |
|
47 @publishedPartner |
|
48 @released |
|
49 */ |
|
50 class CObexConnector : public CBase |
|
51 { |
|
52 public: |
|
53 /** |
|
54 This function is called as a result of an Obex client connect being |
|
55 issued. This function may either |
|
56 1. attempt to make a transport level connection with the transport level |
|
57 of an Obex server. For example, in the case of socket based transports, a |
|
58 socket is opened and a socket connect is issued. |
|
59 2. check that a transport link exists. For example in the case of the usb |
|
60 standard transport the connection may already be there |
|
61 In both cases, if successful, the connector will notify its owner that the |
|
62 transport is up. Otherwise the connector may 'error' the owner or leave as |
|
63 appropriate. |
|
64 |
|
65 @see MObexTransportNotify::TransportUp() |
|
66 @see MObexTransportNotify::Error() |
|
67 */ |
|
68 virtual void ConnectL()=0; |
|
69 |
|
70 /** |
|
71 This function cancels actions taken as a result of the ConnectL() request |
|
72 @see ConnectL() |
|
73 */ |
|
74 virtual void CancelConnect ()=0 ; |
|
75 |
|
76 /** |
|
77 This function is called as a result of an Obex server accept being issued. |
|
78 This function will start a transport object listening for a connect from |
|
79 the transport layer of an Obex client, if the transport layer has not |
|
80 already been established. |
|
81 |
|
82 In both cases, if successful, the connector will notify its owner that the |
|
83 transport is up. Otherwise the connector may 'error' the owner or leave as |
|
84 appropriate. |
|
85 @see MObexTransportNotify::TransportUp() |
|
86 @see MObexTransportNotify::Error() |
|
87 */ |
|
88 virtual void AcceptL ()=0 ; |
|
89 |
|
90 /** |
|
91 This function cancels actions taken as a result of the AcceptL() request |
|
92 |
|
93 @see AcceptL() |
|
94 */ |
|
95 virtual void CancelAccept ()=0; |
|
96 |
|
97 /** |
|
98 This function takes down the transport link. If there are reasons why the |
|
99 transport link cannot be taken down, then the function should return |
|
100 EFalse. |
|
101 */ |
|
102 virtual TBool BringTransportDown()=0; |
|
103 |
|
104 /** |
|
105 This function is a notification from the obex protocol layer that a |
|
106 transport error has occured. Set any transport specific error condition |
|
107 flags in this function. |
|
108 */ |
|
109 virtual void SignalTransportError()=0; |
|
110 |
|
111 public: |
|
112 IMPORT_C CObexConnector(MObexTransportNotify& aObserver); |
|
113 IMPORT_C ~CObexConnector(); |
|
114 |
|
115 protected: |
|
116 IMPORT_C virtual TAny* GetInterface(TUid aUid); |
|
117 IMPORT_C void BaseConstructL(); |
|
118 IMPORT_C MObexTransportNotify& Observer(); |
|
119 |
|
120 private: // owned |
|
121 TAny* iFuture1; |
|
122 |
|
123 private: // unowned |
|
124 MObexTransportNotify& iObserver; |
|
125 }; |
|
126 |
|
127 #endif // __OBEXCONNECTOR_H__ |
|