Skip navigation

Monthly Archives: juli 2006

I’ve started my voyage into bluetooth land now and it has been some confusing days.

I spent about three hours on google just to find out that you couldn’t connect to localhost with bluetooth. This means I have to do some of the work correctly the first time instead (or debug the application on the phone, bleh). About 10 minutes later I luckily found out that it was possible to write the Service Discovery part against localhost by using the address ”0xFFFFFF000000”. Then I went on to figure out how this UUID-stuff worked and now I can actually discover my ”XMMS2 Remote Control” service from my phone. Yey! I used AvetanaBT to implement this part. It is a JSR-82 compatible java framework that runs on J2SE.

Today I’ve been learning about GIOChannels and refreshing my UNIX socket programming knowledge. I realised that I could write quite a bit locally by writing a J2ME compatible java Client that connects over tcp to a test server. I’ve given up on extending Bemused’s protocol as it doesn’t fit my needs at all. So this evening/night have also been used to figure out what the protocol should look like, and a some minutes ago I compiled the first working version that communicates ints and strings.

Requesting the playlist for example looks like this:

Client -> Server :

Server -> Client :

I will probably not document this protocol as I intend to write the server as platform independent as possible. It currently runs on Linux, but with some minor changes it also compiles on FreeBSD. The bluetooth connection will be abstracted so that it can be replaced by tcp if someone cares to write such a module, or perhaps diffrent bluetooth apis (OS X, Wintendo). And maybe the player communication will be abstracted so that any music player with similar features (playback, playlist, medialib) can benefit from this project by adding a corresponding module.

This morning I picked up my new Sony Ericsson K750i phone after several weeks of waiting. The service from Comviq was a bit shaky and just a week ago I was about to discontinue the order and pick another company, but after some compensations I decided to wait instead.

The problems began when I first ordered the phone, or when I thought I ordered the phone. Something messed up the moving of my old number to the new service provider and the order was quietly put on hold by some evil computer without letting anyone know.

After two weeks I called Comviq and asked what was going on since I hadn’t heared anything from them since my original call. The support replied that they would contact me when they knew what was going on, and five minutes later I got an SMS telling me that my number was to be moved to Comviq the week after. Knowing that the order should have taken a total of 3 weeks I called them and asked what was going on, and this time I was told about the problems with the original order and that it would take about 2 additional weeks for the phone to arrive since they couldn’t send it before my number was all done.

Two weeks went, I got my SIM card and the paperworks but still no phone. The 18:th of July my previous provider revoked my SIM-card and now I had no phone to use at all. I called Comviq again and it turned out that the support who had reordered the subscription had not ordered a phone. After some calls I got in contact with a nice girl who provided me with compensation for the delays and sent my phone with prioritized delivery, and as of today I have this very cool piece of technology in my hands.

After using blogspot for a while I realised that I really needed support for tagged entries unless I wanted to fill with my off-topic rants. So this is my new home here at wordpress. I must say I’m impressed with how smooth the transition was. I entered my blogspot details in the import page and a couple of seconds later it was all done.

When I originally wrote the build.xml for this project my main goal was just to get it to work. This lead to a really crappy handling of preverify where you had to add the class files manually as preverify doesn’t search subdirectories for class files. So today I finally got tired of having to edit build.xml every time I added a new class, or renamed an old one. Unfortunatly Google let me down except for some outdated J2ME Ant extensions, but after deciphering the Ant manual I came up with this vanilla Ant code:

<!-- Find class files. -->
<fileset dir="${build}" id="tmp">
      <include name="**/*.class">

<!-- Convert filenames to valid preverify input. -->
<!-- From: /absolute/path/to/package/SomeFile.class -->
<!-- To: package.SomeFile -->
<pathconvert pathsep=" " property="unverified" refid="tmp">
  <packagemapper from="${build}/*.class" to="*">

<!-- Execute preverify on classes. -->
<exec dir="${build}" executable="${j2me.bin}/preverify">
  <arg line="-classpath ${classpath.j2me}">
  <arg line="-d ${preverify}">
  <arg line="${unverified}">

Maybe this will save someone else’s time.

After being convinced by a friend of mine that J2ME hacking could provide hours of fun I was determined to give it a try. My earlier attempts had only been with the basic forms, and I’d found it hard to setup a sane build environment without using Nutbeans or some other IDE.

After reading about MIDP packaging, and finding about about tools like preverify and other stuff, I finally had a nice and small development environment (vim+ant+j2me) without wasting 1GB of ram.

A couple of days earlier I had seen Opera Mini for the first time and I was surprised about its clean and good looking gui so I planned to do something similar. Now almost a week has passed and my GUI toolkit is comming along well. It looks just as good as the one Opera Mini uses, with some parts better looking, and other parts not yet implemented.

Next, the bluetooth part. When the project idea came to mind I thought any bluetooth enabled phone would do, I was wrong. Bluetooth phones predates the J2ME support for bluetooth (JSR-82). After some googling I found out that my phone lacked JSR-82, but the timing was perfect as my 24 month mobile phone contract went out this month. Some clicks later I had ordered a new mobile phone with JSR-82 (Sony Ericsson K750i). With some luck it arrives by the time the GUI toolkit is mature enough.

There are other projects that does this exact task for other music players. I’ve been looking at Bemused which has both Winamp and XMMS support. Bemused is mostly for Symbian based phones, but an outdated J2ME implementation exists. My plans are to be compatible with this protocol if it doesn’t require too much work. The protocol however lacks support for coverart, medialib browsing, so at least that has to differ. When the time comes I’ll try to contact the Bemused people to see if they’re interested in updating their protocol.