You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MUSESDevGuide.tex
+41Lines changed: 41 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -234,6 +234,47 @@ \subsection{Adding Apache Tomcat as a server}
234
234
\chapter{Creating and integrating new sensors}
235
235
\label{ch:sensors}
236
236
237
+
A new sensor must implement the \texttt{eu.musesproject.client.contextmonitoring.\\sensors.ISensor} interface. This interface has six methods:
238
+
239
+
\begin{description}
240
+
\item[void addContextListener(ContextListener listener);] This method takes a ContextListener object, the listener method \textbf{onEvent(ContextEvent contextEvent)} must be called whenever the sensor shall send an event to the MUSES system.
241
+
\item[void removeContextListener(ContextListener listener);] Should contain a null object to remove the reference to the previous ContextListener object. Usually it is not necessary to call this method.
242
+
\item[void enable();] The startup process of the sensor should be written or triggered in this method.
243
+
\item[void disable();] Contains code to stop the sensor so that no more context events are fired to the system.
244
+
\item[ContextEvent getLastFiredContextEvent();] Each sensor has a history of its fired context events; therefore a List<ContextEvents> must be implemented. The size of the list is limited by the static field CONTEXT\_EVENT\_HISTORY\_SIZE, which is located in the ISensor class. The developer has to take care to update the list probably.
245
+
\item[void configure(List<SensorConfiguration> config);] If a sensor needs to be configured as it might expect specific values in order run as intended, the developer has to take care about the List<SensorConfiguration> config object. The SensorConfiguration class is located in the package: \texttt{eu.musesproject.client.db.entity}.
246
+
\end{description}
247
+
248
+
Each sensor must provide a \textbf{public static final String} \textit{TYPE} field. This field is used to identify the sensor. The naming convention is:\\\texttt{CONTEXT\_SENSOR\_<SensorIdentifier>}.
249
+
In addition, and in order to create properties for context events, the sensor must contain a \textbf{public static final String} field for each property identifier.
250
+
251
+
\section{How to integrate new sensors}
252
+
\label{sec:integratesensor}
253
+
254
+
First, new sensors should be placed within the MUSES Client project in the following package:
0 commit comments