|
1 /* |
|
2 * Copyright (c) 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: DriveObserverClient |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef DRIVEOBSERVERCLIENT_H |
|
19 #define DRIVEOBSERVERCLIENT_H |
|
20 |
|
21 #include <set> |
|
22 |
|
23 #include "javaosheaders.h" |
|
24 #include "commslistener.h" |
|
25 |
|
26 namespace java |
|
27 { |
|
28 namespace comms |
|
29 { |
|
30 class CommsClientEndpoint; |
|
31 } |
|
32 |
|
33 namespace fileutils |
|
34 { |
|
35 |
|
36 using java::comms::CommsListener; |
|
37 using java::comms::CommsMessage; |
|
38 |
|
39 class DriveListenerInterface; |
|
40 |
|
41 OS_NONSHARABLE_CLASS(DriveObserverClient) : public CommsListener |
|
42 { |
|
43 public: |
|
44 DriveObserverClient(); |
|
45 virtual ~DriveObserverClient(); |
|
46 |
|
47 int registerListener(DriveListenerInterface* aListener, |
|
48 const int& aServerCommsAddress); |
|
49 int unregisterListener(DriveListenerInterface* aListener, |
|
50 const int& aServerCommsAddress); |
|
51 |
|
52 private: |
|
53 void enableEvents(const int& aServerCommsAddress); |
|
54 void disableEvents(); |
|
55 |
|
56 // CommsListener |
|
57 virtual void processMessage(CommsMessage& aMessage); |
|
58 |
|
59 std::set<DriveListenerInterface*> mListeners; |
|
60 |
|
61 bool mEventsSubscribed; |
|
62 java::comms::CommsClientEndpoint* mComms; |
|
63 bool mCommsOwner; |
|
64 }; |
|
65 |
|
66 } // end of namespace fileutils |
|
67 } // end of namespace java |
|
68 |
|
69 #endif // DRIVEOBSERVERCLIENT_H |