0% found this document useful (0 votes)
137 views6 pages

Introduction To Bluetooth Messenger (BTM)

The document describes a Bluetooth Messenger application that allows users to send text messages and transfer files between Bluetooth-enabled devices within a short distance. The application's objectives are to enable pairing and communication between two devices using Bluetooth, allow text and file transfers, and integrate Bluetooth with Wi-Fi so that communication can continue seamlessly when devices move out of Bluetooth range. The document provides an overview of how the application works, including discovering Bluetooth devices, establishing a connection, sending and receiving messages and files via Bluetooth, and transitioning to Wi-Fi when needed. The application achieves its goals of basic text messaging and file transfers between paired Bluetooth devices.

Uploaded by

Richa Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views6 pages

Introduction To Bluetooth Messenger (BTM)

The document describes a Bluetooth Messenger application that allows users to send text messages and transfer files between Bluetooth-enabled devices within a short distance. The application's objectives are to enable pairing and communication between two devices using Bluetooth, allow text and file transfers, and integrate Bluetooth with Wi-Fi so that communication can continue seamlessly when devices move out of Bluetooth range. The document provides an overview of how the application works, including discovering Bluetooth devices, establishing a connection, sending and receiving messages and files via Bluetooth, and transitioning to Wi-Fi when needed. The application achieves its goals of basic text messaging and file transfers between paired Bluetooth devices.

Uploaded by

Richa Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

3/26/2014

Share

Bluetooth Messenger

More

Next Blog

Create Blog

Sign In

Bluetooth Messenger
Friday, September 24, 2010

Introduction to Bluetooth Messenger (BTM)


1 Introduction
1.1 Background and Context
This document contains overall description of the project, interface requirements, functional and nonfunctional requirements, information about the project is also being given in this document. Today's advanced-generation and tomorrow's third-generation (2.5G and 3G) wireless systems are adding not only multimedia capabilities but also applications that are common today in personal digital assistants (PDAs). Software developers who are targeting the new wireless systems often come from a PC background and are not familiar with embedded platforms. These developers need to be aware of the differences they will find in the new hardware and software environment. Important among these are the media transmission rates, memory resources, user interface, power requirements, processing core architectures and development environments. Developers who are aware of these differences can plan and execute their software more effectively as they create multimedia and PDA-like applications for nextgeneration wireless systems. Most people use Bluetooth messenger in their cell phones, but there are tons of products that use Bluetooth technology. Bluetooth Messenger will allow users to transfer text messages via Bluetooth connections in short distances. As now new generation mostly go for wireless technology and the technology free of cost and easy to use, so by keeping this fact in mind we decided to use such a marvelous technology for our convenience, as our project is about Bluetooth messenger, which will allow people to communicate with each other by using this technology, free of cost. Our main objective was to design and develop such an application which enables users to communicate with each other in a specific distance. First of all, searching for active devices on which this service is running is needed. All devices will be added to your clients and you can control their access mode in setting menu. You can choose which devices have the authority to receive your messages and which have not. As default no device would receive your messages. So the trusted devices should be chosen from the list of devices on the Bluetooth network.

1.2 Scope and Objectives


http://bluetoothmessenger.blogspot.in/ 1/6

3/26/2014

Bluetooth Messenger

This Bluetooth chat application enables two users with Bluetooth-enabled Pocket PCs/PCs/laptops/mobiles to communicate with each other so long as they are within the range of Bluetooth. This application has a scope in wireless technology; it is useful as a communication tool during meetings, where private conversations can take place without affecting the meeting or as a mobile substitute for instant messenger. The main objectives of our project are as under:

1.2.1 Pairing through Bluetooth


First of all we had the objective to pair the two devices on the Bluetooth network. So, these two devices can be connected through Bluetooth and enable to recognize each other.

1.2.2 Communication between Two PCs


The 2nd main objective was the establishment of the communication between two PCs, so that after the pairing of the devices on Bluetooth network, two users using different PCs can send text messages to each other.

1.2.3 Transfer of Files


