Friday, June 29, 2007

J2ME BlueTooth programming(Episode 2)

Peace upon you,
I apology about delaying but I'm sure you forgive me this delay because you know I'm really so busy. In first episode we got introduction about BT and also knew BT Features.Ok let's dig into more details. In this episode after reading it, you should knew terminology of Bluetooth Network Topology , Bluetooth Communication Types , Java BlueTooth API (JABWT) and The Bluetooth protocol stack.


Bluetooth Network Topology
When two or more Bluetooth-enabled devices come within range and establish a connection, a personal area network is formed. A personal area network can either be a piconet or a scatternet.

  • Piconet: Is a single master and up to seven slaves. No matter what kind Bluetooth devices are involved (whether they are phones, access points, PDAs,laptops, headsets, etc.) The master of the piconet is the one that initiates the connection. The device that accepts the connection automatically becomes the slave. Master/slave roles are not predefined; so if a piconet exists between a laptop and a PDA, either device could be the master or the slave.

  • Scatternet: Is a scatternet is essentially a chain of piconets. A scatternet is formed when the slave of a piconet also become the master of its own piconet. Figure 1.0 show the Piconet and Scatternet.


Bluetooth Communication Types

There are three types of communication protocols defined inside Bluetooth technology:

    • OBEX: The "Object Exchange" communication Protocol is used to Exchange Physical data such as Files, images, and so on in binary Format.

    • L2CAP: The "Logical Link Control and Adaptation Protocol" used to send Packets between host and client.

    • RFCOM: The "Radio Frequency COMMunication" is very easy and not Complicated .it is used to stream simple data.


Java Bluetooth API (JABWT)

Sun Java has introduced the Bluetooth JSR82 API package.
http://jcp.org/aboutJava/communityprocess/final/jsr082/ The JSR82 API has capability to provide all three kinds of communications: Obex, L2CAP, or RFCOMM.

  1. javax.bluetooth The core Bluetooth API.

  2. javax.obex The Object Exchange (OBEX) API.


*So what is the JSR-82?

The JSR-82 is the official Java Bluetooth API, which was standardized by Motorola and the following companies in the Java Community Process

  • Sun Microsystems.

  • IBM.

  • Nokia.

  • Sony Ericsson.

  • Symbian.

You can find a list of commercially available JSR-82 device
http://www.javabluetooth.com/jsr82devices.html on our JSR-82 Devices page.



The Bluetooth protocol stack

What's the purpose of the Bluetooth stack? The stack is the piece of software (and firmware) that controls your Bluetooth device. Figure 2 details the protocol stack.



  • The bottom layer of the stack is the HCI, the Host Controller Interface. This layer is literally the interface between the host (your computer or Hardware) and the controller (the Bluetooth device). As you can see, all other layers go through the HCI.
  • The layer above the HCI is L2CAP, the Logical Link Controller Adaptation Protocol. This layer acts as the data multiplexer for all other layers.
  • The next layer is BNEP, the Bluetooth Network Encapsulation Protocol. Using BNEP, you can run other networking protocols, such as IP, TCP, and UDP, over Bluetooth.
  • RFCOMM is known as the virtual serial port protocol because it allows a Bluetooth device to simulate the functions of a serial port.
  • The OBEX protocol layer is implemented above the RFCOMM layer and is useful when you want to transfer data as an object, such as files.
  • SDP is the Service Discovery Protocol layer, which is used whenever you want to find services on a remote Bluetooth device.
  • The final two layers, AVCTP and AVDTP are used for the control and distribution of audio and video over Bluetooth. AVCTP and AVDTP are relatively new additions to the Bluetooth protocol; they are used when you want to control the functions of a media player or if you want stream audio in stereo.

In the next episode I will expose to you simple chat program between two mobiles.Be wiz us

salam

2 comments:

Ahmed Essam said...

Mohamed, You are amazing, I didn't finish the whole topic, but I think it's very good as a start, I wish you continue

Unknown said...

Hello
This is nayan
student of MSc. ETE at NSU in Bangladesh.

I have taken a project "exploiting bluetree scatternet algorithm"
in the final semister. I am a bit confused what to do or implement in this project.

I want make a simulation of scatternet by using java.

Plese help
nayan017@yahoo.com