Vous êtes sur la page 1sur 34

1.

NTRODUCTION
1.1 ABSTRACT
Bluetooth is a by now well-established communications standard for shortdistance wireless connections. It replaces the many proprietary cables that connect one device to another with one universal short-range radio link. For instance, Bluetooth radio technology built into both the cellular telephone and the laptop would replace the cable used today to connect a laptop to a cellular telephone. Printers, desktops, fax machines, keyboards, joysticks and virtually any other digital device can be part of the Bluetooth system. The primary objective of the application is to manage the computer applications executing in the Personal Computer or Laptop using a Mobile Phone. This Mobile Phone should be Bluetooth enabled and the Personal Computer or Laptop should have the Bluetooth Dongle or any other Bluetooth hardware installed. This Project demonstrates an ingenious way of using Bluetooth-Enabled Mobile Phones to control the PC applications with the help of a Software Application, which is based on Client Server architecture. The application "Application Remote Control using Bluetooth" or (ARC) along with the Mobile Phone possess the ability to control various Software Applications such as Windows Media Player and Microsoft PowerPoint Slideshows. It can also control electrical devices such as LEDs, fans using parallel (LPT) port of the PC, and PC monitor. The tools and technologies used for developing the software are JAVA (J2ME and J2SE) for analysis and design phases for developing the code for the application on Microsoft windows 2000/Xp platform.

About Project

Bluetooth is a by now well-established communications standard for shortdistance wireless connections. It replaces the many proprietary cables that connect one device to another with one universal short-range radio link. For instance, Bluetooth radio technology built into both the cellular telephone and the laptop would replace the cable used today to connect a laptop to a cellular telephone. Printers, desktops, fax machines, keyboards, joysticks and virtually any other digital device can be part of the Bluetooth system. The primary objective of the application is to manage the computer applications executing in the Personal Computer or Laptop using a Mobile Phone. This Mobile Phone should be Bluetooth enabled and the Personal Computer or Laptop should have the Bluetooth Dongle or any other Bluetooth hardware installed. This Project demonstrates an ingenious way of using Bluetooth-Enabled Mobile Phones to control the PC applications with the help of a Software Application, which is based on Client Server architecture. The application "Application Remote Control using Bluetooth" or (ARC) along with the Mobile Phone possess the ability to control various Software Applications such as Windows Media Player and Microsoft PowerPoint Slideshows. It can also control electrical devices such as LEDs, fans using parallel (LPT) port of the PC, and PC monitor. The tools and technologies used for developing the software are JAVA (J2ME and J2SE) for analysis and design phases for developing the code for the application on Microsoft windows 2000/Xp platform.

Working Principle: The system basically involves communication between a mobile phone and computer application.

A computer and a mobile phone can communicate with each other using ports. Similar to two islands which communicate with each other using ship ports or air ports. Technically we call them COM ports. Data can be exchanged using ports i.e. port of mobile phone and port of computer. This data is known as commands. When the commands are received from the users Mobile Phone the server accepts and produces the desired operation on the Personal Computer. The server will be implemented in J2SE and operations are produced in a variety of ways such as by producing virtual key presses, calling different executable files.

System Components The Bluetooth enabled Remote Control has two components, namely 1. Client Program 2. Server Program

Client Program: Client program uses Bluetooth API to create Bluetooth connection with the computer. It displays a list of programs on the screen like.

 Home Appliances  MS Office PowerPoint  MS Media Player

On selecting Home Appliances the program displays the following list.  Fan On  Light Off  Etc. On selecting Microsoft PowerPoint the following menu appears;  View Show

 Next  Previous  Exit Server Program: The Server Program has been implemented usingJ2SE.

Interfaces of Server Program: The server has only one interface which is to be used by the user to select the virtual COM port where the Bluetooth serial port server is running.

Operations The commands received from the client will be decoded and the corresponding action will be performed by the server.

1.2 Scope of Project


