Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 3 → Rev 4

/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_01.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_01.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_02.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_02.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_03.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_03.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_05.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_05.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_06.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_06.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_07.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_07.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_08.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_08.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_09.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_09.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_10.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-configuration_10.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-mainscreen.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-mainscreen.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-motortest.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-motortest.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-scanning.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-scanning.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-settings.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-settings.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-telemetry.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-telemetry.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-write_discard.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37-write_discard.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/0.37_by_CaScAdE/20071022-dubwise-0.37.html
0,0 → 1,30
<img src="20071022-dubwise-0.37-scanning.jpg" width="800" height="1702" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-mainscreen.jpg" width="729" height="1710" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-telemetry.jpg" width="804" height="1700" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-motortest.jpg" width="740" height="1677" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-settings.jpg" width="738" height="1669" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_01.jpg" width="805" height="1751" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_02.jpg" width="758" height="1688" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_03.jpg" width="769" height="1700" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_05.jpg" width="714" height="1658" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_06.jpg" width="777" height="1698" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_07.jpg" width="751" height="1712" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_08.jpg" width="737" height="1717" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_09.jpg" width="777" height="1721" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-configuration_10.jpg" width="754" height="1692" border="0" alt=""><br>
<br>
<img src="20071022-dubwise-0.37-write_discard.jpg" width="784" height="1686" border="0" alt=""><br>
<br>
/DUBwise/PR/screenshots/recent/configuration_01.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_01.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/configuration_02.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_02.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/configuration_03.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_03.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/configuration_05.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_05.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/configuration_06.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_06.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/configuration_07.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_07.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/configuration_08.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_08.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/configuration_09.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_09.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/configuration_10.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/configuration_10.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/mainscreen.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/mainscreen.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/motortest.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/motortest.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/scanning.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/scanning.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/settings.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/settings.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/telemetry.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/telemetry.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/screenshots/recent/write_discard.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/screenshots/recent/write_discard.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/dubwise_mk_FM4014.JPG
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/dubwise_mk_FM4014.JPG
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/PR/dubwise_mk_FM4014_getjar.JPG
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/PR/dubwise_mk_FM4014_getjar.JPG
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/bin/v0.41/DUBwise_128x.jad
0,0 → 1,8
MIDlet-Jar-URL: DUBwise_128x.jar
MIDlet-Jar-Size: 50990
MIDlet-Name: DUBwise
MIDlet-Vendor: LiGi
MIDlet-Version: 0.41
MIDlet-1: DUBwise, i.png, DUBwise
MIDletX-No-Command: true
MIDlet-Icon: i.png
/DUBwise/bin/v0.41/DUBwise_128x.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/bin/v0.41/DUBwise_128x.jar
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/bin/v0.41/DUBwise_176x220.jad
0,0 → 1,8
MIDlet-Jar-URL: DUBwise_176x220.jar
MIDlet-Jar-Size: 57214
MIDlet-Name: DUBwise
MIDlet-Vendor: LiGi
MIDlet-Version: 0.41
MIDlet-1: DUBwise, i.png, DUBwise
MIDletX-No-Command: true
MIDlet-Icon: i.png
/DUBwise/bin/v0.41/DUBwise_176x220.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/bin/v0.41/DUBwise_176x220.jar
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/bin/v0.41/DUBwise_240x320.jad
0,0 → 1,8
MIDlet-Jar-URL: DUBwise_240x320.jar
MIDlet-Jar-Size: 51287
MIDlet-Name: DUBwise
MIDlet-Vendor: LiGi
MIDlet-Version: 0.41
MIDlet-1: DUBwise, i.png, DUBwise
MIDletX-No-Command: true
MIDlet-Icon: i.png
/DUBwise/bin/v0.41/DUBwise_240x320.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/bin/v0.41/DUBwise_240x320.jar
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/bin/v0.42_pre8/DUBwise_176x220.jad
0,0 → 1,8
MIDlet-Jar-URL: DUBwise_176x220.jar
MIDlet-Jar-Size: 90562
MIDlet-Name: DUBwise
MIDlet-Vendor: LiGi
MIDlet-Version: 0.42
MIDlet-1: DUBwise, i.png, DUBwise
MIDletX-No-Command: true
MIDlet-Icon: i.png
/DUBwise/bin/v0.42_pre8/DUBwise_176x220.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/bin/v0.42_pre8/DUBwise_176x220.jar
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/bin/v0.42_pre8/DUBwise_240x320.jad
0,0 → 1,8
MIDlet-Jar-URL: DUBwise_240x320.jar
MIDlet-Jar-Size: 75211
MIDlet-Name: DUBwise
MIDlet-Vendor: LiGi
MIDlet-Version: 0.42
MIDlet-1: DUBwise, i.png, DUBwise
MIDletX-No-Command: true
MIDlet-Icon: i.png
/DUBwise/bin/v0.42_pre8/DUBwise_240x320.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/bin/v0.42_pre8/DUBwise_240x320.jar
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/lib/antenna.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/lib/antenna.jar
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/lib/classes.zip
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/lib/classes.zip
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/res/128x/bg.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/128x/bg.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/128x/bt.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/128x/bt.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/128x/i.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/128x/i.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/128x/lcd.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/128x/lcd.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/128x/load.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/128x/load.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/176x220/bg.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/176x220/bg.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/176x220/bt.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/176x220/bt.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/176x220/i.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/176x220/i.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/176x220/lcd.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/176x220/lcd.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/176x220/load.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/176x220/load.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/240x320/bg.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/240x320/bg.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/240x320/bt.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/240x320/bt.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/240x320/i.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/240x320/i.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/240x320/lcd.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/240x320/lcd.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/240x320/load.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/240x320/load.png
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/res/240x320/starfield.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/DUBwise/res/240x320/starfield.jpg
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/server_side/tcp2serial/tcp2serial.rb
0,0 → 1,12
require 'socket'
 
