|
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: Sample |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "comms.h" |
|
19 #include "commsendpoint.h" |
|
20 #include "commsmessage.h" |
|
21 #include "logger.h" |
|
22 |
|
23 #include "coreinterface.h" |
|
24 #include "rtcinterface.h" |
|
25 |
|
26 #include "sample.h" |
|
27 |
|
28 #ifdef __SYMBIAN32__ |
|
29 java::captain::ExtensionPluginInterface* getExtensionPlugin() |
|
30 { |
|
31 #else |
|
32 extern "C" java::captain::ExtensionPluginInterface* getExtensionPlugin() |
|
33 { |
|
34 #endif |
|
35 return new java::captain::Sample(); |
|
36 } |
|
37 |
|
38 namespace java |
|
39 { |
|
40 namespace captain |
|
41 { |
|
42 |
|
43 Sample::Sample() : mCore(0) |
|
44 { |
|
45 JELOG2(EJavaCaptain); |
|
46 } |
|
47 |
|
48 Sample::~Sample() |
|
49 { |
|
50 JELOG2(EJavaCaptain); |
|
51 } |
|
52 |
|
53 void Sample::startPlugin(CoreInterface* core) |
|
54 { |
|
55 JELOG2(EJavaCaptain); |
|
56 mCore = core; |
|
57 mCore->getComms()->registerListener(PLUGIN_ID_SAMPLE_C, this); |
|
58 } |
|
59 |
|
60 void Sample::stopPlugin() |
|
61 { |
|
62 JELOG2(EJavaCaptain); |
|
63 mCore->getComms()->unregisterListener(PLUGIN_ID_SAMPLE_C, this); |
|
64 mCore = 0; |
|
65 } |
|
66 |
|
67 EventConsumerInterface* Sample::getEventConsumer() |
|
68 { |
|
69 JELOG2(EJavaCaptain); |
|
70 return this; |
|
71 } |
|
72 |
|
73 ApplicationManagementEventsInterface* Sample::getApplicationManagementListener() |
|
74 { |
|
75 JELOG2(EJavaCaptain); |
|
76 return this; |
|
77 } |
|
78 |
|
79 ApplicationRuntimeEventsInterface* Sample::getApplicationRuntimeListener() |
|
80 { |
|
81 JELOG2(EJavaCaptain); |
|
82 return this; |
|
83 } |
|
84 java::comms::CommsListener* Sample::getCommsListener() |
|
85 { |
|
86 JELOG2(EJavaCaptain); |
|
87 return this; |
|
88 } |
|
89 |
|
90 // EventConsumerInterface |
|
91 void Sample::event(const std::string& eventProvider, |
|
92 java::comms::CommsMessage& aMsg) |
|
93 { |
|
94 LOG1(EJavaCaptain, EInfo, "Sample::event(), aEvent.event = %s", eventProvider.c_str()); |
|
95 } |
|
96 |
|
97 // ApplicationManagementEventsInterface |
|
98 void Sample::amAdded(const uids_t& uids) |
|
99 { |
|
100 JELOG2(EJavaCaptain); |
|
101 LOG1(EJavaCaptain, EInfo, "Sample::amAdded, %d uids", uids.size()); |
|
102 } |
|
103 |
|
104 void Sample::amUpdated(const uids_t& uids) |
|
105 { |
|
106 JELOG2(EJavaCaptain); |
|
107 LOG1(EJavaCaptain, EInfo, "Sample::amUpdated, %d uids", uids.size()); |
|
108 } |
|
109 |
|
110 void Sample::amDeleted(const uids_t& uids) |
|
111 { |
|
112 JELOG2(EJavaCaptain); |
|
113 LOG1(EJavaCaptain, EInfo, "Sample::amDeleted, %d uids", uids.size()); |
|
114 } |
|
115 |
|
116 // ApplicationRuntimeEventsInterface |
|
117 void Sample::arLaunched(const Uid& aUID, const int& aRuntimeCommsAddress) |
|
118 { |
|
119 JELOG2(EJavaCaptain); |
|
120 std::wstring wuidi = aUID.toString(); |
|
121 std::string suidi(wuidi.begin(), wuidi.end()); |
|
122 LOG2(EJavaCaptain, EInfo, "Sample::arLaunched(%s, %d)", suidi.c_str(), aRuntimeCommsAddress); |
|
123 } |
|
124 |
|
125 void Sample::arTerminated(const Uid& aUID, const int& /*aExitCode*/) |
|
126 { |
|
127 JELOG2(EJavaCaptain); |
|
128 std::wstring wuidi = aUID.toString(); |
|
129 std::string suidi(wuidi.begin(), wuidi.end()); |
|
130 LOG1(EJavaCaptain, EInfo, "Sample::arTerminated(%s, %d)", suidi.c_str()); |
|
131 } |
|
132 |
|
133 // CommsListener methods |
|
134 void Sample::processMessage(CommsMessage&/* message*/) |
|
135 { |
|
136 JELOG2(EJavaCaptain); |
|
137 } |
|
138 |
|
139 } // namespace captain |
|
140 } // namespace java |
|
141 |