The scope of the software being developed can be for only accessing the PC or Laptop through Bluetooth enabled Android mobile acting as remote control. That is executing the commands on PC or Laptop using Bluetooth enabled Android phone. The detailed scope of software being developed is as described below

y It can operate Microsoft power point slides. That is, previous slide, next slide etc.

y It can operate windows media player. That is, playing windows media player, changing the track to previous or next track. y Restart the system. y Shut down the system, Etc.

1.3 Organization profile Effent Technologies


Effent Technologies is an exciting company that provides extensive service on high quality end-to-end consulting, designing, developing and deploying software solutions to meet business objectives. Effent Technologies has been providing business solutions in these core services for the past three years. It has earned reputation for building solid partnerships with its clients in crafting the right solution for them.

The solutions provided by Effent Technologies include: y E-commerce Solutions y SPI Solutions y Web Applications and Hosting y ERP Solutions -CRM Solutions y Access Control and Time Attendance Solutions y HR Solutions y Administrative System Solutions Computer Sales, Service and Maintenance.

This document contains a basic level understanding of the workflow as analyzed by us by your requirement received through e-mail. To get more information of the organization visit the website of Effent Technologies it is: www.effenttechnologies.com

2. Existing System
Initial Investigation
The project selected is developed on android that is mobile operating system, it describes the system as: The software needs to control PC or Laptop using android phone, which will help in easier and speedy access of PC or laptop software applications such as windows Media Player and Power point Slides.

Problem Definition
The project selected is developed on android that is mobile operating system, it describes the system as: The software needs to control PC or Laptop using android phone. This project will help in easier and speedy access of PC or laptop software applications such as windows Media Player and Power point Slides.

This project is a mobile application for Android mobiles designed to help user to access the power point slides and to play media player. This application is easy to use for both beginners and advanced users. It features a familiar and well thought-out, an attractive user interface, combined with strong capabilities.

Evolution of Existing System


In the existing system the Bluetooth interface is used only to transfers the file between client and servers only in one-way but not so simultaneously. With the help of these Bluetooth interface it could be used to control or transfer the files, images, audios and videos with each other. Because many mobile phones today contain Bluetooth and similarly many personal laptop and computer are also coming equipped with Bluetooth .Thus instead of using extra hardware required by infra-red remote control, we can use already available Bluetooth hardware. So this gives us a major advantage i.e. No extra Hardware Cost. Bluetooth Enabled Remote Control is a software program. Part of it resides in a computer and a part in mobile phone. Each Bluetooth hardware requires a program called Bluetooth stack to be installed before use. Different vendors have different Bluetooth stacks and most of the time they are incompatible with each other. We have tried to make Bluetooth enabled Remote Control generic and successfully achieved it.

Disadvantages of the existing system:


 Only data transfer is done without any interactions.

 Even a Bluetooth interface exists in hardware couldnt be completely utilized.

3. Proposed System
3.1Description about the project: The system basically involves communication between a mobile phone and computer application. A computer and a mobile phone can communicate with each other using ports. Similar to two islands which communicate with each other using ship ports or air ports. Technically we call them COM ports. Data can be exchanged using ports i.e. port of mobile phone and port of computer. This data is known as commands. When the commands are received from the users Mobile Phone the server accepts and produces the desired operation on the Personal Computer. The server will be implemented in J2SE and operations are produced in a variety of ways such as by producing virtual key presses, calling different executable files.

System Components The Bluetooth enabled Remote Control has two components, namely 1. Client Program 2. Server Program

Client Program: Client program uses Bluetooth API to create Bluetooth connection with the computer. It displays a list of programs on the screen like.

 Home Appliances  MS Office PowerPoint  MS Media Player

On selecting Home Appliances the program displays the following list.  Fan On  Light Off  Etc. On selecting Microsoft PowerPoint the following menu appears;  View Show  Next  Previous  Exit Server Program: The Server Program has been implemented usingJ2SE.

Interfaces of Server Program: The server has only one interface which is to be used by the user to select the virtual COM port where the Bluetooth serial port server is running.

Operations The commands received from the client will be decoded and the corresponding action will be performed by the server.