port=2323
 
server=TCPServer.new('192.168.1.42',port)
while (session=server.accept)
puts "accept session: " + session.inspect
session.print "OK"
while (input=session.gets)
p input
end
end
/DUBwise/src/BTSearcher.java
0,0 → 1,116
/***************************************
*
* 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 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;
err_log+="Problem in searching the blue tooth devices\n" + ex;
}
 
}
 
public void inquiryCompleted(int transID) {
 
try {
for(int i=0;i<remote_device_count;i++)
{
remote_device_name[i]=remote_devices[i].getFriendlyName(true);
remote_device_mac[i]=remote_devices[i].getBluetoothAddress();
 
}
}
catch (Exception e)
{
err_log+="Problem in searching the blue tooth devices";
}
searching=false;
}
 
 
public void search_again()
{
}
 
//Called when device is found during inquiry
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
{
try
{
if (remote_device_count!=(MAX_DEVICES-1))
{
remote_devices[remote_device_count]=btDevice;
remote_device_count++;
}
}
catch (Exception e)
{
err_log+=("Device Discovered Error: " + e);
}
 
}
 
 
public void serviceSearchCompleted(int transID, int respCode)
{ }
 
public void servicesDiscovered(int transID, ServiceRecord[] records)
{ }
 
 
 
}
/DUBwise/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 MKMiniCanvas 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 MKMiniCanvas(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/MKCommunicator.java
0,0 → 1,404
/********************************************************************************************************************************
*
* 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 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;
/****************** Section: public Methods ************************************************/
public MKCommunicator(DUBwise root_)
{
root=root_;
version=new MKVersion();
debug_data=new MKDebugData();
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()
{
try{
connection = (StreamConnection) Connector.open(mk_url, Connector.READ_WRITE);
reader=connection.openInputStream();
writer=connection.openOutputStream();
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;
}
 
 
 
}
 
 
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)
{
int[] decoded_data;
 
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.handle_lcd_data(Decode64(data,3,20),data[2]-(int)'0');
lcd_data_count++;
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++;
break;
 
}
 
 
 
}
 
String o_msg="";
 
public boolean force_disconnect=true;
 
public void close_connections(boolean force)
{
if (!force) 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");
data_set[pos]=input;
pos++;
}
 
if (proxy!=null)
{
proxy.writer.write('\r');
proxy.writer.write('\n');
proxy.writer.flush();
}
 
