summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.classpath7
-rw-r--r--.project18
-rw-r--r--.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--CMakeLists.txt6
-rw-r--r--bin/sh/lab/smartsens/test/Test.classbin0 -> 3633 bytes
-rw-r--r--src/sh/lab/smartsens/test/Test.java87
6 files changed, 130 insertions, 0 deletions
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..0b06f81
--- a/dev/null
+++ b/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/smartsens-client-java"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/.project b/.project
new file mode 100644
index 0000000..ce183fd
--- a/dev/null
+++ b/.project
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>smartsens-client-java-test</name>
+ <comment></comment>
+ <projects>
+ <project>smartsens-client-java</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c542037
--- a/dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Wed Jul 20 20:43:03 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..4b479c4
--- a/dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required (VERSION 2.6)
+
+project (SMARTSENS_CLIENT_JAVA_TEST)
+
+find_package (Java 1.6 REQUIRED)
+
diff --git a/bin/sh/lab/smartsens/test/Test.class b/bin/sh/lab/smartsens/test/Test.class
new file mode 100644
index 0000000..2e41035
--- a/dev/null
+++ b/bin/sh/lab/smartsens/test/Test.class
Binary files differ
diff --git a/src/sh/lab/smartsens/test/Test.java b/src/sh/lab/smartsens/test/Test.java
new file mode 100644
index 0000000..087cdeb
--- a/dev/null
+++ b/src/sh/lab/smartsens/test/Test.java
@@ -0,0 +1,87 @@
+package sh.lab.smartsens.test;
+
+import java.awt.BorderLayout;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+
+import sh.lab.smartsens.Client;
+import sh.lab.smartsens.DeviceConfiguration;
+import sh.lab.smartsens.DeviceConfiguration.Screen;
+import sh.lab.smartsens.DeviceConfiguration.Sensor;
+import sh.lab.smartsens.DeviceConfiguration.Touchpad;
+import sh.lab.smartsens.FeedbackHandler;
+
+public class Test implements FeedbackHandler {
+
+ private Test() {
+ }
+
+ private void start() throws Exception {
+ DeviceConfiguration configuration = new DeviceConfiguration();
+ configuration.setAccelerationSensor(new Sensor(-100,
+ 100));
+ configuration.setAngularSensor(new Sensor(-100,
+ 100));
+ configuration.setLightSensor(new Sensor(-100,
+ 100));
+ configuration.setMagneticFieldSensor(new Sensor(-100,
+ 100));
+ configuration.setProximitySensor(new Sensor(-100,
+ 100));
+ configuration.setTouchpad(new Touchpad(480,
+ 600));
+
+ configuration.setVibrator(true);
+ configuration.setBlinker(true);
+ configuration.setFlasher(true);
+ configuration.setScreen(new Screen(480,
+ 600));
+
+ Client client = new Client("127.0.0.1",
+ configuration,
+ this);
+ client.resume();
+ }
+
+ public static void main(final String[] args) throws Exception {
+ Test test = new Test();
+ test.start();
+ }
+
+ @Override
+ public void vibrate(final long duration) {
+ System.out.println("Vibrate: duaration=" + duration);
+ }
+
+ @Override
+ public void blink(final long duration) {
+ System.out.println("Blink: duaration=" + duration);
+ }
+
+ @Override
+ public void flash(final boolean state) {
+ System.out.println("Flash: state=" + state);
+ }
+
+ @Override
+ public void screen(final int top,
+ final int left,
+ final int bottom,
+ final int right,
+ final byte[] data) {
+ System.out.println("Vibrate: top=" + top + " left=" + left + " bottom=" + bottom + " right=" + right + " length=" + data.length);
+
+ ImageIcon image = new ImageIcon(data);
+
+ JFrame frame = new JFrame();
+ frame.getContentPane().setLayout(new BorderLayout());
+
+ JLabel label = new JLabel(image);
+ frame.getContentPane().add(label,
+ BorderLayout.CENTER);
+
+ frame.setVisible(true);
+ }
+}