Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 211 → Rev 212

/DUBwise/trunk/android/AndroidManifest.xml
0,0 → 1,94
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.ligi.android"
android:versionCode="1"
android:versionName="1.0">
 
<application android:label="@string/app_name">
 
<uses-library android:name="com.google.android.maps"/>
<activity android:name=".DUBwise"
android:label="@string/app_name"
android:icon="@drawable/icon">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
 
 
<activity android:name=".DUBwiseMapActivity"
android:label="@string/app_name"
>
<intent-filter>
 
<action android:name="android.intent.action.MAIN" />
 
</intent-filter>
</activity>
 
<activity android:name=".ConnectionActivity"
android:label="@string/app_name"
>
<intent-filter>
 
<action android:name="android.intent.action.MAIN" />
 
</intent-filter>
</activity>
 
 
<activity android:name=".MotorTestActivity"
android:label="@string/app_name"
>
<intent-filter>
 
<action android:name="android.intent.action.MAIN" />
 
</intent-filter>
</activity>
 
 
<activity android:name=".RCDataActivity"
android:label="@string/app_name"
>
<intent-filter>
 
<action android:name="android.intent.action.MAIN" />
 
</intent-filter>
</activity>
 
 
 
<activity android:name=".FlightSettingsActivity"
android:label="@string/app_name"
>
<intent-filter>
 
<action android:name="android.intent.action.MAIN" />
 
</intent-filter>
</activity>
 
 
<activity android:name=".FlightSettingsSettingSelect"
 
android:label="@string/app_name"
>
<intent-filter>
 
<action android:name="android.intent.action.MAIN" />
 
</intent-filter>
</activity>
 
</application>
 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
 
 
</manifest>
/DUBwise/trunk/android/build.xml
0,0 → 1,293
<?xml version="1.0" ?>
<project name="DUBwise" default="debug">
 
<!-- The build.properties file can be created by you and is never touched
by activitycreator. If you want to manually set properties, this is
the best place to set them. -->
<property file="build.properties"/>
 
<!-- The default.properties file is created and updated by activitycreator.
It will set any properties not already defined by build.properties. -->
<property file="default.properties"/>
 
<!-- ************************************************************************************* -->
<!-- These settings were written by activitycreator.
Do not change them unless you really know what you are doing. -->
 
<!-- Application Package Name -->
<property name="application-package" value="org.ligi.android" />
 
<!-- The intermediates directory, Eclipse uses "bin"
for its own output, so we do the same. -->
<property name="outdir" value="bin" />
<!-- ************************************************************************************* -->
<!-- No user servicable parts below. -->
 
<property name="android-tools" value="${sdk-folder}/tools" />
<property name="android-framework" value="${android-tools}/lib/framework.aidl" />
 
<!-- Input directories -->
<property name="resource-dir" value="res" />
<property name="asset-dir" value="assets" />
<property name="srcdir" value="src" />
<condition property="srcdir-ospath"
value="${basedir}\${srcdir}"
else="${basedir}/${srcdir}" >
<os family="windows"/>
</condition>
 
<!-- folder for the 3rd party java libraries -->
<property name="external-libs" value="libs" />
<condition property="external-libs-ospath"
value="${basedir}\${external-libs}"
else="${basedir}/${external-libs}" >
<os family="windows"/>
</condition>
 
<!-- folder for the native libraries -->
<property name="native-libs" value="libs" />
<condition property="native-libs-ospath"
value="${basedir}\${native-libs}"
else="${basedir}/${native-libs}" >
<os family="windows"/>
</condition>
 
<!-- Output directories -->
<property name="outdir-classes" value="${outdir}/classes" />
<condition property="outdir-classes-ospath"
value="${basedir}\${outdir-classes}"
else="${basedir}/${outdir-classes}" >
<os family="windows"/>
</condition>
 
<!-- Create R.java in the source directory -->
<property name="outdir-r" value="src" />
 
<!-- Intermediate files -->
<property name="dex-file" value="classes.dex" />
<property name="intermediate-dex" value="${outdir}/${dex-file}" />
<condition property="intermediate-dex-ospath"
value="${basedir}\${intermediate-dex}"
else="${basedir}/${intermediate-dex}" >
<os family="windows"/>
</condition>
 
<!-- The final package file to generate -->
<property name="resources-package" value="${outdir}/${ant.project.name}.ap_" />
<condition property="resources-package-ospath"
value="${basedir}\${resources-package}"
else="${basedir}/${resources-package}" >
<os family="windows"/>
</condition>
 
<property name="out-debug-package" value="${outdir}/${ant.project.name}-debug.apk" />
<condition property="out-debug-package-ospath"
value="${basedir}\${out-debug-package}"
else="${basedir}/${out-debug-package}" >
<os family="windows"/>
</condition>
 
<property name="out-unsigned-package" value="${outdir}/${ant.project.name}-unsigned.apk" />
<condition property="out-unsigned-package-ospath"
value="${basedir}\${out-unsigned-package}"
else="${basedir}/${out-unsigned-package}" >
<os family="windows"/>
</condition>
 
<!-- Tools -->
<condition property="aapt" value="${android-tools}/aapt.exe" else="${android-tools}/aapt" >
<os family="windows"/>
</condition>
<condition property="aidl" value="${android-tools}/aidl.exe" else="${android-tools}/aidl" >
<os family="windows"/>
</condition>
<condition property="adb" value="${android-tools}/adb.exe" else="${android-tools}/adb" >
<os family="windows"/>
</condition>
<condition property="dx" value="${android-tools}/dx.bat" else="${android-tools}/dx" >
<os family="windows"/>
</condition>
<condition property="apk-builder" value="${android-tools}/apkbuilder.bat" else="${android-tools}/apkbuilder" >
<os family="windows"/>
</condition>
 
<property name="android-jar" value="${sdk-folder}/android.jar" />
 
<!-- Rules -->
 
<!-- Create the output directories if they don't exist yet. -->
<target name="dirs">
<echo>Creating output directories if needed...</echo>
<mkdir dir="${outdir}" />
<mkdir dir="${outdir-classes}" />
</target>
 
<!-- Generate the R.java file for this project's resources. -->
<target name="resource-src" depends="dirs">
<echo>Generating R.java / Manifest.java from the resources...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-m" />
<arg value="-J" />
<arg value="${outdir-r}" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<arg value="-I" />
<arg value="${android-jar}" />
</exec>
</target>
 
<!-- Generate java classes from .aidl files. -->
<target name="aidl" depends="dirs">
<echo>Compiling aidl files into Java classes...</echo>
<apply executable="${aidl}" failonerror="true">
<arg value="-p${android-framework}" />
<arg value="-I${srcdir}" />
<fileset dir="${srcdir}">
<include name="**/*.aidl"/>
</fileset>
</apply>
</target>
 
<!-- Compile this project's .java files into .class files. -->
<target name="compile" depends="dirs, resource-src, aidl">
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
srcdir="."
destdir="${outdir-classes}"
bootclasspath="${android-jar}">
<classpath>
<fileset dir="${external-libs}" includes="*.jar"/>
</classpath>
</javac>
</target>
 
<!-- Convert this project's .class files into .dex files. -->
<target name="dex" depends="compile">
<echo>Converting compiled files and external libraries into ${outdir}/${dex-file}...</echo>
<apply executable="${dx}" failonerror="true" parallel="true">
<arg value="--dex" />
<arg value="--output=${intermediate-dex-ospath}" />
<arg path="${outdir-classes-ospath}" />
<fileset dir="${external-libs}" includes="*.jar"/>
</apply>
</target>
 
<!-- Put the project's resources into the output package file. -->
<target name="package-res-and-assets">
<echo>Packaging resources and assets...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-f" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<arg value="-A" />
<arg value="${asset-dir}" />
<arg value="-I" />
<arg value="${android-jar}" />
<arg value="-F" />
<arg value="${resources-package}" />
</exec>
</target>
 
<!-- Same as package-res-and-assets, but without "-A ${asset-dir}" -->
<target name="package-res-no-assets">
<echo>Packaging resources...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-f" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<!-- No assets directory -->
<arg value="-I" />
<arg value="${android-jar}" />
<arg value="-F" />
<arg value="${resources-package}" />
</exec>
</target>
 
<!-- Invoke the proper target depending on whether or not
an assets directory is present. -->
<!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
only when the assets dir exists. -->
<target name="package-res">
<available file="${asset-dir}" type="dir"
property="res-target" value="and-assets" />
<property name="res-target" value="no-assets" />
<antcall target="package-res-${res-target}" />
</target>
 
<!-- Package the application and sign it with a debug key.
This is the default target when building. It is used for debug. -->
<target name="debug" depends="dex, package-res">
<echo>Packaging ${out-debug-package}, and signing it with a debug key...</echo>
<exec executable="${apk-builder}" failonerror="true">
<arg value="${out-debug-package-ospath}" />
<arg value="-z" />
<arg value="${resources-package-ospath}" />
<arg value="-f" />
<arg value="${intermediate-dex-ospath}" />
<arg value="-rf" />
<arg value="${srcdir-ospath}" />
<arg value="-rj" />
<arg value="${external-libs-ospath}" />
<arg value="-nf" />
<arg value="${native-libs-ospath}" />
</exec>
</target>
 