Next objective was to enhance the transfer of text message with the transfer of files. So that users can transfer files as well as they can send text messages to each other.

1.2.4 Integration of Bluetooth with Wi-Fi


The next was to do some advance work and that was the integration of Bluetooth with Wi-Fi. It means that when two users/devices are in connection with each other via Bluetooth and one of them falls out of the range of the Bluetooth, the two devices will still remain in contact with each other and no disconnection message will be made. Our software will transfer the user from Bluetooth to the Wi-Fi network and all the process will be transparent for the user, and the communication remains continue. Our main objective was to develop such an application that enables users to communicate with each other with in Bluetooth range, We had planned to add an additional feature in it that is when two users/devices are in connection with each other via Bluetooth and one of them falls out of the range of the Bluetooth, the two devices will still remain in contact with each other and no disconnection message will be made. This will transfer the user from Bluetooth to the Wi-Fi network and all the process will be transparent for the user. Our project is a base for such Wi-Fi integrated Bluetooth messengers, and 3G Networks.

1.3 Achievements
The idea about developing such an application came to our minds from the rapidly increasing number of users who are using the technology of Bluetooth or who are going for wireless technologies. We had decided to develop such application which can work on Bluetooth network as well as over Wi-Fi network. But due to certain problems we have done the development only for Bluetooth network. This application enables two PCs or laptops to communicate with each other. This application searches the Bluetooth devices and the connection between two devices is established successfully. Two PCs or Laptops with the help of USB dongle and this application can successfully communicate with each other.
http://bluetoothmessenger.blogspot.in/ 2/6

3/26/2014

Bluetooth Messenger

The transfer of files was also one of the objectives defined by us in the start, and this objective is also successfully achieved.

1.4 Overview of Project


This application enable two users to communicate with each other through Bluetooth networking, they can send text messages and files to each other with the help of this application. When our application starts, then it falls in form load event, then the thread is created for listening the incoming text messages. From the lines below it is discovering the Bluetooth devices and then assigning the disovered devices to combo box(cboDevices). btClient = new BluetoothClient(); BluetoothDeviceInfo[] bdi = btClient.DiscoverDevices(); cboDevices.DataSource = bdi; cboDevices.DisplayMember = "DeviceName"; Then the form page will be loaded and will show the available devices then the device is bieng selected and after selecting device, the message will be written in the text box(txtMessage) and then send button will be pressed and the control comes to send button event handler. private void btnSend_Click(System.Object sender, System.EventArgs e) { sendMessage(MAX_TRIES, System.Text.Encoding.Unicode.GetBytes(txtMessage.Text), txtMessage.Text.Length * 2); txtMessagesArchive.Text += "ME" + "->" + txtMessage.Text + Environment.NewLine; txtMessage.Text = ""; } In The above code,in first line sendmessage() method is called where mesage is passed so that it can be send to client.Sendmessage() makes a new object of that client and send message to that client. After sending message, we have setup a thread to listen incomming message.This method listens on Bluetooth and see if it receives any message. Once it receives message then receivemessage() method is called. client = btListener.AcceptBluetoothClient(); stream = client.GetStream(); bytesRead = stream.Read(Buffer, 0, BufferLen); str = client.RemoteMachineName + "->" + System.Text.Encoding.Unicode.GetString(Buffer, 0, bytesRead) + Environment.NewLine; The above code will accept the request from the client and get stream of bytes, encodes in string and make str named string and returns that string back to caller. Then it will invoke update text box event (txtMessagesArchive) in which we see that it populates our message box with that string. Thus the sended and received message is displayed with the device names. Another main functionality of our applictaion is the transfer of files.When the Send File from the menu bar
http://bluetoothmessenger.blogspot.in/ 3/6

3/26/2014

Bluetooth Messenger