3.2 Advantages of proposed system


The scope of the software being developed can be for only accessing the PC or Laptop through Bluetooth enabled Android mobile acting as remote control. That is executing the commands on PC or Laptop using Bluetooth enabled Android phone. The detailed scope of software being developed is as described below y It can operate Microsoft power point slides. That is, previous slide, next slide etc. y It can operate windows media player. That is, playing windows media player, changing the track to previous or next track. y Restart the system. y Shut down the system, Etc.

4. System Analysis & Design


4.1 Hardware Requirement Specification
Purpose:

The software requirement specification is produced at the culmination of the analysis task. The function and performance allocated to software as part of system engineering are refined by establishing a complete information description as functional representation, a representation of system behavior, an indication of performance requirements and design constraints, appropriate validation criteria.
Hardware Requirements:

 Processor: Pentium 3 or More.  Ram: 512MB or More.  Hard Disk: 200MB.  Bluetooth Enabled PC/Laptop or Bluetooth USB Device.  Bluetooth Dongle.  One Mobile Phone embedded with Android OS.
Hardware description: Bluetooth Dongle:

Fig 4.1 A Bluetooth USB dongle with a 100 m range

A personal computer that does not have embedded Bluetooth can be used with a Bluetooth adapter or "dongle" that will enable the PC to communicate with other Bluetooth devices (such as mobile phones, mice and keyboards). While some desktop computers and most form of a dongle. Unlike its predecessor, IrDA, which requires a separate adapter for each device, Bluetooth allows multiple devices to communicate with a computer over a single adapter. Mobile phone requirements A Bluetooth-enabled mobile phone is able to pair with many devices. To ensure the broadest support of feature functionality together with legacy device support, the Open Mobile Terminal Platform (OMTP) forum has published a recommendations paper, entitled "Bluetooth Local Connectivity" The Bluetooth SIG Web site offers additional information about use cases for Bluetooth-enabled mobile phones. 4.2 Software Requirement Specification:
Software Requirements:  Java MicroEdition 2.5.2 or above.  Android SDK (Software Development ToolKit).  Netbeans IDE 5.5 or More.  Eclipse IDE .  Android Virtual Machine .

Software description

BlueCove Java Archive File: BlueCove is a Java library for Bluetooth (JSR-82 implementation) that currently interfaces with the Mac OS X, WIDCOMM, BlueSoleil and Microsoft Bluetooth stack found in Windows XP SP2 or Windows Vista and WIDCOMM and Microsoft Bluetooth stack on Windows Mobile. BlueCove-GPL is additional GPL licensed module to support BlueCove runtime on Linux BlueZ. BlueCove JSR-82 Emulator module is additional module for BlueCove to simulate Bluetooth stack. BlueCove can be used in Java Standard Edition (J2SE) 1.1 or newer. BlueCove has been tested on following JVM:  Apache Harmony - Open Source Java SE 5.0M5 on Win XP 32 bit  SUN Java 1.1.8 on Windows XP/X86  SUN Java 2 Platform Standard Edition 1.4.2 on Windows XP/X86  SUN Java 2 Platform Standard Edition 5.0 on Windows XP/X86  SUN Java 2 Platform Standard Edition 6.0 on Windows XP/X86 and Windows Vista  SUN Sun Java Toolkit for CDC 1.0 on Windows XP/X86 Web Sphere Everyplace Micro Environment 5.7.2, CDC 1.0/Foundation 1.0/Personal Profile 1.0 on Windows XP/X86  WebSphere Everyplace Micro Environment 6.1.1, CDC 1.0/Foundation 1.0/Personal Profile 1.0 on Windows XP and Linux/X86  WebSphere Everyplace Micro Environment 5.7.2, CLDC 1.1, MIDP 2.0 on Windows XP/X86  WebSphere Everyplace Micro Environment 6.1.1, CLDC 1.1, MIDP 2.0 on Linux/X86  Mysaifu JVM - An open-source (GPL v.2 license) Java VM on Windows Mobile 2003 Second Edition.  Java for Mac OS X 10.4 and 10.5, Release 5 on PowerPC and Intel processors

 SUN Java 2 SE 5.0 on Linux Fedora 6 i386 BlueZ 3.7, Fedora 7 i386 BlueZ 3.9, (Also tested on Ubuntu and OpenSUSE, i386 and 64-bit)  GNU libgcj 4.1.2 on Fedora 7 i386 BlueZ 3.9  SableVM on Debian 4.0r3 ARM on Linksys NSLU2 BlueCove provides JSR-82 Java interface for following Bluetooth Profiles:
   