<!-- Package the application without signing it.
This allows for the application to be signed later with an official publishing key. -->
<target name="release" depends="dex, package-res">
<echo>Packaging ${out-unsigned-package} for release...</echo>
<exec executable="${apk-builder}" failonerror="true">
<arg value="${out-unsigned-package-ospath}" />
<arg value="-u" />
<arg value="-z" />
<arg value="${resources-package-ospath}" />
<arg value="-f" />
<arg value="${intermediate-dex-ospath}" />
<arg value="-rf" />
<arg value="${srcdir-ospath}" />
<arg value="-rj" />
<arg value="${external-libs-ospath}" />
<arg value="-nf" />
<arg value="${native-libs-ospath}" />
</exec>
<echo>It will need to be signed with jarsigner before being published.</echo>
</target>
 
<!-- Install the package on the default emulator -->
<target name="install" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="${out-debug-package}" />
</exec>
</target>
 
<target name="reinstall" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="-r" />
<arg value="${out-debug-package}" />
</exec>
</target>
 
<!-- Uinstall the package from the default emulator -->
<target name="uninstall">
<echo>Uninstalling ${application-package} from the default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="uninstall" />
<arg value="${application-package}" />
</exec>
</target>
 
</project>
/DUBwise/trunk/android/default.properties
0,0 → 1,5
# This file is automatically generated by activitycreator.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
# Instead customize values in a "build.properties" file.
 
sdk-folder=/home/ligi/bin/android-sdk-linux_x86-1.0_r2
/DUBwise/trunk/android/res/drawable/bt_off.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/drawable/bt_on.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/drawable/icon.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/drawable/lcd_green.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/drawable/starfield.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/layout/connection.xml
0,0 → 1,78
<?xml version="1.0" encoding="utf-8"?>
 
 
 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
 
 
 
 
 
 
 
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Host:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:focusable="true"
/>
<EditText android:id="@+id/edit_host"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Port:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:focusable="true"
/>
 
<EditText android:id="@+id/edit_port"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
 
 
<CheckBox android:id="@+id/check_autoconn"
android:paddingBottom="24sp"
android:paddingTop="24sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Auto Connect " />
 
 
<Button android:id="@+id/save_btn"
android:text="Save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
 
<Button android:id="@+id/cancel_btn"
android:text="Cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
 
</ScrollView>
 
 
 
 
 
 
 
/DUBwise/trunk/android/res/layout/motortest.xml
0,0 → 1,151
<?xml version="1.0" encoding="utf-8"?>
 
 
 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
 
 
 
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
 
 
 
<CheckBox android:id="@+id/check_fullspeed"
android:paddingBottom="24sp"
android:paddingTop="24sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Allow Full Speed" />
 
<View
 
android:layout_height="2px"
android:layout_width="fill_parent"
 
android:background="#DDFFDD"
android:layout_marginTop="5dip"
android:layout_marginBottom="5dip"/>
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Front:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:focusable="true"
/>
 
<SeekBar android:id="@+id/seek_front"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="255"
android:focusable="true"
/>
 
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Back:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:focusable="true"
/>
 
<SeekBar android:id="@+id/seek_back"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="255" />
 
 
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Left:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:focusable="true"
/>
 
<SeekBar android:id="@+id/seek_left"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="255" />
 
 
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Right:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:focusable="true"
/>
 
<SeekBar android:id="@+id/seek_right"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="255" />
 
 
 
<View
 
android:layout_height="2px"
android:layout_width="fill_parent"
 
android:background="#DDFFDD"
android:layout_marginTop="15dip"
android:layout_marginBottom="5dip"/>
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="All:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:focusable="true"
/>
 
<SeekBar android:id="@+id/seek_all"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="255" />
</LinearLayout>
 
</ScrollView>
 
 
 
 
/DUBwise/trunk/android/res/layout/rcdata.xml
0,0 → 1,216
<?xml version="1.0" encoding="utf-8"?>
 
 
 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
 
 
 
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick0:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_0"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
 
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick 1:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
 
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick2:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_2"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick 3:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_3"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick 4:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_4"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick 5:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_5"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick 6:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_6"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick 7:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_7"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick 8:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_8"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
 
 
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="Stick 9:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:focusable="true"
/>
 
<ProgressBar android:id="@+id/stick_progress_9"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="0"
android:secondaryProgress="0" />
</LinearLayout>
 
 
</ScrollView>
 
 
 
 
/DUBwise/trunk/android/res/raw/voice_sample_01.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_02.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_03.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_04.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_05.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_06.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_07.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_08.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_09.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_10.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_11.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_12.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_13.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_komma.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/raw/voice_sample_volt.mp3
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/trunk/android/res/values/strings.xml
0,0 → 1,10
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">DUBwise</string>
 
<string name="map_menu_zoom_in">Zoom in (Key: I)</string>
<string name="map_menu_zoom_out">Zoom out (Key: O)</string>
<string name="map_menu_back_to_list">Back to list</string>
<string name="map_menu_toggle_street_satellite">Toggle View: Street / Satellite (Key: T)</string>
 
</resources>
/DUBwise/trunk/android/shared_src
0,0 → 1,0
link ../shared/src/
Property changes:
Added: svn:special
+*
\ No newline at end of property
/DUBwise/trunk/android/src/org/ligi/android/AndroidMKCommunicator.java
0,0 → 1,20
package org.ligi.android;
 
import android.app.Activity;
import android.content.SharedPreferences;
 
public class AndroidMKCommunicator extends org.ligi.ufo.MKCommunicator
 
{
 
public AndroidMKCommunicator(android.content.Context ctx)
{
super();
SharedPreferences settings;
settings =ctx.getSharedPreferences("DUBwise", 0);
this.connect_to(settings.getString("conn_host","10.0.2.2")+":"+(settings.getString("conn_port","9876")),"unnamed");
}
 
 
 
}
/DUBwise/trunk/android/src/org/ligi/android/ConnectionActivity.java
0,0 → 1,105
package org.ligi.android;
 
// Need the following import to get access to the app resources, since this
// class is in a sub-package.
 
 
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Button;
import android.text.method.NumberKeyListener;
 
import android.app.AlertDialog.*;
import android.app.AlertDialog;
 
import android.content.SharedPreferences;
/**
* Demonstrates wrapping a layout in a ScrollView.
*
*/
public class ConnectionActivity extends Activity {
 
 
EditText port_edit;
EditText host_edit;
 
Activity here;
 
DUBwise root;
 
 
 
 
 
 
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.connection);
here=this;
SharedPreferences settings = getSharedPreferences("DUBwise", 0);
 
port_edit=(EditText)findViewById( R.id.edit_port);
host_edit=(EditText)findViewById( R.id.edit_host);
 
port_edit.setKeyListener(new NumberKeyListener(){
@Override
protected char[] getAcceptedChars() {
 
return new char[]{'1','2','3','4','5','6','7','8','9','0'};
}
});
 
host_edit.setText(settings.getString("conn_host","10.0.2.2"));
port_edit.setText(settings.getString("conn_port","54321"));
 
Button save_btn=(Button)findViewById( R.id.save_btn);
 
save_btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
 
 
java.net.Socket connection;
java.io.InputStream reader;
java.io.OutputStream writer;
try {
connection = new java.net.Socket(host_edit.getText().toString(),Integer.parseInt(port_edit.getText().toString()));
 
 
SharedPreferences settings = getSharedPreferences("DUBwise", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("conn_host", host_edit.getText().toString());
editor.putString("conn_port", port_edit.getText().toString());
// Don't forget to commit your edits!!!
editor.commit();
 
 
 
finish();
}
catch (Exception e) {
 
new AlertDialog.Builder(here).setTitle("Connection Problem").setMessage("" + e.toString()).setPositiveButton("OK",null).create().show();
 
}
}
});
 
 
Button cancel_btn=(Button)findViewById( R.id.cancel_btn);
 
cancel_btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
finish();
}
});
 
 
}
}
/DUBwise/trunk/android/src/org/ligi/android/ConnectionView.java
0,0 → 1,62
package org.ligi.android;
 
 
 
import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
 
 
import android.app.Activity;
import android.os.Bundle;
 
 
import android.view.View;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.SimpleAdapter;
 
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.net.Uri;
 
import java.net.URISyntaxException;
import android.widget.ArrayAdapter;
import android.content.DialogInterface;
import android.content.Context.*;
import android.widget.EditText;
import android.text.method.NumberKeyListener;
 
 
import com.google.android.maps.MapView;
 
import android.app.AlertDialog.*;
import android.app.AlertDialog;
 
 
// not working atm - import org.bluez.*;
 