process_data(data_set,pos);
}
catch (Exception ex)
{
msg="Problem reading from MK";
// 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/MKDebugData.java
0,0 → 1,94
/*********************************************
*
* 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[1]; }
public int roll_int() { return analog[2]; }
public int accnick() { return analog[3]; }
public int accroll() { return analog[4]; }
 
 
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]);
if ((analog[i]&(2<<14))!=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]&(2<<14))!=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/MKLCD.java
0,0 → 1,78
/*********************************************************************************************************************************
* *
* 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;
 
public MKLCD(MKCommunicator _mk)
{
LCD_str=new String[4];
mk=_mk;
new Thread( this ).start(); // fire up main Thread
}
 
public void run()
{
while(true)
{
try {
if (mk.connected)
{
 
trigger_LCD();
}
else
{
 
}
Thread.sleep(100); }
catch (Exception e) { }
}
}
 
 
public void handle_lcd_data(int[] data,int row)
{
LCD_str[row]="";
for(int foo=0;foo<20;foo++)
LCD_str[row]+=(char)data[foo];
}
 
public void trigger_LCD()
{
try {
 
mk.trigger_LCD(act_key);
act_key=0;
}
catch (Exception e) { }
}
 
int act_key=0;
 
 
public void LCD_NEXTPAGE()
{
act_key=2;
}
 
public void LCD_PREVPAGE()
{
act_key=1;
}
}
/DUBwise/src/MKMiniCanvas.java
0,0 → 1,1017
 
/***************************************************************
*
* minimal canvas to test Abstraction layer on various Phones
*
* Author: Marcus -LiGi- Bueschleb
*
* see README for further Infos
*
***************************************************************/
 
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
 
 
public class MKMiniCanvas
extends Canvas
implements Runnable
{
 
// name/handle for the recordStore to memorize some stuff
private final static String RECORD_STORE_NAME="bluetoothurl";
private BTSearcher bt_scanner;
public MKCommunicator mk=null;
private MKStatistics mk_stat=null;
private MKParamsEditor params_editor=null;
 
 
private String err="";
private DUBwise root;
 
 
 
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;
 
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;
 
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_RAWDEBUG =8;
public final static int STATEID_KEYCONTROL =9;
 
 
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", "MK-KeyControl", "Motor Test" , "Flight Settings","Change Skin","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_KEYCONTROL =1+MAINMENU_RAWDEBUG;
public final static int MAINMENU_MOTORTEST =1+MAINMENU_KEYCONTROL;
public final static int MAINMENU_PARAMS =1+MAINMENU_MOTORTEST;
public final static int MAINMENU_SETTINGS =1+MAINMENU_PARAMS;
public final static int MAINMENU_PROXY =1+MAINMENU_SETTINGS;
public final static int MAINMENU_DEVICESELECT =1+MAINMENU_PROXY;
public final static int MAINMENU_QUIT =1+MAINMENU_DEVICESELECT;
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++)
lcd_lines[i]=(act_menu_select==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 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 MKMiniCanvas(DUBwise _root)
{
 
root=_root;
 
bt_scanner = new BTSearcher();
params_editor = new MKParamsEditor(this);
mk = new MKCommunicator(root);
mk_stat= new MKStatistics(mk);
 
load_images();
try
{
RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true );
 
if (recStore.getNumRecords()==2)
{
 
//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);
 
connect_mk(new String(url_data, 0, url_data.length),new String(name_data, 0, name_data.length));
 
}
recStore.closeRecordStore();
}
catch (Exception e)
{
err+=e.toString();
}
 
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_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);
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;
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();
}
}
}
 
 
 
 
// drawing section
public void paint(Graphics g) {
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_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);
for (int i=0;i<16;i++)
{
g.drawString(mk.debug_data.names[i] + mk.debug_data.analog[i] ,0,y_off,Graphics.TOP | Graphics.LEFT);
g.drawString(mk.debug_data.names[16+i] + mk.debug_data.analog[16+i] ,this.getWidth()/2,y_off,Graphics.TOP | Graphics.LEFT);
y_off+=spacer1;
}
 
 
 
break;
 
