Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Warhawk committed Jun 30, 2014
0 parents commit edb294d
Show file tree
Hide file tree
Showing 85 changed files with 30,869 additions and 0 deletions.
8 changes: 8 additions & 0 deletions RobotWASD/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.classpath
.project
.settings
bin
gen
lint.xml
proguard-project.txt
project.properties
35 changes: 35 additions & 0 deletions RobotWASD/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.ac.uibk.robotwasd"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />

<uses-feature android:name="android.hardware.usb.host" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="at.ac.uibk.robotwasd.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>

<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>
</application>

</manifest>
21 changes: 21 additions & 0 deletions RobotWASD/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Robot WASD example

This example shows how to control the robot from within an android app. In
order to use this your phone has to support USB OTG (no root required).
Communication between the robot and the phone happens via the use of a USB
serial converter (FT232). To use the serial interface following library is
required:

<https://github.com/ksksue/FTDriver>

After installing the android application, connect the phone to the robot. The
application should open automatically. Connection has been established if the
textbox at the bottom contains the word "connected".

Inside the `AndroidManifest.xml` you will find and XML-node named
`intent-filter`. This entry states when the application will be launched. Using
this `intent-filter` option will automatically grant permission to communicate
over USB to the application. If you do not use this mechanism you have to
request them manually.

<http://developer.android.com/guide/topics/connectivity/usb/host.html#permission-d>
Binary file added RobotWASD/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RobotWASD/libs/android-support-v4.jar
Binary file not shown.
Binary file added RobotWASD/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RobotWASD/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RobotWASD/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RobotWASD/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
163 changes: 163 additions & 0 deletions RobotWASD/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >

<GridLayout
android:layout_width="match_parent"
android:layout_height="230dp"
android:columnCount="1" >

<Button
android:id="@+id/buttonX"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="center_horizontal|bottom"
android:layout_row="0"
android:onClick="buttonX_onClick"
android:text="X" />

<Button
android:id="@+id/buttonA"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="left|center_vertical"
android:layout_row="0"
android:onClick="buttonA_onClick"
android:text="A" />

<Button
android:id="@+id/buttonS"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="center"
android:layout_row="0"
android:onClick="buttonS_onClick"
android:text="S" />

<Button
android:id="@+id/buttonD"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="right|center_vertical"
android:layout_row="0"
android:onClick="buttonD_onClick"
android:text="D" />

<Button
android:id="@+id/buttonW"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="center_horizontal|top"
android:layout_row="0"
android:onClick="buttonW_onClick"
android:text="W" />

<Button
android:id="@+id/ButtonDown"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="left|bottom"
android:layout_row="0"
android:onClick="buttonDown_onClick"
android:text="Down" />

<Button
android:id="@+id/ButtonUp"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="right|bottom"
android:layout_row="0"
android:onClick="buttonUp_onClick"
android:text="Up" />

<Button
android:id="@+id/ButtonMinus"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="left|top"
android:layout_row="0"
android:onClick="buttonMinus_onClick"
android:text="-" />

<Button
android:id="@+id/ButtonPlus"
android:layout_width="80dp"
android:layout_height="60dp"
android:layout_column="0"
android:layout_gravity="right|top"
android:layout_row="0"
android:onClick="buttonPlus_onClick"
android:text="+" />

</GridLayout>

<RelativeLayout
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.61"
android:orientation="vertical" >

<Button
android:id="@+id/buttonLedOn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:minHeight="60dp"
android:minWidth="80dp"
android:onClick="buttonLedOn_onClick"
android:text="LED on" />

<Button
android:id="@+id/buttonLedOff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/buttonLedOn"
android:layout_alignBottom="@+id/buttonLedOn"
android:layout_alignParentRight="true"
android:minHeight="60dp"
android:minWidth="80dp"
android:onClick="buttonLedOff_onClick"
android:text="LED off" />

<Button
android:id="@+id/buttonSensor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:minHeight="60dp"
android:minWidth="80dp"
android:onClick="buttonSensor_onClick"
android:text="Read Sensor" />

<EditText
android:id="@+id/textLog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/buttonLedOn"
android:ems="10"
android:enabled="false"
android:scrollbars="none"
android:textSize="12sp" >

<requestFocus />
</EditText>
</RelativeLayout>

</LinearLayout>
5 changes: 5 additions & 0 deletions RobotWASD/res/menu/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/connect" android:title="Connect"></item>
<item android:id="@+id/disconnect" android:title="Disconnect"></item>

</menu>
8 changes: 8 additions & 0 deletions RobotWASD/res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>

<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw600dp devices (e.g. 7" tablets) here.
-->

</resources>
9 changes: 9 additions & 0 deletions RobotWASD/res/values-sw720dp-land/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<resources>

<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>

</resources>
11 changes: 11 additions & 0 deletions RobotWASD/res/values-v11/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<resources>

<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>

</resources>
12 changes: 12 additions & 0 deletions RobotWASD/res/values-v14/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<resources>

<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>

</resources>
7 changes: 7 additions & 0 deletions RobotWASD/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<resources>

<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>

</resources>
8 changes: 8 additions & 0 deletions RobotWASD/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">RobotWASD</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>

</resources>
20 changes: 20 additions & 0 deletions RobotWASD/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<resources>

<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

</resources>
15 changes: 15 additions & 0 deletions RobotWASD/res/xml/device_filter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 0x0403 / 0x6001: FTDI FT232R UART -->
<usb-device vendor-id="1027" product-id="24577" />

<!-- 0x2341 / Arduino -->
<usb-device vendor-id="9025" />

<!-- 0x16C0 / 0x0483: Teensyduino -->
<usb-device vendor-id="5824" product-id="1155" />

<!-- 0x10C4 / 0xEA60: CP210x UART Bridge -->
<usb-device vendor-id="4292" product-id="60000" />

</resources>
Loading

0 comments on commit edb294d

Please sign in to comment.