public class ConnectionView
extends ScrollView
{
 
 
public ConnectionView(DUBwise context) {
super(context);
// setContentView(R.layout.main);
}
 
 
 
}
/DUBwise/trunk/android/src/org/ligi/android/DUBwise.java
0,0 → 1,186
 
package org.ligi.android;
 
import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
 
import android.util.Log;
 
import android.app.Activity;
import android.os.Bundle;
 
 
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.net.Uri;
 
import java.net.URISyntaxException;
import android.widget.ArrayAdapter;
import android.content.DialogInterface;
import android.content.Context.*;
import android.widget.EditText;
import android.text.method.NumberKeyListener;
 
 
import com.google.android.maps.MapView;
 
import android.app.AlertDialog.*;
import android.app.AlertDialog;
 
import android.content.SharedPreferences;
 
import org.ligi.ufo.*;
 
public class DUBwise extends ListActivity
{
 
 
DUBwiseView canvas;
boolean do_sound;
boolean fullscreen;
MKCommunicator mk;
String[] menu_items = new String[]{"Connection", "Old Interface" , "View On Maps", "Flight Settings","RCData","Motor Test", "About","Quit"};
int[] menu_actions= new int[]{ACTIONID_CONN , ACTIONID_OLDINTERFACE , ACTIONID_MAPS ,ACTIONID_FLIGHTSETTINGS,ACTIONID_RCDATA,ACTIONID_MOTORTEST, ACTIONID_ABOUT , ACTIONID_QUIT };
 
public final static int ACTIONID_CONN=0;
public final static int ACTIONID_MAPS=1;
public final static int ACTIONID_ABOUT=2;
public final static int ACTIONID_OLDINTERFACE=3;
public final static int ACTIONID_FLIGHTSETTINGS=4;
public final static int ACTIONID_MOTORTEST=5;
public final static int ACTIONID_RCDATA=6;
public final static int ACTIONID_QUIT=100;
 
SharedPreferences settings;
// public MapView map;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
 
settings = getSharedPreferences("DUBwise", 0);
// menu_items[0]=settings.getString("conn_host","--");
// mk=new MKCommunicator();
this.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu_items));
}
 
 
 
 
public void log(String msg)
{
Log.d("DUWISE",msg);
}
 
public void quit()
{
this.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu_items));
// setContentView(this);
}
 
@Override
protected void onListItemClick(ListView l, View v, int position, long id){
super.onListItemClick(l, v, position, id);
// Get the item that was clicked
Object o = this.getListAdapter().getItem(position);
//String keyword = o.toString();
 
// Create an VIEW intent
Intent myIntent = null;
 
try {
 
switch(menu_actions[position])
{
 
case ACTIONID_CONN:
// setContentView(new ConnectionView(this));
 
startActivity(new Intent(this, ConnectionActivity.class));
break;
case ACTIONID_MOTORTEST:
// setContentView(new ConnectionView(this));
startActivity(new Intent(this, MotorTestActivity.class));
 
break;
 
case ACTIONID_RCDATA:
// setContentView(new ConnectionView(this));
startActivity(new Intent(this, RCDataActivity.class));
 
break;
case ACTIONID_FLIGHTSETTINGS:
// setContentView(new ConnectionView(this));
startActivity(new Intent(this, FlightSettingsActivity.class));
 
 
 
/* EditText edit_host=(EditText)findViewById( R.id.edit_host);
edit_host.setKeyListener(new NumberKeyListener(){
@Override
protected char[] getAcceptedChars() {
char[] numberChars = {'1','2','3'};
return numberChars;
}
});*/
 
// edit_host.setText("foobar");
break;
case ACTIONID_OLDINTERFACE:
mk.connect_to(settings.getString("conn_host","10.0.2.2")+":"+(settings.getString("conn_port","9876")),"unnamed");
canvas=new DUBwiseView(this);
setContentView(canvas);
break;
case ACTIONID_MAPS:
// setActivity(new DUBwiseMapActivity(this));
startActivity(new Intent(this, DUBwiseMapActivity.class));
 
 
// new AlertDialog.Builder(this).setTitle("foo").setMessage("bar").setPositiveButton("OK",null).create().show();
 
// showAlert("A funny title", "MessageBoxes rule extremely!", "Hit Me!", false);
/*
// The intent will open our anddev.org-board and search for the keyword clicked.
myIntent = new Intent("android.intent.action.DUBWISEMAP",
Uri.parse("http://www.ligi.de/"));
startActivity(myIntent);*/
break;
 
case ACTIONID_ABOUT:
startActivity( new Intent("android.intent.action.VIEW", Uri.parse("http://www.ligi.de/")));
break;
 
case ACTIONID_QUIT:
finish();
break;
}
} catch (Exception e) {
e.printStackTrace();
}
// Start the activity
 
}
 
 
 
}
/DUBwise/trunk/android/src/org/ligi/android/DUBwiseMapActivity.java
0,0 → 1,141
package org.ligi.android;
import android.os.Bundle;
import com.google.android.maps.*;
 
import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
import java.util.Map;
import android.view.Menu;
import android.view.MenuItem;
 
import android.view.*;
import android.content.SharedPreferences;
 
public class DUBwiseMapActivity extends MapActivity implements Runnable,MapKey
{
 
//MapView mMapView;
 
MapView map;
MapController mc ;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
boolean supRetVal = super.onCreateOptionsMenu(menu);
 
menu.add(0, 0,0, getString(R.string.map_menu_zoom_in));
menu.add(0, 1,0, getString(R.string.map_menu_zoom_out));
menu.add(0, 2,0, getString(R.string.map_menu_toggle_street_satellite));
menu.add(0, 3,0, R.string.map_menu_back_to_list);
return supRetVal;
}
 
 
 
 
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case 0:
// Zoom not closer than possible
this.mc.setZoom(Math.min(21, map.getZoomLevel() + 1));
// map.displayZoomControls(true);
return true;
case 1:
// Zoom not farer than possible
this.mc.setZoom(Math.max(1, map.getZoomLevel() - 1));
return true;
case 2:
// Switch to satellite view
map.setSatellite(!map.isSatellite());
return true;
case 3:
this.finish();
return true;
}
return false;
}
 
 
AndroidMKCommunicator mk;
 
 
public void run()
{
/*
int i=0;
while(true)
{
try {
 
this.setTitle("UBATT:no");
this.setTitle("UBATT:" + mk.UBatt() + " stats:" + mk.stats.debug_data_count + "--" + i);
i++;
// Thread.sleep(1000);
 
this.setTitle("UBATT2:" + mk.UBatt() + " stats:" + mk.stats.debug_data_count + "--" + i);
}
 
catch (Exception e)
{
this.setTitle(e.toString());
}
}
 
*/
}
 
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
 
this.setTitle("UBATT2:" + mk.UBatt() + " stats:" + mk.stats.version_data_count + "--" );
return true;
}
 
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
 
map=new MapView(this,MapKey);
map.setClickable(true);
 
 
//////////////////////////////////////////////////////////////////////////////this.overlay = this.map.createOverlayController();
 
 
 
mc = map.getController();
//mc.setZoom(20);
setContentView(map);
 
mk=new AndroidMKCommunicator(this
);
 
// this.setTitle("test");
//
new Thread( this ).start(); // fire up main Thread
}
 
@Override
protected void onDestroy()
{
mk.close_connections(true);
mk=null;
super.onDestroy();
 
}
 
@Override
protected boolean isRouteDisplayed() {
return false;
}
 
 
 
}
/DUBwise/trunk/android/src/org/ligi/android/DUBwiseMapView.java
0,0 → 1,17
package org.ligi.android;
 
import com.google.android.maps.MapView;
 
import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
import java.util.Map;
 
public class DUBwiseMapView extends MapView
{
 
 
public DUBwiseMapView (Context context,String api_key) {
super(context,api_key);
}
}
/DUBwise/trunk/android/src/org/ligi/android/DUBwiseStatusVoice.java
0,0 → 1,114
/**************************************
*
* Voice output
*
* Author: Marcus -LiGi- Bueschleb
*
* see README for further Infos
*
*
**************************************/
 
package org.ligi.android;
 
import android.media.*;
import android.media.MediaPlayer.*;
 
import org.ligi.ufo.*;
 
public class DUBwiseStatusVoice
implements Runnable
//,OnCompletionListener
{
 
MKCommunicator mk=null;
DUBwise root=null;
MediaPlayer player;
public final int PLAYERSTATE_IDLE=0;
public final int PLAYERSTATE_PLAYING=1;
public final int PLAYERSTATE_FIN=2;
 
int act_player_state=PLAYERSTATE_IDLE;
 
int last_sound=-1;
 
public DUBwiseStatusVoice(DUBwise _root)
{
 
root=_root;
 
new Thread( this ).start(); // fire up main Thread
}
 
public void start_playing(int resid)
{
last_sound=resid;
try {
player=MediaPlayer.create(root, R.raw.voice_sample_01-1+resid);
 
player.start();
 
}
catch (Exception e) {
}
 
}
 
public void wait_for_end()
{
while (player.isPlaying())
{
try { Thread.sleep(50); }
catch (Exception e) { }
}
try { Thread.sleep(50); }
catch (Exception e) { }
player.stop();
player.release();
 
player=null;
 
System.gc();
try { Thread.sleep(150); }
catch (Exception e) { }
}
 
public void run()
{
while(true)
{
 
if (root.mk.connected&&(root.do_sound)&&(root.mk.debug_data.UBatt()!=-1)&&(!root.mk.force_disconnect))
{
int ubatt=root.mk.debug_data.UBatt();
 
start_playing( (ubatt/10));
wait_for_end();
 
if((ubatt%10)!=0)
{
start_playing( 14);
wait_for_end();
start_playing((ubatt%10));
wait_for_end();
}
start_playing(15);
wait_for_end();
}
 
try { Thread.sleep(5000); }
catch (Exception e) { }
}
}
 
}
 