case STATEID_MAINMENU:
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);
 
 
 
 
// 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("Power: " + (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.LCD_str[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
 
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) {}
}
 
private void connect_mk(String url,String name)
{
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)
{
act_menu_select=0;
// prepare next state
switch(next_state)
{
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;
 
}
// 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 keyPressed(int 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_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_MAINMENU:
if ( getGameAction (keyCode)==FIRE )
switch(act_menu_select)
{
case MAINMENU_SETTINGS:
act_skin++;
act_skin=(byte)(act_skin%2);
load_images();
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 )
{
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:
 
switch (getGameAction (keyCode))
{
case UP:
mk.LCD.LCD_PREVPAGE();
break;
case DOWN:
mk.LCD.LCD_NEXTPAGE();
break;
 
case LEFT:
chg_state(STATEID_MAINMENU);
break;
}
break;
}
 
}
 
 
 
 
 
 
 
}
 
 
/DUBwise/src/MKParamDefinitions.java
0,0 → 1,21
public interface MKParamDefinitions
{
 
// !!TODO!! difference types better ( Ranges / Special values ( Poti ))
public final static int PARAMTYPE_BOOLEAN=0;
public final static int PARAMTYPE_BYTE=1;
 
public final static int PARAMID_STICK_ACCELERATE=0;
public final static int PARAMID_STICK_GIER=1;
public final static int PARAMID_STICK_NICK=2;
public final static int PARAMID_STICK_ROLL=3;
public final static int PARAMID_STICK_POTI1=4;
public final static int PARAMID_STICK_POTI2=5;
public final static int PARAMID_STICK_POTI3=6;
public final static int PARAMID_STICK_POTI4=7;
 
public final static int PARAM_COUNT=8;
 
 
 
}
/DUBwise/src/MKParamsEditor.java
0,0 → 1,250
/**************************************************
*
* 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
{
 
public final static int TAB_COUNT=9;
 
 
 
public final static int TABID_CONFIGURATION=0;
public final static int TABID_CHANNELS=1;
public final static int TABID_STICK=2;
public final static int TABID_ALTITUDE=3;
public final static int TABID_GYRO=4;
public final static int TABID_LOOPING=5;
public final static int TABID_CAMMERA=6;
public final static int TABID_OTHER=7;
public final static int TABID_USER=8;
public String[] tab_names={"Configuration","Channels","Stick","Altitude","Gyro","Looping","Camera","Other","User"};
 
 
public String[] param_names;
 
 
 
public int[] tab_entrys_count={6,8,3,6,4,6,6,6,4};
public String[][] tab_entrys={{"Altitude Contol","Switch for setpoint","Heading Hold","Compass","Orientation fixed","GPS"}
,
{"Accelerate","Gier","Nick","Roll","POTI1","POTI2","POTI3","POTI4"},
{"Nick/Roll P-Rate","Nick/Roll D-Rate","Gier P-Rate"},
 
{"SetPoint","Min. Accelerate","Altitude P","Barometric D","Z-ACC effect ","Gain"},
{"Gyro P-Rate","Gyro I-Rate","ACC Gyro Factor","Main I"},
{"Up","Down","Left","Right","Gas Limit","Response threshold"},
{"Servo Ctrl","Nick compensation","Invert direction","Servo min","Servo max","Servo refresh Rate"},
 
{"Min Gas","Max Gas","Compass effect","voltage warning","distress gas time", "distress gas"},
{"Param1","Param2","Param3","Param4"}
// {"","","","","",""},
};
 
public int[][] tab_entry_types={
 
{ PARAMTYPE_BOOLEAN ,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN },
{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_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE},
{PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,PARAMTYPE_BOOLEAN,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}
 
};
 
 
public int[][][] tab_entry_src={
 
{ {8,0} ,{8,1},{8,2},{8,3},{8,4},{8,5} },
{ {2,0} ,{3,0},{0,0},{1,0},{4,0},{5,0},{6,0},{7,0} },
{ {15,0} ,{16,0},{17,0} },
{ {11,0} ,{9,0},{12,0},{10,0},{14,0},{13,0} }, //!
{ {22,0} ,{23,0},{20,0},{28,0} },
{ {40,0} ,{40,1},{40,2},{40,3},{38,0},{39,0} },
{ {33,0} ,{34,0},{40,2}/*!*/,{35,0},{36,0},{37,0} },
{ {18,0} ,{19,0},{21,0},{24,0},{26,0},{25,0} },
{ {29,0} ,{30,0},{31,0},{32,0} }
};
 
