Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit Test support #1

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
ed9cacf
refactored server stuff to increase cohesion
donho-tech Sep 2, 2012
c851ace
added ignore files
donho-tech Sep 3, 2012
104f1f8
refactoring: made sensor thread more modular
donho-tech Sep 3, 2012
1818f21
added loggin, removed unnecessary method
donho-tech Sep 3, 2012
f73c430
further decreased dependencies
donho-tech Sep 7, 2012
c425e7b
extracted server component
donho-tech Sep 7, 2012
8b25b1c
reduced number of methods, optimised data structures
donho-tech Sep 9, 2012
a2c5557
removed port information and user settings update rate from data model
donho-tech Sep 10, 2012
d458871
put refreshment rate measuring functionality into own class
donho-tech Sep 10, 2012
395d9f6
moved port information int SensorSimulatorController
donho-tech Sep 10, 2012
a3e483f
removed scenario information from data model
donho-tech Sep 10, 2012
a498250
removed unused methods and duplicate variables
donho-tech Sep 14, 2012
410cb5a
removed counting and measuring of reading times from SensorModel
donho-tech Sep 14, 2012
e40d041
removed more unused variables and methods
donho-tech Sep 14, 2012
ed89f90
removed random from sensormodel
donho-tech Sep 14, 2012
b7aa8d2
minor change
donho-tech Sep 14, 2012
cfb2a90
removed unnecessary methods
donho-tech Sep 14, 2012
5670bfd
implemented observer pattern for update delay changes
donho-tech Sep 15, 2012
ca6850f
fixed refreshrate bug
donho-tech Sep 15, 2012
aa068a2
changed parameters of serverthread api
donho-tech Sep 15, 2012
665d42f
made SensorSimulatorModel implementing the server api, server interfa…
donho-tech Sep 15, 2012
e200f8f
simplified packet structure
donho-tech Sep 15, 2012
9a5bfd2
put refresh rate meter into model package
donho-tech Sep 15, 2012
83c190f
added gitignore files and renamed default.properties into default.pro…
donho-tech Sep 16, 2012
b1801ce
moved SensorType to correct package
donho-tech Sep 16, 2012
39661ce
moved sensor data model to library
donho-tech Sep 16, 2012
0af1ec6
updated doc and renamed sensor access method
donho-tech Sep 16, 2012
0c2f155
temperature changes in the gui are reflected in the model instantly, …
donho-tech Sep 17, 2012
c8f3b5b
light model changes are now done instantly, view observes model
donho-tech Sep 18, 2012
8e17e89
pressure sensor is mvc, generalized document listener
donho-tech Sep 19, 2012
11c2f9c
gravity sensor is mvc
donho-tech Sep 22, 2012
878d0be
proximity sensor is mvc
donho-tech Sep 22, 2012
dd42469
made orientation sensor implement mvc
donho-tech Sep 23, 2012
45e14b3
magnetic field sensor mvc
donho-tech Sep 23, 2012
8c44e7d
barcode sensor mvc
donho-tech Sep 23, 2012
b463811
rotationvector sensor implements observerpattern
donho-tech Sep 24, 2012
6f6df24
revert to older version without mvc refactoring
donho-tech Sep 24, 2012
22ced7d
interface for client added
donho-tech Sep 27, 2012
c59c229
provided alternative for SensorSimulatorClient
donho-tech Oct 2, 2012
62d94f1
recording app now sends complete sensor event instead of values only
donho-tech Oct 2, 2012
addb93f
DataReceiver can understand SensorDataSender server (not added to ver…
donho-tech Oct 2, 2012
9c0b55f
clean up work for client server comm
donho-tech Oct 3, 2012
56f07ee
now supporting all sensor listeners
donho-tech Oct 3, 2012
9a28936
use sparsearray instead of hashmap
donho-tech Oct 3, 2012
e1cb857
added sequence dispatcher behavior
donho-tech Oct 4, 2012
2770994
fixed bugs + receiver sends finished signal
donho-tech Oct 12, 2012
2b3dcdb
added testlibrary and clientlib
donho-tech Oct 15, 2012
fa14fae
bugfix dispatcher
donho-tech Oct 21, 2012
6aa8212
multiple test cases possible
donho-tech Oct 27, 2012
abe832d
SensorEventListener now contains a android.hardware.SensorEventListener
donho-tech Oct 28, 2012
b3f214e
switched client server roles: app library is now server, desktop app …
donho-tech Oct 28, 2012
5faa4b4
refactored test library
donho-tech Oct 28, 2012
6670e99
removed ip setting functionality
donho-tech Oct 28, 2012
9918b6b
added wrapper for sensoreventlistener to be able to switch to real api
donho-tech Oct 28, 2012
af9b829
real sensor api fallback functionality
donho-tech Oct 29, 2012
71433c5
toast notification on fake data and play custom seq in test
donho-tech Nov 4, 2012
8dea616
added continuous data stream functionality to smartphone part
donho-tech Nov 5, 2012
789a326
join threads instead of observer
donho-tech Nov 8, 2012
b80a697
reintegrated server component
donho-tech Nov 8, 2012
9dc3309
integration with sensorsimulator buggy
donho-tech Nov 8, 2012
4a0442c
more stable when desktop app is abruptly shutdown, reconnectable
donho-tech Nov 9, 2012
3ac50bb
sensorsimulator samples and sends acchording to registered rates
donho-tech Nov 11, 2012
2d0328f
sending data is buffered until package reaches max capacity to be mor…
donho-tech Nov 11, 2012
6b6911b
fixed waiting bug
donho-tech Nov 20, 2012
5dd7d3a
set sensors via console input, some refactoring
donho-tech Nov 24, 2012
ec2ff26
moved sending stuff to test library
donho-tech Nov 24, 2012
78d144d
removed unused method, renamed sequence data sender
donho-tech Nov 24, 2012
6771880
added recorder
donho-tech Nov 24, 2012
f164d0d
recording and loading functionality added
donho-tech Nov 24, 2012
9b23f42
added help msg
donho-tech Nov 24, 2012
d694a4f
renamed testlib package
donho-tech Nov 24, 2012
337ff10
deleted settings app - no longer needed
donho-tech Nov 24, 2012
908edeb
added some comments
donho-tech Nov 24, 2012
ce0fa46
test projects can now load files from src dir
donho-tech Nov 25, 2012
572455e
refactoring: deleted unused old classes, deleted unused methods
donho-tech Nov 25, 2012
c748d0c
merged abstract class which is no longer needed after SensorSimulator…
donho-tech Nov 25, 2012
dfd2127
reduced visibility of client lib
donho-tech Nov 25, 2012
6eb989d
renamed libs, was too long
donho-tech Nov 25, 2012
5644412
renamed desktop app project to make it clear what it is
donho-tech Nov 25, 2012
2025589
added comment, removed control printlin
donho-tech Nov 25, 2012
a18a909
removed useless class
donho-tech Nov 25, 2012
7c65bb8
testing google chart api
donho-tech Dec 15, 2012
73489a4
performance measuring
donho-tech Dec 15, 2012
161c69d
continuous mode with tcp
donho-tech Dec 27, 2012
56771b9
error msg when ip is missing
donho-tech Dec 27, 2012
a64fe42
put parse cmds in own methods
donho-tech Dec 27, 2012
787946b
Error messages for set cmd
donho-tech Dec 27, 2012
557ed1e
corrected sensor parameters
donho-tech Dec 27, 2012
22cadd6
added help msg for set cmd
donho-tech Dec 27, 2012
c1f87d0
added name param in sensor constructor
donho-tech Dec 27, 2012
7ce9c61
removed outdated samples
donho-tech Dec 27, 2012
db8faf6
ip can now be specified in gui
donho-tech Dec 28, 2012
aac187a
fixed tcp continuous mode: socket timeout bug
donho-tech Dec 29, 2012
18a5a4a
removed logs
donho-tech Dec 29, 2012
8c6ee28
added samples
donho-tech Dec 29, 2012
8719b72
added instruction in comments for test
donho-tech Dec 29, 2012
b22d555
help msg
donho-tech Dec 29, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SensorRecordFromDevice/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
2 changes: 2 additions & 0 deletions SensorRecordFromDevice/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/
gen/
11 changes: 0 additions & 11 deletions SensorRecordFromDevice/default.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-14
target=android-7

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.openintents.sensorsimulator.record;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import android.app.Notification;
Expand All @@ -24,6 +26,8 @@
public class SensorRecordService extends Service {
private static final String TAG = "SensorRecordService";

private static final int PORT = 9100;

private static final CharSequence MSG_SERVER_UNREACHABLE = "Please check"
+ " the IP address and make sure that you have started the java"
+ " desktop application!";
Expand All @@ -35,7 +39,7 @@ public class SensorRecordService extends Service {

// communication
private Socket mRequestSocket;
private ObjectOutputStream mOutStream;
private DataOutputStream mOutStream;

// sensors
private ArrayList<SensorEventListener> mListenersArray;
Expand Down Expand Up @@ -66,31 +70,30 @@ public int onStartCommand(Intent intent, int flags, int startId) {
// get ip address (from intent)
String ipAddress = intent.getStringExtra("ip");
try {
mRequestSocket = new Socket(ipAddress, Global.PORT);
mRequestSocket = new Socket(ipAddress, PORT);
Log.d(TAG, "created socket for ip address:" + ipAddress);
mOutStream = new ObjectOutputStream(
mOutStream = new DataOutputStream(
mRequestSocket.getOutputStream());
mHandler = new Handler(new Callback() {
@Override
public boolean handleMessage(Message msg) {
// event captured by a listener
// send event values to the server (sockets)
try {
// sensorType
mOutStream.writeObject(msg.arg1);
// float[] - sensor values
mOutStream.writeObject(msg.obj);

// Log.d(TAG, "send message:" + ((float[]) msg.obj)[0] +
// " "
// + ((float[]) msg.obj)[1] + " " + ((float[])
// msg.obj)[2]);
//
SensorEventContainer event = (SensorEventContainer) msg.obj;

mOutStream.writeInt(event.type);
mOutStream.writeInt(event.accuracy);
mOutStream.writeLong(event.timestamp);
mOutStream.writeInt(event.values.length);
for (float value : event.values) {
mOutStream.writeFloat(value);
}

} catch (IOException e) {
Log.e(TAG, "Connection closed!");
clearAll(false);
}

return true;
}
});
Expand Down Expand Up @@ -119,8 +122,9 @@ private void registerListener(final int sensorType) {
@Override
public void onSensorChanged(SensorEvent event) {
Message msg = new Message();
msg.obj = event.values.clone();
msg.arg1 = sensorType;
msg.obj = new SensorEventContainer(
sensorType, event.accuracy, event.timestamp,
event.values.clone());
mHandler.sendMessage(msg);
}

Expand Down Expand Up @@ -181,4 +185,28 @@ private void showNotification() {
// Send the notification.
mNotificationManager.notify(NOTIFICATION, notification);
}

/**
* Simple Container Class to wrap sensor data and put them in the queue for
* the network handler. Not necessary, when handler would just process the
* sensor event, but I did not have the time to check the "sensor - id"
* mapping at the time.
*
* @author Qui Don Ho
*
*/
private class SensorEventContainer {
public int type;
public int accuracy;
public long timestamp;
public float[] values;

public SensorEventContainer(int type, int accuracy, long timestamp,
float[] values) {
this.type = type;
this.accuracy = accuracy;
this.timestamp = timestamp;
this.values = values;
}
}
}
158 changes: 0 additions & 158 deletions SensorSimulator/src/org/openintents/tools/simulator/SensorServer.java

This file was deleted.

Loading