/DUBwise/trunk/android/src/org/ligi/android/DUBwiseUIDefinitions.java
0,0 → 1,71
package org.ligi.android;
 
public interface DUBwiseUIDefinitions
{
// id for each state - must just be uniq - order isnt important
public final static byte STATEID_SCANNING =0;
public final static byte STATEID_DEVICESELECT =1;
public final static byte STATEID_MAINMENU =2;
public final static byte STATEID_MOTORTEST =3;
public final static byte STATEID_SELECT_PARAMSET =4;
public final static byte STATEID_EDIT_PARAMS =5;
public final static byte STATEID_HANDLE_PARAMS =6;
public final static byte STATEID_FLIGHTVIEW =7;
public final static byte STATEID_RAWDEBUG =8;
public final static byte STATEID_KEYCONTROL =9;
public final static byte STATEID_SETTINGSMENU =10;
public final static byte STATEID_STICKVIEW =11;
public final static byte STATEID_CAMMODE =12;
public final static byte STATEID_READ_PARAMS =13;
public final static byte STATEID_GPSVIEW =14;
public final static byte STATEID_FILEOPEN =15;
public final static byte STATEID_GRAPH =16;
public final static byte STATEID_CONN_DETAILS =17;
public final static byte STATEID_IPINPUT =18;
public final static byte STATEID_PROXY =19;
public final static byte STATEID_TRAFFIC =20;
public final static byte STATEID_SELECT_COMPORT =21;
public final static byte STATEID_ABOUT =22;
public final static byte STATEID_NC_ERRORS =23;
public final static byte STATEID_FLASHING =24;
public final static byte STATEID_NAMEINPUT =25;
public final static byte STATEID_DATABUFF =26;
 
 
 
public final static int MAINMENU_TELEMETRY =0;
public final static int MAINMENU_RAWDEBUG =1+MAINMENU_TELEMETRY;
public final static int MAINMENU_STICKS =1+MAINMENU_RAWDEBUG;
public final static int MAINMENU_KEYCONTROL =1+MAINMENU_STICKS;
public final static int MAINMENU_MOTORTEST =1+MAINMENU_KEYCONTROL;
public final static int MAINMENU_PARAMS =1+MAINMENU_MOTORTEST;
public final static int MAINMENU_SETTINGSMENU =1+MAINMENU_PARAMS;
public final static int MAINMENU_CAMMODE =1+MAINMENU_SETTINGSMENU;
public final static int MAINMENU_PROXY =1+MAINMENU_CAMMODE;
public final static int MAINMENU_DEVICESELECT =1+MAINMENU_PROXY;
public final static int MAINMENU_QUIT =1+MAINMENU_DEVICESELECT;
 
public String[] main_menu_items={"Telemetry","Raw Debug-Values", "RC-Data", "pilot UFO", "Motor Test" , "Flight Settings","(NA)Tool Settings","(NA)Remote Camera","(NA)Relay","(NA)Change Device" , "Quit " };
 
 
public final static String[] settings_menu_items={"Skin ","Sound ","Vibra " ,"Scrolling BG ","FullScreen " , "Back" };
 
 
 
// public String[] settings_menu_items={"Skin ","Sound ","Vibra " ,"Graph ","FullScreen " ,"Keep BGLight " ,"Back" };
public final static int SETTINGSMENU_CHANGESKIN =0;
public final static int SETTINGSMENU_SOUNDTOGGLE =1;
public final static int SETTINGSMENU_VIBRATOGGLE =2;
public final static int SETTINGSMENU_GRAPHTOGGLE =3;
public final static int SETTINGSMENU_FULLSCREENTOGGLE =4;
public final static int SETTINGSMENU_LIGHTTOGGLE =5;
public final static int SETTINGSMENU_BACK =6;
 
 
 
 
 
 
 
 
}
/DUBwise/trunk/android/src/org/ligi/android/DUBwiseView.java
0,0 → 1,663
package org.ligi.android;
 
 
import android.app.Activity;
import android.os.Bundle;
 
import android.app.Activity;
import android.os.Bundle;
 
import android.view.View;
import android.widget.TextView;
 
 
import android.app.Activity;
import android.content.Context;
import android.graphics.*;
import android.os.Bundle;
import android.os.*;
import android.view.View;
import android.util.Log;
import android.media.*;
import java.util.Random;
import java.net.*;
import java.io.*;
 
 
import android.view.*;
 
import android.graphics.Region.Op;
import android.graphics.Bitmap.*;
 
