Skip navigation

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 :
CMD_PLAYLIST_LIST, CMD_END

Server -> Client :
ANS_PLAYLIST_LIST, size, UINT, 1, UINT, 2, UINT, 3, ANS_END

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.

Annonser

2 Comments

  1. I’m maintaining the BlueCove JSR-82 bindings for Windows, because using AvetanaBluetooth on Windows is quite costly. So that is good to keep in mind if you like to test compatibility sometime.

    BR,
    Paul Tötterman

  2. I have ported xmms-embedded for Motorola A1200 linux phone but no way for a native UI because Motorola released J2ME SDK only. A solution, control xmms from java over TCP. TCP? Because I am not java coder, I will test the protocol from desktop PC. When the protocol ready, I will ask my friend to write a java client for it. Can you share your java remote control over TCP code? Thank You.


Kommentera

Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut / Ändra )

Twitter-bild

Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )

Facebook-foto

Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s

%d bloggare gillar detta: