|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Common definitions and classes needed by DUN plugins |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DUN_PLUGIN_H |
|
20 #define DUN_PLUGIN_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 typedef TAny* TConnId; // supported now: RSocket*, RComm* |
|
25 |
|
26 enum TDunPluginState |
|
27 { |
|
28 EDunStateNone = KErrNotFound, // -1 |
|
29 EDunStateZombie = 0, // 0 |
|
30 EDunStateTryUninitialize, // 1 |
|
31 EDunStateUninitialized, // 2 |
|
32 EDunStateTryLoad, // 3 |
|
33 EDunStateLoaded, // 4 |
|
34 EDunStateTryListen, // 5 |
|
35 EDunStateListening, // 6 |
|
36 EDunStateTryChannel, // 7 |
|
37 EDunStateChanneled // 8 |
|
38 }; |
|
39 |
|
40 const TInt KDunLocalMediaPluginInterfaceUidValue = 0x101F6E2D; |
|
41 const TUid KDunLocalMediaPluginInterfaceUid = { KDunLocalMediaPluginInterfaceUidValue }; |
|
42 |
|
43 const TInt KDunBtPluginUidValue = 0x101F6E2B; |
|
44 const TUid KDunBtPluginUid = { KDunBtPluginUidValue }; |
|
45 const TInt KDunIrPluginUidValue = 0x101FBAEB; |
|
46 const TUid KDunIrPluginUid = { KDunIrPluginUidValue }; |
|
47 const TInt KDunUsbPluginUidValue = 0x101F6E2F; |
|
48 const TUid KDunUsbPluginUid = { KDunUsbPluginUidValue }; |
|
49 |
|
50 class CDunTransporter; |
|
51 |
|
52 /** |
|
53 * Notification interface class to report request for plugin enqueue |
|
54 * This reqeust is made when there are not enough network resources for a |
|
55 * certain plugin's needs |
|
56 * |
|
57 * @lib dunutils.lib |
|
58 * @since S60 v3.2 |
|
59 */ |
|
60 NONSHARABLE_CLASS( MDunPluginManager ) |
|
61 { |
|
62 |
|
63 public: |
|
64 |
|
65 /** |
|
66 * Gets called when old plugin should be enqueued |
|
67 * |
|
68 * @since S60 3.2 |
|
69 * @param aPluginUid UID of the plugin that should be enqueued |
|
70 * @return Symbian error code on error, KErrNone otherwise |
|
71 */ |
|
72 virtual TInt NotifyPluginEnqueueRequest( TUid aPluginUid ) = 0; |
|
73 |
|
74 /** |
|
75 * Gets called when new plugin should be dequeued |
|
76 * |
|
77 * @since S60 3.2 |
|
78 * @param aPluginUid UID of the local media plugin to dequeue |
|
79 * @return Symbian error code on error, KErrNone otherwise |
|
80 */ |
|
81 virtual TInt NotifyPluginDequeueRequest( TUid aPluginUid ) = 0; |
|
82 |
|
83 /** |
|
84 * Get callen when plugin should be closed |
|
85 * |
|
86 * @since S60 3.2 |
|
87 * @param aPluginUid UID of the local media plugin to close |
|
88 * @param aSelfClose ETrue if plugin closes itself, EFalse otherwise |
|
89 * @return Symbian error code on error, KErrNone otherwise |
|
90 */ |
|
91 virtual TInt NotifyPluginCloseRequest( TUid aPluginUid, |
|
92 TBool aSelfClose ) = 0; |
|
93 |
|
94 }; |
|
95 |
|
96 /** |
|
97 * Interface class for accessing CDunServer's functionality |
|
98 * Shares basic interface for all plugins to use when plugin needs to access |
|
99 * server's functionality |
|
100 * |
|
101 * @lib dunutils.lib |
|
102 * @since S60 v3.2 |
|
103 */ |
|
104 NONSHARABLE_CLASS( MDunServerCallback ) : public MDunPluginManager |
|
105 { |
|
106 |
|
107 public: |
|
108 |
|
109 /** |
|
110 * Callback from plugins to server to get a plugin's state |
|
111 * |
|
112 * @since S60 3.2 |
|
113 * @param aPluginUid Plugin's UID which state to get |
|
114 * @return Plugin's state |
|
115 */ |
|
116 virtual TDunPluginState GetPluginStateByUid( TUid aPluginUid ) = 0; |
|
117 |
|
118 /** |
|
119 * Callback from plugins to server to set a new state |
|
120 * New state must be one more than the old state |
|
121 * |
|
122 * @since S60 3.2 |
|
123 * @param aPluginState New state to set for a plugin |
|
124 * @param aPluginUid Plugin's UID for which to change state |
|
125 * @return Symbian error code on error, KErrNone otherwise |
|
126 */ |
|
127 virtual TInt NotifyPluginStateChangeUp( TDunPluginState aPluginState, |
|
128 TUid aPluginUid ) = 0; |
|
129 |
|
130 /** |
|
131 * Callback from plugins to server to set a new state |
|
132 * New state must be one less than the old state |
|
133 * |
|
134 * @since S60 3.2 |
|
135 * @param aPluginState New state to set for a plugin |
|
136 * @param aPluginUid Plugin's UID for which to change state |
|
137 * @return Symbian error code on error, KErrNone otherwise |
|
138 */ |
|
139 virtual TInt NotifyPluginStateChangeDown( TDunPluginState aPluginState, |
|
140 TUid aPluginUid ) = 0; |
|
141 |
|
142 /** |
|
143 * Callback from plugins to server to restart a plugin |
|
144 * Restarting must be done by uninitialization->listening switch since |
|
145 * context is in plugin |
|
146 * |
|
147 * @since S60 3.2 |
|
148 * @param aPluginUid Plugin's UID to restart |
|
149 * @return Symbian error code on error, KErrNone otherwise |
|
150 */ |
|
151 virtual TInt NotifyPluginRestart( TUid aPluginUid ) = 0; |
|
152 |
|
153 /** |
|
154 * Callback from plugins to server to reopen a plugin from queue |
|
155 * |
|
156 * @since S60 3.2 |
|
157 * @return Symbian error code on error, KErrNone otherwise |
|
158 */ |
|
159 virtual TInt NotifyPluginReopenRequest() = 0; |
|
160 |
|
161 }; |
|
162 |
|
163 /** |
|
164 * Interface class for accessing plugins' functionality |
|
165 * Shares basic interface for server to use when server needs to access |
|
166 * plugin's functionality |
|
167 * |
|
168 * @lib dunutils.lib |
|
169 * @since S60 v3.2 |
|
170 */ |
|
171 NONSHARABLE_CLASS( MDunLocalMediaPlugin ) |
|
172 { |
|
173 |
|
174 public: |
|
175 |
|
176 /** |
|
177 * Destructor. Derived class must have virtual destructor also as a plugin |
|
178 * module is always destructed via M-class. |
|
179 */ |
|
180 inline virtual ~MDunLocalMediaPlugin() {}; |
|
181 |
|
182 /** |
|
183 * Symbian 2nd phase constructor. |
|
184 */ |
|
185 virtual void ConstructL( MDunServerCallback* aServer, |
|
186 CDunTransporter* aTransporter ) = 0; |
|
187 |
|
188 /** |
|
189 * Callback from server to plugins to notify when server changes a |
|
190 * plugin's state |
|
191 * |
|
192 * @since S60 3.2 |
|
193 * @param aPluginState New changed state |
|
194 * @return Symbian error code on error, KErrNone otherwise |
|
195 */ |
|
196 virtual TInt NotifyServerStateChange( TDunPluginState aPluginState ) = 0; |
|
197 |
|
198 /** |
|
199 * Callback from server to plugins to ask for current active connection |
|
200 * (For testing purposes only) |
|
201 * |
|
202 * @since S60 5.0 |
|
203 * @return Active connection, NULL otherwise |
|
204 */ |
|
205 virtual TConnId ActiveConnection() = 0; |
|
206 |
|
207 }; |
|
208 |
|
209 /** |
|
210 * Interface class for accessing plugin's main class when its listener |
|
211 * reports that channel can be created. Can be used also to notify plugin's |
|
212 * main class when channel can be deleted. |
|
213 * |
|
214 * @lib dunutils.lib |
|
215 * @since S60 v3.2 |
|
216 */ |
|
217 NONSHARABLE_CLASS( MDunListenCallback ) |
|
218 { |
|
219 |
|
220 public: |
|
221 |
|
222 /** |
|
223 * Callback from plugin's listener to plugin to notify about need to |
|
224 * allocate new channel |
|
225 * |
|
226 * @since S60 3.2 |
|
227 * @param aNoFreeChan ETrue if no free channels, EFalse otherwise |
|
228 * @return Symbian error code on error, KErrNone otherwise |
|
229 */ |
|
230 virtual TInt NotifyChannelAllocate( TBool& aNoFreeChans ) = 0; |
|
231 |
|
232 /** |
|
233 * Callback from plugin's listener to plugin to notify about need to free |
|
234 * an existing channel |
|
235 * |
|
236 * @since S60 3.2 |
|
237 * @return Symbian error code on error, KErrNone otherwise |
|
238 */ |
|
239 virtual TInt NotifyChannelFree() = 0; |
|
240 |
|
241 }; |
|
242 |
|
243 #endif // DUN_PLUGIN_H |