// not working atm - import org.bluez.*;
import org.ligi.ufo.*;
public class DUBwiseView
extends View
implements DUBwiseDefinitions,DUBwiseUIDefinitions
{
 
 
int state=0;
 
 
int state_intro_frame=0;
 
boolean do_sound=true;
boolean do_vibra=true;
boolean do_graph=true;
boolean menu_active=true;
 
public final int SKINID_DARK=0;
public final int SKINID_LIGHT=0;
int act_skin=0;
boolean keep_lighton=true;
 
private Paint mPaint = new Paint();
 
// chars in bitmap
public static int LCD_CHAR_COUNT=222;
 
// some images we need
private Bitmap icon_img,bg_img,lcd_tiles_img,bt_on_img,bt_off_img;
private Bitmap lcd_img=null;
// pos for scrolling
private int pos=0;
 
String str1="";
String[] lcd_lines;
String[] menu_items;
long last_run=0;
int last_key=0;
 
 
int auto_next_state=-1;
 
int wi,he;
// Activity context;
 
DUBwise root;
MKParamEditor param_editor;
// Activity root;
int lcd_top;
int act_menu_select=0;
int[] motortest_vals={0,0,0,0};
 
public DUBwiseView(DUBwise context) {
super(context);
root=context;
param_editor=new MKParamEditor(root);
chg_state_(STATEID_MAINMENU);
 
// needed to get Key Events
setFocusable(true);
 
 
}
 
 
public void chg_state(int next_state)
{
auto_next_state=next_state;
}
 
public void chg_state_(int next_state)
{
auto_next_state=-1;
menu_active=false;
state_intro_frame=0;
if (next_state!=state)act_menu_select=0;
// prepare next state
switch(next_state)
{
case STATEID_STICKVIEW:
// root.mk.user_intent=USER_INTENT_RCDATA;
break;
case STATEID_FLIGHTVIEW:
//root.mk.user_intent=USER_INTENT_LCD;
break;
case STATEID_EDIT_PARAMS:
lcd_lines=param_editor.public_lcd_lines;
calc_lcd();
break;
 
case STATEID_HANDLE_PARAMS:
menu_items=new String[2];
menu_items[0]="write to MK";
menu_items[1]="Discard";
lcd_lines=new String[2];
 
break;
 
case STATEID_SELECT_PARAMSET:
menu_items=new String[5];
for (int i=0;i<5;i++)
menu_items[i]=root.mk.params.names[i];
 
lcd_lines=new String[5];
break;
 
case STATEID_MAINMENU:
menu_active=true;
menu_items=main_menu_items;
lcd_lines=new String[menu_items.length];
for (int y=0;y<main_menu_items.length;y++)
lcd_lines[y]=" " + main_menu_items[y];
break;
 
case STATEID_SETTINGSMENU:
menu_items=new String[settings_menu_items.length];
for(int cnt=0;cnt<settings_menu_items.length;cnt++)
menu_items[cnt]=settings_menu_items[cnt];
 
menu_items[0]+=(act_skin==SKINID_DARK)?"Dark":"Light";
menu_items[1]+=(!do_sound)?"Off":"On";
menu_items[2]+=(!do_vibra)?"Off":"On";
menu_items[3]+=(!do_graph)?"Off":"On";
menu_items[4]+=(!root.fullscreen)?"Off":"On";
menu_items[5]+=(!keep_lighton)?"Off":"On";
 
lcd_lines=new String[menu_items.length];
break;
 
}
// switch state
if (lcd_img!=null)calc_lcd();
state=next_state;
}
 
public Bitmap resize_to_screen(Bitmap orig,float x_scale_,float y_scale_)
{
// createa matrix for the manipulation
Matrix matrix = new Matrix();
float x_scale,y_scale;
if (y_scale_!=0f)
y_scale= (getHeight()*y_scale_ )/orig.getHeight();
else // take x_scale
y_scale=(getWidth()*x_scale_ )/orig.getWidth();
 
if (x_scale_!=0f)
x_scale= (getWidth()*x_scale_ )/orig.getWidth();
else
x_scale= (getHeight()*y_scale_ )/orig.getHeight();
 
matrix.postScale(x_scale , y_scale);
return Bitmap.createBitmap(orig, 0, 0,(int)( orig.getWidth()),(int)( orig.getHeight()), matrix,true);//BitmapContfig.ARGB_8888 );
}
 
 
public boolean onKeyDown(int keyCode, KeyEvent event)
{
 
if ( keyCode==KeyEvent.KEYCODE_BACK)
{
if ( state==STATEID_MAINMENU)
root.finish();
else
chg_state(STATEID_MAINMENU);
}
switch (state)
{
case STATEID_EDIT_PARAMS:
param_editor.keypress(keyCode,keyCode);
lcd_lines=param_editor.public_lcd_lines;
calc_lcd();
break;
case STATEID_MAINMENU:
switch ( keyCode)
{
case KeyEvent.KEYCODE_DPAD_DOWN :
act_menu_select++;
break;
case KeyEvent.KEYCODE_DPAD_UP :
act_menu_select--;
break;
 
case KeyEvent.KEYCODE_DPAD_CENTER :
menu_reaction();
break;
}
break;
case STATEID_FLIGHTVIEW:
switch ( keyCode)
{
 
case KeyEvent.KEYCODE_DPAD_DOWN :
root.mk.LCD.LCD_NEXTPAGE();
lcd_lines=root.mk.LCD.get_act_page();
 
break;
case KeyEvent.KEYCODE_DPAD_UP :
root.mk.LCD.LCD_PREVPAGE();
lcd_lines=root.mk.LCD.get_act_page();
 
break;
 
}
calc_lcd();
break;
}
 
// last_key=keyCode;
// if(lcd_img!=null)
calc_lcd();
invalidate();
return true;
}
 
public void menu_reaction()
{
switch (act_menu_select)
{
case MAINMENU_PARAMS:
chg_state(STATEID_EDIT_PARAMS);
break;
 
case MAINMENU_STICKS:
chg_state(STATEID_STICKVIEW);
break;
 
case MAINMENU_TELEMETRY:
chg_state(STATEID_FLIGHTVIEW);
// root.setContentView(new DUBwiseMapView(root));
break;
case MAINMENU_RAWDEBUG:
chg_state(STATEID_RAWDEBUG);
break;
 
case MAINMENU_KEYCONTROL:
chg_state(STATEID_KEYCONTROL);
break;
 
 
case MAINMENU_MOTORTEST:
// root.mk.motor_test( motortest_vals);
chg_state(STATEID_MOTORTEST);
break;
 
case MAINMENU_QUIT:
root.mk.close_connections(true);
root.quit();
break;
}
}
 
 
 
 
int flight_x,flight_y;
 
@Override public boolean onTouchEvent(MotionEvent event) {
 
 
if ((event.getAction() ==MotionEvent.ACTION_UP)&&(event.getY()<bt_on_img.getHeight()))
{
if ( state==STATEID_MAINMENU)
root.finish();
else
chg_state(STATEID_MAINMENU);
}
 
switch(state)
{
case STATEID_KEYCONTROL:
if (event.getAction() ==MotionEvent.ACTION_UP)
{
flight_x=getWidth()/2-getWidth()/8;
flight_y=getHeight()/2-getWidth()/8;
}
else
{
if(new RectF(getWidth()/8,(getHeight()-getWidth())/2-getWidth()/8,getWidth()-getWidth()/8,getHeight()-getWidth()/8).contains(event.getX(),event.getY()))
{
flight_x=(int)event.getX();
flight_y=(int)event.getY();
 
}
}
break;
case STATEID_MAINMENU:
if ((event.getAction() ==MotionEvent.ACTION_DOWN)||(event.getAction() ==MotionEvent.ACTION_MOVE))
{
if (event.getY()>lcd_top)
{
act_menu_select=(int)((event.getY()-lcd_top)/lcd_tiles_img.getHeight());
calc_lcd();
}
}
if (event.getAction() ==MotionEvent.ACTION_UP)
{
if (event.getY()>lcd_top)
{
act_menu_select=(int)((event.getY()-lcd_top)/lcd_tiles_img.getHeight());
menu_reaction();
}
}
calc_lcd();
break;
 
 
case STATEID_MOTORTEST:
if (new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 -getWidth()/8 - (getWidth()/2 - getWidth()/8),getWidth()/2 + getWidth()/8,getHeight()/2 -getWidth()/8).contains(event.getX(),event.getY()))
motortest_vals[0]= (int)(event.getY()-getHeight()/2+getWidth()/8)*(-1)-5;
 
if (new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 + getWidth()/8,getWidth()/2 + getWidth()/8,getHeight()/2+getWidth()/8 + (getWidth()/2 - getWidth()/8)).contains(event.getX(),event.getY()))
motortest_vals[1]= (int)(event.getY()-getHeight()/2-getWidth()/8)-5;
// left
if (new RectF(0,getHeight()/2 - getWidth()/8,getWidth()/2 - getWidth()/8,getHeight()/2+getWidth()/8).contains(event.getX(),event.getY()))
motortest_vals[2]= (int)(event.getX()-getWidth()/2+getWidth()/8)*(-1)-5;
if (new RectF(getWidth()/2+getWidth()/8,getHeight()/2 - getWidth()/8,getWidth(),getHeight()/2+getWidth()/8).contains(event.getX(),event.getY()))
motortest_vals[3]= (int)(event.getX()-getWidth()/2-getWidth()/8)-5;
 
for (int tmp=0;tmp<4;tmp++)
if (motortest_vals[tmp]<0)motortest_vals[tmp]=0;
 
root.mk.motor_test( motortest_vals);
break;
}
 
 
return true;
 
}
 
 
 
 
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh)
{
 
bg_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.starfield),0f,1f);
lcd_tiles_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.lcd_green),0.05f*LCD_CHAR_COUNT,0f);
icon_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.icon),0.15f,0f);
 
bt_off_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.bt_off),0.06f,0f);
bt_on_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.bt_on),0.06f,0f);
calc_lcd();
 
}
 
 
public void calc_lcd()
{
 
lcd_top=getHeight()-lcd_lines.length*lcd_tiles_img.getHeight();
Paint paint = mPaint;
lcd_img= Bitmap.createBitmap(getWidth(),lcd_lines.length*lcd_tiles_img.getHeight()+100,Bitmap.Config.ARGB_8888);
Canvas lcd_canvas=new Canvas();
 
lcd_canvas.setBitmap(lcd_img);
lcd_canvas.drawColor(Color.WHITE);
int char_width=(int)(lcd_tiles_img.getWidth()/LCD_CHAR_COUNT);
for ( int lcd_line=0 ; lcd_line < lcd_lines.length ; lcd_line++)
for (int char_pos=0;char_pos<20;char_pos++)
{
int act_char=0;
if (char_pos<lcd_lines[lcd_line].length())
act_char=lcd_lines[lcd_line].charAt(char_pos)-32;
if ((menu_active)&&(act_menu_select==lcd_line)&& (char_pos==0))
act_char=30;
lcd_canvas.clipRect(new RectF(char_pos*char_width,lcd_tiles_img.getHeight()*lcd_line,(char_pos+1)*char_width,lcd_tiles_img.getHeight()*(lcd_line+1)),Op.REPLACE );
lcd_canvas.drawBitmap(lcd_tiles_img,(char_pos-act_char)*(char_width),lcd_tiles_img.getHeight()*(lcd_line) , paint);
 
}
}
boolean init_bootloader;
int user_intent;
// fixme -> put in own timed thread - not in draw invalidate loop
public void tick()
{
pos--;
pos%=bg_img.getWidth();
//SystemClock.sleep(50);
if (auto_next_state==-1)
switch(state)
{
case STATEID_FLIGHTVIEW:
// root.mk.trigger_debug_data();
lcd_lines=root.mk.LCD.get_act_page();
calc_lcd();
if (state_intro_frame<200)
state_intro_frame+=5;
break;
case STATEID_EDIT_PARAMS:
 
case STATEID_MAINMENU:
if (state_intro_frame<200)
state_intro_frame+=5;
break;
 
case STATEID_RAWDEBUG:
case STATEID_MOTORTEST:
if (state_intro_frame<150)
state_intro_frame+=5;
break;
case STATEID_KEYCONTROL:
case STATEID_STICKVIEW:
if (state_intro_frame<100)
state_intro_frame+=3;
break;
}
else
{
if (state_intro_frame>10)
state_intro_frame-=7;
else
{
state_intro_frame=0;
chg_state_(auto_next_state);
}
 
}
}
 
 
@Override protected void onDraw(Canvas canvas) {
 
 
tick();
 
Paint paint = mPaint;
paint.setAntiAlias(true);
 
paint.setARGB(255,0,0,0);
canvas.drawBitmap(bg_img,pos,0 , paint);
 
if ((bg_img.getWidth()+pos)<(getWidth()))
canvas.drawBitmap(bg_img,pos+bg_img.getWidth(),0 , paint);
 
 
switch ( state )
{
case STATEID_EDIT_PARAMS:
case STATEID_FLIGHTVIEW:
 
paint.setARGB(state_intro_frame ,0,0,0);
canvas.drawBitmap(lcd_img,0,lcd_top , paint);
break;
 
case STATEID_MOTORTEST:
 
paint.setARGB(state_intro_frame,100,100,100);
 
 
//front
 
canvas.drawRoundRect(new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 -getWidth()/8 - (getWidth()/2 - getWidth()/8),getWidth()/2 + getWidth()/8,getHeight()/2 -getWidth()/8),5,5,paint);
 
// back
canvas.drawRoundRect(new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 + getWidth()/8,getWidth()/2 + getWidth()/8,getHeight()/2+getWidth()/8 + (getWidth()/2 - getWidth()/8)),5,5,paint);
 
