/DUBwise/src/J2ME/build.props |
---|
0,0 → 1,3 |
screensize=240x320 |
voice_mode=de_tts |
basename=DUBwise-240x320-de_tts |
/DUBwise/src/J2ME/build.rb |
---|
0,0 → 1,70 |
#!/usr/bin/env ruby |
# little ruby script to build DUBwise |
# |
# Author: Marcus -LiGi- Bueschleb |
# |
# see README for further Infos |
resdir="res/" |
puts `mv build.props build.props.bak` |
puts `ant clean` |
ARGV<<"" if ARGV==[] |
case ARGV[0] |
when "test" |
screensizes=["240x320"] |
voice_modes=["en_speedy"] |
else |
screensizes=["128x128","176x220","240x320"] |
voice_modes=["no_voice","de_tts","de_64kbit_tts","en_speedy","wav"] |
end |
propertys={} |
screensizes.each { |screensize| |
voice_modes.each { |voice_mode| |
p "cleaning ressources" |
p `rm -rf tmp/res` |
p `mkdir tmp/res` |
p `cp -v res/images_by_screensize/#{screensize}/* tmp/res/` |
propertys["screensize"]=screensize |
p "voice_mode" + voice_mode |
p "Screensize " + screensize |
propertys["voice_mode"]=voice_mode |
propertys["basename"]="DUBwise-#{screensize}-#{voice_mode}" |
p `cp -v res/voice_samples_by_name/#{voice_mode}/* tmp/res/` |
prefs_file= File.new("build.props","w") |
propertys.each_pair {|name,value| |
prefs_file << name+"="+value+"\n" |
} |
prefs_file.close |
`ant build`.each_line { |l| puts l } |
} |
} |
puts `mv -v build.props.bak build.props` |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/DUBwise/src/J2ME/build.xml |
---|
0,0 → 1,70 |
<project name="DUBwise" basedir="."> |
<property name="wtk.home" value="/home/ligi/tools/WTK2.2/"/> |
<property name="project_name" value="DUBwise"/> <!-- jar filename --> |
<property name="project_version" value="0.44"/> |
<property file="build.props"/> |
<property name="res_dir" location="tmp/res"/> |
<property name="build_dir" location="${basedir}/build/"/> |
<property name="lib_dir" location="${basedir}/lib/"/> |
<property name="src_dir" location="${basedir}/src/"/> |
<property name="preprocessed_src_dir" location="${basedir}/tmp/pp_src/"/> |
<taskdef resource="antenna.properties" classpath="${lib_dir}/antenna.jar"/> |
<property name="wtk.midp.version" value="2.0"/> |
<property name="wtk.midpapi" value="${lib_dir}/classes.zip"/> |
<target name="build"> |
<wtkpreprocess version="2" srcdir="${src_dir}" destdir="${preprocessed_src_dir}" symbols="VERSION=${project_version},voice_mode=${voice_mode}" verbose="false"/> |
<wtkbuild destdir="${build_dir}/classes" srcdir="${preprocessed_src_dir}" target="1.1" preverify="true"/> |
<wtkjad |
jadfile="${build_dir}/bin/${basename}.jad" |
jarfile="${build_dir}/bin/${basename}.jar" |
update="false" |
manifest="${build_dir}/bin/MANIFEST.MF" |
name="${project_name}" |
vendor="LiGi" |
version="${project_version}"> |
<attribute name="MIDletX-No-Command" value="true"/> |
<attribute name="MIDlet-Icon" value="i.png"/> |
<midlet name="${project_name}" class="${project_name}" icon="i.png" /> |
<!-- !!TODO!! Remove Icon JAD entry if no icon is there --> |
</wtkjad> |
<wtkpackage |
jarfile="${build_dir}/bin/${basename}.jar" |
jadfile="${build_dir}/bin/${basename}.jad" |
basedir="${build_dir}/classes" |
manifest="${build_dir}/bin/MANIFEST.MF" |
obfuscate="true" |
preverify="true"> |
<fileset dir="${res_dir}/"> |
<include name="*"/> |
</fileset> |
</wtkpackage> |
<!-- !!TODO!! just zip if flag set --> |
<zip destfile="${build_dir}/deploy.zip" basedir="${build_dir}/bin/" includes="**/*"/> |
</target> |
<target name="clean"> |
<delete dir="${build_dir}"/> |
<delete dir="${preprocessed_src_dir}"/> |
<tstamp/> |
<mkdir dir="${preprocessed_src_dir}"/> |
<mkdir dir="${build_dir}"/> |
<mkdir dir="${build_dir}/classes"/> |
<mkdir dir="${build_dir}/bin"/> |
</target> |
</project> |
/DUBwise/src/J2ME/lib/antenna.jar |
---|
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/src/J2ME/lib/classes.zip |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/DUBwise/src/J2ME/res/images_by_screensize/128x128/bt.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/src/J2ME/res/images_by_screensize/128x128/clouds.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/src/J2ME/res/images_by_screensize/128x128/i.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/src/J2ME/res/images_by_screensize/128x128/lcd_blue.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/src/J2ME/res/images_by_screensize/128x128/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/src/J2ME/res/images_by_screensize/128x128/load.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/src/J2ME/res/images_by_screensize/128x128/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/src/J2ME/res/images_by_screensize/176x220/bt.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/src/J2ME/res/images_by_screensize/176x220/clouds.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/src/J2ME/res/images_by_screensize/176x220/i.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/src/J2ME/res/images_by_screensize/176x220/lcd_blue.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/src/J2ME/res/images_by_screensize/176x220/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/src/J2ME/res/images_by_screensize/176x220/load.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/src/J2ME/res/images_by_screensize/176x220/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/src/J2ME/res/images_by_screensize/240x320/bt.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/src/J2ME/res/images_by_screensize/240x320/clouds.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/src/J2ME/res/images_by_screensize/240x320/i.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/src/J2ME/res/images_by_screensize/240x320/lcd_blue.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/src/J2ME/res/images_by_screensize/240x320/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/src/J2ME/res/images_by_screensize/240x320/load.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/src/J2ME/res/images_by_screensize/240x320/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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/1.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/2.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/3.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/4.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/5.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/6.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/7.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/8.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/9.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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/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/src/J2ME/res/voice_samples_by_name/de_64kbit_tts/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/src/J2ME/res/voice_samples_by_name/de_tts/1.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/src/J2ME/res/voice_samples_by_name/de_tts/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/src/J2ME/res/voice_samples_by_name/de_tts/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/src/J2ME/res/voice_samples_by_name/de_tts/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/src/J2ME/res/voice_samples_by_name/de_tts/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/src/J2ME/res/voice_samples_by_name/de_tts/2.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/src/J2ME/res/voice_samples_by_name/de_tts/3.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/src/J2ME/res/voice_samples_by_name/de_tts/4.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/src/J2ME/res/voice_samples_by_name/de_tts/5.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/src/J2ME/res/voice_samples_by_name/de_tts/6.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/src/J2ME/res/voice_samples_by_name/de_tts/7.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/src/J2ME/res/voice_samples_by_name/de_tts/8.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/src/J2ME/res/voice_samples_by_name/de_tts/9.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/src/J2ME/res/voice_samples_by_name/de_tts/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/src/J2ME/res/voice_samples_by_name/de_tts/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/src/J2ME/res/voice_samples_by_name/en_speedy/1.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/src/J2ME/res/voice_samples_by_name/en_speedy/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/src/J2ME/res/voice_samples_by_name/en_speedy/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/src/J2ME/res/voice_samples_by_name/en_speedy/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/src/J2ME/res/voice_samples_by_name/en_speedy/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/src/J2ME/res/voice_samples_by_name/en_speedy/2.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/src/J2ME/res/voice_samples_by_name/en_speedy/3.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/src/J2ME/res/voice_samples_by_name/en_speedy/4.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/src/J2ME/res/voice_samples_by_name/en_speedy/5.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/src/J2ME/res/voice_samples_by_name/en_speedy/6.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/src/J2ME/res/voice_samples_by_name/en_speedy/7.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/src/J2ME/res/voice_samples_by_name/en_speedy/8.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/src/J2ME/res/voice_samples_by_name/en_speedy/9.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/src/J2ME/res/voice_samples_by_name/en_speedy/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/src/J2ME/res/voice_samples_by_name/en_speedy/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/src/J2ME/res/voice_samples_by_name/wav/1.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/10.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/11.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/12.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/13.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/2.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/3.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/4.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/5.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/6.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/7.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/8.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/9.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/komma.wav |
---|
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/src/J2ME/res/voice_samples_by_name/wav/volt.wav |
---|
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/src/J2ME/src/BTSearcher.java |
---|
0,0 → 1,136 |
/*************************************** |
* |
* searches 4 Bluetooth Devices |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
****************************************/ |
import javax.bluetooth.*; |
public class BTSearcher |
implements DiscoveryListener |
{ |
private LocalDevice m_LclDevice = null; |
private DiscoveryAgent m_DscrAgent=null; |
public boolean searching=true; |
public boolean error=false; |
public String err_log="none"; |
public void log(String err_str) |
{ |
err_log+=err_str; |
System.out.println(err_str); |
} |
public final int MAX_DEVICES=10; |
public RemoteDevice[] remote_devices; |
public int remote_device_count=0; |
public String[] remote_device_name; |
public String[] remote_device_mac; |
public BTSearcher() |
{ |
remote_devices=new RemoteDevice[MAX_DEVICES]; |
remote_device_name=new String[MAX_DEVICES]; |
remote_device_mac=new String[MAX_DEVICES]; |
remote_device_count=0; |
} |
public void search() |
{ |
searching=true; |
remote_device_count=0; |
try |
{ |
//First get the local device and obtain the discovery agent. |
m_LclDevice = LocalDevice.getLocalDevice(); |
m_DscrAgent= m_LclDevice.getDiscoveryAgent(); |
m_DscrAgent.startInquiry(DiscoveryAgent.GIAC,this); |
} |
catch (BluetoothStateException ex) |
{ |
error=true; |
log("Problem in searching the blue tooth devices\n" + ex); |
} |
} |
public void inquiryCompleted(int transID) { |
try { |
log("search complete with " + remote_device_count + " devices"); |
for(int i=0;i<remote_device_count;i++) |
{ |
log("#" + i + " -> addr: " + remote_devices[i].getBluetoothAddress()); |
remote_device_mac[i]=remote_devices[i].getBluetoothAddress(); |
remote_device_name[i]=remote_devices[i].getBluetoothAddress(); |
try { |
log("#" + i + "name:" + remote_devices[i].getFriendlyName(true)); |
remote_device_name[i]=remote_devices[i].getFriendlyName(true); |
} |
catch (Exception e) |
{ |
log("Problem getting name of BT-Device( -> taking mac as name): " + e); |
} |
} |
} |
catch (Exception e) |
{ |
log("Problem in searching the blue tooth devices" + e); |
} |
searching=false; |
} |
public void search_again() |
{ |
} |
//Called when device is found during inquiry |
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) |
{ |
log("found device "); |
try |
{ |
if (remote_device_count!=(MAX_DEVICES-1)) |
{ |
remote_devices[remote_device_count]=btDevice; |
remote_device_count++; |
} |
} |
catch (Exception e) |
{ |
log("Device Discovered Error: " + e); |
} |
} |
public void serviceSearchCompleted(int transID, int respCode) |
{ } |
public void servicesDiscovered(int transID, ServiceRecord[] records) |
{ } |
} |
/DUBwise/src/J2ME/src/DUBwise.java |
---|
0,0 → 1,46 |
/*********************************************************************** |
* |
* DUBwise == Digital UFO Broadcasting with intelligent service equipment |
* main MIDLet Source file |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
************************************************************************/ |
import javax.microedition.lcdui.*; |
import javax.microedition.midlet.*; |
public class DUBwise |
extends MIDlet |
{ |
public Display display; |
public DUBwiseCanvas canvas; |
public boolean loaded=false; |
public void vibrate(int duration) |
{ |
display.vibrate(duration); |
} |
protected void startApp() |
throws MIDletStateChangeException |
{ |
if (loaded)return; |
display = Display.getDisplay(this); |
canvas=new DUBwiseCanvas(this); |
// fire up canvas |
display.setCurrent(canvas); |
loaded=true; |
} |
public void quit() { notifyDestroyed(); } |
protected void pauseApp() {} // not needed right now |
protected void destroyApp(boolean arg0) { } |
} |
/DUBwise/src/J2ME/src/DUBwiseCanvas.java |
---|
0,0 → 1,1348 |
/*************************************************************** |
* |
* User Interface ( Canvas ) of DUBwise |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
***************************************************************/ |
import javax.microedition.lcdui.*; |
import javax.microedition.rms.*; |
import javax.microedition.media.*; |
import javax.microedition.media.control.*; |
public class DUBwiseCanvas |
extends Canvas |
implements Runnable |
{ |
// name/handle for the recordStore to memorize some stuff |
private final static String RECORD_STORE_NAME="DUBSETT"; |
private BTSearcher bt_scanner; |
public MKCommunicator mk=null; |
private MKStatistics mk_stat=null; |
private MKParamsEditor params_editor=null; |
public DUBwiseDebug debug=null; |
//#if voice_mode!="no_voice" |
private MKStatusVoice status_voice; |
//#endif |
private String err=""; |
private DUBwise root; |
private UFOProber ufo_prober; |
byte[] settings_arr; |
public boolean do_vibra=true; |
public boolean do_sound=true; |
public boolean do_graph=true; |
public boolean keep_lighton=false; |
private Image bg_img; |
private Image bt_img; |
private Image lcd_img; |
private Image load_img; |
final static int SKINID_DARK= 0; |
final static int SKINID_LIGHT = 1; |
//holds id of actual skin |
byte act_skin=SKINID_DARK; |
public int[] nick_line_pos_data; |
public int[] roll_line_pos_data; |
public int[] accnick_line_pos_data; |
public int[] accroll_line_pos_data; |
public int lcd_char_width=0; |
public int lcd_char_height=0; |
public int frame_pos=0; |
int line_scaler=20; |
int rawdebug_cursor_y=0; |
int rawdebug_off_y=0; |
public int line_middle_y; |
boolean quit=false; |
boolean rescan=true; |
int bg_offset=0; |
// variable to hold the current state |
public int state=-1; |
// id for each state - must just be uniq - order isnt important |
public final static int STATEID_SCANNING =0; |
public final static int STATEID_DEVICESELECT =1; |
public final static int STATEID_MAINMENU =2; |
public final static int STATEID_MOTORTEST =3; |
public final static int STATEID_SELECT_PARAMSET =4; |
public final static int STATEID_EDIT_PARAMS =5; |
public final static int STATEID_HANDLE_PARAMS =6; |
public final static int STATEID_FLIGHTVIEW =7; |
public final static int STATEID_RAWDEBUG =8; |
public final static int STATEID_KEYCONTROL =9; |
public final static int STATEID_SETTINGSMENU =10; |
public final static int STATEID_STICKVIEW =11; |
public final static int STATEID_CAMMODE =12; |
public boolean fullscreen=false; |
public int act_motor=0; |
public int act_motor_increase=0; |
public boolean motor_test_sel_all=false; |
public String[] main_menu_items={"Telemetry","Raw Debug", "view RC-data", "MK-KeyControl", "Motor Test" , "Flight Settings","Tool Settings","Remote Cam","Proxy","Change Device" , "Quit " }; |
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[] 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; |
int local_max=-1; |
int y_off=0; |
int spacer=0; |
int spacer1=0; |
int[] motor_test = {0,0,0,0}; |
String[] menu_items; |
int act_menu_select=0; |
String[] lcd_lines =null; |
public void paint_menu(Graphics g) |
{ |
for ( int i=0;i<menu_items.length;i++) |
{ |
if ((frame_pos%3)!=0) |
{ |
lcd_lines[i]=(act_menu_select==i?">":" ") + menu_items[i]; |
for ( int ii=0;ii<(18-menu_items[i].length());ii++) |
lcd_lines[i]+=" "; |
if (act_menu_select==i) |
lcd_lines[i]+="<"; |
} |
else |
lcd_lines[i]=" " + menu_items[i]; |
} |
paint_lcd(g,true); |
} |
public void menu_keypress(int keyCode) |
{ |
switch (getGameAction (keyCode)) |
{ |
case UP: |
if (act_menu_select!=0) act_menu_select--; |
else |
act_menu_select=menu_items.length-1; |
break; |
case DOWN: |
if (act_menu_select<(menu_items.length-1)) act_menu_select++; |
else act_menu_select=0; |
break; |
} |
} |
public boolean cam_condition() |
{ |
return (mk.stick_data.stick[5]>100); |
} |
public void paint_lcd(Graphics g,boolean bottomup) |
{ |
int y; |
for(int i=0;i<lcd_lines.length;i++) |
for (int pos=0;pos<20;pos++) |
{ |
if (bottomup) |
y=this.getHeight()-(lcd_lines.length-i)*lcd_char_height; |
else |
y=i*lcd_char_height; |
g.setClip((lcd_img.getWidth()/222)*pos,y,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
g.drawImage(lcd_img,(lcd_img.getWidth()/222)*pos-((pos<lcd_lines[i].length()?lcd_lines[i].charAt(pos):' ')-' ')*(lcd_img.getWidth()/222),y,g.TOP | g.LEFT); |
} |
} |
public void load_images() |
{ |
try |
{ |
// load all needed images |
switch (act_skin) |
{ |
case SKINID_DARK: |
lcd_img=Image.createImage("/lcd_green.png"); |
bg_img=Image.createImage("/starfield.jpg"); break; |
case SKINID_LIGHT: |
lcd_img=Image.createImage("/lcd_blue.png"); |
bg_img=Image.createImage("/clouds.jpg"); |
break; |
} |
bt_img=Image.createImage("/bt.png"); |
load_img=Image.createImage("/load.png"); |
} |
catch (Exception e) |
{ |
err+=e.toString(); |
} |
lcd_char_width=lcd_img.getWidth()/222; |
lcd_char_height=lcd_img.getHeight(); |
nick_line_pos_data=new int[bg_img.getWidth()]; |
roll_line_pos_data=new int[bg_img.getWidth()]; |
accnick_line_pos_data=new int[bg_img.getWidth()]; |
accroll_line_pos_data=new int[bg_img.getWidth()]; |
for (int c=0;c<bg_img.getWidth();c++) |
{ |
nick_line_pos_data[c]=-1; |
roll_line_pos_data[c]=-1; |
accnick_line_pos_data[c]=-1; |
accroll_line_pos_data[c]=-1; |
} |
} |
public DUBwiseCanvas(DUBwise _root) |
{ |
root=_root; |
debug = new DUBwiseDebug(); |
bt_scanner = new BTSearcher(); |
params_editor = new MKParamsEditor(this); |
ufo_prober = new UFOProber(); |
mk = new MKCommunicator(root,debug); |
mk_stat = new MKStatistics(mk); |
//#if voice_mode!="no_voice" |
status_voice=new MKStatusVoice(mk,this); |
//#endif |
try |
{ |
RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true ); |
if (recStore.getNumRecords()==3) |
{ |
//byte[] recData = new byte[recStore.getRecordSize(1)]; |
//int len = recStore.getRecord(1, recData, 0); |
//byte[] recData2 = new byte[recStore.getRecordSize(2)]; |
//int len2 = recStore.getRecord(2, recData, 0); |
byte[] url_data=recStore.getRecord(1); |
byte[] name_data=recStore.getRecord(2); |
settings_arr=recStore.getRecord(3); |
act_skin=settings_arr[0]; |
do_sound=(settings_arr[1]==1); |
do_vibra=(settings_arr[2]==1); |
do_graph=(settings_arr[3]==1); |
fullscreen=(settings_arr[4]==1); |
keep_lighton=(settings_arr[5]==1); |
connect_mk(new String(url_data, 0, url_data.length),new String(name_data, 0, name_data.length)); |
} |
recStore.closeRecordStore(); |
} |
catch (Exception e) |
{ |
settings_arr=new byte[10]; |
err+=e.toString(); |
} |
load_images(); |
chg_state((mk.force_disconnect)?STATEID_SCANNING:STATEID_MAINMENU); |
new Thread(this).start(); |
} |
/****************************** Thread ******************/ |
// ticking runnable Section |
public void run() |
{ |
while(true) |
{ |
try { |
repaint(); |
serviceRepaints(); |
long loopStartTime = System.currentTimeMillis(); |
long sleeptime=0; |
// ticked thing |
frame_pos++; |
switch(state) |
{ |
case STATEID_CAMMODE: |
try |
{ |
if(cam_condition()) |
{ |
cam_img=null; |
debug.log("get snap\n"); |
cam_raw = mVideoControl.getSnapshot(null); |
try { Thread.sleep(4000); } |
catch (Exception e) |
{ |
err="Problem Sleeping "; |
} |
} |
else |
{ |
if (cam_img==null) |
cam_img = Image.createImage(cam_raw, 0, cam_raw.length); |
} |
} |
catch ( Exception e) |
{ |
debug.log(e.toString()); |
} |
break; |
case STATEID_KEYCONTROL: |
mk.send_keys(keycontrol_bitfield); |
break; |
case STATEID_MOTORTEST: |
if (motor_test_sel_all) |
for (int m=0;m<4;m++) |
{ |
motor_test[m]+=act_motor_increase; |
if (motor_test[m]<0)motor_test[m]=0; |
if (motor_test[m]>255)motor_test[m]=255; |
} |
else |
{ |
motor_test[act_motor]+=act_motor_increase; |
if (motor_test[act_motor]<0) motor_test[act_motor]=0; |
if (motor_test[act_motor]>255) motor_test[act_motor]=255; |
} |
mk.motor_test(motor_test); |
break; |
case STATEID_SCANNING: |
intro_str_delay--; |
if (intro_str_delay<0) |
{ |
intro_str_delay=1; |
if (intro_str_pos>intro_str.length()) |
intro_str_pos=0; |
lcd_lines[3]=intro_str.substring(intro_str_pos, (((intro_str_pos+20)>intro_str.length())?intro_str.length():intro_str_pos+20)); |
intro_str_pos++; |
} |
if (!bt_scanner.searching) |
chg_state(STATEID_DEVICESELECT); |
break; |
} |
try { |
nick_line_pos_data[-bg_offset] = mk.debug_data.nick_int(); |
roll_line_pos_data[-bg_offset] = mk.debug_data.roll_int(); |
accnick_line_pos_data[-bg_offset] = mk.debug_data.accnick(); |
accroll_line_pos_data[-bg_offset] = mk.debug_data.accroll(); |
} |
catch (Exception e) |
{ |
err+=e.toString(); |
} |
if (quit) |
{ |
try |
{ |
RecordStore.deleteRecordStore(RECORD_STORE_NAME); |
RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true ); |
recStore.addRecord(mk.mk_url.getBytes(), 0, mk.mk_url.getBytes().length); |
recStore.addRecord(mk.name.getBytes(), 0, mk.name.getBytes().length); |
settings_arr=new byte[10]; |
settings_arr[0]=(byte)act_skin; |
settings_arr[1]=(byte)(do_sound?1:0); |
settings_arr[2]=(byte)(do_vibra?1:0); |
settings_arr[3]=(byte)(do_graph?1:0); |
settings_arr[4]=(byte)(fullscreen?1:0); |
settings_arr[5]=(byte)(keep_lighton?1:0); |
recStore.addRecord(settings_arr, 0, settings_arr.length); |
recStore.closeRecordStore(); |
} |
catch (Exception e) |
{ |
err+=e.toString(); |
} |
root.quit(); |
} |
if (rescan) |
{ |
rescan=false; |
} |
try { |
//rescan=false; |
bg_offset--; |
if (bg_offset==-bg_img.getWidth()) |
bg_offset=0; |
if (keep_lighton) com.nokia.mid.ui.DeviceControl.setLights(0,100); |
//bt.tick(); |
// every state has sth to do in tick section |
} |
catch (Exception e) |
{ |
} |
// System.gc(); |
sleeptime=1000/ 15 - (int) (System.currentTimeMillis()- loopStartTime); |
if (sleeptime<0) |
sleeptime=100; // everyone has fi sleep |
try { Thread.sleep(sleeptime); } |
catch (Exception e) |
{ |
err="Problem Sleeping "; |
} |
} |
catch (Exception e) |
{ |
err+=e.toString(); |
} |
} |
} |
boolean firstrun=true; |
// drawing section |
public void paint(Graphics g) { |
if (debug.showing) |
{ |
debug.paint(g); |
return; |
} |
if (firstrun) |
{ |
if (fullscreen) setFullScreenMode(fullscreen); |
firstrun=false; |
} |
y_off=0; |
try { |
if (mk!=null) |
{ |
line_middle_y=this.getHeight()/2; |
if (local_max<Math.abs(mk.debug_data.nick_int())) |
local_max=Math.abs(mk.debug_data.nick_int()); |
if (local_max<Math.abs(mk.debug_data.roll_int())) |
local_max=Math.abs(mk.debug_data.roll_int()); |
if (local_max<Math.abs(mk.debug_data.accnick())) |
local_max=Math.abs(mk.debug_data.accnick()); |
if (local_max<Math.abs(mk.debug_data.accroll())) |
local_max=Math.abs(mk.debug_data.accroll()); |
line_scaler= local_max/(this.getHeight()/2)+1; |
} |
Font f1 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM); |
Font f2 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); |
spacer=(f1.getHeight()); |
spacer1=(f2.getHeight()); |
//default Font |
g.setFont(f1); |
if (state==STATEID_EDIT_PARAMS) |
{ |
g.setColor(0x000000); |
g.fillRect(0,0,this.getWidth(),this.getHeight()); |
} |
else |
{ |
g.setColor(0xFFFFFF); |
g.fillRect(0,0,this.getWidth(),this.getHeight()); |
g.drawImage(bg_img,bg_offset,0, g.TOP | g.LEFT); |
if (bg_offset+bg_img.getWidth()<this.getWidth()) |
g.drawImage(bg_img,bg_offset+bg_img.getWidth(),0, g.TOP | g.LEFT); |
} |
switch (act_skin) |
{ |
case SKINID_DARK: |
g.setColor(0x2dcf20); |
break; |
case SKINID_LIGHT: |
g.setColor(0x000000); |
break; |
} |
switch(state) |
{ |
case STATEID_CAMMODE: |
if (cam_img!=null) |
g.drawImage(cam_img,0,0,g.TOP | g.LEFT); |
g.drawString("condition: " + cam_condition() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("width " + cam_img.getWidth(),0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("height " + cam_img.getHeight(),0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
break; |
case STATEID_STICKVIEW: |
y_off=0; |
for(int tmp_y=0;tmp_y<10;tmp_y++) |
{ |
g.drawString(""+tmp_y+"=>"+mk.stick_data.stick[tmp_y],0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
} |
break; |
case STATEID_KEYCONTROL: |
y_off+=spacer; |
g.drawString("UP&DOWN => nick",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("LEFT&RIGHT => roll",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("1&4 => altitude",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("2&3 => gier",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("Press # and * at once",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("to quit KeyControl",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("bf1:"+ keycontrol_bitfield[0] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
g.drawString("bf2:"+ keycontrol_bitfield[1] ,this.getWidth()/2,y_off,Graphics.TOP | Graphics.LEFT); |
break; |
case STATEID_MOTORTEST: |
for (int bar=0;bar<4;bar++) |
{ |
g.setColor(((bar==act_motor)|motor_test_sel_all)?0x44CC44:0x4444DD); |
g.fillRect(this.getWidth()/(8*2)+bar*2*this.getWidth()/8,10,this.getWidth()/8,20+motor_test[bar]); |
g.setColor(0x000000); |
g.drawString(""+motor_test[bar] ,this.getWidth()/8+bar*2*this.getWidth()/8,10,Graphics.TOP | Graphics.HCENTER); |
if(bar!=4) g.drawString(""+mk.debug_data.motor_val(bar) ,this.getWidth()/8+bar*2*this.getWidth()/8,30,Graphics.TOP | Graphics.HCENTER); |
} |
break; |
case STATEID_EDIT_PARAMS: |
params_editor.paint(g); |
break; |
case STATEID_SCANNING: |
paint_lcd(g,true); |
g.setClip(this.getWidth()/2-load_img.getWidth()/6+1,this.getHeight()/2-load_img.getHeight()/8+1, load_img.getWidth()/4,load_img.getHeight()/3);; |
g.drawImage(load_img,this.getWidth()/2-load_img.getWidth()/8 - ((((frame_pos/3)%12)%4)*(load_img.getWidth()/4)) ,this.getHeight()/2-load_img.getHeight()/6- ((((frame_pos/3)%12)/4)*(load_img.getHeight()/3)), g.TOP | g.LEFT); |
g.drawImage(bt_img,this.getWidth()/2 ,this.getHeight()/2 , g.HCENTER | g.VCENTER); |
break; |
case STATEID_RAWDEBUG: |
g.setFont(f2); |
rawdebug_off_y=0; |
if ((rawdebug_cursor_y+2)*spacer1>this.getHeight()) |
rawdebug_off_y=((rawdebug_cursor_y+2)*spacer1-this.getHeight())/spacer1; |
for (int i=0;i<(this.getHeight()/spacer1);i++) |
{ |
if (i+rawdebug_off_y==rawdebug_cursor_y) |
{ |
g.setColor(0x0000CC); |
g.fillRect(0,y_off,this.getWidth(),spacer1); |
switch (act_skin) |
{ |
case SKINID_DARK: |
g.setColor(0x2dcf20); |
break; |
case SKINID_LIGHT: |
g.setColor(0x000000); |
break; |
} |
} |
if (i+rawdebug_off_y<32) //todo better style |
g.drawString(mk.debug_data.names[i+rawdebug_off_y] + mk.debug_data.analog[i+rawdebug_off_y] ,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer1; |
} |
break; |
case STATEID_MAINMENU: |
g.drawString("probed_device" + ufo_prober.probe_result + " by " + ufo_prober.reply,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("MK-Connection(" + (mk.connected?("open"+((System.currentTimeMillis()- mk.connection_start_time)/1000)+"s"):"close")+"):",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.setFont(f2); |
g.drawString(" Name:" + mk.name,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer1; |
g.drawString(" URL:" + mk.mk_url,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer1; |
g.drawString(" Version:" + mk.version.str,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer1; |
g.setFont(f1); |
g.drawString("Packet Traffic:",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.setFont(f2); |
g.drawString( " debug:"+mk.debug_data_count+ " LCD:" + mk.lcd_data_count + " vers:" + mk.version_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer1; |
g.drawString( " other:"+mk.other_data_count+" params:"+mk.params_data_count,0,y_off,Graphics.TOP | Graphics.LEFT); |
case STATEID_SETTINGSMENU: |
// falltru wanted |
case STATEID_SELECT_PARAMSET: |
case STATEID_HANDLE_PARAMS: |
case STATEID_DEVICESELECT: |
paint_menu(g); |
break; |
case STATEID_FLIGHTVIEW: |
// !!TODO!! check exactly which version those Datas where introduced |
if (mk.version.compare(0,60)==mk.version.VERSION_PREVIOUS) |
{ |
g.drawString("Voltage: " + (mk.debug_data.UBatt()/10) + "," +(mk.debug_data.UBatt()%10)+"V" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
g.drawString("Sender: " + mk.debug_data.SenderOkay(),this.getWidth()/2,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
} |
g.drawString(mk.version.str+"(d"+mk.debug_data_count+ "l" + mk.lcd_data_count+ "v" + mk.version_data_count+"o"+mk.other_data_count+"p"+mk.params_data_count+")",0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("n:"+mk.debug_data.nick_int() + " r:"+mk.debug_data.roll_int() + " an:"+mk.debug_data.accnick() + " ar:"+mk.debug_data.accroll() ,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("m1:"+mk.debug_data.motor_val(0) + " m2:"+mk.debug_data.motor_val(1)+" m3:"+mk.debug_data.motor_val(2) + " m4:"+mk.debug_data.motor_val(3) ,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
if (mk.connected) |
{ |
g.drawString("time conn:" +((System.currentTimeMillis()- mk.connection_start_time)/1000)+"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("time motor>15:" +(mk_stat.motor_on_time/1000) +"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=spacer; |
g.drawString("time motor=15:" +(mk_stat.motor_stand_time/1000) +"s" ,0,y_off,Graphics.TOP | Graphics.LEFT); |
} |
y_off=this.getHeight()-4*lcd_img.getHeight(); |
for ( int foo=0;foo<4;foo++) |
{ |
for (int x=0;x<20;x++) |
{ |
g.setClip((lcd_img.getWidth()/222)*x,y_off,(lcd_img.getWidth()/222),lcd_img.getHeight()); |
g.drawImage(lcd_img,(lcd_img.getWidth()/222)*x-(mk.LCD.get_act_page()[foo].charAt(x)-' ')*(lcd_img.getWidth()/222),y_off, g.TOP | g.LEFT); |
} |
y_off+=lcd_img.getHeight(); |
} |
g.setClip(0,0,this.getWidth(),this.getHeight()); |
// draw lines |
if (do_graph) for ( int x=0;x<this.getWidth();x++) |
{ |
int p= (((-bg_offset+x-this.getWidth()-5))); |
if (p<1) |
p+=bg_img.getWidth(); |
p%=(bg_img.getWidth()-1); |
g.setColor(0x156315); |
draw_graph_part(g,x,nick_line_pos_data[p]/line_scaler,nick_line_pos_data[p+1]/line_scaler); |
g.setColor(0xCC1315); |
draw_graph_part(g,x,roll_line_pos_data[p]/line_scaler,roll_line_pos_data[p+1]/line_scaler); |
g.setColor(0xf8ef02); |
draw_graph_part(g,x,accnick_line_pos_data[p]/line_scaler,accnick_line_pos_data[p+1]/line_scaler); |
g.setColor(0x19194d); |
draw_graph_part(g,x,accroll_line_pos_data[p]/line_scaler,accroll_line_pos_data[p+1]/line_scaler); |
} |
} |
} catch (Exception e) {} |
} |
Player mPlayer; |
VideoControl mVideoControl; |
Image cam_img; |
int cam_img_seq=0; |
byte[] cam_raw; |
private void connect_mk(String url,String name) |
{ |
// ufo_prober.bluetooth_probe(url); |
mk.connect_to(url,name); |
} |
public void draw_graph_part(Graphics g,int x,int y1,int y2) |
{ |
if ( this.getWidth()>200) |
{ |
g.fillRect(x,line_middle_y-y1,1,1 ); |
if (y1>y2) |
g.fillRect(x,line_middle_y-y1,1,y1-y2); |
else |
g.fillRect(x,line_middle_y-y2,1,y2-y1); |
} |
else |
{ |
g.fillRect(x,line_middle_y-y1,1,1 ); |
if (y1>y2) |
g.fillRect(x,line_middle_y-y1,1,y1-y2); |
else |
g.fillRect(x,line_middle_y-y2,1,y2-y1); |
} |
} |
/*********************************************** input Section **********************************************/ |
public final String intro_str=" Digital Ufo Broadcasting with intelligent service equipment by Marcus -LiGi- Bueschleb ; Big Up Holger&Ingo for the MikroKopter Project (http://www.mikrokopter.de) "; |
int intro_str_pos=0; |
int intro_str_delay=3; |
public void chg_state(int next_state) |
{ |
if (next_state!=state)act_menu_select=0; |
// prepare next state |
switch(next_state) |
{ |
case STATEID_CAMMODE: |
if (mVideoControl==null) |
try |
{ |
debug.log("creating player\n"); |
mPlayer = Manager.createPlayer("capture://video?encoding=png&width=2048&height=1536"); |
debug.log("realizing player\n"); |
mPlayer.realize(); |
debug.log("get_videocontrol\n"); |
mVideoControl = (VideoControl)mPlayer.getControl("VideoControl"); |
debug.log("switching Canvas\n"); |
mVideoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this); |
debug.log("get snap\n"); |
byte[] raw = mVideoControl.getSnapshot(null); |
} |
catch ( Exception e) |
{ |
debug.log(e.toString()); |
} |
break; |
case STATEID_KEYCONTROL: |
keycontrol_exit=0; |
break; |
case STATEID_SCANNING: |
lcd_lines=new String[4]; |
lcd_lines[0]="Scanning for Devices"; |
lcd_lines[1]=" "; |
//#expand lcd_lines[2]="DUBwise v%VERSION% "; |
lcd_lines[3]=intro_str.substring(0,20); |
mk.close_connections(true); |
bt_scanner.search(); |
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]=mk.params.names[i]; |
lcd_lines=new String[5]; |
break; |
case STATEID_DEVICESELECT: |
menu_items=new String[bt_scanner.remote_device_count+1]; |
for (int i=0;i<bt_scanner.remote_device_count;i++) |
menu_items[i]=bt_scanner.remote_device_name[i]; |
menu_items[bt_scanner.remote_device_count]="scan again"; |
lcd_lines=new String[bt_scanner.remote_device_count+1]; |
break; |
case STATEID_MAINMENU: |
menu_items=main_menu_items; |
lcd_lines=new String[menu_items.length]; |
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]+=(!fullscreen)?"Off":"On"; |
menu_items[5]+=(!keep_lighton)?"Off":"On"; |
lcd_lines=new String[menu_items.length]; |
break; |
} |
// switch state |
state=next_state; |
} |
public void keyReleased(int keyCode) |
{ |
switch(state) |
{ |
case STATEID_MOTORTEST: |
act_motor_increase=0; |
break; |
case STATEID_KEYCONTROL: |
if (keyCode==KEY_POUND) |
keycontrol_exit &= 255^1; |
else |
if (keyCode==KEY_STAR) |
keycontrol_exit &= 255^2; |
else |
if ((keyCode >= this.KEY_NUM0) && (keyCode < this.KEY_NUM8)) |
keycontrol_bitfield[0]&=255^( 1<<(keyCode-this.KEY_NUM0)); |
else |
if ((keyCode >= this.KEY_NUM8) && (keyCode <= this.KEY_NUM9)) |
keycontrol_bitfield[1]&=255^( 1<<(keyCode-this.KEY_NUM8)); |
else |
switch (getGameAction (keyCode)) |
{ |
case UP: |
keycontrol_bitfield[1]&=255^4; |
break; |
case DOWN: |
keycontrol_bitfield[1]&=255^8; |
break; |
case LEFT: |
keycontrol_bitfield[1]&=255^16; |
break; |
case RIGHT: |
keycontrol_bitfield[1]&=255^32; |
break; |
case FIRE: |
keycontrol_bitfield[1]&=255^64; |
break; |
} |
mk.send_keys(keycontrol_bitfield); |
break; |
} |
} |
byte keycontrol_exit=0; |
public final static int[] keycontrol_bitfield={0,0}; |
public void pointerPressed (int pointer_x, int pointer_y) |
{ |
if (pointer_x<this.getWidth()/2) |
{ |
if (state==STATEID_EDIT_PARAMS) |
{ |
chg_state(STATEID_HANDLE_PARAMS); |
return; |
} |
else |
if (state!=STATEID_KEYCONTROL) |
{ |
chg_state(STATEID_MAINMENU); |
return; |
} |
} |
else |
{ |
fullscreen=!fullscreen; |
setFullScreenMode(fullscreen); |
} |
} |
public void keyPressed(int keyCode) |
{ |
debug.process_key(keyCode); |
if (keyCode==KEY_STAR) |
{ |
if (state==STATEID_EDIT_PARAMS) |
{ |
chg_state(STATEID_HANDLE_PARAMS); |
return; |
} |
else |
if (state!=STATEID_KEYCONTROL) |
{ |
chg_state(STATEID_MAINMENU); |
return; |
} |
} |
if ((keyCode==KEY_POUND)&&(state!=STATEID_KEYCONTROL)) |
{ |
fullscreen=!fullscreen; |
setFullScreenMode(fullscreen); |
return; |
} |
switch(state) |
{ |
case STATEID_RAWDEBUG: |
switch (getGameAction (keyCode)) |
{ |
case UP: |
if (rawdebug_cursor_y==0) |
rawdebug_cursor_y=31; |
else |
rawdebug_cursor_y--; |
break; |
case DOWN: |
if (rawdebug_cursor_y==31) |
rawdebug_cursor_y=0; |
else |
rawdebug_cursor_y++; |
break; |
} |
break; |
case STATEID_KEYCONTROL: |
if (keyCode==KEY_POUND) |
keycontrol_exit |= 1; |
else |
if (keyCode==KEY_STAR) |
keycontrol_exit |= 2; |
else |
if ((keyCode >= this.KEY_NUM0) && (keyCode < this.KEY_NUM8)) |
keycontrol_bitfield[0]|=1<<(keyCode-this.KEY_NUM0); |
else |
if ((keyCode >= this.KEY_NUM8) && (keyCode <= this.KEY_NUM9)) |
keycontrol_bitfield[1]|=1<<(keyCode-this.KEY_NUM8); |
else |
switch (getGameAction (keyCode)) |
{ |
case UP: |
keycontrol_bitfield[1]|=4; |
break; |
case DOWN: |
keycontrol_bitfield[1]|=8; |
break; |
case LEFT: |
keycontrol_bitfield[1]|=16; |
break; |
case RIGHT: |
keycontrol_bitfield[1]|=32; |
break; |
case FIRE: |
keycontrol_bitfield[1]|=64; |
break; |
} |
if (keycontrol_exit==3) |
chg_state(STATEID_MAINMENU); |
else |
mk.send_keys(keycontrol_bitfield); |
break; |
case STATEID_MOTORTEST: |
switch (getGameAction (keyCode)) |
{ |
case UP: |
act_motor_increase=-1; |
break; |
case DOWN: |
act_motor_increase=1; |
break; |
case FIRE: |
motor_test_sel_all=!motor_test_sel_all; |
break; |
case LEFT: |
act_motor--; |
if (act_motor<0) {act_motor=0; chg_state(STATEID_MAINMENU); } |
break; |
case RIGHT: |
act_motor++; |
act_motor%=4; |
break; |
} |
break; |
case STATEID_HANDLE_PARAMS: |
if ( getGameAction (keyCode)==FIRE ) |
switch(act_menu_select) |
{ |
case 0: |
mk.write_params(); |
default: |
chg_state(STATEID_MAINMENU); |
} |
else |
menu_keypress(keyCode); |
break; |
case STATEID_SETTINGSMENU: |
if ( getGameAction (keyCode)==FIRE ) |
switch(act_menu_select) |
{ |
case SETTINGSMENU_CHANGESKIN: |
act_skin++; |
act_skin=(byte)(act_skin%2); |
load_images(); |
chg_state(STATEID_SETTINGSMENU); |
break; |
case SETTINGSMENU_SOUNDTOGGLE: |
do_sound=!do_sound; |
chg_state(STATEID_SETTINGSMENU); |
break; |
case SETTINGSMENU_VIBRATOGGLE: |
do_vibra=!do_vibra; |
chg_state(STATEID_SETTINGSMENU); |
break; |
case SETTINGSMENU_GRAPHTOGGLE: |
do_graph=!do_graph; |
chg_state(STATEID_SETTINGSMENU); |
break; |
case SETTINGSMENU_FULLSCREENTOGGLE: |
fullscreen=!fullscreen; |
setFullScreenMode(fullscreen); |
chg_state(STATEID_SETTINGSMENU); |
break; |
case SETTINGSMENU_LIGHTTOGGLE: |
keep_lighton =!keep_lighton; |
chg_state(STATEID_SETTINGSMENU); |
break; |
case SETTINGSMENU_BACK: |
chg_state(STATEID_MAINMENU); |
break; |
} |
else menu_keypress(keyCode); |
break; |
case STATEID_MAINMENU: |
if ( getGameAction (keyCode)==FIRE ) |
switch(act_menu_select) |
{ |
case MAINMENU_CAMMODE: |
chg_state(STATEID_CAMMODE); |
break; |
case MAINMENU_SETTINGSMENU: |
chg_state(STATEID_SETTINGSMENU); |
break; |
case MAINMENU_STICKS: |
chg_state(STATEID_STICKVIEW); |
break; |
case MAINMENU_KEYCONTROL: |
chg_state(STATEID_KEYCONTROL); |
break; |
case MAINMENU_TELEMETRY : |
chg_state(STATEID_FLIGHTVIEW); |
break; |
case MAINMENU_MOTORTEST : |
chg_state(STATEID_MOTORTEST); |
break; |
case MAINMENU_PARAMS : |
chg_state(STATEID_SELECT_PARAMSET); |
break; |
case MAINMENU_PROXY: |
mk.do_proxy("socket://192.168.1.42:2323"); |
break; |
case MAINMENU_DEVICESELECT: |
chg_state(STATEID_SCANNING); |
break; |
case MAINMENU_RAWDEBUG: |
chg_state(STATEID_RAWDEBUG); |
break; |
case MAINMENU_QUIT: |
// set quit Flag |
quit=true; |
break; |
} |
else menu_keypress(keyCode); |
break; |
case STATEID_SELECT_PARAMSET: |
if ( getGameAction (keyCode)==FIRE ) |
{ |
if ( mk.params.field[act_menu_select]!=null) |
{ |
mk.params.act_paramset=act_menu_select; |
chg_state(STATEID_EDIT_PARAMS); |
} |
} |
else menu_keypress(keyCode); |
break; |
case STATEID_DEVICESELECT: |
/* |
if ((keyCode >= this.KEY_NUM0) && (keyCode < this.KEY_NUM0+bt_scanner.remote_device_count)) |
{ |
connect_mk("btspp://"+bt_scanner.remote_device_mac[keyCode-this.KEY_NUM0] + ":1",bt_scanner.remote_device_name[keyCode-this.KEY_NUM0]); |
chg_state(STATEID_MAINMENU); |
} |
else |
*/ |
if ( getGameAction (keyCode)==FIRE ) |
{ |
if (bt_scanner.remote_device_count > act_menu_select) |
{ |
connect_mk("btspp://"+bt_scanner.remote_device_mac[act_menu_select] + ":1",bt_scanner.remote_device_name[act_menu_select]); |
chg_state(STATEID_MAINMENU); |
} |
else |
chg_state(STATEID_SCANNING); |
} |
else menu_keypress(keyCode); |
break; |
case STATEID_EDIT_PARAMS: |
params_editor.keypress(keyCode,getGameAction (keyCode)) ; |
break; |
case STATEID_FLIGHTVIEW: |
if ((keyCode >= this.KEY_NUM0) && (keyCode <= this.KEY_NUM9)) |
mk.LCD.set_page(keyCode-this.KEY_NUM0); |
else |
switch (getGameAction (keyCode)) |
{ |
case LEFT: |
case UP: |
mk.LCD.LCD_PREVPAGE(); |
break; |
case RIGHT: |
case DOWN: |
mk.LCD.LCD_NEXTPAGE(); |
break; |
} |
break; |
} |
} |
} |
/DUBwise/src/J2ME/src/DUBwiseDebug.java |
---|
0,0 → 1,114 |
/*************************************************************** |
* |
* Code for on Device Debugging of DUBwise |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
***************************************************************/ |
import javax.microedition.lcdui.*; |
public class DUBwiseDebug |
extends Canvas |
{ |
public boolean showing=false; |
public String debug_msg=""; |
private byte[] debug_screen_sequence={KEY_POUND,KEY_NUM4,KEY_NUM2}; |
private byte debug_screen_sequence_pos=0; |
public final static int DEBUG_HISTORY_LENGTH=100; |
public String[] debug_msgs; |
public int debug_pos=0; |
int y_off=0; |
public DUBwiseDebug() |
{ |
debug_msgs=new String[DEBUG_HISTORY_LENGTH]; |
for (int tmp_i=0;tmp_i<DEBUG_HISTORY_LENGTH;tmp_i++) |
debug_msgs[tmp_i]=""; |
} |
public void log(String str) |
{ |
debug_msgs[debug_pos]=str; |
debug_pos++; |
if (debug_pos==DEBUG_HISTORY_LENGTH) |
debug_pos=0; |
debug_msgs[debug_pos]=str; |
} |
public void paint (Graphics g) |
{ |
Font debug_font= Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); |
g.setFont(debug_font); |
g.setColor(0x0000FF); |
g.fillRect(0,0,this.getWidth(),this.getHeight()); |
g.setColor(0xFFFFFF); |
y_off=0; |
for (int tmp_pos=debug_pos;((tmp_pos>0)&&(y_off<this.getHeight()));tmp_pos--) |
{ |
debug_msg=debug_msgs[tmp_pos]; |
String tmp_str=""; |
for(int tmp_i=0;tmp_i<debug_msg.length();tmp_i++) |
{ |
if ((debug_msg.charAt(tmp_i)=='\r')||(debug_msg.charAt(tmp_i)=='\n')) |
{ |
g.drawString(tmp_str,5,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=debug_font.getHeight(); |
tmp_str=""; |
} |
else |
tmp_str+=debug_msg.charAt(tmp_i); |
} |
g.drawString(tmp_str,0,y_off,Graphics.TOP | Graphics.LEFT); |
y_off+=debug_font.getHeight(); |
} |
} |
public void process_key(int keyCode) |
{ |
if (!showing) |
{ |
if (keyCode==debug_screen_sequence[debug_screen_sequence_pos]) |
{ |
debug_screen_sequence_pos++; |
if(debug_screen_sequence_pos==debug_screen_sequence.length) |
{ |
showing=true; |
debug_screen_sequence_pos=0; |
} |
} |
else |
debug_screen_sequence_pos=0; |
} |
else |
{ |
if (keyCode==KEY_STAR) |
showing=false; |
} |
} |
} |
/DUBwise/src/J2ME/src/MKCommunicator.java |
---|
0,0 → 1,437 |
/******************************************************************************************************************************** |
* |
* Abstaction Layer to Communicate via J2ME and Bluetooth with the FlightCtrl of the MikroKopter Project (www.mikrokopter.de ) |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
* |
*******************************************************************************************************************************/ |
import javax.microedition.io.*; |
import java.io.*; |
public class MKCommunicator |
implements Runnable |
{ |
/***************** Section: public Attributes **********************************************/ |
public boolean connected=false; // flag for the connection state |
public boolean fatal=false; // flag which is set when an error is so fatal that reconnecting won't be tried - e.g. unknown version number. |
public String mk_url=""; // buffer the url which is given in the constuctor for reconnectin purposes |
public MKLCD LCD; |
public MKVersion version; |
public MKDebugData debug_data; |
public MKStickData stick_data; |
public MKParamsParser params; |
public MKWatchDog watchdog; |
public MKProxy proxy=null; |
public long connection_start_time=-1; |
/****************** Section: private Attributes **********************************************/ |
private javax.microedition.io.StreamConnection connection; |
private java.io.InputStream reader; |
private java.io.OutputStream writer; |
// temp - to be removed |
String p_msg="--"; |
public String msg="BT_INIT"; |
public int debug_data_count=0; |
public int version_data_count=0; |
public int other_data_count=0; |
public int lcd_data_count=0; |
public int params_data_count=0; |
String name; |
DUBwise root; |
DUBwiseDebug debug; |
/****************** Section: public Methods ************************************************/ |
public MKCommunicator(DUBwise root_,DUBwiseDebug debug_) |
{ |
debug=debug_; |
root=root_; |
version=new MKVersion(); |
debug_data=new MKDebugData(); |
stick_data=new MKStickData(); |
params=new MKParamsParser(); |
LCD= new MKLCD(this); |
watchdog=new MKWatchDog(this); |
new Thread( this ).start(); // fire up main Thread |
} |
public void do_proxy(String proxy_url) |
{ |
proxy=new MKProxy(proxy_url); |
} |
// URL string: "btspp://XXXXXXXXXXXX:1" - the X-Part is the MAC-Adress of the Bluetooth-Device connected to the Fligth-Control |
public void connect_to(String _url,String _name) |
{ |
mk_url=_url; // remember URL for connecting / reconnecting later |
name=_name; |
force_disconnect=false; |
connected=false; |
} |
/****************** Section: private Methods ************************************************/ |
private void connect() |
{ |
System.out.println("trying to connect to" + mk_url); |
try{ |
connection = (StreamConnection) Connector.open(mk_url); |
// old call |
// connection = (StreamConnection) Connector.open(mk_url, Connector.READ_WRITE); |
reader=connection.openInputStream(); |
writer=connection.openOutputStream(); |
// |
String magic="\rmk-mode\r"; |
writer.write(magic.getBytes()); |
writer.flush(); |
// |
connection_start_time=System.currentTimeMillis(); |
connected=true; // if we get here everything seems to be OK |
get_version(); |
lcd_data_count=0; |
debug_data_count=0; |
version_data_count=0; |
} |
catch (Exception ex) |
{ |
// TODO difference fatal errors from those which will lead to reconnection |
msg="Problem connecting" + "\n" + ex; |
System.out.println("problem connecting " + ex); |
} |
} |
public int[] Decode64(int[] in_arr, int offset,int len) |
{ |
int ptrIn=offset; |
int a,b,c,d,x,y,z; |
int ptr=0; |
int[] out_arr=new int[len]; |
while(len!=0) |
{ |
a = in_arr[ptrIn++] - '='; |
b = in_arr[ptrIn++] - '='; |
c = in_arr[ptrIn++] - '='; |
d = in_arr[ptrIn++] - '='; |
//if(ptrIn > max - 2) break; // nicht mehr Daten verarbeiten, als empfangen wurden |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
if((len--)!=0) out_arr[ptr++] = x; else break; |
if((len--)!=0) out_arr[ptr++] = y; else break; |
if((len--)!=0) out_arr[ptr++] = z; else break; |
} |
return out_arr; |
} |
// FC - Function Mappers |
// send a version Request to the FC - the reply to this request will be processed in process_data when it arrives |
public void get_version() |
{ |
send_command(0,'v',new int[0]); |
} |
// send a MotorTest request - params are the speed for each Motor |
public void motor_test(int[] params) |
{ |
send_command(0,'t',params); |
} |
public void send_keys(int[] params) |
{ |
send_command(0,'k',params); |
} |
// get params |
public void get_params(int id) |
{ |
int[] params=new int[1]; |
params[0]=id; |
while(sending) |
{try { Thread.sleep(50); } |
catch (Exception e) { } |
} |
send_command(0,'q',params); |
} |
public void get_debug_name(int id) |
{ |
int[] params=new int[1]; |
params[0]=id; |
while(sending) |
{try { Thread.sleep(50); } |
catch (Exception e) { } |
} |
send_command(0,'a',params); |
} |
public void trigger_LCD(int key) |
{ |
if (sending) return; |
int[] params=new int[3]; |
params[0]=key; |
params[1]=0; |
params[2]=0; |
send_command(0,'h',params); |
} |
public void write_params() |
{ |
while(sending) |
{try { Thread.sleep(50); } |
catch (Exception e) { } |
} |
send_command(0,(char)('l'+params.act_paramset),params.field[params.act_paramset]); |
} |
boolean sending=false; |
// send command to FC ( add crc and pack into pseudo Base64 |
public void send_command(int modul,char cmd,int[] params) |
{ |
sending=true; |
char[] send_buff=new char[5 + (params.length/3 + (params.length%3==0?0:1) )*4]; // 5=1*start_char+1*addr+1*cmd+2*crc |
send_buff[0]='#'; |
send_buff[1]=(char)modul; |
send_buff[2]=cmd; |
for(int param_pos=0;param_pos<(params.length/3 + (params.length%3==0?0:1)) ;param_pos++) |
{ |
int a = (param_pos*3<params.length)?params[param_pos*3]:0; |
int b = ((param_pos*3+1)<params.length)?params[param_pos*3+1]:0; |
int c = ((param_pos*3+2)<params.length)?params[param_pos*3+2]:0; |
send_buff[3+param_pos*4] = (char)((a >> 2)+'=' ); |
send_buff[3+param_pos*4+1] = (char)('=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4))); |
send_buff[3+param_pos*4+2] = (char)('=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6))); |
send_buff[3+param_pos*4+3] = (char)('=' + ( c & 0x3f)); |
//send_buff[3+foo]='='; |
} |
/* for(int foo=0;foo<(params.length/3 + (params.length%3==0?0:1) )*4;foo++) |
{ |
int a = (foo<params.length) params[foo]; |
int a = params[foo]; |
//send_buff[3+foo]='='; |
} |
*/ |
try |
{ |
int tmp_crc=0; |
for ( int tmp_i=0; tmp_i<send_buff.length;tmp_i++) |
{ |
tmp_crc+=(int)send_buff[tmp_i]; |
writer.write(send_buff[tmp_i]); |
} |
tmp_crc%=4096; |
writer.write( (char)(tmp_crc/64 + '=')); |
writer.write( (char)(tmp_crc%64 + '=')); |
writer.write('\r'); |
writer.flush(); |
} |
catch (Exception e) |
{ // problem sending data to FC |
} |
sending=false; |
} |
public void process_data(int[] data,int len) |
{ |
switch((char)data[2]) |
{ |
case 'D': // debug Data |
debug_data_count++; |
debug_data.set_by_mk_data(Decode64(data,3,len-3),version); |
break; |
case 'A': // debug Data Names |
//debug_data_count++; |
debug_data.set_names_by_mk_data(data[1]-'0',Decode64(data,3,len-3)); |
break; |
case 'V': // Version Info |
version_data_count++; |
version.set_by_mk_data(Decode64(data,3,6)); |
break; |
case '0': |
case '1': |
case '2': |
case '3': |
lcd_data_count++; |
LCD.handle_lcd_data(Decode64(data,3,20),data[2]-(int)'0'); |
break; |
case '4': |
stick_data.set_by_mk_data(Decode64(data,3,20)); |
String tmp_s=""; |
for (int tmp_c=0;tmp_c<10;tmp_c++) |
tmp_s+="s"+tmp_c+"v"+stick_data.stick[tmp_c]+" "; |
debug.log(tmp_s); |
break; |
case 'L': |
case 'M': |
case 'N': |
case 'O': |
case 'P': |
params.set_by_mk_data((int)(data[2]-'L'),Decode64(data,3,len-3),version); |
params_data_count++; |
break; |
default: |
other_data_count++; |
debug.log("got other data:" + (char)data[2] + "=>" + (byte)data[2]); |
String tmp_str=""; |
for (int tmp_i=0;tmp_i<len;tmp_i++) |
tmp_str+=(char)data[tmp_i]; |
debug.log(tmp_str); |
break; |
} |
} |
String o_msg=""; |
public boolean force_disconnect=true; |
public void close_connections(boolean force) |
{ |
if ((!force)&&root.canvas.do_vibra) root.vibrate(500); |
force_disconnect=force; |
try{ reader.close(); } |
catch (Exception inner_ex) { } |
try{ writer.close(); } |
catch (Exception inner_ex) { } |
try{ connection.close(); } |
catch (Exception inner_ex) { } |
connected=false; |
} |
// Thread to recieve data from Connection |
public void run() |
{ |
int[] data_set=new int[150]; |
int input; |
int pos=0; |
msg+="!!run started!!"; |
while(true) |
{ |
if (!connected) |
{ |
if (!force_disconnect) connect(); |
} |
else |
try{ |
pos=0; |
input=0; |
// recieve data-set |
while ((input != 13)) // &&(input!=-1)) |
{ |
input = reader.read() ; |
if (proxy!=null) |
proxy.writer.write(input); |
// if (input==-1) throw new Exception("test"); |
if (input!=-1) |
{ |
data_set[pos]=input; |
pos++; |
} |
} |
if (proxy!=null) |
{ |
proxy.writer.write('\r'); |
proxy.writer.write('\n'); |
proxy.writer.flush(); |
} |
if (pos>5) |
process_data(data_set,pos); |
} |
catch (Exception ex) |
{ |
debug.log("Problem reading from MK -> closing conn"); |
debug.log(ex.toString()); |
// close the connection |
close_connections(false); |
} |
// sleep a bit to get someting more done |
try { Thread.sleep(50); } |
catch (Exception e) { } |
} // while |
} // run() |
} |
/DUBwise/src/J2ME/src/MKDebugData.java |
---|
0,0 → 1,95 |
/********************************************* |
* |
* class representing the DebugData Structure |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
********************************************/ |
public class MKDebugData |
{ |
public int[] analog; |
public String[] names; |
public boolean[] got_name; |
public int motor_complete=-1; |
private int i; |
public int motor_val(int id) { return analog[12+id]; } |
public int nick_int() { return analog[0]; } |
public int roll_int() { return analog[1]; } |
public int accnick() { return analog[2]; } |
public int accroll() { return analog[3]; } |
public int UBatt() { return analog[9]; } |
public int SenderOkay() { return analog[10]; } |
public MKDebugData() |
{ |
names=new String[32]; |
analog=new int[32]; |
got_name=new boolean[32]; |
for (i=0;i<32;i++) |
{ |
analog[i]=-1; |
names[i]="-#"+i+"->"; |
got_name[i]=false; |
} |
} |
public void set_names_by_mk_data(int id,int[] in_arr) |
{ |
names[id]=""; |
for (i=0;i<16;i++) |
{ |
if ((char)in_arr[i]!=' ') |
names[id]+=(char)in_arr[i]; |
got_name[id]=true; |
} |
names[id]+=":"; |
} |
public void set_by_mk_data(int[] in_arr,MKVersion version) |
{ |
if (version.compare(-1,-1)==version.VERSION_EQUAL) |
return; |
if (version.compare(0,60)==version.VERSION_PREVIOUS) |
{ |
for (i=0;i<32;i++) |
{ |
//analog[i]=(int)((in_arr[1+i*2]<<8) | in_arr[2+i*2]); |
analog[i]=(int)((in_arr[3+i*2]<<8) | in_arr[2+i*2]); |
if ((analog[i]&(1<<15))!=0) |
analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
} |
} |
else |
{ |
for (i=0;i<16;i++) |
{ |
analog[i]=(int)((in_arr[17+i*2]<<8) | in_arr[18+i*2]); |
if ((analog[i]&(1<<15))!=0) |
analog[i]=-(analog[i]&(0xFFFF-1))^(0xFFFF-1); |
} |
} |
motor_complete=motor_val(0)+motor_val(1)+motor_val(2)+motor_val(3); |
} |
} |
/DUBwise/src/J2ME/src/MKLCD.java |
---|
0,0 → 1,156 |
/******************************************* |
* |
* Handling of MK LCD |
* |
* Author: Marcus -LiGi- Bueschleb |
* see README for further Infos |
* |
* |
*******************************************/ |
public class MKLCD |
implements Runnable |
{ |
MKCommunicator mk=null; |
// public String[] LCD_str; |
private String[][] lcd_buf; |
private final static int MAX_LCD_PAGES=20; |
int act_key=0; |
int act_mk_page=0; |
int act_user_page=0; |
boolean initial_run=true; |
int pages=0; |
int pages_read=0; |
byte init_state=0; |
public String[] get_act_page() |
{ return lcd_buf[act_user_page]; } |
public MKLCD(MKCommunicator _mk) |
{ |
lcd_buf=new String[MAX_LCD_PAGES][4]; |
for (int p=0;p<MAX_LCD_PAGES;p++) |
{ |
lcd_buf[p][0]="buffering Page "; |
lcd_buf[p][1]="please stay patient "; |
lcd_buf[p][2]=" "; |
lcd_buf[p][3]=" ;-) "; |
} |
mk=_mk; |
new Thread( this ).start(); // fire up main Thread |
} |
public void run() |
{ |
while(true) |
{ |
try { |
if (mk.connected) |
trigger_LCD(); |
Thread.sleep(100); |
} |
catch (Exception e) { } |
} |
} |
public void set_page(int page) |
{ |
act_user_page=page; |
} |
public void handle_lcd_data(int[] data,int row) |
{ |
if (row==0) // firs row indicates page |
{ |
pages_read++; |
act_mk_page=data[18]-48; |
if (data[17]!=91) // [ |
act_mk_page+=10*(data[17]-48); |
if (act_mk_page>pages) |
pages=act_mk_page; |
if (( init_state==1)&&(act_mk_page==0)) |
{ init_state=2; act_key=1; } |
else if ((init_state==2)&&(act_mk_page!=0)) |
{ init_state=3; act_key=2; } |
} |
lcd_buf[act_mk_page][row]=""; |
for(int foo=0;foo<20;foo++) |
lcd_buf[act_mk_page][row]+=(char)data[foo]; |
if (init_state==-1) // init over |
{ |
if (act_mk_page<act_user_page) |
act_key=2; |
if (act_mk_page>act_user_page) |
act_key=1; |
} |
else if (init_state==3) |
{ |
if (row==3) |
{ |
if(act_mk_page==pages-1) |
init_state=-1; |
else |
act_key=2; |
} |
} |
} |
boolean init=true; |
public void trigger_LCD() |
{ |
if (mk.connected && mk.version.known) |
try { |
if (init_state==0) |
{ |
mk.trigger_LCD(3); |
init_state++; |
} |
else |
mk.trigger_LCD(act_key); |
act_key=0; |
} |
catch (Exception e) { } |
} |
public void LCD_NEXTPAGE() |
{ |
if (act_user_page!=pages) |
act_user_page++; |
else |
act_user_page=0; |
} |
public void LCD_PREVPAGE() |
{ |
if (act_user_page!=0) |
act_user_page--; |
else |
act_user_page=pages; |
} |
} |
/DUBwise/src/J2ME/src/MKParamDefinitions.java |
---|
0,0 → 1,9 |
public interface MKParamDefinitions |
{ |
public final static int PARAMTYPE_BYTE=0; |
public final static int PARAMTYPE_BITSWITCH=1; |
public final static int PARAMTYPE_STICK=2; |
} |
/DUBwise/src/J2ME/src/MKParamsEditor.java |
---|
0,0 → 1,196 |
/************************************************** |
* |
* class to handle Editing of MK Params |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
*************************************************/ |
import javax.microedition.lcdui.*; |
public class MKParamsEditor |
implements MKParamDefinitions |
{ |
private int act_tab=0; |
private int act_y=0; |
private int act_lcd_lines=10; |
DUBwiseCanvas canvas; |
public String[] lcd_lines; |
public MKParamsEditor(DUBwiseCanvas _canvas) |
{ |
canvas=_canvas; |
lcd_lines=new String[40]; |
refresh_lcd(); |
} |
public void paint ( Graphics g) |
{ |
refresh_lcd(); |
canvas.paint_lcd(g,false); |
} |
public void refresh_lcd() |
{ |
if (canvas.mk!=null) |
{ |
act_lcd_lines=canvas.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?" ":"< ") + canvas.mk.params.tab_names[act_tab] + (act_tab==(canvas.mk.params.tab_names.length-1)?" ":" >"); |
for (int i=0;i<canvas.mk.params.field_names[act_tab].length;i++) |
{ |
lcd_lines[1+2*i]=canvas.mk.params.field_names[act_tab][i]; |
if (canvas.mk.params.field_types[act_tab][i]== canvas.mk.params.PARAMTYPE_BITSWITCH) |
lcd_lines[2+2*i]=(((canvas.mk.params.get_field_from_act(canvas.mk.params.field_positions[act_tab][i]/8)&(1<<canvas.mk.params.field_positions[act_tab][i]%8))==0)?"off":"on" ) ; |
if (canvas.mk.params.field_types[act_tab][i]== canvas.mk.params.PARAMTYPE_BYTE) |
{ |
lcd_lines[2+2*i]=""+canvas.mk.params.get_field_from_act(canvas.mk.params.field_positions[act_tab][i]); |
if ((canvas.mk.params.get_field_from_act(canvas.mk.params.field_positions[act_tab][i])>250)&&(canvas.mk.params.get_field_from_act(canvas.mk.params.field_positions[act_tab][i])<256)) |
lcd_lines[2+2*i]+="[Poti"+(canvas.mk.params.get_field_from_act(canvas.mk.params.field_positions[act_tab][i])-250) +"]"; |
} |
if (canvas.mk.params.field_types[act_tab][i]== canvas.mk.params.PARAMTYPE_STICK) |
{ |
lcd_lines[2+2*i]=""+canvas.mk.params.get_field_from_act(canvas.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){} |
canvas.lcd_lines=new String[act_lcd_lines]; |
for(int i=0;i<act_lcd_lines;i++) |
canvas.lcd_lines[i]=lcd_lines[i]; |
} |
else |
{ |
canvas.lcd_lines=new String[1]; |
canvas.lcd_lines[0]="reading params"; |
} |
} |
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 Canvas.RIGHT: |
if (act_tab<canvas.mk.params.tab_names.length-1) act_tab++; |
break; |
case Canvas.LEFT: |
if (act_tab!=0) act_tab--; |
break; |
} |
else |
{ |
if(canvas.mk.params.field_types[act_tab][act_y/2-1]==canvas.mk.params.PARAMTYPE_BYTE) |
{ |
if ((keyCode >= Canvas.KEY_NUM0) && (keyCode <= Canvas.KEY_NUM9)) |
{ |
if((editing_number)&&( Math.abs(canvas.mk.params.get_field_from_act(canvas.mk.params.field_positions[act_tab][act_y/2-1]))*10+(keyCode - Canvas.KEY_NUM0)<1000)) |
canvas.mk.params.set_field_from_act(canvas.mk.params.field_positions[act_tab][act_y/2-1] , Math.abs(canvas.mk.params.get_field_from_act(canvas.mk.params.field_positions[act_tab][act_y/2-1]))*10+(keyCode - Canvas.KEY_NUM0)); |
else |
canvas.mk.params.set_field_from_act(canvas.mk.params.field_positions[act_tab][act_y/2-1] , (keyCode - Canvas.KEY_NUM0)); |
editing_number=true; |
return; |
} |
else |
if ( keyCode==KEYCODE_CLEAR) |
canvas.mk.params.set_field_from_act(canvas.mk.params.field_positions[act_tab][act_y/2-1],0); |
} |
editing_number=false; |
switch (action) |
{ |
case Canvas.RIGHT: |
switch(canvas.mk.params.field_types[act_tab][act_y/2-1]) |
{ |
case PARAMTYPE_BITSWITCH: |
canvas.mk.params.field_from_act_xor((canvas.mk.params.field_positions[act_tab][act_y/2-1]/8),1<<(canvas.mk.params.field_positions[act_tab][act_y/2-1]%8)); |
break; |
case PARAMTYPE_BYTE: |
case PARAMTYPE_STICK: |
canvas.mk.params.field_from_act_add(canvas.mk.params.field_positions[act_tab][act_y/2-1],1); |
break; |
} |
break; |
case Canvas.LEFT: |
switch(canvas.mk.params.field_types[act_tab][act_y/2-1]) |
{ |
case PARAMTYPE_BITSWITCH: |
canvas.mk.params.field_from_act_xor((canvas.mk.params.field_positions[act_tab][act_y/2-1]/8),1<<(canvas.mk.params.field_positions[act_tab][act_y/2-1]%8)); |
break; |
case PARAMTYPE_BYTE: |
case PARAMTYPE_STICK: |
canvas.mk.params.field_from_act_add(canvas.mk.params.field_positions[act_tab][act_y/2-1],-1); |
break; |
} |
break; |
} |
} |
switch (action) |
{ |
case Canvas.DOWN: |
if (act_y<(act_lcd_lines-2)) act_y+=2; |
else act_y=0; |
break; |
case Canvas.UP: |
if (act_y!=0) act_y-=2; |
else act_y=act_lcd_lines-1; |
break; |
} |
refresh_lcd(); |
} |
} |
/DUBwise/src/J2ME/src/MKParamsParser.java |
---|
0,0 → 1,119 |
/************************************************** |
* |
* class representing the Params Structure |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
*************************************************/ |
public class MKParamsParser |
implements MKParamDefinitions |
{ |
// -- start generated code -- |
public final static int PARAMTYPE_BYTE=0; |
public final static int PARAMTYPE_BITSWITCH=1; |
public final static int PARAMTYPE_STICK=2; |
public final static String[][] all_tab_names={{"Altitude","Camera","Channels","Configuration","Gyro","Other","Stick","User"},{"Altitude","Camera","Channels","Configuration","Gyro","Looping","Other","Stick","User"},{"Altitude","Camera","Channels","Configuration","Coupling","Gyro","Looping","Other","Stick","User"},{"Altitude","Camera","Channels","Configuration","Coupling","Gyro","Looping","Other","Stick","User"}}; |
public final static String[][][] all_field_names={{{"Min. Accelerate","Barometric D","Setpoint","Altitude P","Gain","Z-ACC"},{"Servo control","Nick compensation","Servo min","Servo max","Refresh rate","Invert Direction"},{"Nick","Roll","Accelerate","Gier","POTI1","POTI2","POTI3","POTI4"},{"ALTITUDE_CONTROL","Switch for Setpoint","Heading Hold","Compas Active","GPS"},{"ACC/Gyro Factor","P-Rate","I-Rate"},{"Min Gas","Max Gas","Compass Effect","Voltage Warning","Distress Gas","Distress Gas Time"},{"Nick/Roll P","Nick/Roll D","Gier P"},{"Param 1","Param 2","Param 3","Param 4"}},{{"Min. Accelerate","Barometric D","Setpoint","Altitude P","Gain","Z-ACC"},{"Servo control","Nick compensation","Servo min","Servo max","Refresh rate","Invert Direction"},{"Nick","Roll","Accelerate","Gier","POTI1","POTI2","POTI3","POTI4"},{"ALTITUDE_CONTROL","Switch for Setpoint","Heading Hold","Compas Active","GPS"},{"ACC/Gyro Factor","P-Rate","I-Rate"},{"Gas Limit","Threshold","UP","DOWN","LEFT","RIGHT"},{"Min Gas","Max Gas","Compass Effect","Voltage Warning","Distress Gas","Distress Gas Time"},{"Nick/Roll P","Nick/Roll D","Gier P"},{"Param 1","Param 2","Param 3","Param 4"}},{{"Min. Accelerate","Barometric D","Setpoint","Altitude P","Gain","Z-ACC"},{"Servo control","Nick compensation","Servo min","Servo max","Refresh rate","Invert Direction"},{"Nick","Roll","Accelerate","Gier","POTI1","POTI2","POTI3","POTI4"},{"ALTITUDE_CONTROL","Switch for Setpoint","Heading Hold","Compas Active","Compas Fix","GPS","Coupling","Yaw Rate Limiter"},{"Yaw pos. feedback","Yaw neg. feedback"},{"ACC/Gyro Factor","P-Rate","I-Rate","ACC/Gyro Comp","Drift-Compensation"},{"Gas Limit","Threshold","Hysterese","TurnOver Nick","TurnOver Roll","UP","DOWN","LEFT","RIGHT"},{"Min Gas","Max Gas","Compass Effect","Voltage Warning","Distress Gas","Distress Gas Time"},{"Nick/Roll P","Nick/Roll D","Gier P"},{"Param 1","Param 2","Param 3","Param 4"}},{{"Min. Accelerate","Barometric D","Setpoint","Altitude P","Gain","Z-ACC"},{"Servo control","Nick compensation","Servo min","Servo max","Refresh rate","Invert Direction"},{"Nick","Roll","Accelerate","Gier","POTI1","POTI2","POTI3","POTI4"},{"ALTITUDE_CONTROL","Switch for Setpoint","Heading Hold","Compas Active","Compas Fix","GPS","Coupling","Yaw Rate Limiter"},{"Yaw pos. feedback","Yaw neg. feedback"},{"ACC/Gyro Factor","P-Rate","I-Rate","ACC/Gyro Comp","Drift-Compensation","Dynamic stability"},{"Gas Limit","Threshold","Hysterese","TurnOver Nick","TurnOver Roll","UP","DOWN","LEFT","RIGHT"},{"Min Gas","Max Gas","Compass Effect","Voltage Warning","Distress Gas","Distress Gas Time"},{"Nick/Roll P","Nick/Roll D","Gier P"},{"Param 1","Param 2","Param 3","Param 4","Param 5","Param 6","Param 7","Param 8"}}}; |
public final static int[][][] all_field_positions={{{9,10,11,12,13,14},{33,34,35,36,37,304},{0,1,2,3,4,5,6,7},{64,65,66,67,69},{20,22,23},{18,19,21,24,25,26},{15,16,17},{29,30,31,32}},{{9,10,11,12,13,14},{33,34,35,36,37,328},{0,1,2,3,4,5,6,7},{64,65,66,67,69},{20,22,23},{38,39,320,321,322,323},{18,19,21,24,25,26},{15,16,17},{29,30,31,32}},{{9,10,11,12,13,14},{33,34,35,36,37,384},{0,1,2,3,4,5,6,7},{64,65,66,67,68,69,70,71},{41,42},{20,22,23,45,46},{38,39,40,43,44,376,377,378,379},{18,19,21,24,25,26},{15,16,17},{29,30,31,32}},{{9,10,11,12,13,14},{33,34,35,36,37,424},{0,1,2,3,4,5,6,7},{64,65,66,67,68,69,70,71},{41,42},{20,22,23,45,46,47},{38,39,40,43,44,416,417,418,419},{18,19,21,24,25,26},{15,16,17},{29,30,31,32,48,49,50,51}}}; |
public final static int[][][] all_field_types={{{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH},{PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK},{PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}},{{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH},{PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK},{PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}},{{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH},{PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK},{PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH},{PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}},{{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH},{PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK,PARAMTYPE_STICK},{PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH},{PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},{PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}}}; |
public final static int[] all_name_positions={46,46,53,58}; |
public final static int[] all_lengths={58,58,65,70}; |
// -- end generated code -- |
public final static int MAX_PARAMSETS=20; |
public final static int MAX_PARAMLENGTH=100; |
public int[][] field; |
public String[] names={"Paramset 1","Paramset 2","Paramset 3","Paramset 4","Paramset 5"}; |
public int act_paramset=0; |
public int get_field_from_act(int pos) |
{ return field[act_paramset][pos]; } |
public void set_field_from_act(int pos,int val) |
{ |
if (val>255) val=255; |
if (val<0) val=255; |
field[act_paramset][pos]=val; |
} |
public void field_from_act_add(int pos,int val) |
{ |
set_field_from_act(pos , get_field_from_act(pos)+val); |
} |
// for boolean Flags |
public void field_from_act_xor(int pos,int val) |
{ |
field[act_paramset][pos]^=val; |
} |
public MKParamsParser() |
{ |
field=new int[MAX_PARAMSETS][]; |
for (int ii=0;ii<MAX_PARAMSETS;ii++) |
field[ii]=null; |
} |
//<--generated |
public static final int COMP_COUNT=3; |
// public string[COMP_COUNT] categorys; |
//-> |
public int[] param_type; |
public int[] param_pos; |
public int[] param_innerpos; |
public String[] tab_names; |
public String[][] field_names; |
public int[][] field_positions; |
public int[][] field_types; |
public int length; |
public int name_start; |
public void set_by_mk_data(int paramset_num,int[] in_arr,MKVersion version) |
{ |
tab_names=all_tab_names[version.compatible-4]; |
field_names=all_field_names[version.compatible-4]; |
field_positions=all_field_positions[version.compatible-4]; |
field_types=all_field_types[version.compatible-4]; |
name_start=all_name_positions[version.compatible-4]; |
length=all_lengths[version.compatible-4]; |
field[paramset_num]=new int[length]; |
for ( int i=0;i<length;i++) |
field[paramset_num][i]=in_arr[i]; |
names[paramset_num]="" + (paramset_num+1) +": "; |
for ( int i=name_start;i<length;i++) |
{ |
if(in_arr[i]==0)break; |
names[paramset_num]+=(char)in_arr[i]; |
} |
} |
} |
/DUBwise/src/J2ME/src/MKProxy.java |
---|
0,0 → 1,34 |
import java.io.*; |
import javax.microedition.io.*; |
public class MKProxy |
implements Runnable |
{ |
public String err_str="none"; |
StreamConnection connection; |
public java.io.InputStream reader; |
public java.io.OutputStream writer; |
public MKProxy(String url) |
{ |
try |
{ |
connection = (StreamConnection) Connector.open(url, Connector.READ_WRITE); |
reader=connection.openInputStream(); |
writer=connection.openOutputStream(); |
} |
catch (Exception e) |
{ |
err_str=e.toString(); |
} |
} |
public void run() |
{ |
} |
} |
/DUBwise/src/J2ME/src/MKStatistics.java |
---|
0,0 → 1,67 |
/******************************************************************************** |
* Statistics from MK-Connection ( needed for 2. Thread and Readability of Code ) |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
********************************************************************************/ |
public class MKStatistics |
implements Runnable |
{ |
public long motor_on_time=-1; |
public long motor_stand_time=-1; |
public long motor_sum=-1; |
MKCommunicator mk=null; |
public MKStatistics(MKCommunicator _mk) |
{ |
mk=_mk; |
new Thread( this ).start(); // fire up main Thread |
} |
private long last_run_ms=0; |
private long last_step=-1; |
public void run() |
{ |
while(true) |
{ |
if (mk.connected) |
{ |
if (last_run_ms!=0) |
{ |
last_step=System.currentTimeMillis()-last_run_ms; |
if (mk.debug_data.motor_complete>0) |
motor_sum+=mk.debug_data.motor_complete; |
if (mk.debug_data.motor_complete>60) |
motor_on_time+=last_step; |
if (mk.debug_data.motor_complete==60) |
motor_stand_time+=last_step; |
} |
last_run_ms=System.currentTimeMillis(); |
} |
else |
{ |
last_run_ms=-1; |
motor_on_time=-1; |
motor_stand_time=-1; |
} |
try { Thread.sleep(500); } |
catch (Exception e) { } |
} |
} |
} |
/DUBwise/src/J2ME/src/MKStatusVoice.java |
---|
0,0 → 1,144 |
/************************************** |
* |
* Voice output for MK |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
* |
**************************************/ |
import javax.microedition.media.*; |
import javax.microedition.media.control.*; |
import java.util.*; |
import java.io.*; |
public class MKStatusVoice |
implements Runnable,PlayerListener |
{ |
MKCommunicator mk=null; |
DUBwiseCanvas canvas=null; |
Player 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; |
VolumeControl vc; |
public MKStatusVoice(MKCommunicator _mk,DUBwiseCanvas _canvas) |
{ |
canvas=_canvas; |
mk=_mk; |
new Thread( this ).start(); // fire up main Thread |
} |
public void playerUpdate(Player player, String event, Object data) |
{ |
if(event == PlayerListener.END_OF_MEDIA) { |
try { |
defplayer(); |
} |
catch(MediaException me) { } |
act_player_state=PLAYERSTATE_FIN; |
player=null; |
} |
} |
void defplayer() throws MediaException { |
if (player != null) { |
if(player.getState() == Player.STARTED) { |
player.stop(); |
} |
if(player.getState() == Player.PREFETCHED) { |
player.deallocate(); |
} |
if(player.getState() == Player.REALIZED || player.getState() == Player.UNREALIZED) { |
player.close(); |
} |
} |
player = null; |
} |
public void start_playing(String name) |
{ |
try { |
try { |
player = Manager.createPlayer(getClass().getResourceAsStream(name+".mp3"), "audio/mp3"); |
} |
catch (Exception e) { |
player = Manager.createPlayer(getClass().getResourceAsStream(name+".wav"), "audio/x-wav"); |
} |
player.addPlayerListener(this); |
player.realize(); |
act_player_state=PLAYERSTATE_PLAYING; |
vc = (VolumeControl) player.getControl("VolumeControl"); |
if(vc != null) { |
vc.setLevel(100); |
} |
player.prefetch(); |
player.setLoopCount(1); |
player.start(); |
} |
catch (Exception e) { |
} |
} |
public void wait_for_end() |
{ |
while (act_player_state!=PLAYERSTATE_FIN) |
{ |
try { Thread.sleep(5); } |
catch (Exception e) { } |
} |
} |
public void run() |
{ |
while(true) |
{ |
if (mk.connected&&(canvas.do_sound)&&(mk.debug_data.UBatt()!=-1)&&(!mk.force_disconnect)) |
{ |
int ubatt=mk.debug_data.UBatt(); |
start_playing(""+(ubatt/10)); |
wait_for_end(); |
if((ubatt%10)!=0) |
{ |
start_playing("komma"); |
wait_for_end(); |
start_playing(""+(ubatt%10)); |
wait_for_end(); |
} |
start_playing("volt"); |
} |
try { Thread.sleep(5000); } |
catch (Exception e) { } |
} |
} |
} |
/DUBwise/src/J2ME/src/MKStickData.java |
---|
0,0 → 1,42 |
/********************************************* |
* |
* class representing the StickData Structure |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
********************************************/ |
public class MKStickData |
{ |
// holing stick data |
public int[] stick; |
// general counter |
private int i; |
public MKStickData() |
{ |
stick=new int[10]; |
for (i=0;i<10;i++) |
stick[i]=-1; |
} |
public void set_by_mk_data(int[] in_arr) |
{ |
for (i=0;i<10;i++) |
{ |
stick[i]=(int)((in_arr[1+i*2]<<8) | in_arr[i*2]); |
if ((stick[i]&(1<<15))!=0) |
stick[i]=-(stick[i]&(0xFFFF-1))^(0xFFFF-1); |
} |
} |
} |
/DUBwise/src/J2ME/src/MKVersion.java |
---|
0,0 → 1,47 |
/************************************ |
* |
* class representing the MK-Version |
* Author: Marcus -LiGi- Bueschleb |
* Project-Start: 9/2007 * |
* |
* see README for further Infos |
* |
****************************************/ |
public class MKVersion |
{ |
public int major=-1; |
public int minor=-1; |
public int compatible=-1; |
public String str="--"; |
// version known? |
public boolean known=false; |
public final byte VERSION_AFTER=0; |
public final byte VERSION_EQUAL=1; |
public final byte VERSION_PREVIOUS=2; |
public void set_by_mk_data(int[] data) |
{ |
major=data[0]; |
minor=data[1]; |
compatible=data[2]; |
str="v"+major+"."+minor+"/"+compatible; |
known=true; |
} |
public byte compare(int major_c,int minor_c) |
{ |
if ((major_c==major)&&(minor_c==minor)) |
return VERSION_EQUAL; |
// TODO - compare major - PC-COMPATIBLE |
else if (minor_c>minor) return VERSION_AFTER; |
return VERSION_PREVIOUS; |
} |
} |
/DUBwise/src/J2ME/src/MKWatchDog.java |
---|
0,0 → 1,75 |
/************************************** |
* |
* WatchDog for MK-Connection |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
* |
**************************************/ |
public class MKWatchDog |
implements Runnable |
{ |
MKCommunicator mk=null; |
int debug_data_count_buff=-123; |
int lcd_data_count_buff=-123; |
public MKWatchDog(MKCommunicator _mk) |
{ |
mk=_mk; |
new Thread( this ).start(); // fire up main Thread |
} |
public void run() |
{ |
while(true) |
{ |
try { Thread.sleep(3000); } |
catch (Exception e) { } |
if (mk.connected&&(!mk.force_disconnect)) |
{ |
if (debug_data_count_buff==mk.debug_data_count) |
{ |
// mk.close_connections(false); |
} |
if ((lcd_data_count_buff==mk.lcd_data_count)||(mk.lcd_data_count==0)) |
mk.LCD.trigger_LCD(); |
debug_data_count_buff=mk.debug_data_count; |
lcd_data_count_buff=mk.lcd_data_count; |
if (mk.version.major==-1) |
mk.get_version(); |
for ( int cnt=0;cnt<5;cnt++) |
if (mk.params.field[cnt]==null) |
{ |
mk.get_params(cnt+1); |
break; |
} |
for (int c=0;c<32;c++) |
if (!mk.debug_data.got_name[c]) |
{ |
mk.get_debug_name(c); |
break; |
} |
} |
} |
} |
} |
/DUBwise/src/J2ME/src/UFOProber.java |
---|
0,0 → 1,76 |
/********************************************************************************** |
* |
* Probe which type of UFO we talk to |
* |
* Author: Marcus -LiGi- Bueschleb |
* |
* see README for further Infos |
* |
* |
**********************************************************************************/ |
import javax.microedition.io.*; |
import java.io.*; |
public class UFOProber |
{ |
public final static int PROBE_RESULT_NONE=0; |
public final static int PROBE_RESULT_MK=1; |
public final static int PROBE_RESULT_NG=2; |
public int probe_result=PROBE_RESULT_NONE; |
String reply=""; |
public boolean probe_error=false; |
private javax.microedition.io.StreamConnection connection; |
private java.io.InputStream reader; |
private java.io.OutputStream writer; |
public void bluetooth_probe(String url) |
{ |
try{ |
connection = (StreamConnection) Connector.open(url); |
reader=connection.openInputStream(); |
writer=connection.openOutputStream(); |
String magic="\rmk-mode\r"; |
writer.write(magic.getBytes()); |
writer.flush(); |
/* |
int input=0; |
// recieve data-set |
// the 1st line is the echo of the command when ng |
while ((input != 13) &&(input!=-1)) |
{ |
input = reader.read() ; |
reply+=(char)input; |
} |
reply=""; |
input=0; |
while ((input != 13) &&(input!=-1)) |
if (input!=10){ |
input = reader.read() ; |
reply+=(char)input; |
} |
if (reply=="NG here\r") |
probe_result=PROBE_RESULT_NG; |
probe_result=PROBE_RESULT_MK; |
*/ |
writer.close(); |
reader.close(); |
connection.close(); |
} |
catch (Exception ex) |
{ |
probe_error=true; |
} |
} |
} |