private int act_tab=0;
private int act_y=0;
private int act_lcd_lines=10;
 
MKMiniCanvas canvas;
 
public String[] lcd_lines;
 
public MKParamsEditor(MKMiniCanvas _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=tab_entrys_count[act_tab]*2+1;
for ( int i=0;i<act_lcd_lines;i++)
lcd_lines[i]="";
 
lcd_lines[0]=(act_tab==0?" ":"< ") + tab_names[act_tab] + (act_tab==(TAB_COUNT-1)?" ":" >");
 
for (int i=0;i<tab_entrys_count[act_tab];i++)
{
lcd_lines[1+2*i]=tab_entrys[act_tab][i];
if (tab_entry_types[act_tab][i]== PARAMTYPE_BOOLEAN)
lcd_lines[2+2*i]=(((canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])&(1<<tab_entry_src[act_tab][i][1]))==0)?"off":"on" ) ;
if (tab_entry_types[act_tab][i]== PARAMTYPE_BYTE)
{
lcd_lines[2+2*i]=""+canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0]);
if ((canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])>250)&&(canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])<256))
lcd_lines[2+2*i]+="[Poti"+(canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][i][0])-250) +"]";
}
}
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]+=" ";
}
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<TAB_COUNT-1) act_tab++;
break;
 