// left
canvas.drawRoundRect(new RectF(0,getHeight()/2 - getWidth()/8,getWidth()/2 - getWidth()/8,getHeight()/2+getWidth()/8),5,5,paint);
 
canvas.drawRoundRect(new RectF(getWidth()/2+getWidth()/8,getHeight()/2 - getWidth()/8,getWidth(),getHeight()/2+getWidth()/8),5,5,paint);
 
 
paint.setARGB(100,30,30,255);
 
canvas.drawRoundRect(new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 -getWidth()/8 - motortest_vals[0],getWidth()/2 + getWidth()/8,getHeight()/2 -getWidth()/8),5,5,paint);
 
// back
canvas.drawRoundRect(new RectF(getWidth()/2 - getWidth()/8,getHeight()/2 + getWidth()/8,getWidth()/2 + getWidth()/8,getHeight()/2+getWidth()/8 + motortest_vals[1]),5,5,paint);
 
// left
canvas.drawRoundRect(new RectF(getWidth()/2-getWidth()/8- motortest_vals[2],getHeight()/2 - getWidth()/8,getWidth()/2 - getWidth()/8,getHeight()/2+getWidth()/8),5,5,paint);
 
canvas.drawRoundRect(new RectF(getWidth()/2+getWidth()/8,getHeight()/2 - getWidth()/8,getWidth()/2+getWidth()/8+ motortest_vals[3],getHeight()/2+getWidth()/8),5,5,paint);
 
 
paint.setARGB(state_intro_frame+70,0,250,0);
paint.setTextAlign(Paint.Align.CENTER);
 
canvas.drawText("Front:"+ motortest_vals[0],getWidth()/2 ,getHeight()/2 -getWidth()/8-10,paint);
 
canvas.drawText("Back:"+ motortest_vals[1],getWidth()/2 ,getHeight()/2 +getWidth()/8+15,paint);
 
canvas.drawText("Left:"+ motortest_vals[2],getWidth()/4 ,getHeight()/2 ,paint);
canvas.drawText("Right:"+ motortest_vals[3],3*getWidth()/4 ,getHeight()/2 ,paint);
break;
 
case STATEID_RAWDEBUG:
paint.setARGB(state_intro_frame,50,50,200);
 
for(int y_p=0;y_p<16;y_p++)
canvas.drawRoundRect(new RectF(0,(getHeight()/32)*y_p*2,getWidth(),(getHeight()/32)*(y_p*2+1)),5,5,paint);
 
 
 
paint.setARGB(state_intro_frame,0,250,0);
for(int y_p=0;y_p<32;y_p++)
{
canvas.drawText( root.mk.debug_data.names[y_p],0,(getHeight()/32)*(y_p+1)-2,paint);
canvas.drawText( ""+root.mk.debug_data.analog[y_p],getWidth()/3,(getHeight()/32)*(y_p+1)-2,paint);
}
 
 
 
 
break;
 
case STATEID_KEYCONTROL:
canvas.rotate((root.mk.debug_data.analog[18]*(-90))/3000,getWidth()/2,getHeight()/2);
paint.setARGB(state_intro_frame,177,129,0);
// roll rect
canvas.drawRect(-getWidth(),getHeight()/2,2*getWidth(),3*getHeight()/2,paint);
 
int bar_height=20;
// nick rect
paint.setARGB(state_intro_frame,0,200,0);
canvas.drawRoundRect(new RectF(getWidth()/3,getHeight()/2 -bar_height/2 + root.mk.debug_data.analog[17]*getHeight()/(3*3000) ,2*getWidth()/3, getHeight()/2+ root.mk.debug_data.analog[17]*getHeight()/(3*3000)+bar_height),5,5,paint);
 
 
 
canvas.restore();
 
paint.setARGB(state_intro_frame,0,0,255);
// canvas.drawRoundRect(new RectF(getWidth()/2-getWidth()/8,getHeight()/2-getWidth()/8,getWidth()/2+getWidth()/8,getHeight()/2+getWidth()/8),5,5,paint);
 
canvas.drawRoundRect(new RectF(flight_x,flight_y,flight_x+getWidth()/8,flight_y+getWidth()/8),5,5,paint);
paint.setARGB(255,0,0,0);
break;
 
case STATEID_STICKVIEW:
paint.setARGB(state_intro_frame,50,50,200);
for(int y_p=0;y_p<10;y_p++)
canvas.drawRoundRect(new RectF(getWidth()/3 +((root.mk.stick_data.stick[y_p]<0)?(((root.mk.stick_data.stick[y_p]*getWidth()/3)/127)):0) ,(getHeight()/10)*y_p,getWidth()-getWidth()/3+((root.mk.stick_data.stick[y_p]>0)?(((root.mk.stick_data.stick[y_p]*getWidth()/3)/127)):0) ,(getHeight()/10)*(y_p+1)),15,15,paint);
paint.setARGB(state_intro_frame*2+50,0,255,0);
paint.setTextAlign(Paint.Align.CENTER);
for(int y_p=0;y_p<10;y_p++)
canvas.drawText("Chan " + (y_p+1) + "("+root.mk.stick_data.stick[y_p]+")",getWidth()/2,(getHeight()/20)*(y_p*2+1),paint);
paint.setTextAlign(Paint.Align.LEFT);
 
 
canvas.drawText("RC-Signal: " + root.mk.debug_data.SenderOkay(),0,10,paint);
break;
 
case STATEID_MAINMENU:
paint.setARGB(state_intro_frame ,0,0,0);
canvas.drawBitmap(lcd_img,0,lcd_top , paint);
 
int spacer=15;
int y_pos=10;
paint.setColor(Color.GREEN);
// canvas.drawText("LastKeyCode:"+last_key,0,10,paint);
paint.setTextAlign(Paint.Align.LEFT);
if (root.mk.connected)
{
canvas.drawText("Connected to MK with Version:"+root.mk.version.major+"."+root.mk.version.minor,0,y_pos,paint);
y_pos+=spacer;
canvas.drawText(" Power Source: " +( root.mk.debug_data.UBatt()/10) + "." + ( root.mk.debug_data.UBatt()%10) + " Volts | RC-Signal: " + root.mk.debug_data.SenderOkay(),0,y_pos,paint);
y_pos+=spacer;
canvas.drawText(" debug:"+root.mk.stats.debug_data_count+ " LCD:" + root.mk.stats.lcd_data_count + "(Pages:" + root.mk.LCD.pages + ") vers:" + root.mk.stats.version_data_count,0,y_pos,paint);
y_pos+=spacer;
canvas.drawText(" other:"+root.mk.stats.other_data_count+" params:"+root.mk.stats.params_data_count,0,y_pos,paint);
}
else
{
canvas.drawText("No QuadroKopter Communication established.",0,y_pos,paint);
y_pos+=spacer;
}
break;
}
 
 
 
paint.setARGB(255,255,255,255);
// icon indicating QC is connected
// !!FIXME!! -10 by screensize
canvas.drawBitmap(icon_img,getWidth()-icon_img.getWidth(),-10 , paint);
if (root.mk.ready())
canvas.drawBitmap(bt_on_img,getWidth()-icon_img.getWidth()-bt_on_img.getWidth()-5,5 , paint);
else
canvas.drawBitmap(bt_off_img,getWidth()-icon_img.getWidth()-bt_on_img.getWidth()-5,5 , paint);
 
 
paint.setARGB(255,0,0,0);
invalidate();
}
}
/DUBwise/trunk/android/src/org/ligi/android/FlightSettingsActivity.java
0,0 → 1,97
 
package org.ligi.android;
 
import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
 
import android.util.Log;
import android.view.ViewGroup.*;
import android.app.Activity;
import android.os.Bundle;
 
 
import android.view.*;
import android.widget.*;
 
 
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.net.Uri;
 
import java.net.URISyntaxException;
import android.widget.ArrayAdapter;
 
 
import android.text.method.NumberKeyListener;
 
 
import com.google.android.maps.MapView;
 
