Skip to content

Commit 2c536aa

Browse files
committed
first commit
1 parent e90fdf3 commit 2c536aa

File tree

338 files changed

+9829
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

338 files changed

+9829
-0
lines changed

DroidDroid/.classpath

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
4+
<classpathentry kind="src" path="src"/>
5+
<classpathentry kind="src" path="gen"/>
6+
<classpathentry kind="lib" path="libs/AmarinoLibrary_v0_55.jar"/>
7+
<classpathentry kind="output" path="bin"/>
8+
</classpath>

DroidDroid/.project

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>DroidDroid</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>

DroidDroid/AndroidManifest.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="org.simonmonk.arduinodroid.bot"
4+
android:versionCode="1" android:versionName="1.0">
5+
<application android:icon="@drawable/icon" android:label="@string/app_name">
6+
<activity android:name="org.simonmonk.arduinoandroid.bot.DroidDroid">
7+
<intent-filter>
8+
<action android:name="android.intent.action.MAIN" />
9+
<category android:name="android.intent.category.LAUNCHER" />
10+
</intent-filter>
11+
</activity>
12+
<activity android:name="org.simonmonk.arduinoandroid.bot.DroidDroidControls"
13+
android:label="@string/app_name"
14+
android:screenOrientation="landscape"
15+
android:configChanges="orientation|keyboardHidden"
16+
>
17+
</activity>
18+
</application>
19+
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7"/>
20+
21+
</manifest>

DroidDroid/bin/DroidDroid.apk

17 KB
Binary file not shown.

DroidDroid/bin/classes.dex

16.5 KB
Binary file not shown.

DroidDroid/bin/resources.ap_

8.43 KB
Binary file not shown.

DroidDroid/default.properties

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system use,
7+
# "build.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Indicates whether an apk should be generated for each density.
11+
split.density=false
12+
# Project target.
13+
target=android-7
17.8 KB
Binary file not shown.
Loading

DroidDroid/res/drawable/icon.png

4.05 KB
Loading

DroidDroid/res/layout/controls.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:orientation="vertical"
4+
android:layout_width="fill_parent"
5+
android:layout_height="fill_parent"
6+
android:background="#cdcdcd">
7+
8+
<!-- <EditText android:id="@+id/deviceIDField"
9+
android:layout_width="fill_parent"
10+
android:layout_weight="1"
11+
android:layout_height="wrap_content"
12+
android:layout_gravity="left"
13+
>
14+
</EditText> -->
15+
16+
<SeekBar android:id="@+id/SeekBarRight"
17+
android:layout_width="fill_parent"
18+
android:layout_weight="1"
19+
android:layout_height="wrap_content"
20+
android:max="510"
21+
android:layout_gravity="center"
22+
android:minHeight="50dp"
23+
android:thumbOffset="4px"
24+
android:thumb="@drawable/btn_square_overlay_normal"
25+
>
26+
</SeekBar>
27+
28+
29+
<SeekBar android:id="@+id/SeekBarLeft"
30+
android:layout_height="wrap_content"
31+
android:layout_width="fill_parent"
32+
android:layout_weight="1"
33+
android:max="510"
34+
android:layout_gravity="center"
35+
android:minHeight="50dp"
36+
android:thumb="@drawable/btn_square_overlay_normal"
37+
android:thumbOffset="4px"
38+
>
39+
</SeekBar>
40+
41+
42+
</LinearLayout>

DroidDroid/res/layout/main.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:orientation="vertical"
4+
android:layout_width="fill_parent"
5+
android:layout_height="wrap_content"
6+
>
7+
8+
<EditText android:id="@+id/deviceIDField"
9+
android:layout_width="fill_parent"
10+
android:layout_height="wrap_content"
11+
>
12+
</EditText>
13+
14+
<Button
15+
android:id="@+id/okButton"
16+
android:layout_width="fill_parent"
17+
android:layout_height="wrap_content"
18+
android:text="Set Device ID"
19+
/>
20+
21+
</LinearLayout>

DroidDroid/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">DroidDroid</string>
4+
</resources>

DroidDroid/screenshots/device.png

