views:

388

answers:

4

How to send image from server to client through bluetooth in j2me?

A: 

If you look into "apps\BluetoothDemo\src\example\bluetooth\demo" folder of Sun WTK 2.5.x installation folder, you can find BTImageServer.java and BTImageClient.java source codes.

It uses serial profile to send image data from server to client. I think you can easily understand by looking it.

Regards, Wonil.

Wonil Kim
Plz. give me the complete link of the folder you had described for viewing BTImageServer.java and BTImageClient.java source codes.
mm21
A: 

If you mean OBEX, try avetana (obex implementation on JSR-82) - it includes some example.

Pavel Alexeev
A: 

I've found the avetana Bluetooth libraries to be a bit unstable, and found BlueCove to be a better proposition. As mentioned, OBEX is the OBject EXchange protocol to use, and the docs are all over the internet.

LongSteve
A: 

If you are in control of both the server and client, then you don't need to worry about the complexities of OBEX. You can create your own lightweight protocol that does only what you need.

If you are new to Bluetooth on J2ME, start by reading about JSR 82. You'll want to create an RFCOMM/SPP connection between your client and server.

Next is the matter of sending an image over a serial connection in J2ME. If you have the image loaded as a javax.microedition.lcdui.Image, you'll need to obtain the ARGB pixel data using Image.getRGB().

This gives you an int array, which you'll need to send over the SPP connection (look at DataOutputStream.writeInt()), and rebuild at the other end using Image.createRGBImage().

HTH.

funkybro