|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __OBJECTEXCHANGETESTOBJECT_H__ |
|
20 #define __OBJECTEXCHANGETESTOBJECT_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CObjectExchangeClient; |
|
25 |
|
26 class MOsmObexSenderObserver |
|
27 { |
|
28 public: |
|
29 virtual void ObexFileSent() = 0; |
|
30 virtual void ObexDisconnected( TInt aError, TInt aState ) = 0; |
|
31 }; |
|
32 |
|
33 /*! |
|
34 @class COsmObexSender |
|
35 |
|
36 @discussion Class for testing the asynchronous call API of CObjectExchangeClient |
|
37 */ |
|
38 class COsmObexSender : public CActive |
|
39 { |
|
40 public: |
|
41 |
|
42 enum TOsmConnectionType |
|
43 { |
|
44 EOsmConnectionBT, |
|
45 EOsmConnectionIrDA |
|
46 }; |
|
47 |
|
48 COsmObexSender( MOsmObexSenderObserver& aObserver ); |
|
49 |
|
50 |
|
51 /*! |
|
52 @function NewL |
|
53 |
|
54 @discussion Construct a COsmObexSender |
|
55 @result a pointer to the created instance of COsmObexSender |
|
56 */ |
|
57 static COsmObexSender* NewL( MOsmObexSenderObserver& aObserver ); |
|
58 |
|
59 /*! |
|
60 @function NewLC |
|
61 |
|
62 @discussion Construct a COsmObexSender |
|
63 @result a pointer to the created instance of COsmObexSender |
|
64 */ |
|
65 static COsmObexSender* NewLC( MOsmObexSenderObserver& aObserver ); |
|
66 |
|
67 /*! |
|
68 @function ~COsmObexSender |
|
69 |
|
70 @discussion Destroy the object and release all memory objects. Close any open sockets |
|
71 */ |
|
72 ~COsmObexSender(); |
|
73 |
|
74 /*! |
|
75 @function StartL |
|
76 |
|
77 @discussion Start the test procedure |
|
78 */ |
|
79 void SendFileL( TOsmConnectionType aConnectionType, const TDesC& aFileName ); |
|
80 |
|
81 /*! |
|
82 @function StopL |
|
83 |
|
84 @discussion Stop the test procedure |
|
85 */ |
|
86 void StopL(); |
|
87 |
|
88 |
|
89 protected: // from CActive |
|
90 /*! |
|
91 @function DoCancel |
|
92 |
|
93 @discussion Cancel any outstanding requests |
|
94 */ |
|
95 void DoCancel(); |
|
96 |
|
97 /*! |
|
98 @function RunL |
|
99 |
|
100 @discussion Respond to an event |
|
101 */ |
|
102 void RunL(); |
|
103 |
|
104 private: |
|
105 /*! |
|
106 @function CMessageClient |
|
107 |
|
108 @discussion Construct this object |
|
109 */ |
|
110 COsmObexSender(); |
|
111 |
|
112 /*! |
|
113 @function ConstructL |
|
114 |
|
115 @discussion Perform second phase construction of this object |
|
116 */ |
|
117 void ConstructL(); |
|
118 |
|
119 private: |
|
120 |
|
121 /*! |
|
122 @enum TState |
|
123 |
|
124 @discussion The state of the active object, determines behaviour within |
|
125 the RunL method. |
|
126 @value EWaitingToConnect initial state |
|
127 @value EConnecting trying to connect to the server |
|
128 @value ESending Sending data |
|
129 @value EDisconnecting Disconnecting from the remote |
|
130 */ |
|
131 |
|
132 enum TState |
|
133 { |
|
134 EWaitingToConnect, |
|
135 EConnecting, |
|
136 ESending, |
|
137 EDisconnecting |
|
138 }; |
|
139 |
|
140 /*! @var iState the state of the active object, determines behaviour within the RunL method. */ |
|
141 TState iState; |
|
142 |
|
143 /*! @var iObexClient Active object that does file transfer */ |
|
144 CObjectExchangeClient* iObexClient; |
|
145 |
|
146 MOsmObexSenderObserver& iObserver; |
|
147 |
|
148 TFileName iFileName; |
|
149 |
|
150 }; |
|
151 |
|
152 |
|
153 |
|
154 #endif // __OBJECTEXCHANGETESTOBJECT_H__ |
|
155 |