Bluetooth Hotspot
-
Upload
smita-dagade -
Category
Documents
-
view
275 -
download
7
Transcript of Bluetooth Hotspot
Project ReportOn
“BLUETOOTH HOTSPOT”
By
Miss. Payal Doshi
Miss. Trupti Dhepe
Miss. Harshal Jamdade
Guided By
Prof. Madhavi Gangurde
Department Of Computer Engineering
Vidyavardhini’s College of Engineering & TechnologyVasai Road (West)-401202
University of Mumbai2008-2009
1
VIDYAVERDHINI’S COLLEGE OF ENGINEERING AND TECHNOLOGYVASAI ROAD, THANE
DEPARTMENT OF COMPUTER ENGINEERING
This is to certify that project entitled
“BLUETOOTH HOTSPOT”
has been carried out by,
Miss. Payal Doshi
Miss. Trupti Dhepe
Miss. Harshal Jamdade
Students of final year B.E. (Computer Engineering) under my
guidance & submitted the complete Final Year Project of the
requirement for the award of degree of
“BACHELOR OF ENGINEERING”
in Computer Engineering of the Mumbai University
during academic year 2008 - 2009
----------------------
Project Guide
---------------------- ---------------------- Head of Department Principal
2
---------------------- ----------------------Internal Examiner External Examiner
3
ACKNOWLEDGEMENT
We take this opportunity of submitting this dissertation to express our deep regard towards those who offered their invaluable assistance and guidance in the hour of needs.
After completion of our project “BLUETOOTH HOTSPOT”We look back in retrospect to the people who have helped us in our work. Without their invaluable help and guidance, the completion of this project would have been a difficult task.
We would like to express our sincere gratitude towards the people who guided us through our project.
Co-ordination and guidance of out internal guide Prof. Madhavi Gangurde who helped us sail smoothly to completion of our project and provided us their helping hand in all technical aspects.
We thank Prof. Vikrant Agaskar, our Head of Department (Computer) for his guidance and help whenever required.
We are very grateful to our Principal, Dr. Mohan N. Bhave and our college authotities for providing facilities and excellent infrastructure.
4
TABLE OF CONTENTS
1. INTRODUCTION ……………………………………………………… 011.1 Project Definition 011.2 Objective 011.3 Brief Description of the Project 011.4 Scope of the Project 041.5 Software Engineering Approach 04
2. SOFTWARE AND HARDWARE REQUIREMENTS ……………… 082.1 Software Requirements 082.2 Hardware Requirements 122.3 Bluetooth Technology Overview 132.4 RFCOMM Protocol 162.5 OBEX Protocol 17
3. ANALYSIS ……………………………………………………………… 183.1 Introduction 183.2 Existing System 183.3 Drawback Of Existing System 193.4 Proposed System 193.5 Feasibility Study 20
4. REQUIREMENTS SPECIFICATION ………………………………… 234.1 Introduction 234.2 General Description 244.3 Functional Requirements 24
5. CLASS DIAGRAM ……………………………………………………… 27
6. OBJECT ORIENTED DIAGRAMS …………………………………… 296.1 Use Case Diagram 296.2 Activity Diagram 326.3 Data Flow Diagrams 346.4 Sequence Diagram 45
7. DESIGN ………………………………………………..………………… 47Introduction 47Architectural Design 47Functional Design 48User Interface 49
5
8. CODING AND TESTING ……………………………………………… 508.1 Coding 508.2 Testing 50
9. CONCLUSION …………………………………………………………. 578.1 Conclusion 578.2 Future Enhancement 57
ANNEXURE –A (Table Structure) ……………………………………….. 58
ANNEXURE –B (Sample GUI Forms) …………………………………… 59
ANNEXURE –C (Sample Codes) …………………………………………… 65
ANNEXURE –D (References) ……………………………………………… 89
6
1. INTRODUCTION
1.1 PROJECT DEFINITION
Bluetooth hotspot is a technology which allows Bluetooth enabled mobiles (clients) to access the
internet. With this technology mobile phones need not have a GPRS connection in it. The technology
also manages the clients entering, leaving and connecting to the Bluetooth Server. It manages the
web page request of each client connected to the Bluetooth Server.
This one is free for Bluetooth enabled mobile users and the speed is much better than what GPRS
ever offered.
1.2 OBJECTIVE
The objective of this project is to evaluate the market for Bluetooth technology as a hotspot access
technology. It identifies the need for Bluetooth hotspots in order to exploit the proliferation of
wireless devices and the development of wireless applications that can benefit everyone in the
society. It also describes a design and implementation strategy for a Bluetooth hotspot deployment.
In terms of social conception, Bluetooth hotspots have the ability to bridge the digital divide between
people who do or do not have access to the technology. It is not necessary to purchase a PC , a laptop
or a PDA which are often used for business and work related purposes, for occasionally checking
email and browsing the Internet. There are some consumers who are not a frequent user of the
Internet due to the nature of their work, lifestyle or income. This group of people is Katter off
investing in a Bluetooth enabled mobile phone to access the Internet.
1.3 BRIEF DESCRIPTION OF THE PROJECT
System Concept
A hotspot is a public location such as an airport, shopping mall or conference centre that has readily
accessible wireless Bluetooth network. Bluetooth is
A specification for ‘a small form-factor, low-cost radio solution' providing links between mobile
computers, mobile phones and other portable handheld devices, and connectivity to the Internet. It
will enable users to connect a wide range of computing and telecommunications devices easily and
simply, without the need to buy, carry, or connect cables.
7
System Overview
The following diagram gives a very extensive idea about the system proposed. This system
essentially covers most of the issues related to setting up a basic network. Bluetooth Service Login
Authentication.
Figure1. Basic structure of the hotspot network
As shown in Figure 1, there are two major components of the entire system. The first component is
the Bluetooth hotspot network which consists of many machines in a client server configuration. The
Bluetooth network is essentially a collection of many Bluetooth devices like mobile phones. A
"Bluetooth Server” connects the entire network to the Internet acting as a gateway to the “clients”.
The second part of the network is the Bluetooth service manager. This is mainly the software used to
manage the users of that particular system. This system takes care about the login and authentication.
The customer enters his/her user details to gain access to the service. Then the authentication process
validates the users. User details are stored in a database with access details.
Bluetooth dongles are used as an access point for the clients and the servers. Windows XP has been
proved to give the best support for Bluetooth. Thus Windows XP would be the best possible
candidate for the server environment. The dongle is installed with drivers which enable it to perform
various network functions including Internet access.
8
Implementation
The structure of the Bluetooth network is described as follows.
Figure2. Architecture of the hotspot network
Figure 2 shows that the Bluetooth clients are connected to the hotspot server.
Before the clients can be connected to the server, they have to be paired with the Bluetooth Server.
Pairing is an important part in a Bluetooth setup. When the client requests to be connected to the
server, the server asks for a passkey. When the client and the server enter the same passkey then the
devices are paired together and can perform network functions. For a hotspot network, a common
passkey could he maintained for the day. The patrons can be provided this passkey over the counter.
This passkey can be changed on a daily basis. Authentication is probably the most important part of
the system. Therefore we prefer a manual control on the devices present in the hotspot in the form of
hotspot manager.
The server has to be setup to enable Internet Connection and redirect the web pages to mobiles. The
server recognizes the client‘s request for Internet access and sends the request to the Internet Server.
It gets the web page in the format accessible in mobiles from the Internet Server and sends it to the
requesting client and thus enables the client to access Internet.
A centralized database will maintain the details of all users along with date and time of login
registered to the system. Once the user enters the hotspot, a simple “Passkey” facility will enable the
user to access the Internet.
9
1.4 SCOPE OF THE PROJECT
As the number of Bluetooth products increases each year, it is important to develop applications and
services to take full advantage of their potential and capabilities. A broadband hotspot is one
application where Bluetooth has a value in providing Internet access to mobile users. Consumers
owning a Bluetooth enabled mobile phone can easily access a Bluetooth hotspot to browse the
Internet without having to carry a PDA or a laptop.
Today, the majority of people are in possession of a mobile phone. The number of mobile phone
users is increasing each year. Mobile phone creates more possibilities for social networking. The
deployment of Bluetooth hotspots will widen access to broadband services using mobile phones not
only to professionals and mobile workers but more importantly, to other segments of consumers who
want to go on-line for non-business related and sociable purposes, and to consumers who do not own
PCs.
1.5 SOFTWARE ENGINEERING APPROACH
The steps involved in Software engineering are shown below:
1) Reorganization of need
2) Feasibility study
3) System Analysis
4) System Design
5) Implementation
6) Post-implementation and maintenance
Phase 1: Reorganization of need
The client wants to build a face reading website to attract people towards this art. There are few sites
which provide this but they are quite time consuming and inconvenient.
Phase 2: Feasibility study
The feasibility study proposes one or more conceptual solutions to the problem set for the project.
The conceptual solutions give an idea of what the new system will look like. They define what will
be done on the computer and what will remain manual. They also indicate what input will be needed
by the systems and what outputs will be produced i.e. in feasibility study the analyst has to do
evaluation of existing systems and procedures. He has to present a number of alternative solutions to
the user. After consulting with user, the analyst has to finalize one alternative, which will be best for
all the given solutions.
10
Phase 3: System Analysis
Analysis is a detailed study of the various operations performed by a system and their relationships
within and outside of system i.e. it includes finding out in more detail what the system problems are
and what the different new changes the user wants. During analysis analysts use many of the
commonly used system analysis techniques, such as data flow diagram, decision table and so on.
Analysis must spend considerable time examining components, such as the various forms used in the
system, as well as the operation of finishing computer systems.
This phase results in a detailed model of the system. The model describe the system functions,
system data and system information flows i.e. once analysis is completed, the analyst has a firm
understanding what is to be done. The next step is to decide how the problem might be solved.
Phase 4: System Design
The system design is the most important and challenging phase of the system life cycle. Analysis
phase is used to design the logical model of the system and system design phase in used to design the
physical model of the system. The system design phase produces a design for the new system. There
are many things to be done here. Designers must select the equipment needed to implement the
system. They must specify new programs or changes to existing databases. Designers must also
produce detailed documents that describe how users will use the system.
Thus, in this phase, the designer/analyst designs:1) Output
2) Input
3) File
4) Processing
Output design means that what should be the format for presenting the results obtained. It should be
in most convenient, attractive format for the user. In input design phase, which is a part of system
design phase the system analyst has to decide what inputs are required for the system and prepare
input format to give input to the system according to user’s requirement.
File design deals with how the data has to be stored on physical devices. Finally process design
includes the description of the procedure for carrying out operations on the given data.
Phase 5: System Implementation
During implementation, the components built during development are put into operational use.
Following are the activities which takes place during system implementation phase:
1) Writing, testing, debugging and documenting programs
11
2) Ordering and installing any new hardware.
3) Establishing a maintenance procedure to repair and enhance the system.
4) Completing system documentation.
5) Evaluating the final system to make sure that it is fulfilling original needs and that it begins
operation on time and within budget.
Phase 6: Post Implementation and maintenance
The system is considered to be working when phase five has been completed. However, there are
still a number of activities that take place after a system is completed. The two main activities are:
1) Post Implementation
2) Maintenance
The post-implementation activity takes place after a year to determine that whether the system is
perfectly working or not, whether the system is satisfying the user needs or not, if not, changes are
made to the system to make it perfect.
It includes following tasks:
1) Correcting errors
2) Resolving necessary changes
3) Enhances or modifies the system
Thus, we can say that the system development life cycle is the set of activities that analysts and
designers carry out to develop and implement an information system, includes preliminary
investigation – collection of data and determination of requirements, design of system, development
of software and system testing and implementation.
Process Model selected for our project: - “Linear Sequential Model”.
The Sequential model suggests systematic and sequential approach to software development that
begins at system level and project through the following activities:
12
FIG1.1: SOFTWARE DEVELOPMENT LIFE CYCLEFIG1.1: SOFTWARE DEVELOPMENT LIFE CYCLE
11. . Analysis:Analysis:
This covers a detailed study of requirement of both the users and software. This activity is basically
concerned with ‘what’ of the system such as
i) What are inputs in the system?
ii) What are the different conditions?
iii) What are the processes required?
iv) What are the outputs accepted?
2. Design2. Design
The design phase deals with the various concept of the system design such as data structure, software
architecture and algorithms. This phase translates the requirements into representation of software.
This stage answers the question of ‘how’.
3. Coding3. Coding
Coding refers to the translation of the design into machine redable form. The more detailed design,
easier its coding and better its reliability.
4. Testing4. Testing
Once the code is written it should be tested rigorously for correctness of code and results. Testing
May involved the individual units or whole system. It requirds detailed plan as to what, when and
how to test.
5. Maintenance5. Maintenance
After software has been installed it may undergo some changes. Some this may occurs due to change
in the user’s requirement, operating environment or error in the software that has not been fixed
during testing. Maintenance insures that these changes are incorporated whenever necessary.
13
2. HARDWARE AND SOFTWARE REQUIREMENTS
Bluetooth Hotspot System is designed to run on client-server architectures.
2.1 SOFTWARE REQUIREMENTS
2.1.1 Server Side:a) Operating System
We are using Windows XP operating system
With Windows XP service pack 2, for many Bluetooth USB dongles no drivers are required.
You just plug-in the Bluetooth USB dongle and Windows XP with Service Pack 2 detects it
and in short time you can use it - pair with devices, connect to their services, connect your
Windows Mobile devices over Bluetooth over ActiveSync, etc
Windows XP also has a facility to generate a passkey automatically for the connection
between the mobile phone and your computer. You can use this passkey or enter one of your
own. Passkeys can have up to 16 characters. The passkey must be entered within 30 seconds,
or authentication may not succeed.
b) Bluetooth API
Blue Cove 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.
Blue Cove 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
c) Java Development Kit
This is used to design and execute the Java Server Programs. We have used JDK1.5.0_17 for
this purpose.
14
d) MS-Access
We are using MS-Access as the back-end for storing the Bluetooth devices and the files sent
to them and web pages requested by them.
e) Sun Wireless Toolkit
This toolkit simulates the output on a mobile phone. This is used for the purpose of designing
and testing of client program.
2.1.2 Java as Front End:
Simple
Java was designed to be easy for the professional programmer to learn and use effectively. If you
already understand the basic concepts of object-oriented programming, learning Java will be even
easier. In java, there are a small number of clearly defined ways to accomplish a given task.
Object-Oriented
Java was not designed to be source-code compatible with any other language. One outcome of this
was a clean, usable, pragmatic approach to objects. Borrowing liberally from many seminal object-
software environments of the last few decades, Java manages to strikes a balance between the
purists’s “everything is an object” paradigm and the pragmatist’s “stay out of my way” model.
Robust
Multiplatform environment of the Web places extraordinary demands on a program, because the
program must execute reliably in a variety of systems. Thus, ability to create robust programs was
given a high priority in the design of Java. To gain reliability, Java restricts you in a few key areas.
Java is strictly typed language; it checks your code at compile time. It also checks your code at run
time.
Multithreaded
Java was designed to meet the real-world requirement of creating interactive, networked programs.
The Java run-time system comes with an elegant yet sophisticated solution for multiprocess
synchronization that enables you to construct smoothly running interactive systems. Java’s easy-to-
use approach to multithreading allows you to think about the specific behavior of your program, not
the multitasking subsystem.
Interpreted and High Performance
Java enables the creation of cross-platform programs by compiling into an intermediate
representation called Java byte code. This code can be interpreted on any system that provides a Java
15
Virtual Machine. It is true that Java was engineered for interpretation, the Java byte code was
carefully designed so that it would be easy to translate directly into native machine code for very
high performance by using a just-in-time compiler. Java run-time systems that provide this feature
lose none of the benefits of the platform-independent code. “High-performance cross-platform” is no
longer an oxymoron.
Dynamic
Java programs carry with them substantial amounts of run-time type information that is used to
verify and resolve accesses to objects at run time. This makes it possible to dynamically link code in
a safe and expedient manner. This is crucial to the robustness of the applet environment, in which
small fragments of byte code may be dynamically updated on a running system.
Platform Independent
Sun identifies “Write once, run anywhere” as the core value proposition of the Java Platform.
Translated from the business jargon, this means that the most important Promise of Java technology
is that you only have to write your application once—for the Java platform and then you’ll be able to
run it ANYWHERE. Anywhere, that is, that supports the Java Platform. Fortunately, Java support is
becoming ubiquitous. It is integrated, into practically all major operating systems.
2.1.3 Using Microsoft Access as Database
Database plays an important role in solving the problems of information management.
Large database and Space management:
ACCESS server supports the largest of database roughly 1,000,000 terabytes for example: you can
store 100 megabytes each about every man, woman, child on the planet in single ACCESS database
server. It also gives support for up to 64GB of physical RAM as well as supports 32 processes in a
single instance.
Security:
ACCESS server provides with an authentication mode so that no one gets in unless they are granted
access and once users are inside, various security systems keep prying eyes out to sensitive areas.
These features make it easy to manage even most complex design for data access. Another key
benefit of Java is its security features. Both the language and the platform were designed from the
ground up with security in mind. The Java platform allows users to download untrusted code over a
network and run it in a secure environment in which it cannot do any harm: it cannot infect the host
system with a virus. The security features of the Java language and platform have been subjected to
intense scrutiny by security experts around the world.
16
Data Integrity:
The process of restricting the data to enter in your table is referred to as enforcing data integrity, such
as domain, entity and referential, this has reduced the cost of coding and managing checks in many
database applications.
17
2.2 HARDWARE REQUIREMENTS
2.2.1 Server Side:
a) Bluetooth Dongle
Bluetooth Dongle is required to convert non-Bluetooth PC to Bluetooth enabled one. It is
accompanied by software required for its installation. We have use “BlueSoleil” software.
Specifications:
- Version 2.0
- Range 10m
- Interface: Compliant with USB 2.0 & 1.1
- Data Transmission Rate: 3Mbps
b) Processor
Pentium4/Celeron 2.0 GHz
c) RAM
Minimum: 512 MB (Recommended 1 GB)
2.1.2 Client Side:
a) Bluetooth enabled mobile phone with JVM and JSR82 support .
JSR82 is Java Specification for Bluetooth. Since the client has to send web page URL
through Bluetooth, the client device must have JSR82 support along with a Java Virtual
Machine (JVM) which is required to execute any J2ME program on the device.
18
2.3 BLUETOOTH TECHNOLOGY OVERVIEW
The Basic Components of a Bluetooth ApplicationThe basic components of any Bluetooth application consist of the following items:
Stack initialization
Device management
Device discovery
Service discovery
Service registration
Communication
Stack Initialization
Now before you can do anything, your stack needs to be initialized. Remember, a Bluetooth stack
has direct access to the underlying Bluetooth device. Stack initialization can consist of a number of
things, but its main purpose is to get the Bluetooth device ready to start wireless communication.
Stack initialization sequences can vary, and it's heavily dependent upon the underlying OS and
Bluetooth radio. In some cases (in particular, with the Rococo Palm DK) no code is needed at all to
initialize your stack. In other cases, you'll need to write a bit of code to get your stack initialized
because you need to specify baud rates for your RS-232 interface.
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 (Local Device) and
also some information on the devices in the area (Remote Device). The Device Class object gives
you information about the official class of device (CoD) as defined in the Bluetooth specification.
Device Discovery
Your 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. Who knows? The possibilities are
endless. In order to find out, your Bluetooth device will use the device discovery classes that are
provided in the Java Bluetooth API to
See what's out there. Which Bluetooth devices should use device discovery? Well, if you are
planning to use a peer-to-peer application in Bluetooth, like two PDAs in a chat session, then either
device would use device discovery to find the other device. If you are planning to use a client-server
type application, like printing from a lap-top to a printer, then the client is most likely to perform
19
device discovery. It doesn't make sense for the printer to constantly look for devices that want to
print something.
Now, let's take a look at the two classes needed in order for your Bluetooth device to discover remote
Bluetooth devices in the area: Discovery Agent and DiscoveryListener.
Service Discovery
After you have located devices in the area, it would be really nice to see what services those devices
offer. Of course, you can always inspect the DeviceClass object, but that may only reveal half the
picture. Let's say that you want to print a text file. Obviously, if the DeviceClass indicates that the
major device class of the RemoteDevice is a printer, then you're all set. But what if the major device
class is a computer? Would it come to mind that you can also print to a computer that is acting as a
print server? 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.DiscoveryAgent, DiscoveryListener, ServiceRecord, DataElement, and UUID. You'll also
interact (indirectly) with the SDDB whenever you want to discover services on a remote Bluetooth
device.
Service Registration
Before a Bluetooth client device can use service discovery on a Bluetooth server device, the server
needs to register its services internally. That process is called service registration. This section
discusses what's involved in service registration for a Bluetooth device, and we'll also give you a
rundown of the classes needed to accomplish this.
Note: In a peer-to-peer application, like a file transfer or chat application, be sure to remember that
any device can act as the client or the server, so you'll need to incorporate that functionality into your
code in order to handle both scenarios of service discovery and service registration.
Here's a scenario of what's involved in getting your service registered and stored in the SDDB:Call
Connector.open() and cast the resulting connection to a streamConnectionNotifier object.
Connector.open() creates a new ServiceRecord and sets some attributes.
1. Use the LocalDevice object and the StreamConnectionNotifier to obtain the ServiceRecord that
was created by the system.
2. Add or modify the attributes in the ServiceRecord (optional).
3. Use the StreamConnectionNotifier to call acceptAndOpen () and wait for Bluetooth clients to
discover this service and connect.
20
4. The system creates a service record in the SDDB. Wait until a client connects. When the server is
ready to exit, call close () on the StreamConnectionNotifier.
5. The system removes the service record from the SDDB.
Communication
Bluetooth is a communication protocol. The official Java Bluetooth API gives you three ways to
send and receive data.
Bluetooth specification gives you three protocols to send and receive data:
RFCOMM (for stream data)
L2CAP (for packet data)
OBEX (for object data)
We have used last two protocols. So let’s take a deeper look into these protocols.
21
2.4 RFCOMM PROTOCOL
The most common Bluetooth profiles use the Serial Port Profile as a foundational layer.
Note RFCOMM is the protocol layer that the Serial Port Profile uses in order to communicate, but
these two items are almost always used synonymously.
Sessions and Connections
Before we continue, there's a little more terminology to introduce here: sessions and connections.
You can only have a single session between two Bluetooth devices. This limitation isn't a big deal,
per se, because the definition of a session is simply one or more connections shared between two
devices. You can also relate a Bluetooth session in the same way that sessions are created and used
on the Web. When a Web server is
Communicating to a Web client, there is only one session, although there are numerous connections.
Now, a Bluetooth device can have multiple sessions only if each session is linked to a different
device. This also applies on the Web; powerful application servers have the capability to create
multiple sessions and keep them in memory, but each session is linked to a different client.
22
2.5 OBEX PROTOCOL
OBEX (which stands for OBject EXchange) is a communication protocol that allows object data to
be transferred between two devices (it doesn't matter if those devices are wirelessly or physically
connected). OBEX was originally created by the Infrared Data Association (IrDA), but it later
became one of the Bluetooth adopted protocols (like WAP). Take a look at to see where OBEX fits
in the Bluetooth and IrDA protocol stacks.
In the Bluetooth specification, OBEX is the underlying protocol that is used to implement the
following Bluetooth profiles:
Generic Object Exchange Profile
Object Push Profile
Synchronization Profile
File Transfer Profile
Basic Imaging Profile
Basic Printing Profile
The OBEX protocol has simple client/server architecture. OBEX clients get objects from and put
objects onto OBEX servers. OBEX servers wait around for incoming requests from clients. The
OBEX definition can be summarized in two parts: the OBEX Object Model and the OBEX Session
Protocol. The Object Model provides the definition of OBEX objects and information on how to
transfer them. The Session Protocol defines the handshaking that needs to occur between the client
and the server when transferring objects between devices.
23
3. ANALYSIS
3.1 INTRODUCTION
When we plan to do in any project we need to have a reason to do it. We need to answer questions
like
1. Why we need to build this?
2. What is the system right now?
3. What it lacks?
4. What approach should we use?
5. Is it the correct way, is it feasible?
We do all this in the analysis phase of our project building. It is in the analysis phase we learn about
the system its plus point, its drawbacks, our approach to build the
3.2 EXISTING SYSTEM
3.2.1 Wi-Fi
Most widely used wireless technology today, is Wi-Fi. Wi-Fi hotspots are deployed in shopping
malls, cafes, public libraries etc. It gives internet access to Wi-Fi enabled laptops or to Wi-Fi enabled
mobile phones for free or at a low cost to the ones in that hotspot area.
A wireless network uses radio waves, just like cell phones, televisions and radios do. In fact,
communication across a wireless network is a lot like two-way radio communication. Here's what
happens:
1) A computer's wireless adapter translates data into a radio signal and transmits it using
an antenna.
2) A wireless router receives the signal and decodes it. It sends the information to the
Internet using a physical, wired Ethernet connection.
The process also works in reverse, with the router receiving information from the Internet, translating
it into a radio signal and sending it to the computer's wireless adapter.
The radios used for Wi-Fi communication are very similar to the radios used for walkie-talkies, cell
phones and other devices. They can transmit and receive radio waves, and they can convert 1s and 0s
into radio waves and convert the radio waves back into 1s and 0s.
24
3.2.2 GNU box
Further there is at technology for Bluetooth enabled devices too. Some of the tech savvy people
might have heard that we are able to connect our mobile to access internet connection on PC by
simply downloading software, which is available for free. This software is the GNU Box.
Yes its true one of the best application but little tricky. Basically GNU Box lets your pc share your
internet connection with your phone over Bluetooth making you have free internet on your phone
this is a bit tricky and it takes a while to get it right but you'll be satisfied with the results just follow
the tut and you'll do just fine.
All that the GNU Box does is modify the communications database settings. You need it because the
user interface (Settings|Connection|Access points) doesn't allow you to specify the right settings. No
software is needed to run in the background for this to work.
3.3 DRAWBACK OF EXISTING SYSTEM
The current system is comparatively slower and requires costlier tools to be installed and maintained.
3.4 PROPOSED SYSTEM
Bluetooth hotspot is software developed to allow internet access to multiple Bluetooth devices
present in the Hotspot area. The main objective of the project is to develop low cost technology that
is affordable and useful to common man. Hence no costly hardware is used. The sole hardware
required for the project is a Bluetooth dongle.
What is Bluetooth Dongle?
The Bluetooth USB dongle allows data transfer between multitudes of devices. Transfer information
from your PC or Laptop to Car Kits, Mobile Phones, PDAs, GPS Receivers and much more. You can
now join the VOIP revolution and combine with a Bluetooth Headset to enable voice calls on the
internet with SKYPE. In short the Bluetooth dongle converts non-Bluetooth PC to Bluetooth enabled
one.
25
The Bluetooth Dongle attached to the hotspot server is used as router in this case. Thus server is set
up as an access point through which the Bluetooth clients can access internet.
3.5 FEASIBILITY STUDY
Whenever a project is initiated, it is necessary to check whether the new system is feasible to
develop or install. The main objective is to determine whether the development of the project has a
reasonable chance of success.
There were three types of Feasibility Study carried out during the field study of the project. They
were related as follows:
Economic Feasibility
Technical Feasibility
Behavioral Feasibility
Economic Feasibility: In the economic feasibility, the project was considered and cost estimation
was done that is how much cost will be appropriately required for overall development of the project
and will the project be actually implemented and will the clients find the software to be useful
enough to implement for their personal use or for the organizational use.
COST ESTIMATION:
Sr.No. Expense Description Value
1 Number of the programmers 3
2 Number of hours per programmers 60
3 Coding cost per hour Rs.70
4 Remuneration per programmer 80*60 = Rs.4800
5 Total Remuneration of the project 4800*3 = Rs.14400
6 Documentation Cost Rs.1600
7 Internet charges and other expenses Rs.800
TOTAL Rs.16800
26
EFFORT ESTIMATION:
Although relatively few analysis and specification metrics have appeared in the literature, it is
possible to adapt metrics that are often used for project estimation. The function point metric (FP)
can be used effectively as a means for measuring the functionality delivered by the system. The FP
can be used for following:
1) Estimating the cost or effort required to design code and test the software.
2) Predicting the number of errors that will be encountered during testing.
3) Forecasting the number of components and/or the number of projected source lines in the
implemented system.
Estimation table: -
The project complexity is taken to be average.
Information domain value
Count Simple Average Complex FP Count
Number of inputs 14 3 4 6 56
Number of outputs 6 4 5 7 30
Number of inquiries 2 3 4 6 8
Number of files 2 7 10 15 20
Number of external interfaces
0 5 7 10 0
COUNT TOTAL 114
Complexity weighting factor: -
Factor ValuesBackup and recovery 3Data communication 3Distributed processing 2Performance critical 3Existing operating environment 4
27
On line data entry 5input transaction over multiple screen 3Master file update online 2Information domain value complex 2Code design for reuse 4Conversion/installation in design 1Multiple installation 1Application design for change 3Complexity adjustment factor 2Total 38
Finally the estimated number of FP is derived,FP (estimated) = count total*[0.65+0.01*summation of (Fi)] = 117.42
Technical Feasibility: In the technical feasibility, the project was checked and the software and the
hardware requirements of the project was pre calculated. In checking the project for the technical
feasibility, we considered that will the project require high end hardware or a normally configured
personal computer will run the software. Even, it is considered that if the software can work with the
minimum amount of the software requirements that is an extra software product for running the
project will be needed or not.
Behavioral Feasibility: In this feasibility study, the project was checked and assumed that if the
software is actually developed, will the interface provide user friendly enough for a non-computer
educated client to work with the software. Will the clients in the organization accept this software?
28
4. REQUIREMENT SPECIFICATION
4.1 INTRODUCTION
Requirements specification helps in understanding the design and implementation issues for
the technical staff of both the system procedure and the system developer. Requirements analysis is a
software engineering task that bridges the gap between system level software allocation and software
design.
4.1.1 Purpose:
We are building this Bluetooth Hotspot system to enable free access of internet to the Bluetooth
devices like mobile phones in the Hotspot area. This technology will allow users to send a URL
request to the Hotspot Server. The Hotspot Internet Server then returns the web page back to the
client device. This received content is in raw form and needs to be further processed for getting
proper display of webpage. This processing is done by HTML parser. The proposed system will be
user friendly and will not require any specialized knowledge for operation. The Bluetooth Hotspot
System with easy and convenient interface will help its users to easily surf through the web pages.
The application will have the front end of JAVA for server and J2ME for client and backend of MS-
Access.
4.1.2 Scope:
As the number of Bluetooth products increases each year, it is important to develop applications and
services to take full advantage of their potential and capabilities. A broadband hotspot is one
application where Bluetooth has a value in providing Internet access to mobile users. Consumers
owning a Bluetooth enabled mobile phone can easily access a Bluetooth hotspot to browse the
Internet without having to carry a PDA or a laptop.
Today, the majority of people are in possession of a mobile phone. The number of mobile phone
users is increasing each year. Mobile phone creates more possibilities for social networking. The
deployment of Bluetooth hotspots will widen access to broadband services using mobile phones not
only to professionals and mobile workers but more importantly, to other segments of consumers who
want to go on-line for non-business related and sociable purposes, and to consumers who do not own
PCs.
4.1.3 Abbreviation:
Some of the abbreviations used in the coding are:
JDBC ODBC Connectivity
Where JDBC stands for Java Database Connectivity &
ODBC stands for Open Database Connectivity
29
AWT stands for Abstract Window Tool Kit
J2ME stands for Java 2 Micro Edition
GUI stands for Graphic User Interface
4.2 GENERAL DESCRIPTION
This section will look into the description of the project in terms of coding format. The functions
involved user characteristics and constraints that exist with them.
4.2.1 Product Function Overview:
The product being the output is the server software that will work on a machine having connection to
internet server and must have minimal configuration with java installed over it. The entire project is
being built up with java as front end & MS Access as back end. For Client a Bluetooth device with
JSR82 support is required.
4.2.2 User Characteristics:
While designing the system we have taken care that the user looks apparently in control and at ease.
There is no much load added to the user’s memory. The interface is consistent through out the
system. We have taken maximum care so that the user if given wrong input will not face difficult
situation. To run this system the user does not need to aware of the technology used both on the cli nt
as well as on the server side.
General Constraints:
The following are the general constraints over the system:
The user needs to send the correct URL
The user needs to allow his Bluetooth device to connect to the server.
4.3 FUNCTIONAL REQUIREMENTS
The system designed has certain functions present. These functions have certain requirements to
execute as desired. They also have certain constraints. They take some specific input and give certain
output. We will see them in the following points:
4.3.1 General description of INPUT/OUTPUT:
The Bus Reservation System requires some certain inputs from the user.
4.3.1.1 Inputs:
Device Name and Address.
Address of File(Client Program) to be sent
30
Hit send button to send the file
URL of the required web page.
4.3.1.2 Outputs:
File is sent to the selected device
Web page is sent to the requesting Bluetooth device
4.3.1 Functional Description:
The following will help you to view all functions occurring in the report:
Hotspot Manager
Input: 1) Device name and address
2) Address of the file to be sent.
3) Press ‘Send’ button.
Output: 1) “File Sent” Message on screen
Functions: 1) Refresh list to find new devices when ‘Refresh’ Button is hit.
2) Selecting of device and file from the list.
3) Find the Obex address of the selected device.
4) Get permission from Bluetooth device for pairing.
5) Send file to the Obex address
6) Notify the manager whether file has been successfully sent or not.
Hotspot Internet Server
Input: 1) URL or web page address from the client device
Output: 1) Web page Sent to Client device.
Functions: 1) Make connection with the Internet server
2) Send the URL and get the web content fron the Internet server
3) Forward the content to requesting client device.
Client Request MIDlet
Input: 1) URL from the client (user).
Output: 1) Redirection to HTML parser.
Functions: 1) Send URL to the Hotspot Internet server
2) Get web content from the Hotspot Internet server
3) Forward the content to HTML parser.
31
HTML Parser
Input: 1) Web Content
Output: 1) Web page with proper layout suitable for the Bluetooth device
Functions: 1) Calculate the size of display screen of the client Bluetooth device.
2) Check each HTML tag and convert the content next to it accordingly
3) Form proper layout and display the content the MIDlet.
32
5. CLASS DIAGRAM
Class diagram is similar to a family tree. A class diagram consists of a group of classes and
interfaces reflecting important entities of the business domain of the system being modeled, and the
relationships between these classes and entities. The classes and interfaces in the diagram represent
the members of the family tree and the relationships between the classes are analogous to
relationships between members in a family tree. Classes in a class diagram are interconnected in a
hierarchical fashion, like a set of parent classes and related child classes under the parent classes.
By definition, a class diagram is a diagram showing a collection of classes and interfaces,
along with the collaborations and relationships among classes and interfaces.
A class diagram is a pictorial representation of the detail system design. A class diagram is a static
view system. The structure of a system is represented using class diagram .a class diagram is
composed primarily of a class.
Class:
A class represents an entity of a given system that provides an encapsulated implementation of
certain functionality of a given entity. These are exposed by the class to the other classes as methods.
Apart from business functionality, a class also has property that reflects unique features of a class.
The properties of a class are called attributes. Class is represented by a rectangle.
The class diagram depicting our social networking system is as shown on next page:
33
Hopspot manager
namequalification
send_prog()truncate()
User
user_namelogin_timeLeaving_time
install()type_URL()read_URL()activation()truncate()
1..*
1
1..*
1
manages
Client program
length
open_window()send_URL2BTserver()
Internet server
(from Use Case View)
BT server
IP addrname
detect()authenticate()queing()send_URL2IS()send_webpage2user()accept_page()
1
1..*
1
1..*
accept pairing
1..*
1
1..*
1
send client program
1
1
1
1
send webpage
1
1
1
1
send URL
1
1
1
1
send URL
1
1
send requested webpage
1
1
Fig. Class diagram of Bluetooth Hotspot
34
6. OBJECT ORIENTED DIAGRAMS
6.1 USE CASE DIAGRAM:
The use case diagram is used to identify the primary elements and processes that form the system.
The primary elements are termed as “actors” and the processes are called “use cases”. The use case
diagram shows which actors interact with each use case.
A use case diagram captures the functional aspects of a system . More specifically it captures the
business processes in the system. Use case diagram defines the requirements of the system being
modeled and hence are used to write test scripts for the modeled systems.
A use case diagram is quite simple in nature and depicts 2 types of elements : one representing the
business roles while the other representing the business processes.
1. Actor:
An actor portrays any entity (or entities) that perform certain roles in a given system . the different
roles the actor represents are the actual business roles of a user in a given system. An actor in a use
case diagram interacts with the use case. An actor is shown as a stick figure in a use case diagram
depicted “outside” the system boundary.
An actor in a use case diagram
2. Use case
A use case in a use case diagram is a visual representation of distinct business functionality in a
system. A use case is shown as an ellipse in a use case diagram.
Use cases in use case diagram
35
Use case diagram:
Given below is the use case diagram representing our social networking system:
bluetooth Usecase Diagram
bluetooth server
hotspot manager
Internet server
Users
Activate bluetooth device & open visibility of device
detect bluetooth device in Hotspot
Send message for pairing
Accept pairing by typing appropriate passkey
If passkey is correct authenticate user
send client program
Allow installation of client program
Type URL of webpage&send to server
Take URL from user&device name
Queueing the request of webpages
Send request to internet server one by one
send required webpage to BT server
Accept webpage from Internet server & convert into the mobile format
Send tne webpage to appropriate client
Read page
Stop BT connection to a perticular device
36
6.2 ACTIVITY DIAGRAM:
Activity diagram represents the business and operational workflow of a system. An activity diagram
is a dynamic diagram that shows the activity and the event that causes the object to be in a particular
state. An activity diagram talks more about the transitions and activities causing the changes in the
object states.
Activity diagrams are typically used for business process modeling. They consist of:
Initial node.
Activity final node.
Activities
The starting point of the diagram is the initial node, and the activity final node is the ending. An
activity diagram can have zero or more activity final nodes. In between activities are represented by
rounded rectangles. A typical activity diagram is as shown below
Fig. A typical activity diagram
37
Given below is the activity diagram representing our social networking system:
do/ detect bluetooth device
do/ Authenticate passkey
do/ truncate connection
do/ Send client program
If passkey is coorect?
do/ Queing of URL request
queue empty?
do/ Do nothing
do/ Send a URL to internet server
yes
no
do/ convert web page into mobile format
do/ send webpage to appropriate mobile
do/ activate bluetooth device
do/ Accept pairing by appropriate passkey
do/ Allow installation of client prog
do/ Type URL of webpage
do/ Read web page
do/ Send mesg for pairing
do/ send webpage
do/ Open window to type URL
read new web page?
do/ truncate
Ato open window
yes no
from read web page condition
Client ProgramInternet ServerHotspot managerUsersBluetooth Server
Fig. activity diagram for Bluetooth Hotspot
38
6.3 DATA FLOW DIAGRAM:
A data-flow diagram (DFD) is a graphical representation of the "flow" of data through an
information system. It differs from the flowchart as it shows the data flow instead of the control flow
of the program.
A data-flow diagram can also be used for the visualization of data processing (structured design).
A data flow diagram mainly consists of the following:
1. Function
2. File/Database
3. Input/Output
4. Flow
Level 0 Diagram
A context level Data flow diagram created using Select SSADM.
This level shows the overall context of the system and its operating environment and shows the
whole system as just one process. It does not usually show data stores, unless they are "owned" by
external systems, e.g. are accessed by but not maintained by this system, however, these are often
shown as external entities.
39
Level 1 (High Level Diagram)
Fig. A Level 1 Data flow diagram for the same system.
This level (level 1) shows all processes at the first level of numbering, data stores, external entities
and the data flows between them. The purpose of this level is to show the major high-level processes
of the system and their interrelation. A process model will have one, and only one, level-1 diagram.
A level-1 diagram must be balanced with its parent context level diagram, i.e. there must be the same
external entities and the same data flows, these can be broken down to more detail in the level 1, e.g.
the "enquiry" data flow could be spilt into "enquiry request" and "enquiry results" and still be valid.
Level 2 (Low Level Diagram)
40
Fig. A Level 2 Data flow diagram showing the "Process Enquiry" process for the same system.
This level is a decomposition of a process shown in a level-1 diagram, as such there should be a
level-2 diagram for each and every process shown in a level-1 diagram. In this example processes
1.1, 1.2 & 1.3 are all children of process 1, together they wholly and completely describe process 1,
and combined must perform the full capacity of this parent process. As before, a level-2 diagram
must be balanced with its parent level-1 diagram.
DATA FLOW DIAGRAM
(LEVEL 0)CONTEXT LEVEL DIAGRAM
41
Bluetooth hotspot software
Application Manager
Bluetooth Server
Internet Server
User
Send Message for pairing
Truncate connection of a device
Detect device & authenticate
Send client pgm
Queue requests for web pages
Accept URL
Send Web Page
Accept Web Page
Send URL
Send Passkey
Allow Installation
42
Hotspot manager
Users
1. Activation
2. Pairing & detection
3. Install
5. Truncate connection
LEVEL 1BLUETOOTH
HOTSPOT
4. Process URL
Bluetooth server
Bluetooth device
Internet server
43
Users
Mobile
1.1On Bluetooth device
1.2 Make device visible to all
44
LEVEL 21. Activation
DETECTION & PAIRING
Hotspot manager
Users
2.2 Inform manager
2.3 send request for pairing
2.7Establish connection if passkey matches
2.6 match passkey on server 2.4Type
passkey on BT device
2.5 type passkey on server
2.1 Detect BT device in hotspot
2.8 Add device & Details in database
LEVEL 22. Pairing & Detection
DETECTION & PAIRING
User information
BT server
45
BT server Users
3.1 Send client program
3.2Install client program
LEVEL 23. Install
3. INSTALL
Client program
3.3 open window to type URL
46
User
BT server4.1 type URL & send
4.3 store URL & Details
4.2 send URL to server
4.7 send webpage to appropriate user
4.5 send requested webpage
4.4 send URL
4.6 convert webpage into mobile format
Client program
Internet server
User information
LEVEL 24. Process URL
4. PROCESS URL
47
LEVEL 2
5. Truncate Connection
User
Hotspot manager
BT server
5.1 don’t want to see new webpage
5.2 truncate connection
5.3 Accept device name& update user details
48
User information
Client program
BT server
LEVEL 34.7 SEND WEBPAGE TO APPROPRIATE MOBILE
4.7.1 Check sending device of given URL
4.7.3 Update user information
4.7.2 Send the webpage to the device
User information
49
6.4 SEQUENCE DIAGRAM:
A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram that
shows how processes operate with one another and in what order. It is a construct of a Message
Sequence Chart.
Sequence diagrams are sometimes called Event-trace diagrams, event scenarios, and timing
diagrams.
UML sequence diagrams are used to show how objects interact in a given situation. An important
characteristic of a sequence diagram is that time passes from top to bottom: the interaction starts near
the top of the diagram and ends at the bottom. Sequence diagram consists of the following behavioral
elements.
1. Objects
The primary element involved in a sequence diagram is an object-instance of a class. A sequence
diagram consists of sequences of interaction among different object over a period of time. An object
is represented by a named rectangle. And to the left of “;”is the object name and to its right is the
class name.
fig eg . Of a symbol for object
2. Messages
The interaction between different objects in a sequence diagram is represented as messages. A
message is denoted by a directed arrow. Depending on the type of message, the notation differs.
Fig e.g. of a symbol for message
The sequence diagram representing our social networking system is as shown on next page:
50
51
7. DESIGN
7.1 INTRODUCTION:
Design has been described as multi-step process in which representation of data and program
structure, interface characteristics and procedural detail are synthesized from information
requirements. Design is essentially the bridge between requirement specification and the final
solution for satisfying the requirements.
7.2 ARCHITECTURAL DESIGN:
The architectural design phase identifies the multiple components and the interaction among them. It
provides enough detail on the component to write and detail designs. During this phase, top level
designs, all forms, report, data structures, program module and human interfaces based on the
information contained in the System Specification document. It also identifies the design criteria and
design constraints applicable.
Primary objective of the architectural design is to develop a modular program structure and
represent the control relationship between modules. In addition, it melds program structure and data
structure defining interfaces that enable data to flow throughout the program.
7.2.1 Problem Specification:
We are building this Bluetooth Hotspot system to enable free access of internet to the Bluetooth
devices like mobile phones in the Hotspot area. This technology will allow users to send a URL
request to the Hotspot Server. The Hotspot Internet Server then returns the web page back to the
client device. This received content is in raw form and needs to be further processed for getting
52
proper display of webpage. This processing is done by HTML parser. The proposed system will be
user friendly and will not require any specialized knowledge for operation. The Bluetooth Hotspot
System with easy and convenient interface will help its users to easily surf through the web pages.
The application will have the front end of JAVA for server and J2ME for client and backend of MS-
Access.
7.3 FUNCTIONAL DESIGN:
The procedure followed during implementation is as follows:
o Server continuously opens for detecting new Bluetooth devices in Hotspot area.
o Bluetooth client in hotspot turns on its Bluetooth Connection
o Server detects connection and sends pairing request and also informs the manager
about new device in the Hotspot
o Hotspot manager enters passkey for pairing after examining the new client.
o Server sends the client program to client device through Bluetooth
o Client allows the installation of client program sent by the server.
o A window to accept URL is opened after installation
o Client types the URL of required webpage
o The server notes the URL and the device that requested it
o The URL is then sent to Internet server.
o The web page is fetched and returned to Bluetooth Server
o The server checks database to get the name of requesting device for currently
processed URL
o The web page is then sent to the Bluetooth Device
o The client program opens the web page for client to read
o The client can now request for another web page or close the client program
application.
53
7.4 USER INTERFACE:
The Interface design focuses on three areas of concern:
The design of interface between software components.
The design of interfaces between the software and other non-human producers and consumers
of information.
The design of interface between a human and a computer.
The user interface design creates an effective communication between a human and a computer.
The system has following forms for user interface:
Hotspot Manager
Hotspot Internet Server
Client Request MIDlet (Client Side)
For Details of these refer ‘Annexure B’.
54
8. CODING AND TESTING
8.1 CODING:
The goal of the coding and programming phase is to translate the design of the system produced
during the design phase into code in a given programming language which can be executed and
which performs specified by the design. The coding phase affects both testing and maintenance
profoundly. The goal during this phase is to simplify the job of the tester and the maintainer.
The coding of our project is done in JAVA. The database is created in Microsoft Access. The
compatibility between Java and MS-Access helps set up a high standard system.
Java is a well defined language. The user can only view the frame output but the coding remains
hidden. Java is a simple, platform independent, robust, multithreaded, high performance coding
language. Also java is well known and easy language. The database being in MS-Access provides
useful characteristics like security, data integrity etc.
Thus using these standard technologies we have built our project.
8.2 TESTING:
Testing is a set of activities that can be planned in advance and conducted systematically. Any
testing strategy must incorporate test planning, test case design, test execution and resultant data
collection and evaluation. A software testing strategy should be flexible enough to promote a
customized testing approach. Testing is an individualistic process and number of test varies as the
development approaches.
8.2.1 Test Plan:
8.2.1.1 Test Unit:
We have basically four modules two test:
Searching Bluetooth Devices
Sending File
Sending Request from Client to Server.
Searching and Sending Webpage to the client.
8.2.1.2 Features to test:
The following are the features to test:
8.2.1.3 Testing Approach:
We would follow a mixed approach of various testing techniques:
White Box Testing:
55
White Box tasting also known as glass box testing, uses control structure of procedural design to
derive test cases. We would be using it for Conditional testing and Data flow testing.
Conditional Testing will be used for radio button selection in face analysis form and in image file
uploading in contact form.
Data Flow Testing will be used to check the flow of parameters in between the form and from
database to the text file.
Black Box Testing:
Black Box Testing is used to examine the specifications to see what the program must do under
various conditions. It will check for incorrect or missing functions, interface errors and behavior or
performance errors.
It is used to find the outcomes of various inputs in the program i.e. Blank input, invalid input or valid
input.
With the above testing we also have Unit testing, Integration testing, Validation testing and System
testing.
8.2.1 Testing Environment:
The system is tested in two environments:
Developer’s Site:
The system is tested in a controlled environment in presence of the developers. It is also known as
Alpha Testing.
User’s Site:
The system here is tested in uncontrolled environment. It is done by user. Any errors are reported to
the developer. It is known as Beta Testing.
56
8.2.2 Sample Test Cases:
1) No Bluetooth Device is present in the Hotspot Area:
2) On Pressing ‘Refresh’ when few Bluetooth devices are present the area:
57
3) When File is sent Successfully:
4) When File is not sent:
58
5) No URL on the Client Window on pressing ‘Submit’:
59
6) Valid URL
7) Invalid URL
7.1) Server is not connected to Internet:
7.2) Wrong URL:
60
61
9. CONCLUSION
9.1 CONCLUSION:
The penetration rate of mobile phone user is higher than other handheld devices such as PDAs and
laptops. Due to the fact that it is affordable and small, every segment of society including teenagers,
professionals and elderly people has a mobile phone for social networking, businesses or work
related purposes and also emergency cases. The realization of the importance of extending the
availability and accessibility of information, mobile phone manufacturers are exploiting the
development of wireless technology to include Bluetooth in particular, in most of their mobile phone
models. As a result, the functionalities and capabilities of a mobile phone have extended, not just to
make and receive calls but also to surf the Internet, check email, download software or application,
play games and listen to music.
Bluetooth hotspot is one of the potential services to be offered to mobile phone users. It will make
surfing Internet free of cost in Bluetooth Hotspot enabled area. So one does not have to depend on
the costly GPRS system provided by the telecom companies. Also the power consumption is much
low as compared to Wi-Fi Hotspot.
9.2 FUTURE ENHANCEMENT:
The Bluetooth Hotspot can be extended in terms of area under hotspot by deploying multiple access
points in the form of server.
The hotspot servers at a greater distance (in Kms) can be connected through internet and the clients
of both the hotspots can communicate with each other free of cost. This gives additional feature to
Bluetooth devices which generally cannot communicate with other devices at a long distance (in
Kilometers) due to the short range of the Bluetooth.
The current system does not support JavaScript and emailing. This can be introduced to make this
technology a full fledged product.
62
Annexure A
The database required for the system .The database is created in Microsoft Access. We require
database to store information of the Bluetooth devices and the files sent to that device. The tables are
shown below:
63
Annexure B
1] When the application starts the following window will be displayed.
2] When hotspot manager presses Refresh button:
64
3] When hotspot manager selects one of the detected Bluetooth device:
4] Hotspot manager then clicks Browse button to select file:
65
5] After selecting file, full path of that file is displayed in text field then Hotspot manager presses Upload file button to send selected file to selected device:
6] After receiving file by selected device following message will be displayed:
66
7] After pressing OK button you will get empty text field so that hotspot manager can select new device:
8] After selecting new device & if that device is paired with hotspot server but its Bluetooth is not ON then the corresponding message will be displayed:
67
9] After pressing OK button:
10] Hotspot Internet Server is continuously waiting for web page requests
68
11] A Client Device requests for a web page
12] Web page is sent. Connection is closed and client is waiting for another request.
69
Annexure C
btframe.java
import java.sql.*;import java.util.Date;import java.text.DateFormat;import java.util.Timer;import java.util.TimerTask;import java.awt.*;import java.awt.event.*;import java.io.*;import java.util.*;import javax.swing.*;import javax.swing.event.*;import javax.swing.border.*;import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.util.List;import java.util.logging.Level;import java.util.logging.Logger;import javax.bluetooth.BluetoothStateException;import javax.bluetooth.RemoteDevice;import javax.swing.DefaultListModel;import javax.swing.JFileChooser;import java.io.OutputStream;import javax.obex.ClientSession;import javax.obex.HeaderSet;import javax.obex.Operation;import java.lang.String;import javax.bluetooth.DeviceClass;import javax.bluetooth.DiscoveryAgent;import javax.bluetooth.DiscoveryListener;import javax.bluetooth.LocalDevice;import javax.bluetooth.RemoteDevice;import javax.bluetooth.ServiceRecord;
public class btframe extends JFrame { JList deviceList=new JList(); public DefaultListModel model; String addr;
70
private LocalDevice localDevice; private DiscoveryAgent agent; public BluetoothBrowser browser1; public Connection dbconn1; public MSaccessconn msconn; public int index; void refreshList() { ApplicationContext context = ApplicationContext.getInstance(); deviceList.removeAll(); model = new DefaultListModel(); List<RemoteDevice> devices = context.getDevices(); if(devices!=null) { for(RemoteDevice device : devices) { try { model.addElement( "" + device.getFriendlyName(false) +" ( "+ device.getBluetoothAddress() +" )"); } catch (IOException ex) { Logger.getLogger(btframe.class.getName()).log(Level.SEVERE, null, ex); } } } deviceList.setModel(model); repaint(); }
public btframe() { super("Bluetooth Hotspot");
msconn= new MSaccessconn(); dbconn1=msconn.getConnection();
JPanel panel = new JPanel( new BorderLayout() ); panel.setLayout( new GridBagLayout() ); panel.setBorder( new EmptyBorder( new Insets( 10, 10, 10, 10 ) ) ); getContentPane().add( BorderLayout.CENTER,panel);
JScrollPane jsp = new JScrollPane(); deviceList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jsp.setViewportView(deviceList);
71
JLabel label1 = new JLabel(); label1.setText("Select Bluetooth Device:"); label1.setBackground(Color.white);
JLabel label2 = new JLabel(); label2.setText("Select File to Upload:"); label2.setBackground(Color.white);
final JTextField txt1 = new JTextField(); Dimension longField = new Dimension( 200, 20 ); txt1.setPreferredSize( longField );
JButton rb=new JButton("Refresh"); JButton bb=new JButton("Browse"); JButton ub=new JButton("Upload File");
GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets( 3, 3, 3, 3 ); c.gridx = 0; c.gridy = 0; c.weightx = 0.0; c.gridwidth = 1; // spans across 1 columns c.fill = GridBagConstraints.HORIZONTAL; // fills the 1 columns panel.add( label1, c );
c.gridx = 5; panel.add( rb, c );
c.gridx = 0; c.gridy = 1; c.weightx = 1.0; c.gridwidth = 6; // spans across 5 columns c.fill = GridBagConstraints.HORIZONTAL; // fills the 5 columns panel.add( jsp, c );
c.gridx = 0; c.gridy = 2; c.weightx = 0.0; c.gridwidth = 1; // spans across 1 columns c.fill = GridBagConstraints.HORIZONTAL; // fills the 1 columns panel.add( label2, c );
c.gridx = 0; c.gridy = 3; c.weightx = 1.0; c.gridwidth = 3; // spans across 1 columns c.fill = GridBagConstraints.HORIZONTAL; // fills the 1 columns
72
panel.add( txt1 , c );
c.gridx = 5; c.gridy = 3; c.weightx = 0.0; c.gridwidth = 1; // spans across 1 columns c.fill = GridBagConstraints.HORIZONTAL; // fills the 1 columns panel.add( bb , c );
c.gridx = 0; c.gridy = 4; c.weightx = 0.0; c.gridwidth = 1; // spans across 1 columns c.fill = GridBagConstraints.HORIZONTAL; // fills the 1 columns panel.add( ub , c );
ActionListener lst = new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); if(fileChooser.showDialog(btframe.this, "Select File") == JFileChooser.APPROVE_OPTION) { txt1.setText(fileChooser.getSelectedFile().getPath()); } } }; bb.addActionListener(lst);
lst = new ActionListener() { public void actionPerformed(ActionEvent evt) { BluetoothBrowser browser; try { browser = new BluetoothBrowser(btframe.this); browser.inquiry(); } catch (BluetoothStateException ex) { Logger.getLogger(btframe.class.getName()).log(Level.SEVERE, null, ex); } } }; rb.addActionListener(lst);
lst = new ActionListener()
73
{ public void actionPerformed(ActionEvent evt1) { try { index=deviceList.getSelectedIndex(); System.out.println("index:"+index);
// Build URL for the bluetooth device, note the port 9 browser1 = new BluetoothBrowser(btframe.this); browser1.serviceinquiry(index); String s_URL = browser1.s_URL; System.out.println("sURL:"+s_URL); if(s_URL==null) {
String message = "Device does not support Object Push OR device is not active."; JOptionPane.showMessageDialog(btframe.this, message,"ERROR !", JOptionPane.ERROR_MESSAGE);
index=-1; txt1.setText(""); System.out.println(""+index); } else { //add information of selected device in database RemoteDevice remoteDevice=(RemoteDevice)browser1.devicesDiscovered.elementAt(index); DateFormat plain = DateFormat.getInstance( ); String now = plain.format(new Date( )); // 4/12/00 6:06 AM
String sql="insert into device(Device_Address,Friendly_name,ac_file,dt_time) values ('" + remoteDevice.getBluetoothAddress() + "','" + remoteDevice.getFriendlyName(false) + "','" + txt1.getText() + "','" + now + "')"; try { Statement stmt = dbconn1.createStatement(); int result = stmt.executeUpdate( sql ); System.out.println("result:" + result); if ( result == 1 ) {
System.out.println( "Record inserted." + remoteDevice.getBluetoothAddress()); } stmt.close(); }
74
catch ( SQLException sqlex ) {
System.out.println( sqlex.toString() ); } // Get file as bytes FileInputStream stream = new FileInputStream(txt1.getText()); File f = new File(txt1.getText()); int size = (int) f.length(); byte[] file = new byte[size]; stream.read(file);
// Filename String filename = f.getName();
// Trigger the task in a different thread so it won't block the UI SendFileTask task = new SendFileTask(s_URL, file, filename); Thread thread = new Thread(task); task.run();
String message = "File has been sent successfully !"; JOptionPane.showMessageDialog(btframe.this, message,"Message", JOptionPane.ERROR_MESSAGE); s_URL=null; index=-1; txt1.setText(""); System.out.println("new"+s_URL+"" +index); }
} catch(Exception ex2) { System.err.println("Ex: " + ex2.getMessage()); ex2.printStackTrace(); } } }; ub.addActionListener(lst);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setSize(2000,900); pack();
}//End of constructor
public static void main(String[] args)
75
{ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new btframe().setVisible(true); } }); }//End of main
}//End of class
BluetoothBrowser.java
import java.io.*;import java.util.*;import javax.bluetooth.*;import javax.microedition.io.*;import javax.obex.*;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;import javax.swing.border.*;import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.util.List;import java.util.logging.Level;import java.util.logging.Logger;import javax.bluetooth.BluetoothStateException;import javax.bluetooth.RemoteDevice;import javax.swing.DefaultListModel;import javax.swing.JFileChooser;import javax.bluetooth.DeviceClass;import javax.bluetooth.DiscoveryAgent;import javax.bluetooth.DiscoveryListener;import javax.bluetooth.LocalDevice;import javax.bluetooth.RemoteDevice;import javax.bluetooth.ServiceRecord;
public class BluetoothBrowser implements DiscoveryListener { private LocalDevice localDevice; private DiscoveryAgent agent; private btframe bf;
76
private ApplicationContext context; private static Object lock=new Object(); public static final Vector devicesDiscovered = new Vector(); public static String s_URL=null;
public BluetoothBrowser(btframe bf) throws BluetoothStateException { localDevice = LocalDevice.getLocalDevice(); agent = localDevice.getDiscoveryAgent(); this.bf = bf; context = ApplicationContext.getInstance(); } public void inquiry() throws BluetoothStateException { agent.startInquiry(DiscoveryAgent.GIAC, this); }
public void deviceDiscovered(RemoteDevice device1, DeviceClass devClass) { context.addDevice(device1); devicesDiscovered.addElement(device1); synchronized(lock) { lock.notify(); } } public void servicesDiscovered(int transID, ServiceRecord[] servRecord) { System.out.println("Discovered a service....."); for(int i=0;i<servRecord.length;i++) {
s_URL=servRecord[i].getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,true);
System.out.println("The service URL is "+s_URL); } } public void serviceSearchCompleted(int transID, int responseCode) { System.out.println("search completed."); System.out.println("URL:"+s_URL);
synchronized(lock) { lock.notify(); }
77
} public void inquiryCompleted(int discType) {
bf.refreshList(); synchronized(lock) { lock.notify(); } }
public void serviceinquiry(int index) throws BluetoothStateException { s_URL=null; RemoteDevice remoteDevice=(RemoteDevice)devicesDiscovered.elementAt(index); javax.bluetooth.UUID[] uuidSet = new javax.bluetooth.UUID[1]; uuidSet[0]=new javax.bluetooth.UUID("1105",true); System.out.println("\nSearching for service..."); agent.searchServices(null,uuidSet,remoteDevice,this); try { synchronized(lock) { lock.wait(); } } catch (InterruptedException e) { e.printStackTrace(); } } }//End of class
78
ApplicationContext.java
import java.awt.*;import java.awt.event.*;import java.io.*;import java.util.*;import javax.swing.*;import javax.swing.event.*;import javax.swing.border.*;import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.util.List;import java.util.logging.Level;import java.util.logging.Logger;import javax.bluetooth.BluetoothStateException;import javax.bluetooth.RemoteDevice;import javax.swing.DefaultListModel;import javax.swing.JFileChooser;import javax.bluetooth.DeviceClass;import javax.bluetooth.DiscoveryAgent;import javax.bluetooth.DiscoveryListener;import javax.bluetooth.LocalDevice;import javax.bluetooth.RemoteDevice;import javax.bluetooth.ServiceRecord;import java.util.ArrayList;
public class ApplicationContext { public static ApplicationContext instance; private ApplicationContext() { devices = new ArrayList<RemoteDevice>(); }
public static ApplicationContext getInstance() { if(instance==null) { instance = new ApplicationContext(); } return instance; }
private List<RemoteDevice> devices;
public void addDevice(RemoteDevice device) { devices.add(device);
79
}
public List<RemoteDevice> getDevices() { return devices; } }
MSaccessconn.java
import java.sql.*;
public class MSaccessconn { public MSaccessconn() { } public Connection getConnection() { Connection conn=null; // Loading driver try { String url = "jdbc:odbc:btdevice"; Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ); conn = DriverManager.getConnection( url ); } catch ( ClassNotFoundException cnfex ) { cnfex.printStackTrace(); } catch ( SQLException sqlex ) { sqlex.printStackTrace(); } catch ( Exception excp ) { excp.printStackTrace(); }
return conn; } }
80
SendFileTask.java
import java.io.*;import java.util.*;import javax.bluetooth.*;import javax.microedition.io.*;import javax.obex.*;import java.io.OutputStream;import javax.microedition.io.Connection;import javax.microedition.io.Connector;import javax.obex.ClientSession;import javax.obex.HeaderSet;import javax.obex.Operation;
public class SendFileTask implements Runnable { private String btConnectionURL; private byte[] file; private String filename;
public SendFileTask(String s_URL, byte[] file, String filename) { this.btConnectionURL = s_URL; this.file = file; this.filename = filename; }
public void run() { try { if(btConnectionURL == null) { System.out.println("Can't send file to selected device it is not active. "); } else { Connection connection = Connector.open(btConnectionURL);
// connection obtained // now, let's create a session and a headerset objects ClientSession cs = (ClientSession) connection; HeaderSet hs = cs.createHeaderSet();
// now let's send the connect header cs.connect(hs); hs.setHeader(HeaderSet.NAME, filename); hs.setHeader(HeaderSet.TYPE, "binary"); hs.setHeader(HeaderSet.LENGTH, new Long(file.length));
81
Operation putOperation = cs.put(hs); OutputStream outputStream = putOperation.openOutputStream(); outputStream.write(file);
// file push complete outputStream.close(); putOperation.close(); cs.disconnect(null); connection.close(); } } catch (Exception e) { System.err.println("Exception: " + e.getMessage()); e.printStackTrace(); } } }
SPPlinkServer.java
import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.microedition.io.*; import java.io.*; import java.net.*;import javax.bluetooth.*; import javax.bluetooth.RemoteDevice;
public class SPPlinkServer implements ActionListener, Runnable{ LocalDevice device; DiscoveryAgent agent; String HTBTurl = null; Boolean mServerState = false; // stop is default state
Thread mServer = null; String msgOut = "srv out msg"; String msgIn = "no msg rcv"; StreamConnectionNotifier btServerNotifier ; UUID uuid = new UUID("9106", true); JLabel spacerlabel = new JLabel(" ");
JButton startButton = new JButton("Start Server");
82
JTextArea textarea = new JTextArea("",20, 40); JButton endButton = new JButton("End Server");
public SPPlinkServer(){
//Give it the Java look and feel JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("FileServer "); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JScrollPane scrollPane = new JScrollPane(textarea); textarea.setEditable(false); Container cp = frame.getContentPane(); cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
startButton.setAlignmentX(Component.CENTER_ALIGNMENT); startButton.addActionListener(this); cp.add(startButton);
endButton.setAlignmentX(Component.CENTER_ALIGNMENT); endButton.addActionListener(this); cp.add(endButton); spacerlabel.setAlignmentX(Component.CENTER_ALIGNMENT); cp.add(spacerlabel); scrollPane.setAlignmentX(Component.CENTER_ALIGNMENT); cp.add(scrollPane);
frame.pack(); frame.setVisible(true);
updateStatus("[server:] FileServer Application started"); updateStatus("[server:] Press the \"Start Server\" button to await for client devices");
}
private void startServer() { if (mServer !=null) return; //start the server and receiver mServer = new Thread(this); mServer.start(); }
83
private void endServer() { if (mServer == null) return; try { mServer.join(); } catch (Exception ex) {}; mServer = null; } public void run() { try { UUID uuid = new UUID("9106", true); device = LocalDevice.getLocalDevice(); // obtain reference to singleton device.setDiscoverable(DiscoveryAgent.GIAC); // set Discover mode to LIAC }catch (Exception e) { System.err.println("Cant init set discvover"); e.printStackTrace(); }
String url = "btspp://localhost:" + uuid + ";name=BTTP;authenticate=false;master=false;encrypt=false";
try{
// obtain connection and stream to this service btServerNotifier = (StreamConnectionNotifier) Connector.open( url ); } catch ( Exception e)
{ e.printStackTrace(); } while (mServerState ) { StreamConnection btConn = null; try { updateStatus("[server:] Now waiting for a client to connect"); btConn = btServerNotifier.acceptAndOpen();
RemoteDevice dev = RemoteDevice.getRemoteDevice(btConn); System.out.println("Remote device address: "+dev.getBluetoothAddress()); updateStatus("Remote device "+dev.getFriendlyName(true)+"connected"); } catch (IOException ioe)
{
84
} if (btConn != null) processConnection(btConn); } }
void processConnection(StreamConnection conn) { // A client is now connected
String str=null;DataInputStream in=null;
try {
//Reading data--------stream open in=conn.openDataInputStream();
//reading URL and displaying it on the command prompt byte[] b=new byte[64];int p= in.read(b);
System.out.print("data read " +p);str=new String(b);System.out.println(str);str=str.substring(1);System.out.println(str);
updateStatus("request for url:"+str); } catch (Exception e) { e.printStackTrace();
}
try{
//reading Webcontent and displaying it on the command prompt URL url= new URL(str);URLConnection yc=url.openConnection();HttpURLConnection inpcon = (HttpURLConnection)yc;InputStream b_in=inpcon.getInputStream();DataOutputStream out=conn.openDataOutputStream();byte[] fileAsBytes = new byte[1024];while(b_in.read(fileAsBytes)>0){ out.write(fileAsBytes);
System.out.println(new String(fileAsBytes));}
b_in.close();
85
out.close();System.out.println("Data sent");in.close();
} catch (Exception e) { e.printStackTrace();
} try { conn.close(); updateStatus("[server:] Finished connection");
}catch (Exception e ){ } }
public void actionPerformed(ActionEvent e) { if ((e.getActionCommand()).equals("Start Server") ) { startButton.setEnabled(false); mServerState = true; // set server state started startServer(); } if ((e.getActionCommand()).equals("End Server") ) { endButton.setEnabled(false); startButton.setEnabled(true); mServerState = false; endServer(); }
}
public void updateStatus(String message) { textarea.append("\n" + message); }
public static void main(String[] args) { new SPPlinkServer(); } }
86
ClientServer.java
import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import javax.bluetooth.BluetoothStateException;import javax.bluetooth.DeviceClass;import javax.bluetooth.DiscoveryAgent;import javax.bluetooth.DiscoveryListener;import javax.bluetooth.LocalDevice;import javax.bluetooth.RemoteDevice;import javax.bluetooth.ServiceRecord;import javax.bluetooth.UUID;import javax.microedition.io.Connector;import javax.microedition.io.StreamConnection;import javax.microedition.io.StreamConnectionNotifier;import javax.microedition.midlet.*;import javax.microedition.lcdui.*;
public class ClientServer implements DiscoveryListener{ /** Creates a new instance of ClientServer */ UUID RFCOMM_UUID = new UUID(0x0003); private String m_ServerUrl = "btspp://localhost:" + RFCOMM_UUID + ";name=rfcommtest;authorize=true"; private StreamConnection m_StrmConn = null; private LocalDevice m_LclDevice = null; private InputStream m_Input=null; private OutputStream m_Output=null; private StreamConnectionNotifier m_StrmNotf=null; public boolean m_bIsServer=false,m_bServerFound=false,m_bInitServer=false,m_bInitClient=false; private static String m_strUrl; private final String SEVER_RESPONSE= "RUN_THE_GAME",CLIENT_RESPONSE="CLIENT_IS_READY"; private DiscoveryAgent m_DscrAgent=null; private String str=null; private Form form; private TextFieldCapture tf; public ClientServer(TextFieldCapture tf,String str) {
this.tf=tf;this.form=tf.form;this.str=str;
InitClient();
87
} private void InitClient() { SearchAvailDevices(); } public void SearchAvailDevices() { try { //First get the local device and obtain the discovery agent. m_LclDevice = LocalDevice.getLocalDevice(); m_DscrAgent= m_LclDevice.getDiscoveryAgent(); m_DscrAgent.startInquiry(DiscoveryAgent.GIAC,this); } catch (BluetoothStateException ex) { System.out.println("Problem in searching the blue tooth devices"); ex.printStackTrace(); } } public void SendMessages(String v_strData) { try { m_Output.write(v_strData.length()); m_Output.write(v_strData.getBytes()); } catch (IOException ex) { ex.printStackTrace(); } } public void inquiryCompleted(int discType) { System.out.println("InquiryCompleted");
88
} //called when service search gets complete public void serviceSearchCompleted(int transID, int respCode) { if(m_bServerFound) { try { //lets the communication start by setting the url and send client reponse m_StrmConn = (StreamConnection) Connector.open(m_strUrl); m_Output = m_StrmConn.openOutputStream(); m_Input = m_StrmConn.openInputStream(); //m_Output.write(CLIENT_RESPONSE.length()); //m_Output.write(CLIENT_RESPONSE.getBytes());
//SendMessages(str); try
{ m_Output.write(str.length()); m_Output.write(str.getBytes()); m_Output.close(); } catch (IOException ex) { ex.printStackTrace(); }
String st=null;try{
byte[] b=new byte[64]; int p=m_Input.read(b);
System.out.print("data read " +p); st=new String(b);
StringItem si = new StringItem("hello "+st, null); si.setLayout(StringItem.LAYOUT_CENTER | StringItem.LAYOUT_VCENTER);
form.append(si); Display.getDisplay(tf).setCurrent(form);
m_Input.close();}catch(IOException ex){ex.printStackTrace();
StringItem si = new StringItem("Error......", null); si.setLayout(StringItem.LAYOUT_CENTER | StringItem.LAYOUT_VCENTER); form.append(si); Display.getDisplay(tf).setCurrent(form);
} tf.openBsr(st);
System.out.println("serviceSearchCompleted"); }
89
catch (IOException ex) { ex.printStackTrace(); } } }
void CloseAll() { try {
if( m_Output!=null) m_Output.close();
if( m_Input!=null) m_Input.close(); } catch (IOException ex) { ex.printStackTrace(); } }
//called when service found during service search public void servicesDiscovered(int transID, ServiceRecord[] records) { for (int i = 0; i < records.length; i++) { m_strUrl = records[i].getConnectionURL(ServiceRecord.AUTHENTICATE_ENCRYPT, false); System.out.println(m_strUrl); if(m_strUrl.startsWith("btspp://111111111111:")) //we have found our service protocol { m_bServerFound = true; m_bInitClient=true; break; } } }
90
//Called when device is found during inquiry public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) { try { // Get Device Info System.out.println("Device Discovered"); System.out.println("Major Device Class: " + cod.getMajorDeviceClass() + " Minor Device Class: " + cod.getMinorDeviceClass()); System.out.println("Bluetooth Address: " + btDevice.getBluetoothAddress()); System.out.println("Bluetooth Friendly Name: " + btDevice.getFriendlyName(true)); // Search for Services UUID uuidSet[] = new UUID[1]; uuidSet[0] = RFCOMM_UUID; int searchID = m_DscrAgent.searchServices(null,uuidSet,btDevice,this); } catch (Exception e) { System.out.println("Device Discovered Error: " + e); } }
}
TextFieldCapture.java
import javax.microedition.midlet.*;import javax.microedition.lcdui.*;import java .lang.*; public class TextFieldCapture extends MIDlet implements CommandListener { private Display display; public Form form; private Command submit; private Command exit; private TextField textfield; private ClientServer m_BlueObj; private boolean m_bIsServer=false; private BrowserScreen bsr; public String str; public TextFieldCapture() {
91
display = Display.getDisplay(this); submit = new Command("Submit", Command.SCREEN, 1); exit = new Command("Exit", Command.EXIT, 1); textfield = new TextField("Enter URL:", "", 30, TextField.ANY); form = new Form("Web Page Viewer"); form.addCommand(exit); form.addCommand(submit); form.append(textfield); form.setCommandListener(this); textfield.setString("http://www."); }
public BrowserScreen browserCanvas () {return bsr;
}
public void DispNow(BrowserScreen Browser) {
this.bsr=Browser;display.setCurrent(bsr);
} public void startApp() { display.setCurrent(form); }
public void pauseApp() { }
public void destroyApp(boolean unconditional) { m_BlueObj.CloseAll(); }
public void openBsr(String str){bsr=new BrowserScreen(this);
StringItem si = new StringItem("Browser initiated", null); si.setLayout(StringItem.LAYOUT_CENTER | StringItem.LAYOUT_VCENTER); form.append(si); Display.getDisplay(this).setCurrent(form);
//this.DispNow(bsr);
bsr.getURL(str);
92
System.out.println("Browser given data");si = new StringItem("Browser given data", null);
si.setLayout(StringItem.LAYOUT_CENTER | StringItem.LAYOUT_VCENTER); form.append(si); Display.getDisplay(this).setCurrent(form);
display.setCurrent(bsr); }
public void commandAction(Command command, Displayable displayable) { if (command == submit) {
String s=textfield.getString(); textfield.setString(s);form.removeCommand(submit);m_BlueObj=new ClientServer(this,s);
} else if (command == exit) { destroyApp(false); notifyDestroyed(); } }
}
93
Annexure D
BOOKS:
1. C.S.R. Prabhu, A. Prathap Reddi “BLUETOOTH TECHNOLOGY and its Application with
Java and J2ME”
2. Bruce Hopkins, Ranjith Antony “BLUETOOTH FOR JAVA”
3. Jazilah Jamaluddin, Ratish Nair, Reuben Edwards, and Paul Coulton “Widening Access to
Broadband Hotspots Employing Bluetooth”, IEEE 2004.
WEBSITES:1. http://www.bluetooth.com
2. http://forum/nokia.com
3. http://www.ieee.com
4. http://www.jsr82.com
5. http://www.bluecove.com
94