• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Controlpcviabluetoothenablemobile 091028150632-phpapp01
 

Controlpcviabluetoothenablemobile 091028150632-phpapp01

on

  • 1,587 views

 

Statistics

Views

Total Views
1,587
Views on SlideShare
1,587
Embed Views
0

Actions

Likes
0
Downloads
28
Comments
2

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

12 of 2 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • plz send me the source code of this project n can u tell me that is this project work in linux.???????????
    Are you sure you want to
    Your message goes here
    Processing…
  • plz send me source code to my email address. i need it desperately.

    rupkoraj@hotamil.com
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Controlpcviabluetoothenablemobile 091028150632-phpapp01 Controlpcviabluetoothenablemobile 091028150632-phpapp01 Document Transcript

    • CSE 2200- SOFTWARE DEVELOPMENT PROJECTName of the project: Wireless controlling pc by usingBluetooth supported mobile. Project supervisor Mr. Sheikh Md. Masudul Ahsan Assistant Professor Department of Computer Science and Engineering Khulna University of Engineering and Technology Khulna-9203 Project submitted by Samiul hoque Prosenjit Shaha Roll: 0507035 Roll:0507012
    • ACKNOWLEDGEMENTS First of all we acknowledge to almighty ALLAH for completing this project successfully.Then we are grateful to our project supervisor whose intelligent direction has made the task easierto accomplish. A special thanks to the Head of the Department of Computer science & Engineeringto allow us to take several components from the Hardware and Interfacing Lab as also to the teacherwho has assigned us this project.
    • INDEX1. Objectives2. What is Bluetooth3. The Bluetooth Protocol Stack4. RFCOMM5. Profiles6. Java Bluetooth API7. The Basic components of a Bluetooth Application8. How to make connection between mobile and a PC9.The Client Program10. Basic Parts of the Client Program11.The Java Communication API12.The Receiver Program13. The Basic Parts of the Receiver Program14. Limitations15. Conclusion16. Resources17. Installation Process:
    • ObjectivesThe objective of this project is to a develop software that willperform basic PC controlling operations and some external devicecontrolling operation using Bluetooth radio signal. Java™.
    • Software advantages1. We can explore all the drives and it’s subfolders and files.2.We can see Text file and image file in mobile and play and control song in pc.3. This software enables user to control various windows applications (ex: Restart ,Log off , Turn off) from a remote place and no need to use keyboard or mouse.What is Bluetooth? Bluetooth is a wireless communication protocol mainly used for short distance and indevices with low power consumption. Because Bluetooth is capable of communicating in anomni-directional manner of up to 30 feet at 1 Mb/s it is far superior to infrared. Whereinfrared requires a distance of a few feet or less and requires a direct line of site fortransmissions. The Bluetooth core system consists of a radio frequency (RF) transceiver,baseband, and protocol stack. The system offers services that enable the connection ofdevices and the exchange of a variety of classes of data between these devices. Actually itsa wireless communication protocol that, like HTTP or FTP, operates in a client/serverarchitecture. It uses the 2.4 GHz band. If there are multipleperipherals to be connected to a computer using RS-232 or USB, then Bluetooth is the idealsolution to use those devices wirelessly.The Basic features of Bluetooth: 1. 100 Feet Range (Exception Bluetooth Class 1 has 300 feet range). 2. Data transfer speed 1 MB/s. 3. Low power consumption. 4. Omni-directional radio signa 5. Uses 2.4 Ghz-2.482 Ghz radio frequency band
    • The Bluetooth protocol stackThe Bluetooth stack and Bluetooth hardware has close relationship. It works as the driverfor 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 protocoland also allows you to control your Bluetooth device programmatically. The Bluetooth stackallows to do these two things: 1. Communicate with other Bluetooth devices 2. Control host Bluetooth deviceFor example the Bluetooth protocol stack similar with the HTTP protocol stack . A Webbrowser 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 stackto send out Web content to Web browsers over the network. So, like the HTTP protocolstack, a Bluetooth protocol stack will allow Bluetooth clients and servers to send and receivedata 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)RFCOMMRFCOMM is commonly known as the wireless serial port, or the cable replacementprotocol. 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 connectedby a cable.ProfilesBluetooth profile is a designed set of functionality for Bluetooth devices. This enables twoBluetooth devices to interact properly. To interact Bluetooth-enabled devices , having aBluetooth 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 theBluetooth 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 communicateover the virtual serial port as if it were an actual serial port. By using the serial port profile wewere able to send stream data to PC. The Bluetooth device in PC receives the stream datathrough virtual com port. There are many profiles such as: 1. Generic Access Profile 2. Service Discovery Application Profile 3. Serial Port profile 4. Headset profile 5. Object Push profile 6. File Transfer profile The Java Bluetooth API To control the Bluetooth device programmatically, we need J2ME optional package JSR 82. 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 ManagementLocalDevice, RemoteDevice, and DeviceClass are the classes in the Java Bluetoothspecification that form the Generic Access Profile and allow you to perform devicemanagement. These classes allow you to query some statistical information about your ownBluetooth device (LocalDevice) and also some information on the devices in the area(RemoteDevice). The DeviceClass object gives you information about the official class ofdevice (CoD) as defined in the Bluetooth specification. A device class is simply a classification of Bluetooth devices. By simply calling themethods of this class, it can be determined what kind of devices are in the area, likecomputers, laptops, phones, PDAs, access points, etc. The methodsprovided to accomplish this task are getMinorDeviceClass() and getMajorDeviceClass(),both of which return an int. The following table shows some common major and minor deviceclasses. Major Minor Major class Minor class Class class Description Description 256 4 Computer Desktop 256 8 Computer Server 256 12 Computer Laptop 256 20 Computer PDA 512 4 Phone Cellular
    • Device Discovery The Bluetooth device has no idea of what other Bluetooth devices are in the area. Perhapsthere are laptops, desktops, printers, mobile phones, or PDAs in the area. The possibilitiesare endless. In order to find out, the Bluetooth device will use the device discovery classesthat are provided in the Java Bluetooth API.The two classes needed in order for your Bluetooth device to discover remote Bluetoothdevices in the area: DiscoveryAgent and DiscoveryListener.The method DiscoveryAgent is used to make the Bluetooth device search for other devicesin the area. The length of the inquiry is totally dependent upon the implementation of theJava Bluetooth specification. The accessCode can be one of the following DiscoveryAgentconstants: NOT_DISCOVERABLE, LIAC, or GIAC.A reference to a class that implements the DiscoveryListener interface is also passed. Whennew devices are discovered, event callbacks are passed back to this object. This method willreturn true if the device successfully went into discovery mode. The startInquiry() method isthe only way to perform device discovery without blocking the current thread. Service DiscoveryAfter locating devices in the area, it would be really nice to see what services those devicesoffer. The service discovery-related classes in the Java Bluetooth specification implementthe 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 onremote Bluetooth devices.The following classes are provided in the Java Bluetooth specification for service discovery:Discovery Agent, Discovery Listener, Service Record, Data Element, and UUID.The Service Discovery Database (SDDB) is the central repository for all service records. If aparticular JSR-82 implementation does not storeService records in the SDDB as Java objects, then it must convert them into Service Recordobjects when a client performs a search for services and a match is found.
    • Communication As Bluetooth is a communication protocol the official Java Bluetooth API gives three waysto send and receive data. Here two of them are: RFCOMM for stream data and L2CAP forpacket data.RFCOMM is the protocol layer that the serial port profile uses in order to communicate.How to make connection between a mobile and a PC? We used a Bluetooth dongle to make a connection between a Bluetooth enabled mobileand a PC. Unfortunately J2SE doesn’t support the java Bluetooth API JSR-82. So wecouldn’t initialize the Bluetooth stack of the dongle in our way. To make the dongle work weused its driver CD to initialize the stack. We send stream data to PC using its serial portprofile over the RFCOMM protocol layer. The Bluetooth dongle works as a receiver or a server and we developed a program forthe mobile which works as the client. The client first discovers the Bluetooth devices aroundit. Then it discovers what services they contain. If the device is a desktop and supports theserial port profile, out client can interact with it over its RFCOMM protocol layer. The clientprogram sends some stream data as command to PC’s virtual communication port. There isa server program in the PC which reads stream data from the communication port andexecutes those commands.The client programWe developed a MIDLET for our mobile phone which will work as the client. We gave thename of our client program “MOBILE MANIA”. Our client program contains all the basiccomponents of a Bluetooth application. It can perform the following tasks: 1. Device Discovery 2. Service Discovery
    • 3. Communication with a Desktop computer 4. Can gain the Bluetooth address of the server to connect 5. Can gain the Bluetooth information about the host micro device This is the basic interface of our client program. From its menu we can choose to discoverany Bluetooth device around the host mobile phone or can view the Bluetooth informationabout the mobile phone. It can discover any device around its Bluetooth range and can showits friendly name.Basic Parts of the Client program:Basic components of the client program are a. Device Discovery b. Service Discovery c. Controlling the whole pcDevice DicoveryOur client program can discover any Bluetooth devices around it. Whenever the Devicediscovery option is pressed it starts the discovery agent to discover any remote device.
    • DiscoveryAgent agent = device.getDiscoveryAgent(); agent.startInquiry( DiscoveryAgent.GIAC, new Listener() );Our client device starts in GIAC mode, which means other remote device also can discoverour device. Whenever a device is discovered a discovery Listener shows the friendly nameof the Bluetooth device.Service DicoveryOur client program is also capable of Discovering Services offered by the remote device.Our program search services with the UUID 0x0003 which is the UUID for RFCOMM. agent.searchServices( null, // attributes to retrieve from remote device new UUID[]{ new UUID( 0x0003) }, /* search criteria, 0x0003 = RFCOMM*/ remote, new Listener());Whenever a service is found our program stores the service records in a service array. Thenour program retrieves the service name from a user defined function uuidToName andshows the list of services in the MIDLET screen. ServiceRecord rec = (ServiceRecord)bluetooth.services.elementAt(i); DataElement e = rec.getAttributeValue( 0x0001 ); // ServiceClassIDList Enumeration en = (Enumeration)e.getValue(); DataElement e2 = (DataElement)en.nextElement(); Object v = e2.getValue();Controlling The PC
    • The PC controlling part of our program can send command to a connected PC to controlsome basic component of it. The mobile connects with the PC by obtaining the url Stringthat is needed to connect to the device from the ServiceRecord object that we get fromservice discovery. Our program generates the connecting string automatically by comparingthe UUID of Serial Port profile with the UUID of discovered service record objects in thecurrent inquiry. If there is a match then our program saves the connecting string to connectwith the remote device. if ( u.equals( new UUID( 0x1105 ) )){ //0x1105 UUID for serial port profile remote=(RemoteDevice)bluetooth.devices.elementAt(deviceDiscoveryUI.getSelected Index()); URL="btspp://"+remote.getBluetoothAddress()+":"+i+";master=false;encrypt =false;authenticate=false"; }In the connecting string the part “btspp:” means Bluetooth serial port profile, the nextnumber is the Bluetooth address of the remote device which is found bygetBluetoothAddress() method. The next digit will be the channel number which will be theindex number of the matching UUID in the Service Record. Here master is false whichmeans that the client can only request for data transferring operation. Encrypt andAuthenticate is also false. If there is no matching UUID found then our program rejects to be connected. Ourprogram also checks the characteristics of the remote device. If the remote device is acomputer and a desktop then it gives permission to be connected. DeviceClass cls = (DeviceClass) bluetooth.deviceClasses.elementAt( selectedDevice ); if((cls.getMajorDeviceClass())!=256&&(cls.getMinorDeviceClass())!=4) alert( "This Device cant perform PC controlling Operation", deviceDiscoveryUI ); The PC Controlling interfaceIf all the requirements were fulfilled then our PC controlling interface appears. Through thisinterface we can perform the whole PC controlling operation or can connected to our PC. con = (OutputConnection) Connector.open( url2,Connector.WRITE ); out = con.openOutputStream(); byte[] data1 = new byte[]{ (byte)nam}; out.write( data1 ); out.flush(); out.close();
    • The Java communications API: The Java communications API is a package that can be used to write platform-independent communications applications for technologies such as voice mail, fax, and smartcards. This Java communications API contains support for RS232 serial ports. Using thisAPI one can: 1. Enumerate ports available on the system. 2. Open and claim ownership of ports. 3. Resolve port ownership contention between multiple applications. 4. Perform asynchronous and synchronous I/O on ports. 5. Receive Beans-style events describing communication port state changes.The Java communications API does not support unsigned applet access to ports.
    • The Receiver Program: The receiver program is used in the computer which receives command from the client’smobile through serial port and takes necessary steps to perform different actions. İt contains all thenecessary informations to receive command from the client and to contrtol computer as well asexternal electric devices. When the receiver program is run it always waits for a connection from any bluetooth remotedevice within it’s range. The receiver is waiting for connection from any Bluetooth enable Basic Parts of the Receiver Program The receiver program in the computer can be discussed according to its basic parts. It has the following basic parts: i. Creating the Graphical User Interface(GUI) ii. Adding action Listener to the buttons iii. Writing the current parameters of the port to a configuration file
    • iv. Creating properties object from configuration file v. Setting parameters to the property object vi. Handling the exception of opening more than one port at a time vii. Receiving data sent from the client viii. Comparing string and generating commands ix. Showing the current status of the receiver.Creating the Graphical User Interface (GUI):The GUI part of the receiver program contains several labels, buttons, panels, textarea ofjavax.awt class. The buttons and textareas are added in panels. The whole GUI part is placed in aconstructor. The components are placed to their absolute position by using the functionsetBound( ).As the GUI part is placed in the constructor, whenever the receiver program is run theGUI part becomes visible.Adding action listener to the buttons:Here three buttons are used: “Open Port”, ”Close Port” and “EXIT”The actions to be performed by these buttons are specified in this part of the receiver program. Anyexception in performing the specified action is handled here.Now let us discuss about the actions performed by these three buttonsOpen Port:Once the program is started, the appropriate communication port to receive the data fromclient is selected from the list of available communication ports. Then the button “Open Port”is pressed to open the selected port. After the port is successfully opened, it becomes ready toreceive data sent from mobile by the client.Close Port:When the function of the opened port come to an end, that port should be closed so that anotherports can be opened further. Because in case of serial port only port can be accessed at a time. Soafter performing action the port should be closed.EXIT:If the receiver wishes to be disconnected from client, then the receiver program should be closed.This is done by pressing the “EXIT” button. After pressing the “EXIT” button if any port remainsopened at that time, then that port is closed and after this the program terminates.
    • Showing the current status of the receiver:In the text area the current status of the receiver remains shown. When the client send newcommands status of the receiver becomes changed. This help anyone near the receiver to know thecommand that is currently being processed by the computer Confirmation Message after successful connection to a remote device. Bluetooth Serial port B is now being openLimitationsThough we have developed our software using the platform independent programminglanguage Java but our software is not totally platform independent at all.Our soft ware canonly read data from the serial port. It can generate signal from the PC. So we can perform
    • two way operation. Our software also can’t initialize the Bluetooth stack for dongle. It needsa matching driver for the dongle.ConclusionThis software is very much user-friendly. To use it one needs just to press button to controlpc operation. User don’t have to know the Bluetooth address of the server PC. It candiscover any Bluetooth device and there services around it.This software is applicable for all versions of WINDOWS operating system. As maximumcomputer users feel comfort to use this operating system. We are looking forward to improveour software to make it truly platform independent and to implement the software in two waycommunication.Future plan1.Our future plan is to stream music files and video files (.3gp,mp4,avi) from pc.2. Accessing the internet via pc.Resources: 1. Jdk 5.5 2. Net Beans IDE 5.5 3. Java how to program 6th edition - Deitel & Deitel 4. The Complete Reference J2ME -Herbert Schildt 7 . Bluetooth For Java -Bruce Hopkins 8 . javax.comm package
    • Installation Process: There are two parts of our software. One is developed for the mobile phone (client sided)which must be installed in appropriate mobile phone. To do so, 1. Transfer the .JAR and .JAD file to the mobile phone provided in the CD.(recommended to Bluetooth Serial port enable mobile) 2. Install it. The other part is developed for the personal computer (server sided) which processes theupcoming command and takes actions.This software is bundled with JRE-1.6 and does not requirespre-installation of JAVA. It is also required to attach a blue tooth receiver to your computer if it isnot capable of receiving blue tooth signal. It is suggested to use a Bluetooth dongle. Now, 1. Install driver for your Bluetooth receiver device. 2. Install the Receiver software. To do that just double click the “Receiver.msi” file and the software will be automatically installed. 3. See (Bluetooth driver software >My Service> Properties>Serial port B ) 4. Select the port which is used by the Bluetooth receiver from the port list and open it (suggest to select the Bluetooth serial port B).