How to send image from server to client through bluetooth in j2me?
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.
If you mean OBEX, try avetana (obex implementation on JSR-82) - it includes some example.
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.