case Canvas.LEFT:
if (act_tab!=0) act_tab--;
break;
}
else
{
if(tab_entry_types[act_tab][act_y/2-1]==PARAMTYPE_BYTE)
{
if ((keyCode >= Canvas.KEY_NUM0) && (keyCode <= Canvas.KEY_NUM9))
{
if((editing_number)&&( Math.abs(canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][act_y/2-1][0]))*10+(keyCode - Canvas.KEY_NUM0)<1000))
canvas.mk.params.set_field_from_act(tab_entry_src[act_tab][act_y/2-1][0] , Math.abs(canvas.mk.params.get_field_from_act(tab_entry_src[act_tab][act_y/2-1][0]))*10+(keyCode - Canvas.KEY_NUM0));
else
canvas.mk.params.set_field_from_act(tab_entry_src[act_tab][act_y/2-1][0] , (keyCode - Canvas.KEY_NUM0));
editing_number=true;
return;
}
else
if ( keyCode==KEYCODE_CLEAR)
canvas.mk.params.set_field_from_act(tab_entry_src[act_tab][act_y/2-1][0],0);
}
editing_number=false;
switch (action)
{
case Canvas.RIGHT:
switch(tab_entry_types[act_tab][act_y/2-1])
{
case PARAMTYPE_BOOLEAN:
canvas.mk.params.field_from_act_xor(tab_entry_src[act_tab][act_y/2-1][0],1<<tab_entry_src[act_tab][act_y/2-1][1]);
break;
case PARAMTYPE_BYTE:
canvas.mk.params.field_from_act_add(tab_entry_src[act_tab][act_y/2-1][0],1);
break;
}
break;
case Canvas.LEFT:
switch(tab_entry_types[act_tab][act_y/2-1])
{
case PARAMTYPE_BOOLEAN:
 
canvas.mk.params.field_from_act_xor(tab_entry_src[act_tab][act_y/2-1][0],1<<tab_entry_src[act_tab][act_y/2-1][1]);
break;
case PARAMTYPE_BYTE:
canvas.mk.params.field_from_act_add(tab_entry_src[act_tab][act_y/2-1][0],-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/MKParamsParser.java
0,0 → 1,113
/**************************************************
*
* class representing the Params Structure
*
* Author: Marcus -LiGi- Bueschleb
*
* see README for further Infos
*
*************************************************/
 
public class MKParamsParser
implements MKParamDefinitions
 
{
 
public final static int MAX_PARAMSETS=20;
public final static int MAX_PARAMLENGTH=70;
 
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][MAX_PARAMLENGTH];
for (int ii=0;ii<MAX_PARAMSETS;ii++)
for (int i=0;i<MAX_PARAMLENGTH;i++)
field[ii][i]=-1;
 
}
 
 
public int[] param_type;
public int[] param_pos;
public int[] param_innerpos;
 
public void set_by_mk_data(int paramset_num,int[] in_arr,MKVersion version)
{
param_type=new int[PARAM_COUNT];
param_pos=new int[PARAM_COUNT];
param_innerpos=new int[PARAM_COUNT];
 
param_type[PARAMID_STICK_ACCELERATE]=PARAMTYPE_BYTE;
param_pos[PARAMID_STICK_ACCELERATE]=2;
param_innerpos[PARAMID_STICK_ACCELERATE]=0;
 
switch (version.compatible)
{
case 4:
case 5:
for ( int i=0;i<58;i++)
field[paramset_num][i]=in_arr[i];
names[paramset_num]="" + (paramset_num+1) +": ";
for ( int i=46;i<58;i++)
{
if(in_arr[i]==0)break;
names[paramset_num]+=(char)in_arr[i];
}
break;
 
case 6:
for ( int i=0;i<65;i++)
field[paramset_num][i]=in_arr[i];
names[paramset_num]="" + (paramset_num+1) +": ";
for ( int i=53;i<65;i++)
{
if(in_arr[i]==0)break;
names[paramset_num]+=(char)in_arr[i];
}
break;
case 7:
for ( int i=0;i<70;i++)
field[paramset_num][i]=in_arr[i];
names[paramset_num]="" + (paramset_num+1) +": ";
for ( int i=58;i<70;i++)
{
if(in_arr[i]==0)break;
names[paramset_num]+=(char)in_arr[i];
}
break;
}
}
 
 
 
}
/DUBwise/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/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/MKVersion.java
0,0 → 1,43
/************************************
*
* 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="--";
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;
}
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/MKWatchDog.java
0,0 → 1,77
/**************************************
*
* 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(1000); }
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();
if (mk.params.field[0][0]==-1)
mk.get_params(1);
else if (mk.params.field[1][0]==-1)
mk.get_params(2);
else if (mk.params.field[2][0]==-1)
mk.get_params(3);
else if (mk.params.field[3][0]==-1)
mk.get_params(4);
else if (mk.params.field[4][0]==-1)
mk.get_params(5);
 
for (int c=0;c<32;c++)
if (!mk.debug_data.got_name[c])
{
mk.get_debug_name(c);
break;
}
}
 
}
}
 
}
/DUBwise/build.props
0,0 → 1,2
screensize=240x320
 
/DUBwise/build.xml
0,0 → 1,67
<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.42"/>
 
<property file="build.props"/>
 
<property name="res_dir" location="${basedir}/res/${screensize}"/>
<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}" verbose="false"/>
<wtkbuild destdir="${build_dir}/classes" srcdir="${preprocessed_src_dir}" target="1.1" preverify="true"/>
<wtkjad
jadfile="${build_dir}/bin/${project_name}_${screensize}.jad"
jarfile="${build_dir}/bin/${project_name}_${screensize}.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/${project_name}_${screensize}.jar"
jadfile="${build_dir}/bin/${project_name}_${screensize}.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}"/>
<tstamp/>
<mkdir dir="${build_dir}"/>
<mkdir dir="${build_dir}/classes"/>
<mkdir dir="${build_dir}/bin"/>
</target>
 
</project>
/DUBwise/build_all.rb
0,0 → 1,24
# little ruby script to build versions for all resolution types
#
# Author: Marcus -LiGi- Bueschleb
#
# see README for further Infos
 
resdir="res/"
 
puts `mv build.props build.props.bak`
puts `ant clean`
 
Dir[resdir+"*"].each { |res_type|
res_type.gsub!(resdir,"")
p res_type
 
prefs_file= File.new("build.props","w")
prefs_file << ("screensize="+res_type+"\n")
prefs_file.close
 
log= `ant build`
log.each_line { |l| puts l }
}
puts `mv -v build.props.bak build.props`