SDAP - Service Discovery Application Profile RFCOMM - Serial Cable Emulation Protocol L2CAP - Logical Link Control and Adaptation Protocol OBEX - Generic Object Exchange Profile (GOEP) profile on top of RFCOMM and TCP.

Fig. Bluecove provides JSR-82 Java interface for Bluetooth Profiles

Operating System:

Operating system is an interface between hardware and user. It is responsible for the management and co-ordination of activities and sharing of the limited resources of the computer. The operating system acts as a host for application that run on the machine. As a host, one of the purposes of the operating system is to handle the details of the operation of the hardware. This relieves application programs from having to manage these details and makes it easier to write applications. Almost all computers including handheld computers, desktop computers, super computers and even video games consoles, use an operating system of some type. Operating systems offers a number of services to application programs and users. Applications access these services through application programming interfaces (APIs) or system calls. By invoking these interfaces, the application can request a service from operating system, past parameters, and receive the results of the operation. Users may also interact with operating system with some kind of the software user interface (UI) like typing commands by using command line interface (CLI) or using graphical user interface (GUI). For hand-held and desktop computers, the user interface is generally considered as part of the operating system. On large multi-user system like UNIX and Unix-like systems, the user interface is generally implemented as an application program that runs outside the operating system. Operating system support: Apple has supported Bluetooth since Mac OS X v10.2 which was released in 2002. For Microsoft platforms, Windows XP Service Pack 2 and SP3 releases have native support for Bluetooth 1.1, 2.0 and 2.0+EDR. Previous versions required users to install their Bluetooth adapter's own drivers, which were not directly supported by Microsoft. Microsoft's own Bluetooth dongles (packaged with their Bluetooth computer devices) have no external drivers and thus require at least Windows XP Service Pack 2. Windows Vista RTM/SP1 with the Feature Pack for Wireless or Windows Vista SP2 support Bluetooth 2.1+EDR. Windows 7 supports Bluetooth 2.1+EDR and Extended Inquiry Response (EIR).