import android.app.AlertDialog.*;
import android.app.AlertDialog;
 
import android.content.*;
 
import org.ligi.ufo.*;
 
public class FlightSettingsActivity extends Activity
// extends ListActivity
 
{
 
String[] menu_items = new String[]{"Stick","Navi"};
 
 
 
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent i=new Intent(this, FlightSettingsSettingSelect.class);
i.putExtra("items",menu_items);
 
startActivityForResult(i,0);
}
@Override
protected void onActivityResult(int requestCode,int resultCode, Intent intent)
{
if ( resultCode!=RESULT_CANCELED)
{
Bundle extras = intent.getExtras();
if (extras!=null)
{
LinearLayout lin = new LinearLayout(this);
lin.setOrientation(LinearLayout.VERTICAL);
LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT);
TextView t1 = new TextView(this);
t1.setText("Here is the first textbox" + extras.getInt("pos"));
lin.addView(t1, params);
setContentView(lin);
}
}
else
finish();
}
 
 
 
 
 
}
/DUBwise/trunk/android/src/org/ligi/android/FlightSettingsSettingSelect.java
0,0 → 1,122
 
package org.ligi.android;
 
import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
 
import android.util.Log;
import android.view.ViewGroup.*;
import android.app.Activity;
import android.os.Bundle;
 
 
import android.view.*;
import android.widget.*;
 
 
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.net.Uri;
 
import java.net.URISyntaxException;
import android.widget.ArrayAdapter;
 
 
import android.text.method.NumberKeyListener;
 
 
import com.google.android.maps.MapView;
 
import android.app.AlertDialog.*;
import android.app.AlertDialog;
 
import android.content.*;
 
import org.ligi.ufo.*;
 
public class FlightSettingsSettingSelect extends ListActivity
{
 
// String[] menu_items = new String[]{"Stick","Navi"};
 
 
@Override
protected void onCreate(Bundle savedInstanceState) {
Bundle extras = getIntent().getExtras();
 
// Bundle extras = intent.getExtras();
 
String[] menu_items=extras.getStringArray("items");
super.onCreate(savedInstanceState);
//setContentView(R.layout.motortest);
 
this.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu_items));
// setContentView(list_act);
 
 
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id){
super.onListItemClick(l, v, position, id);
// Get the item that was clicked
Object o = this.getListAdapter().getItem(position);
//String keyword = o.toString();
 
Intent mIntent = new Intent();
mIntent.putExtra("pos",position);
setResult(RESULT_OK, mIntent);
finish();
 
 
 
// Create an VIEW intent
try {
switch(position)
{
case 0:
/*
// ListActivity Lis= new ListActivity(this);
is_list=false;
LinearLayout lin = new LinearLayout(this);
lin.setOrientation(LinearLayout.VERTICAL);
LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT);
TextView t1 = new TextView(this);
t1.setText("Here is the first textbox");
lin.addView(t1, params);
setContentView(lin);
*/
break;
}
} catch (Exception e) {
e.printStackTrace();
}
// Start the activity
}
 
 
}
/DUBwise/trunk/android/src/org/ligi/android/MKParamEditor.java
0,0 → 1,205
/**************************************************
*
* class to handle Editing of MK Params
*
* Author: Marcus -LiGi- Bueschleb
*
* see README for further Infos
*
*************************************************/
 
package org.ligi.android;
 
import android.view.*;
 
import org.ligi.ufo.*;
 
public class MKParamEditor
implements MKParamDefinitions
{
 
 
private int act_tab=0;
private int act_y=0;
private int act_lcd_lines=10;
 
DUBwise root;
 
public String[] lcd_lines;
 
public String[] public_lcd_lines;
public MKParamEditor(DUBwise _root)
{
root=_root;
lcd_lines=new String[40];
// refresh_lcd();
}
/*
public void paint ( Graphics g)
{
refresh_lcd();
canvas.paint_lcd(g,false);
}
*/
public void refresh_lcd()
{
// try
{
 
if (root.mk!=null)
{
act_lcd_lines=root.mk.params.field_names[act_tab].length*2+1;
for ( int i=0;i<act_lcd_lines;i++)
lcd_lines[i]="";
 
 
try
{
 
lcd_lines[0]=(act_tab==0?" ":"< ") + root.mk.params.tab_names[act_tab] + (act_tab==(root.mk.params.tab_names.length-1)?" ":" >");
 
for (int i=0;i<root.mk.params.field_names[act_tab].length;i++)
{
lcd_lines[1+2*i]=root.mk.params.field_names[act_tab][i];
if (root.mk.params.field_types[act_tab][i]== root.mk.params.PARAMTYPE_BITSWITCH)
lcd_lines[2+2*i]=(((root.mk.params.get_field_from_act(root.mk.params.field_positions[act_tab][i]/8)&(1<<root.mk.params.field_positions[act_tab][i]%8))==0)?"off":"on" ) ;
if (root.mk.params.field_types[act_tab][i]== root.mk.params.PARAMTYPE_BYTE)
{
lcd_lines[2+2*i]=""+root.mk.params.get_field_from_act(root.mk.params.field_positions[act_tab][i]);
if ((root.mk.params.get_field_from_act(root.mk.params.field_positions[act_tab][i])>250)&&(root.mk.params.get_field_from_act(root.mk.params.field_positions[act_tab][i])<256))
lcd_lines[2+2*i]+="[Poti"+(root.mk.params.get_field_from_act(root.mk.params.field_positions[act_tab][i])-250) +"]";
}
 
if (root.mk.params.field_types[act_tab][i]== root.mk.params.PARAMTYPE_STICK)
{
lcd_lines[2+2*i]=""+root.mk.params.get_field_from_act(root.mk.params.field_positions[act_tab][i]);
}
 
 
}
for (int i=0;i<act_lcd_lines;i++)
{
lcd_lines[i]=(act_y==i?"#":" ")+lcd_lines[i];
}
 
for ( int i=0;i<act_lcd_lines;i++)
while(lcd_lines[i].length()<20)
{
lcd_lines[i]+=" ";
}
}
catch (Exception e){}
public_lcd_lines=new String[act_lcd_lines];
for(int i=0;i<act_lcd_lines;i++)
public_lcd_lines[i]=lcd_lines[i];
}
else
{
public_lcd_lines=new String[1];
public_lcd_lines[0]="reading params";
}
 
}
// catch (Exception e){}
}
 
 
public final static int KEYCODE_CLEAR=-8;
public boolean editing_number=false;
 
public void keypress (int keyCode,int action)
{
if (act_y==0) switch (action)
{
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (act_tab<root.mk.params.tab_names.length-1) act_tab++;
break;
 
case KeyEvent.KEYCODE_DPAD_LEFT:
if (act_tab!=0) act_tab--;
break;
}
else
{
if(root.mk.params.field_types[act_tab][act_y/2-1]==root.mk.params.PARAMTYPE_BYTE)
{
if ((keyCode >=KeyEvent.KEYCODE_0) && (keyCode <=KeyEvent.KEYCODE_9))
{
if((editing_number)&&( Math.abs(root.mk.params.get_field_from_act(root.mk.params.field_positions[act_tab][act_y/2-1]))*10+(keyCode -KeyEvent.KEYCODE_0)<1000))
root.mk.params.set_field_from_act(root.mk.params.field_positions[act_tab][act_y/2-1] , Math.abs(root.mk.params.get_field_from_act(root.mk.params.field_positions[act_tab][act_y/2-1]))*10+(keyCode -KeyEvent.KEYCODE_0));
else
root.mk.params.set_field_from_act(root.mk.params.field_positions[act_tab][act_y/2-1] , (keyCode -KeyEvent.KEYCODE_0));
editing_number=true;
return;
}
else
if ( keyCode==KEYCODE_CLEAR)
root.mk.params.set_field_from_act(root.mk.params.field_positions[act_tab][act_y/2-1],0);
}
editing_number=false;
switch (action)
{
case KeyEvent.KEYCODE_DPAD_RIGHT:
switch(root.mk.params.field_types[act_tab][act_y/2-1])
{
case PARAMTYPE_BITSWITCH:
root.mk.params.field_from_act_xor((root.mk.params.field_positions[act_tab][act_y/2-1]/8),1<<(root.mk.params.field_positions[act_tab][act_y/2-1]%8));
break;
case PARAMTYPE_BYTE:
case PARAMTYPE_STICK:
root.mk.params.field_from_act_add(root.mk.params.field_positions[act_tab][act_y/2-1],1);
break;
}
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
switch(root.mk.params.field_types[act_tab][act_y/2-1])
{
case PARAMTYPE_BITSWITCH:
root.mk.params.field_from_act_xor((root.mk.params.field_positions[act_tab][act_y/2-1]/8),1<<(root.mk.params.field_positions[act_tab][act_y/2-1]%8));
break;
case PARAMTYPE_BYTE:
case PARAMTYPE_STICK:
root.mk.params.field_from_act_add(root.mk.params.field_positions[act_tab][act_y/2-1],-1);
break;
}
break;
}
}
switch (action)
{
 
case KeyEvent.KEYCODE_DPAD_DOWN:
if (act_y<(act_lcd_lines-2)) act_y+=2;
else act_y=0;
break;
 
case KeyEvent.KEYCODE_DPAD_UP :
if (act_y!=0) act_y-=2;
else act_y=act_lcd_lines-1;
break;
}
 
refresh_lcd();
 
 
}
}
 