11.8 KB
Loading
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package org.simonmonk.arduinoandroid.bot;
2+
3+
import org.simonmonk.arduinodroid.bot.R;
4+
5+
6+
import android.app.Activity;
7+
import android.content.Intent;
8+
import android.content.SharedPreferences;
9+
import android.os.Bundle;
10+
import android.preference.PreferenceManager;
11+
import android.util.Log;
12+
import android.view.View;
13+
import android.view.View.OnClickListener;
14+
import android.widget.Button;
15+
import android.widget.EditText;
16+
import at.abraxas.amarino.Amarino;
17+
18+
public class DroidDroid extends Activity implements OnClickListener {
19+
20+
private static final String TAG = "SM";
21+
22+
public static String DEVICE_ADDRESS;
23+
24+
EditText idField;
25+
Button button;
26+
27+
/** Called when the activity is first created. */
28+
@Override
29+
public void onCreate(Bundle savedInstanceState) {
30+
super.onCreate(savedInstanceState);
31+
setContentView(R.layout.main);
32+
33+
Log.d(TAG, "Main onStart");
34+
35+
// get references to views defined in our main.xml layout file
36+
idField = (EditText) findViewById(R.id.deviceIDField);
37+
button = (Button) findViewById(R.id.okButton);
38+
// register listeners
39+
button.setOnClickListener(this);
40+
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
41+
DEVICE_ADDRESS = prefs.getString("device", "00:11:04:08:04:64");
42+
idField.setText(DEVICE_ADDRESS);
43+
}
44+
45+
46+
public void onClick(View v)
47+
{
48+
DEVICE_ADDRESS = idField.getText().toString();
49+
PreferenceManager.getDefaultSharedPreferences(this)
50+
.edit()
51+
.putString("device", DEVICE_ADDRESS)
52+
.commit();
53+
Amarino.connect(this, DEVICE_ADDRESS);
54+
Intent i = new Intent(this, DroidDroidControls.class);
55+
startActivity(i);
56+
}
57+
58+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package org.simonmonk.arduinoandroid.bot;
2+
3+
import org.simonmonk.arduinodroid.bot.R;
4+
import android.app.Activity;
5+
import android.os.Bundle;
6+
import android.util.Log;
7+
import android.widget.SeekBar;
8+
import android.widget.SeekBar.OnSeekBarChangeListener;
9+
import at.abraxas.amarino.Amarino;
10+
11+
public class DroidDroidControls extends Activity implements OnSeekBarChangeListener {
12+
13+
private static final String TAG = "SM";
14+
15+
16+
final int DELAY = 150;
17+
SeekBar leftSB;
18+
SeekBar rightSB;
19+
20+
int left = 255;
21+
int right = 255;
22+
long lastChange;
23+
24+
/** Called when the activity is first created. */
25+
@Override
26+
public void onCreate(Bundle savedInstanceState) {
27+
super.onCreate(savedInstanceState);
28+
setContentView(R.layout.controls);
29+
30+
// get references to views defined in our main.xml layout file
31+
leftSB = (SeekBar) findViewById(R.id.SeekBarLeft);
32+
rightSB = (SeekBar) findViewById(R.id.SeekBarRight);
33+
34+
// register listeners
35+
leftSB.setOnSeekBarChangeListener(this);
36+
rightSB.setOnSeekBarChangeListener(this);
37+
}
38+
39+
@Override
40+
protected void onStart() {
41+
super.onStart();
42+
leftSB.setProgress(left);
43+
rightSB.setProgress(right);
44+
}
45+
46+
@Override
47+
protected void onStop() {
48+
super.onStop();
49+
50+
Amarino.disconnect(this, DroidDroid.DEVICE_ADDRESS);
51+
}
52+
53+
54+
55+
@Override
56+
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
57+
// do not send to many updates, Arduino can't handle so much
58+
if (System.currentTimeMillis() - lastChange > DELAY ){
59+
updateState(seekBar);
60+
lastChange = System.currentTimeMillis();
61+
}
62+
}
63+
64+
@Override
65+
public void onStartTrackingTouch(SeekBar seekBar) {
66+
lastChange = System.currentTimeMillis();
67+
}
68+
69+
@Override
70+
public void onStopTrackingTouch(SeekBar seekBar) {
71+
updateState(seekBar);
72+
}
73+
74+
private void updateState(final SeekBar seekBar) {
75+
76+
switch (seekBar.getId()){
77+
case R.id.SeekBarLeft:
78+
left = seekBar.getProgress();
79+
updateLeft();
80+
break;
81+
case R.id.SeekBarRight:
82+
right = seekBar.getProgress();
83+
updateRight();
84+
break;
85+
}
86+
// provide user feedback
87+
}
88+
89+
private void updateLeft(){
90+
Log.d(TAG, "update left=" + (512 - left));
91+
Log.d(TAG, "device address=" + DroidDroid.DEVICE_ADDRESS);
92+
Amarino.sendDataToArduino(this, DroidDroid.DEVICE_ADDRESS, 'l', (511 - left));
93+
}
94+
95+
private void updateRight(){
96+
Log.d(TAG, "update right=" + (512 - right));
97+
Log.d(TAG, "device address=" + DroidDroid.DEVICE_ADDRESS);
98+
Amarino.sendDataToArduino(this, DroidDroid.DEVICE_ADDRESS, 'r', (511 - right));
99+
}
100+
101+
}

DroidGeigerLaunch/.classpath

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>

DroidGeigerLaunch/.project

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>DroidGeigerLaunch</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>

DroidGeigerLaunch/Android.mk

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Copyright (C) 2011 The Android Open Source Project
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
LOCAL_PATH:= $(call my-dir)
18+
include $(CLEAR_VARS)
19+
20+
LOCAL_MODULE_TAGS := tests
21+
22+
LOCAL_SRC_FILES := $(call all-subdir-java-files)
23+
24+
LOCAL_PACKAGE_NAME := DroidGeiger
25+
26+
LOCAL_JAVA_LIBRARIES := com.android.future.usb.accessory
27+
28+
include $(BUILD_PACKAGE)

0 commit comments

Comments
 (0)