Uploaded by GAURAV SINGH

bluetooth projectReport

advertisement
A Project Report
On
Bluetooth Chat App
Submitted in partial fulfillment of the
requirement for the award of the degree of
BACHELOR OF TECHNOLOGY
B.Tech
Session 2023-24
By
Gaurav Singh - 20scse1010135
Sarvesh Shyamal Sinha - 20scse1010615
Under the guidance of
Dr.Prashant Johri
SCHOOL
OF
COMPUTING
SCIENCE
AND
ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
GALGOTIAS UNIVERSITY, GREATER NOIDA
INDIA
1
CANDIDATE’S iDECLARATION
I/We ihereby icertify ithat ithe iwork iwhich iis ibeing ipresented iin ithe ithesis/project/dissertation,
ientitled i“BlueTooth iChat iApp i i”in ipartial ifulfillment iof ithe irequirements ifor ithe
iaward iof ithe iB.Tech iCSE isubmitted iin ithe iSchool iof iComputing iScience iand iEngineering
iof iGalgotias iUniversity, iGreater iNoida, iis ian ioriginal iwork icarried iout iduring ithe iperiod
iof iJani2024 ito iAprili2024, iunder ithe isupervision iof iDr. iPrashant iJohri, iDepartment iof
iComputer iScience iand iEngineering/Computer iApplication iand iInformation iand iScience, iof
iSchool iof iComputing iScience iand iEngineering i, iGalgotias iUniversity, iGreater iNoida
The imatter ipresented iin ithe ithesis/project/dissertation ihas inot ibeen i submitted iby
ime/us ifor ithe iaward iof iany iother idegree iof ithis ior iany iother iplaces.
Gaurav iSingh: i20SCSE1010135
Sarvesh ishyamal isinha: i20SCSE1010615
This iis ito icertify ithat ithe iabove istatement imade iby ithe icandidates iis icorrect ito ithe
ibest iof imy iknowledge.
Dr iPrashant iJohriI Department iof iSCSE
2
CERTIFICATE
The iFinal iThesis/Project/ iDissertation iViva-Voce iexamination iof iGaurav iSingh i–
i20SCSE1010135, iSarvesh iShyamal iSinha i– i20SCSE1010615 ihas ibeen iheld ion 22 April
2024 iand ihis/her iwork iis irecommended ifor ithe iaward iof iB iTECH iCSE.
Signature iof iExaminer(s)
Signature iof iSupervisor(s)
Signature iof iProgram iChair
Signature iof iDean
3
Table of Contents
1 INTRODUCTION
10-15
1.1 OVERVIEW
1.2 NEED
1.3 PURPOSE
1.4 BENEFITS
1.5 HARDWARE REQUIREMENTS
1.6 SOFTWARE REQUIREMENTS
1.7 APPLICATION ARCHITECTURE
1.8 FEATURES
2 FEASIBILITY STUDY
16-19
2.1. OVERVIEW
2.2. TECHNICAL FEASIBILITY
2.3. ECONOMIC FEASIBILITY
2.4. OPERATIONAL FEASIBILITY
3 REQUIREMENT ANALYSIS
20-25
3.1. OVERVIEW
3.2. SYSTEM ANALYSIS
3.3. REQUIREMENT ANALYSIS/STUDY
3.4. PRESENT SYSTEM
3.5. IDENTIFICATION OF NEEDS
3.6. SOFTWARE REQUIREMENT ANALYSIS (SRS)
3.7. HARDWARE CONFIGURATION
3.8. SOFTWARE CONFIGURATION
3.9. FUNCTIONAL REQUIREMENTS
3.10.NON-FUNCTIONAL REQUIREMENTS
4 SYSTEM DESIGN
26-32
4.1. OVERVIEW
4.2. ENTITY-RELATIONSHIP DIAGRAM
4.3. COMPONENTS OF ER-DIAGRAM
4.4. CLASS DIAGRAM
4.5. UML DIAGRAM
4.6. USE-CASE DIAGRAM
4
5 CODING
33-47
5.1. OVERVIEW
5.2. TECHNOLOGY USED
6 TESTING
48-51
6.1. INTRODUCTION
6.2. OBJECTIVE
6.3. TYPES OF TESTING
6.4. UNIT TESTING
6.5. INTEGRATION TESTING
6.6. VALIDATION TESTING
6.7. SYSTEM TESTING
6.8. TEST CASES
7 SNAPSHOTS
52-58
7.1 HOME PAGE
7.2 MAIN PAGE
7.3 LIST DEVICES PAGE
7.4 CONNECTED DEVICE
7.5 OUTPUT OF CHAT
CONCLUSION AND FUTURE SCOPE
5
59-61
8
Chapter 1
Project Description
Project Title
Bluetooth Chat application
1.1 Overview
Bluetooth is a wireless communication technology that enables the wireless transmission of data over short
distances. Bluetooth can communicate with 2.4 GHz using radio frequencies. Bluetooth technology can reach up to
10 meters of shooting capacity in an open area. Data transfer speeds between 1 Mbps and 721 Kbps are achieved in
transfers with Bluetooth.
“Bluetooth Chat application” is an android application that is used to send and receive messages. We can chat with
our friend if we are in Bluetooth range and don’t have access to the internet.
Also, teachers will able to send notes to multiple students via Bluetooth Chat application and able to teach them. It
will be helpful to students if there is no wi-fi in your school, for travelers to chat between tents in mountains, and in
many other cases.
Need and Purpose1.2
Need
Messaging has become a part of our everyday lives in part due to its convenience for real-time chat communication
and simple-to-use functionality. For instance, an iOS or text message on an iPhone or Android device from a friend,
an email from a co-worker on Microsoft or Gmail, a team chat in a Slack or Microsoft Teams workspace, or even
instant messaging through social media. These messaging and real-time chat applications play an important role in
how the world interacts today, due to their immediacy and vast capabilities.
With the help of Bluetooth Chat application, it is easy to communicate on that places where we face internet
connection problem and it is more beneficial in flights as well where we can just connect with the Bluetooth
application and chat with our friends.
Simply the need for this application is that everyone has now access to chat via Bluetooth connection and do
some good use without using internet or when facing issue with internet.
6
1.3 Purpose
Purpose to develop “Bluetooth Chat application”
I.
Easy to communicate.
II.
Sending and receiving messages in real time.
III.
Used in collaborate learning.
IV.
Help to save your internet data.
V.
Engaging messaging features
1.4 Benefits
I.
Operating reliably, in real-time.
II.
Ensuring security.
III.
Increasing real-time chat app engagement.
IV.
Build real-time chat apps.
1.5 Application Architecture
▪
While using the traditional approach it is difficult to handle and maintain the client data and also time consuming to
find data when we required previous client data So, Online yoga website can solve these types of problems.
The three-tier Architecture for the proposed system is defined as:
1.6 The features of this application are:
Features
Description
Front page
In this section, admin can enter into the next screen where they
connect and pair device and chat.
Ready tab
User can ready their device to start checking available Bluetooth
devices.
List Devices
In this section, admin can check the listed devices which is available to
pair and chat.
7
Connected
In this section, admin can check whether device is connected or start
device
connecting or connection is failed.
Receive
In this section, admin can receive and see messages sent from the
messages
connected device.
Send tab
In this section, admin can send messages whatever they want to send to
the connected device.
1.7 Application Architecture
▪
While using the traditional approach it is difficult to handle and maintain the client data and also time consuming to
find data when we required previous client data So, Online yoga website can solve these types of problems.
The three-tier Architecture for the proposed system is defined as:
1.8 The features of this application are:
Features
Description
Front page
In this section, admin can enter into the next screen where they
connect and pair device and chat.
Ready tab
User can ready their device to start checking available Bluetooth
devices.
8
List Devices
In this section, admin can check the listed devices which is available to
pair and chat.
Connected
In this section, admin can check whether device is connected or start
device
connecting or connection is failed.
Receive
In this section, admin can receive and see messages sent from the
messages
connected device.
Chapter: 2 Feasibility Study
9
Chapter:2
Feasibility Study
2.1 Overview
A feasibility analysis is essential to determine the practicability of an idea to meet the performance requirement
of any proposed system. It is done to reveal whether the project is feasible or not. This study ensures that the
proposed idea is possible or not. It is the starting design stage of any project. This type of study can determine if
the project will be implemented or not. As the analysis implies that we have to cover some aspects to check the
feasibility of the project. The main goals of feasibility study are as follows
▪
To understand all aspects of project
▪
▪
▪
▪
Concept development
Determining the scope
Determining the market values
To measure cost Benefit analysis
▪
To check compatibility with existing system
It is a formal documentation of any project which provides the summarized information about “What is going
to be done”.
The feasibility study includes
▪
▪
▪
▪
▪
▪
Scope of the project
Analyses current market trends and scenarios
Detailed Risk Analysis
Evaluating Cost Analysis
Make Assessment
Recommendations and conclusions
Preliminary investigation of any project is its Feasibility Study. This report provides overview of all relevant
data. There are five major dimensions of feasibility study acronym as TELOS: Technical, Economic, Legal,
Operational and Scheduling. If these five dimensions are successfully tested for adding new modules and
debugging existing running system. The types of feasibility study that are covered during preliminary
investigation:
▪
Technical Feasibility
10
▪
▪
▪
▪
Economic Feasibility
Legal Feasibility
Operational Feasibility
Scheduling Feasibility
2.2 Technical Feasibility
Technical feasibility revolved around the existing system and the requirements of proposed system. Basically, this
is the assessment which work on the information about the resources required to develop the proposed system and
how much the system is have the ability to carry out the implementation of proposed system. Let’s take an example
according to this system which is currently run-on local server. So, to run this system on local machine we need
some software which helps to run this system’s functionality. So, that software is technically required for this
system. If the required software and hardware will be easily available it means the system is technical feasible.
Hence, the system is technically feasible. The essential questions which should be covered during technical
feasibility study are as following: Is the proposed system is practicable?
▪
▪
▪
▪
▪
Is the system is available in inadequacy of resources?
Does the necessary technology exist?
Does the system capable for up gradation if required in future?
Does the system capable to handle the queries and solutions?
Are the existing technologies enough to develop new proposed system?
If the answer of the above questions is Yes then it is technical feasible.
2.3 Economic Feasibility
It is the study which refers to cost analysis. It is the assessment of checking cost benefit analysis. It is also a method
which help the company to determine the investment on the system and the future benefits. Economic feasibility is
also used to evaluate the effectiveness of the proposed system.
11
As cost is the important factor, so it must be checked that the system will be economical feasible or not so that it
can be determined that proposed system should be continued or not. Since the cost and benefits for my system is
correct. My system has less cost. And benefits are more so our system is economically feasible.
The questions which should be covered during the economic feasibility study/analysis are as following:
•
Estimated cost of required software and hardware.
•
Estimated cost of system development
•
Determine cost with its total expected benefits
•
Determine the savings which will be result from the proposed system
•
Does the system cost effective or not?
These are some key points which should be kept in mind during the phase of economic feasibility. If these questions
will be answered yes then the system can be implemented otherwise there may be chances of rejection or
enhancements according to requirements.
2.4 Operational Feasibility
Any project/system will be beneficial only if they can be turned out into an information system. If the proposed
system meets the organization’s requirements, then it means that the proposed system is operationally feasible. It is
an important part of project implementation. As it is dependent on human resources for the system involves in
either development or maintenance or implementation. It is the study/analysis that tells us how well proposed
system solves the user quires.
Some questions are raised during the operational feasibility are as follows:
•
Is the system solving problem properly
•
Does management support the system
•
Does the system satisfy the required requirements listed in technical feasibility phase
Since our system satisfy all the properties for a operational feasibility so our system is operationally feasible.
12
Chapter: 3 Requirement
Analysis
Chapter 3
Requirement Analysis
3.1 Overview
In this chapter we can study about the analysis which developers will do during development of system/project. It
contains the requirement observations which are performed by developers so that project should be developed and
delivered on time. There are various requirements which are important and all these are mentioned in this chapter.
Before starting any project or system there are some factors which must be analyzed as it is an important phase of
project development. The requirement analysis and specification phase start when feasibility study is done and it
will start when the project is economically and technically sound feasible. The main goal of this phase is to
understand requirements of customer so that project/system should meet the customer’s requirements. It is
important because after analyzing the requirements of customer all collected data is formatted and arranged in a
document. This document is also known as RAD (Requirement Analysis Documentation), which is important for
any developer to go through this RAD to understand what outcome customer wants from the proposed system. SRS
plays an important role in project/system development. As RAD is a report which describes about the system output
and for those corresponding input requirements. In short RAD is a report which contains all functional and nonfunctional requirements.
3.2 System Analysis
System analysis is the process that involves gathering of factual data, system functioning or we can say what should
be the output of proposed system. It is the study from that developer team can understand the process involved and
identifying the problem. This involves the study of business process, gathering the functional as well as functional
data of the system, understand the flow of system. It is an important factor that system meets the customer
requirement. So, system requirement is the phase which makes a bridge between customer requirement and
developers’ team.
The main goal/objective of system analysis phase is as follows:
•
What are the customer’s requirements?
•
What are the customer’s expectations?
•
Flow of data  What is being done?
13
•
How it is being done?
14
•
How it is being done?
•
Who can do this?
3.3 Requirement Analysis/Study
Requirement analysis is the process of understanding user’s or customer’s expectations. It is important to
understand the user’s expectations because if the system meets the user’s satisfaction, then the system is considered
useful and acceptable otherwise system is not considered. It is important to gather information for a new and
modified system according to user’s expectations. This feature is called requirements must be perceptible, relevant
and detailed.
This is also an important factor of project management. Frequent meetings with customer/user are important to
know the requirements time to time as customer’s requirements may be changed as previously documented. There
may be chances of ambiguity or conflict in requirements as demanded previously by the users.
It is not only the task of one person but it is a team effort that is combination of hardware, software and public
dealing expertise.
There are many fact-finding techniques which can be used by developer to gather the information about system
requirements.
3.4 Present System & 3.5 Identification of Needs
Present system requires lot of manual work to maintain record of client. Present system is time consuming to search
any pass out Client data or present Client’s previous data. To maintain the data and scheduling of classes is difficult
for normal classes. It is difficult to access current system anytime means in case of urgency it is difficult to access
and give report.
Why we need this application?
So, to overcome these problems we can use the proposed system which will able to do all these tasks at any time
without time consuming.
3.6 Software Requirement Analysis
Software Requirement Specification (SRS) is the initial point of the software development activity. It is a complete
detail of the nature of a system which is to be developed. The SRS document includes all necessary demands for
project development. To resolve the requirements, we need to have clear and through understanding of the system
which is to be developed. This is planned after detailed communication with project team and the customer.
15
An SRS minimizes the time and effort desired by developers to accomplish desired goals and also minimize the
development cost. A good SRS shows how an application will connect with system hardware, other programs and
users in a great variety of real- world situations.
The goal is to implement a recommend system on music domain. The system will be composed of server-side
component and client-side component. The server-side component will handle the database operations and
algorithms that build recommendation results. The client-side components will be graphical interfaces that are
integrated into corresponding better systems.
Software Requirement Specification (SRS)
3.7 Hardware Configuration:
Client Side:
RAM
3 GB (min)
Android version
10.00 and higher
Processor
Qualcomm
higher)
3.8 Software Requirement:
Client Side:
Operating System
Android
16
Snapdragon
(version630
and
3.9 Functional Requirements
Functional requirements are requirements which specify what system should do.
Functional requirements of Bluetooth Chat application are:
•
Connect with any android mobile via Bluetooth and chat by using Bluetooth Chat application.
•
If you already paired your device then your name will always show on the list devices.
•
You can chat till the time Bluetooth is connected.
•
You may also send lengthy messages.
•
Only one device is connected at a time and chat with each other.
3.10 Non-Functional Requirements
•
Only connected devices can see their messages.
•
All the connected users can chat.
The message will show up instantly on the screen
Chapter: 4 System Design
17
Chapter
4
System Design
4.1 Overview
This chapter includes the designs which are related to our project that describes about the aspects of the system.
This chapter includes Data Flow Diagrams (DFD‟s), Entity- Relationship Diagram, Structure of database, Class
Diagram, Activity Diagram. Design is the first step which is required to understand the flow of data, input interface
and output screen looks like.
There are some key points because we system design is important. These are as follows:
•
To understand the flow of data
•
To visualize the customer’s expectation
•
For better productivity
•
To understand the activities performed on system
•
To determine the relationship between entities of the system
•
To determine the relationship between system modules
•
It helps in understanding results comes from previous phases
•
To create a better view of system
•
Reveal design issues and flaws
•
To visualize the interaction between objects of system
•
Designs are helpful to implement code
4.2 Entity-Relationship Diagram
ER Diagrams was first developed by PETER CHEN in 1976. When we are using database, it must be understanding
the relationship between data. It is used to describe the structure of database with the help of diagram. EntityRelationship diagrams act as a tool to build the logical database design of the system. There are some factors
which tell us why we need Entity-Relationship Diagrams. These are as follows: To find out the logical structure of
the database
•
To define about the entities and their attributes
•
To show relationship between entities
•
To visualize the entities within the system scope
18
lOMoARcPSD|34521098
4.3Components of ER Diagram
ERD is basically consisting of five main components:
Features
Description
Entity
Entity is represented by labeled rectangles. The label is the name
of the entity. Entity names should be singular nouns.
Relationship
Relationships are represented by a solid line connecting two entities.
The name of the relationship is written over the line. Relationship
names should be verbs
Cardinality
Cardinality of many is represented by a line ending in a crow's foot. If
the crow's feet is omitted, the cardinality is one.
Attribute
when included, are listed inside the entity rectangle. Attributes which
are identifiers are underlined. Attribute names should be singular
nouns.
Table 4.1: Features Table
lOMoARcPSD|34521098
Bluetooth Chat Application
User
List
Devices
Ready to
connect
Connected
Devices
Message view
Send
/Receive
messages
lOMoARcPSD|34521098
Figure 4.1: ER Diagram
4.4 Class Diagram
The class diagram is the leading building block in object-oriented modeling. They are used both for normal
conceptual modeling of the systematic of the application, and for complete modeling translating the models into
programming code. The classes in a class diagram appear for both the main objects and or interactions in the
application and the objects to be programmed. In the conceptual design of a system, a number of classes are
recognized and grouped together in a class diagram which helps to find the statically relations between those
objects. With complete modeling, the classes of the contextual design are often split in a number of subclasses. In
order to further narrate the behavior of systems, these class diagrams can be complemented by state diagram or
UML state machine. Also, as an alternative of class diagrams
Object role modeling can be used if you just want to model the classes and their relationships
4.5 UML Diagrams:
Actor: A logical set of roles that users of use cases play when interacting with the use cases.
Use case: A illustration of sequence of actions, including variants, that a system performs that
yields an observable result of value of an actor UML (Unified Modeling Language). UML is a language for specify,
visualize and documenting the system. This is the step in developing any product after analysis. The goal from this
lOMoARcPSD|34521098
is to manufacture a model of the entities involved in the project which later need to be built. The representation of
the entities that are to be used in the product being produced need to be designed.
4.6 USECASE DIAGRAMS:
Use case diagrams model action within a system and support the developers understand of what the user require.
The stick man represents what’s known as an actor.
Use case diagram can be convenient for getting an overall view of the system and explain who can do and more
importantly what they can’t do.
Use case diagram made of use cases and actors and shows the communication between the use case and actors.
•
The desire is to show the communication between the use case and actor.
•
To represent the system requirements from user’s point of view.
•
An actor could be the end-user of the system or an external system.
USECASE DIAGRAM:
A Use case is an explanation of set of sequence of actions. Graphically it is rendered as an ellipse with solid line
which has only its name. Use case diagram is a behavioral diagram that shows a set of use cases and actors and
their links. It is an organization between the use cases and actors. An actor shows a real-world object. Primary
Actor – Sender. Secondary Actor Receiver.
lOMoARcPSD|34521098
Fig. 4.2 Application Use Case Diagram
lOMoARcPSD|34521098
Chapter 5
Coding
Chapter
5
Coding
5.1 Coding Technology Used- Java
Following technologies that are used by Bluetooth Chat application is
5.2 Java
Java is a high-level, class-based, object-oriented programming language that is designed to have as few
implementation dependencies as
possible.
It
is
a general-purpose programming
language
intended
to
let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that
support Java without the need to recompile. Java applications are typically compiled to bytecode that can run on
lOMoARcPSD|34521098
any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar
to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities
(such as reflection and runtime code modification) that are typically not available in traditional compiled languages.
As of 2019, Java was one of the most popular programming languages in use according to GitHub, particularly
for client–server web applications, with a reported 9 million developers.
Java was originally developed by James Gosling at Sun Microsystems. It was released in May 1995 as a core
component of Sun Microsystems' Java platform. The original and reference implementation Java compilers, virtual
machines, and class libraries were originally released by Sun under proprietary licenses. As of May 2007, in
compliance with the specifications of the Java Community Process, Sun had relicensed most of its Java technologies
under the GPL-2.0-only license. Oracle offers its own Hotspot Java Virtual Machine, however the official reference
implementation is the OpenJDK JVM which is free open-source software and used by most developers and is the
default JVM for almost all Linux distributions.
35
lOMoARcPSD|34521098
CODE
o Activity_get_started.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".getStarted">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="#3E6D9C"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
app:srcCompat="@drawable/bluechatpic" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Get Started"
android:layout_marginTop="200dp"
android:layout_marginStart="140dp"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
lOMoARcPSD|34521098
o activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/listen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="47dp"
android:layout_marginBottom="8dp"
android:background="@color/colorPrimaryDark"
android:text="Ready"
android:textColor="@android:color/white"
app:layout_constraintBottom_toTopOf="@+id/listview"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<Button
android:id="@+id/listDevices"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="48dp"
android:background="@color/colorPrimaryDark"
android:text="List Devices"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="@+id/listen"
app:layout_constraintStart_toEndOf="@+id/listen"
app:layout_constraintTop_toTopOf="@+id/listen"
app:layout_constraintVertical_bias="1.0" />
<TextView
android:id="@+id/status"
android:layout_width="91dp"
android:layout_height="44dp"
android:layout_marginStart="52dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="24dp"
android:gravity="center"
37
lOMoARcPSD|34521098
android:text="Status"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="@+id/listview"
app:layout_constraintHorizontal_bias="0.545"
app:layout_constraintStart_toEndOf="@+id/listDevices"
app:layout_constraintTop_toTopOf="parent" />
<ListView
android:id="@+id/listview"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="33dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="29dp"
android:background="#26A896"
app:layout_constraintBottom_toTopOf="@+id/msg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/status" />
<TextView
android:id="@+id/msg"
android:layout_width="0dp"
android:layout_height="171dp"
android:layout_marginStart="14dp"
android:layout_marginLeft="14dp"
android:layout_marginEnd="14dp"
android:layout_marginRight="14dp"
android:layout_marginBottom="110dp"
android:text="Message"
android:textColor="@android:color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<EditText
android:id="@+id/writemsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginBottom="28dp"
android:ems="10"
android:inputType="textPersonName"
android:textColor="@android:color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/send"
lOMoARcPSD|34521098
android:layout_width="136dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="37dp"
android:layout_marginEnd="19dp"
android:layout_marginBottom="25dp"
android:background="@color/colorPrimaryDark"
android:text="Send"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/writemsg"
app:layout_constraintTop_toBottomOf="@+id/msg"
tools:ignore="HardcodedText" />
</androidx.constraintlayout.widget.ConstraintLayout>
o getStarted.java
package com.halil.ozel.bluetoothchatapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class getStarted extends AppCompatActivity
{Button button;
@Override
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.activity_get_started);
button=findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(getStarted.this,MainActivity.class);
startActivity(intent);
}
});
}
}
39
lOMoARcPSD|34521098
o MainActivity.java
package com.halil.ozel.bluetoothchatapp;
import android.Manifest;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Message;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
public class MainActivity extends AppCompatActivity
{Button listen, send, listDevices;
ListView listView;
TextView messageBox, status;
EditText writeMessage;
BluetoothAdapter bluetoothAdapter;
BluetoothDevice[] bluetoothDevices;
lOMoARcPSD|34521098
SendReceive sendReceive;
static final int STATE_LISTENING = 1;
static final int STATE_CONNECTING = 2;
static final int STATE_CONNECTED = 3;
static final int STATE_CONNECTION_FAILED = 4;
static final int STATE_MESSAGE_RECEIVED = 5;
int REQUEST_ENABLE_BLUETOOTH = 1;
private static final String APP_NAME = "BluetoothChatApp";
private static final UUID MY_UUID = UUID.fromString("318c6089-985c-4773-b7ca4c6130e4209e");
@SuppressLint("MissingPermission")
@Override
protected void onCreate(Bundle savedInstanceState)
{super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listen = findViewById(R.id.listen);
send = findViewById(R.id.send);
listDevices = findViewById(R.id.listDevices);
listView = findViewById(R.id.listview);
status = findViewById(R.id.status);
messageBox = findViewById(R.id.msg);
writeMessage = findViewById(R.id.writemsg);
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!bluetoothAdapter.isEnabled()) {
Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
}
}
startActivityForResult(enableIntent, REQUEST_ENABLE_BLUETOOTH);
implementListeners();
private void implementListeners()
{ listDevices.setOnClickListener(new View.OnClickListener()
{
@SuppressLint("MissingPermission")
@Override
41
lOMoARcPSD|34521098
public void onClick(View v) {
@SuppressLint("MissingPermission") Set<BluetoothDevice> devices =
bluetoothAdapter.getBondedDevices();
String[] strings = new String[devices.size()];
bluetoothDevices = new BluetoothDevice[devices.size()];
int index = 0;
if (devices.size() > 0) {
for (BluetoothDevice device : devices)
{bluetoothDevices[index] = device;
strings[index] = device.getName();
}
index++;
ArrayAdapter<String> arrayAdapter = new
ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, strings);
}
});
}
listView.setAdapter(arrayAdapter);
listen.setOnClickListener(new View.OnClickListener()
{@Override
public void onClick(View v) {
ServerClass serverClass = new ServerClass();
}
});
serverClass.start();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener()
{@Override
public void onItemClick(AdapterView<?> parent, View view, int i, long id)
{ClientClass clientClass = new ClientClass(bluetoothDevices[i]);
clientClass.start();
}
status.setText(R.string.connecting);
lOMoARcPSD|34521098
});
send.setOnClickListener(new View.OnClickListener()
{@Override
public void onClick(View v) {
String string = String.valueOf(writeMessage.getText());
}
}
});
sendReceive.write(string.getBytes());
Handler handler = new Handler(new Handler.Callback()
{@SuppressLint("SetTextI18n")
@Override
public boolean handleMessage(Message msg) {
if (ActivityCompat.checkSelfPermission(getApplicationContext(),
Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
switch (msg.what) {
case STATE_LISTENING:
status.setText(R.string.listening);
break;
case STATE_CONNECTING:
status.setText(R.string.connecting);
break;
case STATE_CONNECTED:
status.setText(R.string.connected);
break;
case STATE_CONNECTION_FAILED:
status.setText(R.string.failed);
break;
case STATE_MESSAGE_RECEIVED:
byte[] readBuffer = (byte[]) msg.obj;
String tempMessage = new String(readBuffer, 0, msg.arg1);
43
lOMoARcPSD|34521098
messageBox.setText(tempMessage);
break;
}
});
}
}
return true;
private class ServerClass extends Thread
{ private BluetoothServerSocket
serverSocket;
@SuppressLint("MissingPermission")
public ServerClass() {
try {
serverSocket = bluetoothAdapter.listenUsingRfcommWithServiceRecord(APP_NAME,
MY_UUID);
}
} catch (IOException e)
{e.printStackTrace();
}
public void run()
{ BluetoothSocket socket =
null;
while (true)
{try {
Message message = Message.obtain();
message.what = STATE_CONNECTING;
handler.sendMessage(message);
socket = serverSocket.accept();
} catch (IOException e)
{e.printStackTrace();
Message message = Message.obtain();
message.what = STATE_CONNECTION_FAILED;
}
handler.sendMessage(message);
lOMoARcPSD|34521098
if (socket != null) {
Message message = Message.obtain();
message.what = STATE_CONNECTED;
handler.sendMessage(message);
sendReceive = new SendReceive(socket);
sendReceive.start();
}
}
}
}
break;
private class ClientClass extends Thread
{private BluetoothDevice device;
private BluetoothSocket socket;
public ClientClass(BluetoothDevice device1)
{device = device1;
try {
if (ActivityCompat.checkSelfPermission(getApplicationContext(),
Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
socket = device.createRfcommSocketToServiceRecord(MY_UUID);
}
}
} catch (IOException e)
{e.printStackTrace();
}
public void run()
{try {
if (ActivityCompat.checkSelfPermission(getApplicationContext(),
Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
socket.connect();
45
lOMoARcPSD|34521098
Message message = Message.obtain();
message.what = STATE_CONNECTED;
handler.sendMessage(message);
sendReceive = new SendReceive(socket);
}
sendReceive.start();
} catch (IOException e)
{e.printStackTrace();
Message message = Message.obtain();
message.what = STATE_CONNECTION_FAILED;
}
}
}
handler.sendMessage(message);
private class SendReceive extends Thread
{private final InputStream inputStream;
private final OutputStream outputStream;
public SendReceive(BluetoothSocket socket) {
InputStream tempInput = null;
OutputStream tempOutput = null;
try {
tempInput = socket.getInputStream();
tempOutput = socket.getOutputStream();
} catch (IOException e)
{e.printStackTrace();
}
inputStream = tempInput;
}
outputStream = tempOutput;
lOMoARcPSD|34521098
public void run() {
byte[] buffer = new byte[1024];
int bytes;
while (true) {
try {
bytes = inputStream.read(buffer);
handler.obtainMessage(STATE_MESSAGE_RECEIVED, bytes, -1,
buffer).sendToTarget();
}
}
}
}
} catch (IOException e)
{e.printStackTrace();
}
public void write(byte[] bytes)
{try {
outputStream.write(bytes);
} catch (IOException e)
{e.printStackTrace();
}
}
Chapter 6
Testing
lOMoARcPSD|34521098
Chapter 6
Testing
6.1 Introduction
Testing accomplishes a variety of things, but most importantly it measures the quality of application
that is developed. This view presupposes that there are defects in application waiting to be
discovered.
Testing plays a essential role in the success of the system. System testing makes the logical
assumptions that if all the parts of the system are correct, the goal will be successfully achieved.
Once program code has developed, testing begins. The testing proves focuses on the logical
internals of the application, ensuring that all statements have been tested, and on the functional
externals, that is conducting tests to uncover error and ensure that define input will produce actual
results that agrees with required results.
6.2 Objective
▪
▪
▪
Testing is a process of carry out a program with intent of finding an error.
A good test case is one that has a high probability of finding an as–yet trackless error.
A successful test is one that uncovers an as–yet trackless error.
6.3 Types of Testing
•
Unit Testing
•
Integration Testing
•
Validation testing
•
System Testing
6.4 Unit Testing:
lOMoARcPSD|34521098
49
lOMoARcPSD|34521098
In computer programming, unit testing is a verification and validation method in which a
programmer tests if smallest units of source code are fit for use. A unit is the little testable part of an
application. In procedural programming a unit may be an smallest function or procedure.
Test for the admin module
Testing admin login form-This form is pre-owned for log in of administrator of the system.
In
this form we enter the username and password if both are correct administration page will open
otherwise if any of data is wrong it will get turn back to the login page and again ask the features.
Report Generation:
admin can create report from the main database.
6.5 Integration Testing:
It is the phase in software testing in which little software modules are combined and tested as a
group. It takes place after unit testing and before system testing. Integration testing take hold of as
its input modules that have been unit tested, groups them in huge aggregates, applies tests defined in
an integration test plan to those aggregates, and brings as its output the integrated system ready for
system testing.
6.6 Validation testingValidation testing is the process of determining whether a product, service, or system meets
specifications and serves its intended purpose. Validation is a quality assurance procedure that
establishes evidence that a product, service, or system meets its intended requirements to a high
degree of certainty. This frequently necessitates end-user acceptance of suitability for purpose.
6.7 System Testing
lOMoARcPSD|34521098
Software or hardware system testing is testing performed on a completed, integrated system to assess the
system's conformance with its set requirements. System testing falls under the category ofblack box testing, and as
such, requires no understanding of the code or logic's inner workings
.• System testing, in general, uses all "integrated" software components that have passed integration testing, as well
as the software system itself, which is integrated with any relevant hardware system. The goal of integration testing
is to detect any inconsistencies between integrated software units or between any of the assemblies and the hardware.
6.7 Test cases
Step
Test Case
No
Name
1
Ready your
device
Prerequisite
Step
Expected Result
Actual Result
Description
Make
sure Ready
to Bluetooth is on.
Bluetooth
should Bluetooth should
be on.
be on.
get
connected
2
List
Make
sure List devices.
devices
Bluetooth is on.
Make sure another Make
sure
device Bluetooth is another
device
enabled.
Bluetooth
is
enabled.
3
4
5
Connection
Make
sure Connected/
status
Bluetooth is on.
Connected/
Connected/
Connecting/
Connecting/
Connecting/
connection
connection failed
connection failed
Text
Text
Blank text
Blank text
failed
sure Text
Receiving
Make
messages
Bluetooth is on.
Send
Make
messages
Bluetooth is on.
sure Send
lOMoARcPSD|34521098
Chapter 7Snapshots
Chapter 7Snapshots
7.1 Home Page
lOMoARcPSD|34521098
7.2 Connected Device
lOMoARcPSD|34521098
Chapter 8
Conclusion and Future
Scope
Chapter 8
Conclusion and Future
ScopeConclusion
This application provides all the features that are required when there is no internet
connection, can prove helpful in collaborate learning, Easy to communicate, Sending and
receiving messages in real time, help to save your internet data, Engaging messaging features.
Messaging has become a part of our everyday lives in part due to its convenience for realtime chat communication and simple-to-use functionality. These messaging and real-time
chat applications play an important role in how the world interacts today, due to their
immediacy and vast capabilities. Hence, after going through the design and architecture of
android as well as Bluetooth we can conclude that the implementation of Bluetooth chat
application can be done easily which can be prove to be very useful to the android users.
Future Scope
With the knowledge I have gained by developing this application, I am confident that
in thefuture I can make the application more effectively by adding these services.
•
Extending this application by providing Authorization service.
•
Creating Database and maintaining users.
•
Increasing the effectiveness of the application by providing Voice Chat.
•
Extending it to Web Support.
lOMoARcPSD|34521098
PLAGIARISM CHECK
This is to certify that document detailed below has been evaluated by
plagiarism software “Website SEO Checker”. The content was found
plagiarism free.
Download