Setting up the development environment: Difference between revisions

From
Jump to navigation Jump to search
(veralteten link überarbeitet)
 
(3 intermediate revisions by 2 users not shown)
Line 26: Line 26:
# Install Subversion: http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 (the svn-1.2.3-setup.exe)
# Install Subversion: http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 (the svn-1.2.3-setup.exe)
# Adjust the rights on <code><var>c:\eclipse</var></code> to Everybody: Read, Execute (make sure these are inherited to all files and folders below)
# Adjust the rights on <code><var>c:\eclipse</var></code> to Everybody: Read, Execute (make sure these are inherited to all files and folders below)
# Run Eclipse and install EclipseME per [http://eclipseme.org/docs/installEclipseME.html these] installation instructions (Note: the correct update site is <code>http://www.eclipseme.org/updates/</code> and <em>not</em> <code>http://eclipseme.sourceforge.net/updates/</code> which erroneously is shown in the screenshots.) Don't bother with the configuration instructions yet.
# Run Eclipse and install EclipseME per [http://eclipseme.org/docs/installEclipseME.html these] installation instructions (Note: they fixed the documentation to point to <code>http://www.eclipseme.org/updates/</code> and <em>not</em> <code>http://eclipseme.sourceforge.net/updates/</code> which erroneously was shown in the screenshots.) Don't bother with the configuration instructions yet.
# Install Subclipse per [http://subclipse.tigris.org/install.html these instructions]. You can combine this step with the previous one.
# Install Subclipse per [http://subclipse.tigris.org/install.html these instructions]. You can combine this step with the previous one.
# Exit Eclipse.
# Exit Eclipse.
Line 45: Line 45:
# Install subversion by whatever method your distribution uses (Gentoo Linux: <code>emerge subversion</code>)
# Install subversion by whatever method your distribution uses (Gentoo Linux: <code>emerge subversion</code>)
# Start Eclipse
# Start Eclipse
## Install EclipseME per [http://eclipseme.org/docs/installEclipseME.html these] installation instructions (Note: the correct update site is <code>http://www.eclipseme.org/updates/</code> and <em>not</em> <code>http://eclipseme.sourceforge.net/updates/</code> which erroneously is shown in the screenshots.) Don't bother with the configuration instructions yet.<br>Note: If you did not install Eclipse in your home directory you may have to use the <code>Change Location...</code> button to choose an installation location where you can write to.
## Install EclipseME per [http://eclipseme.org/docs/installEclipseME.html these] installation instructions (Note: they fixed the documentation to point to <code>http://www.eclipseme.org/updates/</code> and <em>not</em> <code>http://eclipseme.sourceforge.net/updates/</code> which erroneously was shown in the screenshots.) Don't bother with the configuration instructions yet.<br>Note: If you did not install Eclipse in your home directory you may have to use the <code>Change Location...</code> button to choose an installation location where you can write to.
## Install Subclipse per [http://subclipse.tigris.org/install.html these instructions]. You can combine this step with the previous one.
## Install Subclipse per [http://subclipse.tigris.org/install.html these instructions]. You can combine this step with the previous one.
# Exit Eclipse
# Exit Eclipse
# Download the Wireless Toolkit 2.2 from http://java.sun.com/products/sjwtoolkit/download-2_2.html (the file is called <code>j2me_wireless_toolkit-2_2-linux-i386.bin</code>
# Download the Wireless Toolkit 2.2 from (the file is called https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter<code>sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh</code>
# <code>chmod a+x j2me_wireless_toolkit-2_2-linux-i386.bin</code>
# <code>chmod a+x sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh</code>
# <code>./j2me_wireless_toolkit-2_2-linux-i386.bin</code>
# <code>./sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh</code>
# If it should ask you for the path to a "Java interpreter directory": Find out where the <code>java</code> binary lives (in another terminal do <code>which java</code> which will say something like <code><var>/usr/bin/</var>java</code>, where <code><var>/usr/bin/</var></code> is the 'Java interpreter directory').
# If it should ask you for the path to a "Java interpreter directory": Find out where the <code>java</code> binary lives (in another terminal do <code>which java</code> which will say something like <code><var>/usr/bin/</var>java</code>, where <code><var>/usr/bin/</var></code> is the 'Java interpreter directory').
# Install the toolkit somewhere below your home directory (for example <code>/home/<var>ploetz</var>/<var>sw/WTK2.2</var></code>)
# Install the toolkit somewhere below your home directory (for example <code>/home/<var>ploetz</var>/<var>sw/WTK2.2</var></code>)
Line 83: Line 83:
export JDK_PLATFORM=linux
export JDK_PLATFORM=linux
make
make
On Debian stable you might run into compilation problems mentioning some confusion of <code>uint8_t</code> and <code>char</code>, probably due to too old bluez-libs. You then should use the following patch:
On Debian stable you might run into compilation problems mentioning some confusion of <code>uint8_t</code> and <code>char</code>, probably due to too old bluez-libs. You then should use [http://www.informatik.hu-berlin.de/~ploetz/avetana.diff this patch]. Use it like this:
<pre>
diff -rU 2 avetana_alt/sources/c/BlueZ.cpp avetana/sources/c/BlueZ.cpp
--- avetana_alt/sources/c/BlueZ.cpp 2005-10-22 22:08:10.000000000 +0200
+++ avetana/sources/c/BlueZ.cpp 2005-12-16 09:53:08.688229557 +0100
@@ -176,5 +176,5 @@
memset(&buf, 0, sizeof(sdp_buf_t));
- buf.data = (uint8_t*)malloc(SDP_UUID_SEQ_SIZE);
+ buf.data = (char*)malloc(SDP_UUID_SEQ_SIZE);
buf.buf_size = SDP_UUID_SEQ_SIZE;
@@ -1911,10 +1911,10 @@
if (cstate_len > 0 || rsp_concat_buf.data_size != 0) {
- uint8_t *targetPtr = NULL;
+ char *targetPtr = NULL;
cstate = cstate_len > 0? (sdp_cstate_t *)(pdata + rsp_count): 0;
// build concatenated response buffer
- rsp_concat_buf.data = (uint8_t *)realloc(rsp_concat_buf.data, rsp_concat_buf.data_size + rsp_count);
+ rsp_concat_buf.data = (char *)realloc(rsp_concat_buf.data, rsp_concat_buf.data_size + rsp_count);
rsp_concat_buf.buf_size = rsp_concat_buf.data_size + rsp_count;
targetPtr = rsp_concat_buf.data + rsp_concat_buf.data_size;
@@ -2057,5 +2057,5 @@
// build concatenated response buffer
- rsp_concat_buf.data = (uint8_t *)realloc(rsp_concat_buf.data, rsp_concat_buf.data_size + rsp_count);
+ rsp_concat_buf.data = (char *)realloc(rsp_concat_buf.data, rsp_concat_buf.data_size + rsp_count);
targetPtr = (char *)rsp_concat_buf.data + rsp_concat_buf.data_size;
rsp_concat_buf.buf_size = rsp_concat_buf.data_size + rsp_count;
@@ -2428,5 +2428,5 @@
uint64_t u64;
uint128_t u128;
- uint8_t *seqp = buf->data + buf->data_size;
+ char *seqp = buf->data + buf->data_size;
pdu_size = sdp_set_data_type(buf, dtd);
</pre>
Use it like this:
patch -p1 < ~/id/avetana.diff
patch -p1 < ~/id/avetana.diff



Latest revision as of 16:53, 19 November 2010

The development environment for the SPAN project involves:

  • A Wireless Toolkit: Either from Sony Ericsson (windows-only) or from SUN (Linux or Windows)
  • Subversion, additionally the Subclipse Eclipse plugin
  • Eclipse, version 3.1.x
  • EclipseME
  • Access to the SAR private network (either direct or through OpenVPN)
  • Account for the SAR SVN server

Already included in the subversion checkout will be

I'll assume that you want to set up the Sony Ericsson kit on Windows and the SUN kit on linux.

Installation for Windows

You need: Windows 2000/XP, (local) administrative rights, additionally a normal user for everyday work

  1. Become (local) administrator
  2. (optional, if needed) Get J2SE SDK 1.4.x from [1]
  3. (optional, if needed) Get DirectX 8.1 or later from [2] (there is a "runtime" quick link to the right)
  4. Get Eclipse 3.1.x from [3]
  5. Unpack Eclipse to the hard drive (e.g. in c:\eclipse)
  6. optional: create a start menu item for c:\eclipse\eclipse.exe
  7. Install Subversion: http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 (the svn-1.2.3-setup.exe)
  8. Adjust the rights on c:\eclipse to Everybody: Read, Execute (make sure these are inherited to all files and folders below)
  9. Run Eclipse and install EclipseME per these installation instructions (Note: they fixed the documentation to point to http://www.eclipseme.org/updates/ and not http://eclipseme.sourceforge.net/updates/ which erroneously was shown in the screenshots.) Don't bother with the configuration instructions yet.
  10. Install Subclipse per these instructions. You can combine this step with the previous one.
  11. Exit Eclipse.
  12. Install the Sony-Ericsson J2ME SDK from [4], for example to C:\SonyEricsson
  13. Adjust the rights on C:\SonyEricsson to Everybody: Read, Execute plus Full Access for your normal user (most of the programs in the SDK want to write in that directory)
  14. (optional, if needed) Disable the "Windows Firewall", because it interferes with emulator-emulator connections and is generally not needed on a properly configured system. If your Windows is not hardened yet you might want to do that now: http://www.ntsvcfg.de/
  15. Become your normal user.
  16. Start Eclipse.
  17. Follow the configuration hints from [5] (the root of the Wireless Toolkit is C:\SonyEricsson)

You're done. For information on how to start developing look at file:///C:/SonyEricsson/J2ME_SDK/PC_Emulation/WTK2/docs/UserGuide-html/demonstrations.html, and [6].

Installation for Linux

  1. Install the SUN Java SDK 1.4.2 or later by whatever method your distribution uses. (For example, Gentoo Linux: emerge sun-jdk)
  2. Install Eclipse:
    • If your distribution already has an eclipse package use this (Gentoo: Put =dev-util/eclipse-sdk-3.1.1 into /etc/portage/package.keywords and emerge eclipse-sdk)
    • Otherwise: Download the eclipse tarball, unzip it somewhere below your home directory and set your PATH environment variable to the eclipse directory.
  3. Install subversion by whatever method your distribution uses (Gentoo Linux: emerge subversion)
  4. Start Eclipse
    1. Install EclipseME per these installation instructions (Note: they fixed the documentation to point to http://www.eclipseme.org/updates/ and not http://eclipseme.sourceforge.net/updates/ which erroneously was shown in the screenshots.) Don't bother with the configuration instructions yet.
      Note: If you did not install Eclipse in your home directory you may have to use the Change Location... button to choose an installation location where you can write to.
    2. Install Subclipse per these instructions. You can combine this step with the previous one.
  5. Exit Eclipse
  6. Download the Wireless Toolkit 2.2 from (the file is called https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFiltersun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh
  7. chmod a+x sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh
  8. ./sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh
  9. If it should ask you for the path to a "Java interpreter directory": Find out where the java binary lives (in another terminal do which java which will say something like /usr/bin/java, where /usr/bin/ is the 'Java interpreter directory').
  10. Install the toolkit somewhere below your home directory (for example /home/ploetz/sw/WTK2.2)
  11. Start Eclipse and follow the configuration hints from [7] (the root of the Wireless Toolkit is /home/ploetz/sw/WTK2.2)

Common checkout instructions

  1. Window -> Open Perspective -> SVN Repository Exploring
  2. Right click in the SVN Repository view and choose New -> Repository Location. The URL shall be svn://merkur/, and fill in your username and password.
  3. On merkur, in the span subdirectory, you'll find three directories for now:
    Testbed
    Contains the J2ME code for the mobile phone, and the common libraries
    jsr82test
    Contains the J2SE code for the PC, but is dependent on the common libraries
    docs
    Documentation and illustrations
  4. Right click 'Testbed' and use Check out as project
    Sony-Ericsson Toolkit
    Open Window -> Preferences -> J2ME. Right click Profiles -> Add MIDP profile. Profile name "Bluetooth", Next, Add External JARs -> C:\SonyEricsson/J2ME_SDK/PC_Emulation/WTK2/lib/jsr082.jar, Finish. Then expand Platform Definitions -> Sony Ericsson J2ME SDK 2.2.x MIDP Platform. Right click Platform Definitions, Add Platform Definition. Platform Definition name "Bluetooth Platform", Base Platform Definition "Sony Ericsson J2ME SDK 2.2.x MIDP Platform", Next, Configuration CLDC-1.1, add all Profiles that the Sony Ericsson J2ME SDK 2.2.x MIDP Platform has (that's why you just expanded it) and additionally the Bluetooth profile. Finish. Unfortunately this setting is not permanent and the current version of EclipseME forgets about your choice of CLDC-1.1 as soon as you quit Eclipse. When restarting Eclipse you have to delete this platform definition and recreate it.
  5. Go back to the Java perspective, right click the newly created project and open the J2ME settings. Set the J2ME Platform Definition to your custom-created Bluetooth Platform for the Sony Ericsson Toolkit, or to the J2ME Wireless Toolkit 2.2 MIDP 2.0 All Profiles Platform for the SUN toolkit. Ok.
  6. Go back to the SVN Repository Exploring perspective, Right click 'jsr82test' and Check out as project.

You now have checked out all the necessary code. To start your first MIDlet, in the Java perspective: In the Package Explorer, expand Testbed -> src -> (default package). Right click Test1.java and choose Run as -> Emulated J2ME Midlet.

Set up Bluetooth (Linux only)

Use your distribution preferred way to install the hotplug package (should already be installed by default) and the bluez-utils package (or whatever contains the hcid binary). On some distributions you will also need to install the corresponding development packages (libbluetooth1-dev in Debian, generally whatever contains the bluetooth.h file).

Nowf ire up the init script that came with the bluez package (something like /etc/init.d/bluez start, may already have been done by your package manager) and plug in the Bluetooth USB adaptor. You should now see a device hci0 in the output of hciconfig and be able to do hcitool scan to scan for the mobile phone (or any other Bluetooth device).

Download the source for the Avetana JSR-82 package from their sourceforge.net project page. Unpack the package:

mkdir avetana
cd avetana
tar -xzf ~/id/avetanaBluetooth-200510223.tgz

and compile it:

cd sources
export JDK_HOME=/opt/sun-jdk-1.4.2.09
export JDK_PLATFORM=linux
make

On Debian stable you might run into compilation problems mentioning some confusion of uint8_t and char, probably due to too old bluez-libs. You then should use this patch. Use it like this:

patch -p1 < ~/id/avetana.diff

Once you have successfully compiled the library you will get (among others) a file build/libavetanaBT.so. Place this in the jsr82test/res directory of your Eclipse workspace and you should be ready to use the Bluetooth code.