/DUBwise/trunk/android/src/org/ligi/android/MapKey.java.skeleton
0,0 → 1,8
package org.ligi.android;
 
public interface MapKey
{
 
public final String MapKey=INSERT_YOUR_MAP_API_KEY;
 
}
/DUBwise/trunk/android/src/org/ligi/android/MotorTestActivity.java
0,0 → 1,138
 
package org.ligi.android;
 
import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
 
import android.util.Log;
 
import android.app.Activity;
import android.os.Bundle;
 
 
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.net.Uri;
 
import java.net.URISyntaxException;
import android.widget.*;
import android.content.DialogInterface;
import android.content.Context.*;
import android.widget.EditText;
import android.text.method.NumberKeyListener;
 
 
import com.google.android.maps.MapView;
 
import android.app.AlertDialog.*;
import android.app.AlertDialog;
 
import android.content.SharedPreferences;
 
import org.ligi.ufo.*;
 
public class MotorTestActivity extends Activity
implements SeekBar.OnSeekBarChangeListener
{
 
SeekBar seek_right,seek_left,seek_front,seek_back,seek_all;
CheckBox full_speed;
boolean toasted=false;
 
AndroidMKCommunicator mk;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
 
mk= new AndroidMKCommunicator(this);
setContentView(R.layout.motortest);
 
seek_right=(SeekBar)findViewById( R.id.seek_right);
seek_left=(SeekBar)findViewById( R.id.seek_left);
seek_front=(SeekBar)findViewById( R.id.seek_front);
seek_back=(SeekBar)findViewById( R.id.seek_back);
seek_all=(SeekBar)findViewById( R.id.seek_all);
full_speed=(CheckBox)findViewById( R.id.check_fullspeed);
seek_right.setOnSeekBarChangeListener(this);
seek_left.setOnSeekBarChangeListener(this);
seek_front.setOnSeekBarChangeListener(this);
seek_back.setOnSeekBarChangeListener(this);
seek_all.setOnSeekBarChangeListener(this);
// toast=Toast;
toast=toast.makeText(this, "Value too Dangerous - Clipping! Activate 'Allow Full Speed' to Override" + mk.stats.debug_data_count,Toast.LENGTH_LONG );
}
@Override
protected void onDestroy()
{
mk.close_connections(true);
mk=null;
super.onDestroy();
 
}
 
Toast toast;
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) {
// mProgressText.setText(progress + " " +
// getString(R.string.seekbar_from_touch) + "=" + fromTouch);
if (( progress>50)&&(!full_speed.isChecked()))
{
seekBar.setProgress(50);
progress=50;
toast.show ();
}
else
{
toast.cancel();
}
if (seekBar==seek_all)
{
seek_right.setProgress(progress);
seek_left.setProgress(progress);
seek_front.setProgress(progress);
seek_back.setProgress(progress);
}
 
 
int[] params=new int[4];
params[0] = seek_right.getProgress();
params[1] = seek_left.getProgress();
params[2] = seek_front.getProgress();
params[3] = seek_back.getProgress();
 
 
params[3] = seek_right.getProgress();
params[2] = seek_left.getProgress();
params[0] = seek_front.getProgress();
params[1] = seek_back.getProgress();
 
mk.motor_test(params);
}
 
 
public void onStartTrackingTouch(SeekBar seekBar) {
//mTrackingText.setText(getString(R.string.seekbar_tracking_on));
}
 
public void onStopTrackingTouch(SeekBar seekBar) {
// mTrackingText.setText(getString(R.string.seekbar_tracking_off));
}
 
}
/DUBwise/trunk/android/src/org/ligi/android/R.java
0,0 → 1,72
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
 
package org.ligi.android;
 
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int bt_off=0x7f020000;
public static final int bt_on=0x7f020001;
public static final int icon=0x7f020002;
public static final int lcd_green=0x7f020003;
public static final int starfield=0x7f020004;
}
public static final class id {
public static final int cancel_btn=0x7f060004;
public static final int check_autoconn=0x7f060002;
public static final int check_fullspeed=0x7f060005;
public static final int edit_host=0x7f060000;
public static final int edit_port=0x7f060001;
public static final int save_btn=0x7f060003;
public static final int seek_all=0x7f06000a;
public static final int seek_back=0x7f060007;
public static final int seek_front=0x7f060006;
public static final int seek_left=0x7f060008;
public static final int seek_right=0x7f060009;
public static final int stick_progress_0=0x7f06000b;
public static final int stick_progress_1=0x7f06000c;
public static final int stick_progress_2=0x7f06000d;
public static final int stick_progress_3=0x7f06000e;
public static final int stick_progress_4=0x7f06000f;
public static final int stick_progress_5=0x7f060010;
public static final int stick_progress_6=0x7f060011;
public static final int stick_progress_7=0x7f060012;
public static final int stick_progress_8=0x7f060013;
public static final int stick_progress_9=0x7f060014;
}
public static final class layout {
public static final int connection=0x7f030000;
public static final int motortest=0x7f030001;
public static final int rcdata=0x7f030002;
}
public static final class raw {
public static final int voice_sample_01=0x7f040000;
public static final int voice_sample_02=0x7f040001;
public static final int voice_sample_03=0x7f040002;
public static final int voice_sample_04=0x7f040003;
public static final int voice_sample_05=0x7f040004;
public static final int voice_sample_06=0x7f040005;
public static final int voice_sample_07=0x7f040006;
public static final int voice_sample_08=0x7f040007;
public static final int voice_sample_09=0x7f040008;
public static final int voice_sample_10=0x7f040009;
public static final int voice_sample_11=0x7f04000a;
public static final int voice_sample_12=0x7f04000b;
public static final int voice_sample_13=0x7f04000c;
public static final int voice_sample_komma=0x7f04000d;
public static final int voice_sample_volt=0x7f04000e;
}
public static final class string {
public static final int app_name=0x7f050000;
public static final int map_menu_back_to_list=0x7f050003;
public static final int map_menu_toggle_street_satellite=0x7f050004;
public static final int map_menu_zoom_in=0x7f050001;
public static final int map_menu_zoom_out=0x7f050002;
}
}
/DUBwise/trunk/android/src/org/ligi/android/RCDataActivity.java
0,0 → 1,120
 
package org.ligi.android;
 
import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
 
import android.util.Log;
 
import android.app.Activity;
import android.os.Bundle;
 
 
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
 
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.net.Uri;
 
import java.net.URISyntaxException;
import android.widget.*;
import android.content.DialogInterface;
import android.content.Context.*;
import android.widget.EditText;
import android.text.method.NumberKeyListener;
 
 
import com.google.android.maps.MapView;
 
import android.app.AlertDialog.*;
import android.app.AlertDialog;
 
import android.content.SharedPreferences;
 
 
import android.view.*;
import android.content.*;
import android.view.ViewGroup.*;
 
import org.ligi.ufo.*;
 
public class RCDataActivity extends Activity
implements DUBwiseDefinitions,Runnable
{
 
 
 
AndroidMKCommunicator mk;
 
ProgressBar[] bars;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
 
 
bars=new ProgressBar[10];
 
mk= new AndroidMKCommunicator(this);
mk.user_intent=USER_INTENT_RCDATA;
setContentView(R.layout.rcdata);
 
bars[0]= (ProgressBar)findViewById( R.id.stick_progress_0);
bars[1]= (ProgressBar)findViewById( R.id.stick_progress_1);
bars[2]= (ProgressBar)findViewById( R.id.stick_progress_2);
bars[3]= (ProgressBar)findViewById( R.id.stick_progress_3);
bars[4]= (ProgressBar)findViewById( R.id.stick_progress_4);
bars[5]= (ProgressBar)findViewById( R.id.stick_progress_5);
bars[6]= (ProgressBar)findViewById( R.id.stick_progress_6);
bars[7]= (ProgressBar)findViewById( R.id.stick_progress_7);
bars[8]= (ProgressBar)findViewById( R.id.stick_progress_8);
bars[9]= (ProgressBar)findViewById( R.id.stick_progress_9);
 
new Thread( this ).start(); // fire up main Thread
}
 
public void run()
{
while(true)
{
try{
Thread.sleep(50);
for (int i=0;i<10;i++)
bars[i].setProgress(mk.stick_data.stick[i]+127);
}
catch(Exception e)
{
 
mk.log(e.toString());
}
 
}
 
 
 
}
@Override
protected void onDestroy()
{
mk.close_connections(true);
mk=null;
super.onDestroy();
 
}
 
 
}
/DUBwise/trunk/android
Property changes:
Added: svn:ignore
+bin
+