is been clicked, then the following code will be executed SelectBluetoothDeviceDialog sbdd = new SelectBluetoothDeviceDialog(); sbdd.ShowAuthenticated = true; sbdd.ShowRemembered = true; sbdd.ShowUnknown = true; The above lines will discover and search for the available bluetooth devices on the bluetooth network to send files. The following code will open the file dialog box and after selecting file the selected file will be send to the client. if (sbdd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (ofdFileToBeam.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; Uri theuri = new Uri("obex://" + sbdd.SelectedDevice.DeviceAddress.ToString() + "/" + System.IO.Path.GetFileName(ofdFileToBeam.FileName)); ObexWebRequest request = new ObexWebRequest(theuri); request.ReadFile(ofdFileToBeam.FileName); ObexWebResponse response = (ObexWebResponse)request.GetResponse(); MessageBox.Show(response.StatusCode.ToString()); response.Close(); MessageBox.Show("File sent :" + DateTime.Now.ToString("dd/mm/yy/*/HH:mm") + " " + ofdFileToBeam.FileName); File.AppendAllText("C:\\History of file transfer.txt", "File sent to " + sbdd.SelectedDevice.DeviceName + ":" + DateTime.Now.ToString("dd/mm/yy/*/HH:mm") + " " + ofdFileToBeam.FileName + Environment.NewLine);

Cursor.Current = Cursors.Default; } } After sending the request to the client, the DealWithRequest( ) will be executed. Here the file will be received by the client. After receiving file, the message box will be shown, which will contains the notification about the file received. The below code is doing this job. public void DealWithRequest() { while (ol.IsListening) { try {
http://bluetoothmessenger.blogspot.in/ 4/6

3/26/2014

Bluetooth Messenger

ObexListenerContext olc = ol.GetContext(); ObexListenerRequest olr = olc.Request; string filename = Uri.UnescapeDataString(olr.RawUrl.TrimStart(new char[] { '/' })); olr.WriteFile(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "\\" + DateTime.Now.ToString("ddMMyyHHmm") + " " + filename); MessageBox.Show("File received :" + DateTime.Now.ToString("dd/mm/yy/*/HH:mm") + " " + filename); File.AppendAllText("C:\\History of file transfer.txt", "File received :" + DateTime.Now.ToString("dd/mm/yy/*/HH:mm") + " " + filename + Environment.NewLine); } catch (Exception ex) { break; } } } } The history of send and received files is also being saved in our application.This is done by the following code. For history of sent files. File.AppendAllText("C:\\History of file transfer.txt", "File sent to " + sbdd.SelectedDevice.DeviceName + ":" + DateTime.Now.ToString("dd/mm/yy/*/HH:mm") + " " + ofdFileToBeam.FileName + Environment.NewLine); For history of received files. File.AppendAllText("C:\\History of file transfer.txt", "File received :" + DateTime.Now.ToString("dd/mm/yy/*/HH:mm") + " " + filename + Environment.NewLine); An additional feature of saving the chat has also been added in our Bluetooth messenger.The following code will create the text file at the location selected by the user with the user defined name. string Saved_File = ""; saveFileDialog1.InitialDirectory = "C:"; saveFileDialog1.Title = "Save a Text File "; saveFileDialog1.FileName = ""; saveFileDialog1.Filter = "Text Files|*.txt|All Files|*.*"; if (saveFileDialog1.ShowDialog() != DialogResult.Cancel) { Saved_File = saveFileDialog1.FileName; richTextBox1.SaveFile(Saved_File, RichTextBoxStreamType.PlainText); } Other additional features like edit menu, which contains copy, paste, cut, undo, redo, select all have also
http://bluetoothmessenger.blogspot.in/ 5/6

3/26/2014

Bluetooth Messenger

been added in Bluetooth Messenger. There is another features, that is for making our chat more attractive and its about the formatting of font. User can choose and select the Color, Font size, Style of his own choice.
Posted by v4.csit at 1:02 AM No comments:

Recommend this on Google

Home
Subscribe to: Posts (Atom)

Followers
Join this site
w ith Google Friend Connect

There are no members yet. Be the first!

Already a member? Sign in

About Me
v4.csit View my complete profile

Blog Archive
2010 (1) September (1) Introduction to Bluetooth Messenger (BTM)

Awesome Inc. template. Powered by Blogger.

http://bluetoothmessenger.blogspot.in/

6/6

You might also like