The Windows XP and Windows Vista/Windows 7 Bluetooth stacks support the following Bluetooth profiles natively: PAN, SPP, DUN, HID, HCRP. The Windows XP stack can be replaced by a third party stack which may support more profiles or newer versions of Bluetooth. The Windows Vista/Windows 7 Bluetooth stack supports vendor-supplied additional profiles without requiring the Microsoft stack to be replaced. Linux has two popular Bluetooth stacks, BlueZ and Affix. The BlueZ stack is included with most Linux kernels and was originally developed by Qualcomm. The Affix stack was developed by Nokia. FreeBSD features Bluetooth support since its 5.0 release. NetBSD features Bluetooth support since its 4.0 release. Its Bluetooth stack has been ported to OpenBSD as well. Net Beans IDE: The NetBeans IDE is an open-source integrated development environment. NetBeans IDE supports development of all Java application types (Java SE including JavaFX, (Java ME, web, EJB and mobile applications) out of the box. Among other features are an Ant-based project system, Maven support, refactorings, and version control (supporting CVS, Subversion, Mercurial and Clearcase). Modularity: All the functions of the IDE are provided by modules. Each module provides a well defined function, such as support for the Java language, editing, or support for the CVS versioning system, and SVN. NetBeans contains all the modules needed for Java development in a single download, allowing the user to start working immediately. Modules also allow NetBeans to be extended. New features, such as support for other programming languages, can be added by installing additional modules. For instance, Sun Studio, Sun Java Studio Enterprise, and Sun Java Studio Creator from Sun Microsystems are all based on the NetBeans IDE. Bluetooth

Bluetooth is a proprietary open wireless technology standard for exchanging data over short distances (using short length radio waves) from fixed and mobile devices, creating personal area networks (PANs) with high levels of security. Invented by telecoms vendor Ericsson in 1994, it was originally conceived as a wireless alternative to RS-232 data cables. It can connect several devices, overcoming problems of synchronization. Today Bluetooth is managed by the Bluetooth Special Interest Group. Bluetooth uses a radio technology called frequency-hopping spread spectrum, which chops up the data being sent and transmits chunks of it on up to 79 bands of 1 MHz width in the range 2402-2480 MHz. Bluetooth is a packet-based protocol with a master-slave structure. One master may communicate with up to 7 slaves in a piconet; all devices share the master's clock. Packet exchange is based on the basic clock, defined by the master, which ticks at 312.5 s intervals. Bluetooth provides a secure way to connect and exchange information between devices such as faxes, mobile Positioning

phones, telephones, laptops, personal

computers, printers, Global

System (GPS) receivers, digital cameras, and video game consoles. It is a standard communications protocol primarily designed for low power consumption, with a short range (power-class-dependent: 100 m, 10 m and 1 m, but ranges vary in practice; see table below) based on low-cost transceiver microchips in each device. Because the devices use a radio (broadcast) communications system, they do not have to be in line of sight of each other.

4.3 Non Functional Requirements and Constraints


1. The new system should be cost effective 2. To improve productivity and service and services. 3. To enhance user interface. 4. To improve information presentation and durability. 5. To upgrade systems reliability, availability and flexibility. 6. To address human factors for better and uses acceptance.

4.4 Development Environment Software Selection


Android Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Google Inc. purchased the initial developer of the software, Android Inc., in 2005.Android's mobile operating system is based on a modified version of the Linux kernel. Google and other members of the Open Handset Alliance collaborated on Android's development and release. The Android Open Source Project (AOSP) is tasked with the maintenance and further development of Android. The Android operating system is the world's best-selling Smartphone platform. Android has a large community of developers writing applications that extend the functionality of the devices. There are currently over 150,000 apps available for Android. Android Market is the online app store run by Google, though apps can also be downloaded from third-party sites. Developers write primarily in the Java language, controlling the device via Google-developed Java libraries. The unveiling of the Android distribution on 5 November 2007 was announced with the founding of the Open Handset Alliance, a consortium of 80

hardware, software, and telecom companies devoted to advancing open standards for mobile devices. Google released most of the Android code under the Apache License, a free software and open source license. The Android open-source software stack consists of Java applications running on a Java-based, object-oriented application framework on top of Java core

libraries running on a Dalvik virtual machine featuring JIT compilation. Libraries written in C include the surface OpenGL ES 2.0 3D graphics API, Web Kit layout engine, SGL graphics engine, SSL, and Bionic libc . The Android operating system, including the Linux kernel, consists of roughly 12 million lines of code including 3 million lines of XML, 2.8 million lines of C, 2.1 million lines of Java, and 1.75 million lines of C++ . History of Android Back in July 2005, when Google seemed to have so much money it didn't know what to do with, it quietly went about buying up a load of start-up companies . Some of these never really saw the light of day: for instance, Dodgeball, a service that allowed you to text a group of friends in a similar way to Twitter, has never really appeared anywhere in Google's stable. But at the same time, it also bought a little-known company called Android Inc, co-founded by Andy Rubin, now director of mobile platforms at Google .Little was known about this company even within its own industry: in fact, all that was available in terms of description was it was 'it developed software for mobile phones.' In 2003, before getting involved with Android, Rubin conducted an interview with Business Week:"Rubin said there was tremendous potential in developing smarter mobile devices that are more aware of its owner's location and preferences. The IPhone Hot on the heels of the iPhone launch, rumours began to increase of Google bringing out its own handset, to help leverage its burgeoning mobile search functions. Widespread reports of Google hawking its wares round to all the major manufacturers and carriers began to circulate; it was believed the new handset would be designed to work around location-based services and implement a whole host of Google Labs' ideas, as well as the old favourites Maps and Mail. In fact, the fact Google was spotted

more times than a Big Brother reject in the media meant it became a matter of when and not if a gPhone would be announced. And then the Californians went and sprang a huge surprised on the world: not only had it not been working on a handset, it had been developing the core of a whole new open-source OS to rival the likes of Symbian, Microsoft et al. The beginnings of what we now know as the Open Handset Alliance (OHA), including HTC, LG, Samsung, T-Mobile and a whole host of other names. And what many people fail to realize, especially those who call it 'Google's Android', is that the new platform was born out of this group, not Google incorporating the help of others. Well, that's not strictly true - Google is clearly the main driving force behind the new system, but all factions of the OHA stand to do well from the success of the OS. Many people had trouble understanding the benefits of what Google Android actually was, and what made it special compared to the raft of other rival OS systems out there. Lego The best way to describe it was making all sections of the system like Lego bricks. Where before developers might have struggled to break down the bits of a mobile phone OS, and even if successful, would find that getting one part of the system to talk to another was very difficult indeed, as they were packaged up in their own little programmers. But with Android, the rules were changed. Fancy making a GPS application that used SMS location updates? The two sections would fit together nicely. If you wanted to add in some location data from the net to just pop on a web piece too.

Features
y

Application framework enabling reuse and replacement of components Dalvik virtual machine optimized for mobile devices Integrated browser based on the open source WebKit engine Optimized graphics powered by a custom 2D graphics library and 3D graphics.

SQL Lite for structured data storage Media support for common audio, video, and still image formats . GSM Telephony (hardware dependent) Bluetooth, EDGE, 3G, and WiFi (hardware dependent) Camera, GPS, compass, and accelerometer (hardware dependent)

Android Architecture

The following diagram shows the major components of the Android operating system. Each section is described in more detail below.

Fig: Android Architecture

Applications Android will ship with a set of core applications including an email client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language.

Application Framework By providing an open development platform, Android offers developers the ability to build extremely rich and innovative applications. Developers are free to take

advantage of the device hardware, access location information, run background services, set alarms, add notifications to the status bar, and much, much more. Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user. Underlying all applications is a set of services and systems, including:  A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser.  Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data.  A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files.  A Notification Manager that enables all applications to display custom alerts in the status bar.  An Activity Manager that manages the lifecycle of applications and provides a common navigation back stack.

Libraries Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework. Some of the core libraries are listed below:

 System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices  Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG  Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications  LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view  SGL - the underlying 2D graphics engine  3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer  FreeType - bitmap and vector font rendering  SQLite - a powerful and lightweight relational database engine available to all applications Android Runtime Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool. The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management. Linux Kernel

Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack. Android Bluetooth The Android platform includes support for the Bluetooth network stack, which allows a device to wirelessly exchange data with other Bluetooth devices. The application framework provides access to the Bluetooth functionality through the Android Bluetooth APIs. These APIs let applications wirelessly connect to other Bluetooth devices, enabling point-to-point and multipoint wireless features. Using the Bluetooth APIs, an Android application can perform the following:
y

Scan for other Bluetooth devices Query the local Bluetooth adapter for paired Bluetooth devices Establish RFCOMM channels Connect to other devices through service discovery Transfer data to and from other devices Manage multiple connections

This architecture describes how to us the Android Bluetooth APIs to accomplish the four major tasks necessary to communicate using Bluetooth: setting up Bluetooth, finding devices that are either paired or available in the local area, connecting devices, and transferring data between devices. All of the Bluetooth APIs are available in the android.bluetooth package.
Android Bluetooth Architecture

Here's a summary of the classes you will need to create Bluetooth connections:
y

Bluetooth Adapter

Represents the local Bluetooth adapter (Bluetooth radio). The Bluetooth Adapter is the entry-point for all Bluetooth interaction. Using this, you can discover other Bluetooth devices, query a list of bonded (paired) devices, instantiate a Bluetooth Device using a known MAC address, and create a Bluetooth Server Socket to listen for communications from other devices.
y

BluetoothDevice

Represents a remote Bluetooth device. Use this to request a connection with a remote device through a Bluetooth Socket or query information about the device such as its name, address, class, and bonding state.
y

BluetoothSocket

Represents the interface for a Bluetooth socket . This is the connection point that allows an application to exchange data with another Bluetooth device via InputStream and OutputStream.
y

BluetoothServerSocket

Represents an open server socket that listens for incoming requests. In order to connect two Android devices, one device must open a server socket with this class. When a remote Bluetooth device makes a connection request to the this device, the Bluetooth Server Socket will return a connected Bluetooth Socket when the connection is accepted.

BluetoothClass

Describes the general characteristics and capabilities of a Bluetooth device. This is a read-only set of properties that define the device's major and minor device classes and its services. However, this does not reliably describe all Bluetooth profiles and services supported by the device, but is useful as a hint to the device type.

Fig: Bluetooth Stack.

The diagram above offers a library-oriented view of the Bluetooth stack.

The Bluetooth stack and Bluetooth hardware has close relationship. It works as the driver for the Bluetooth hardware. The Bluetooth stack is a controlling agent (it could be software, firmware, hardware, or a combination of all three) that implements the Bluetooth protocol and also allows you to control your Bluetooth device programmatically. The Bluetooth stack allows to do these two things:  Communicate with other Bluetooth devices  Control host Bluetooth device For example the Bluetooth protocol stack similar with the HTTP protocol stack . A Web browser uses an HTTP protocol stack so that it can receive Web content like

HTML pages, images, files, and best of all, Java applets. A Web server also uses an HTTP protocol stack to send out Web content to Web browsers over the network. So, like the HTTP protocol stack, a Bluetooth protocol stack will allow Bluetooth clients and servers to send and receive data over a wireless network. Layers of the Protocol Stack: 1. Host Controller Interface (HCI) 2. Logical Link Control and Adaptation Protocol (L2CAP) (packet data) 3. Service Discovery Protocol (SDP) 4. RFCOMM (stream data) 5. Wireless Access Protocol (WAP) 6. Object Exchange (OBEX) (object data) 7. Bluetooth Network Encapsulation Protocol (BNEP) 8 . Human Interface Device Protocol (HID)

RFCOMM RFCOMM is commonly known as the wireless serial port, or the cable replacement protocol. The name is derived from the fact that the serial ports are called COMM1, COMM2, etc. RFCOMM simulates the functionality of a standard serial port. For instance, a Bluetooth-enabled mobile would use the RFCOMM layer to synchronize its data to a Bluetooth-enabled PC as if they were physically connected by a cable. PROFILES Bluetooth profile is a designed set of functionality for Bluetooth devices. This enables two Bluetooth devices to interact properly. To interact Bluetooth-enabled devices , having a Bluetooth stack is not good enough. Those devices also need to implement the same profile. We used the Serial Port Profile that interacts directly with the

RFCOMM layer in the Bluetooth protocol stack. This profile is used to create a virtual serial port on Bluetooth-enabled device. For instance , some Bluetooth kits come with a driver that will allow the operating system to communicate over the virtual serial port as if it were an actual serial port. By using the serial port profile we were able to send stream data to PC. The Bluetooth device in PC receives the stream data through virtual com port. There are many profiles such as: y Generic Access Profile. y Service Discovery Application Profile. y Serial Port profile. y Headset profile. y Object Push profile. y File Transfer profile.

The Java Bluetooth API To control the Bluetooth device programmatically, we need J2ME optional package JSR82. JSR-82 can only be implemented on the J2ME platform. JSR-82 cannot be implemented on the J2SE because the J2SE does not support the generic connection framework. The JSR-82 actually consists of two independent packages: 1. javax.bluetooth (the 13 classes and interfaces that are needed to perform wireless communication with the Bluetooth protocol) 2. javax.obex (the 8 classes that are needed to send objects between

devices, independent of the transport mechanism between them) . Device Management Local Device, Remote Device, and Device Class are the classes in the Java Bluetooth specification that form the Generic Access Profile and allow you to perform device

management. These classes allow you to query some statistical information about your own Bluetooth device and also some information on the devices in the area The Device Class object gives you information about the official class of device as defined in the Bluetooth specification. A device class is simply a classification of Bluetooth devices. By simply calling the methods of this class, it can be determined what kind of devices are in the area, like computers, laptops, phones, PDAs, access points, etc. The methods provided to accomplish this task are getMinorDeviceClass() and getMajorDeviceClass(), both of which return an int. The following table shows some common major and minor device classes.

Device Discovery The Bluetooth device has no idea of what other Bluetooth devices are in the area. Perhaps there are laptops, desktops, printers, mobile phones, or PDAs in the area. The possibilities are endless. In order to find out, the Bluetooth device will use the device discovery classes that are provided in the Java Bluetooth API. The two classes needed in order for your Bluetooth device to discover remote Bluetooth devices in the area: DiscoveryAgent and DiscoveryListener. The method DiscoveryAgent is used to make the Bluetooth device search for other devices in the area. The length of the inquiry is totally dependent upon the implementation of the Java Bluetooth specification. The accessCode can be one of the following DiscoveryAgent constants: NOT_DISCOVERABLE, LIAC, or GIAC. A reference to a class that implements the DiscoveryListener interface is also passed. When new devices are discovered, event callbacks are passed back to this object. This method will return true if the device successfully went into discovery

mode. The startInquiry() method is the only way to perform device discovery without blocking the current thread. Service Discovery After locating devices in the area, it would be really nice to see what services those devices offer. The service discovery-related classes in the Java Bluetooth specification implement the Service Discovery Application Profile. The Service Discovery Application Profile, in turn, uses the Service Discovery Protocol (SDP) layer in your Bluetooth stack to find services on remote Bluetooth devices. The following classes are provided in the Java Bluetooth specification for service discovery: Element, and UUID. The Service Discovery Database (SDDB) is the central repository for all service records. If a particular JSR-82 implementation does not store Service records in the SDDB as Java objects, then it must convert them into Service Record objects when a client performs a search for services and a match is found. Discovery Agent, Discovery Listener, Service Record, Data

Communication

As Bluetooth is a communication protocol the official Java Bluetooth API gives three ways to send and receive data. Here two of them are: RFCOMM for stream data and L2CAP for packet data.RFCOMM is the protocol layer that the serial port profile uses in order to communicate.

Java The Internet helped catapult Java to the forefront of programming and Java in turn has had a profound effect on the Internet. The reason is simple: Java expands the universe of objects that can move about freely in cyberspace. In a network, there are two broad categories of objects transmitted between the Server and your Personal Computer: passive information and dynamic, active programs like an object that can be transmitted to your computer, which is a dynamic, self-executing program. Such a program would be an active agent on the client computer, yet the server would initiate it. As desirable as dynamic, networked programs are, they also present serious Prior to Java cyberspace was Java addresses these

problems in the areas of security and portability.

effectively closed to half the entities that now live there.

concerns and doing so, has opened the door to an existing a new form of program. The rise of server-side Java applications is one of the latest and most exciting trends in Java programming. It was first hyped as a language for developing elaborate client-side web content in the form of applets. Now, Java is coming into its own as a language ideally suited for server-side development. Businesses in particular have been quick to recognize Javas potential on the server-Java is inherently suited for large client/server applications. The cross platform nature of Java is extremely useful for organizations that have a heterogeneous collection of servers running various flavors of the Unix of Windows operating systems. Javas modern, object-oriented, memory-protected design allows developers to cut development cycles and increase

reliability. In addition, Javas built-in support for networking and enterprise API provides access to legacy data, easing the transition from older client/server systems.