paper_Bluetalk

W
Shared by: ashrafp
Categories
Tags
-
Stats
views:
2
posted:
8/1/2011
language:
Slovenian
pages:
6
Document Sample
scope of work template
							                    BlueTalk - File transfer over Bluetooth
                                                      Ana Gainaru, Andreea Leta
                                                    Computer Science Department
                                                 University “Politehnica” of Bucharest
                                                         Bucharest, Romania
                                             anamch@gmail.com, andreea.leta@gmail.com


Abstract— In an information-oriented society like ours the access       devices are mobile in general and the Bluetooth channel has a
to information has become paramount. Due to the fact that many          high probability to throw errors, the total data quantity that a
devices today are Bluetooth enabled, we decided to implement an         mobile device can receive is limited to a few hundred kB. For
application based on the already available Bluetooth stack. This        that reason, BlueTalk divides the information in small pieces so
paper presents a media transmitter tool, BlueTalk, capable of           that the Bluetooth devices receives the data sequentially.
providing relevant information oriented to business needs and           BlueTalk uses a cooperative strategy for sending data which
location of the discovered devices. Using BlueTalk media or any         means that the pieces of information will be sent whenever a
other type of content can be sent to the discovered devices either      connection is free. In this way we are able to minimize the total
for useful purposes (map of location, route to nearest exit) or for
                                                                        download time.
entertainment purposes (images or music files). The hardware on
which the application resides can be discoverable and at the same            Normally in Bluetooth, one device can be a master while all
time search for new devices. In this way the application can send       the others are slaves: the roles must be able to switch
and also receive notifications from the devices. If the receiver        dynamically with a frequency that minimizes the discovery
rejects the connection request, Bluetalk will not send any type of      latency, but yet leaves enough time for the peer to peer data
content to that device. An important advantage of the application       transfer. In order to have two connected nodes using Bluetooth,
is the neighbors discovery. BlueTalk will try to adjust the interval    one has to make a search for devices and the other node must
between inquiries in order to obtain an optimal time when the
                                                                        allow others to discover it. Because BlueTalk doesn’t assign
number of discovered devices increases/decreases abruptly.
                                                                        roles explicitly, all devices can be masters or slaves. The
Experimental results show that Bluetalk provides a feasible
solution for mobile advertising.
                                                                        application uses two Bluetooth dongles, one for discovering
                                                                        Bluetooth devices in the area and sending data, and one for
   Keywords-bluetooth, internet sharing, file transfer, file sharing,   listening mode and receiving data. This way the BlueTalk
P2P                                                                     application is able to play the role of the master and that of the
                                                                        slave in the same time.
                         I. INTRODUCTION                                    BlueTalk is a peer to peer file sharing application based on
    Wireless Bluetooth technology is an universal specification         Bluetooth devices such as PDAs, cell phones and smart
that facilitates communication between mobile phones, laptops           phones. Using BlueTalk, people can share data as they move
or other portable devices. The idea behind the Bluetooth                around in shopping malls, buses, subway stations. The
technology is to support short range wireless transmissions in          application is useful in many practical day to day situations.
an universal way by using the unlicensed 2,4GHz short-range             The application might be used by commercial stores to make
radio frequency bandwidth. Bluetooth allows users to form               their offer public. Users could browse between stores’ offers on
clusters of 8 maximum connected devices that form a star                their cell phones just by walking in front of these. The
shaped form named a piconet. The main device from the                   application may also be used to serve news headlines to users,
cluster is named a master all other devices are named slaves.           using news feed format such as RSS. Buses can fetch all the
Two Bluetooth devices separated by a maximum distance of                news headlines from various providers like CNN or Slashdot.
10m can transfer data with a maximum speed of 2.1Mbps. In               Then, users can browse a list of available feeds while on the
order to minimize the interference between different piconet            bus, and choose those of interest, and fetch the information via
structures Bluetooth uses a radio technology called frequency           Bluetooth.
hopping spread spectrum (FHSS). This is accomplished by                    This paper is organized as follows: Section 2 presents the
using an algorithm for a pseudo-random frequency changing               BlueTalk architecture, highlighting its properties and
from a set of 79 frequencies.                                           characteristics. Section 3 presents the proposed application in
   BlueTalk is a file transfer application for devices that use         theory and then details on its implementation. In section 4 we
the Bluetooth technology (PDAs, mobile phones or smart                  present several simulation results being obtained. Section 5
phones).                                                                provides examples of related applications. Finally, in section 6
                                                                        we outline conclusions and future work.
   Bluetooth is used in numerous applications including audio
and data transmissions. However, because the Bluetooth
                  II. SYSTEM ARCHITECTURE
    BlueTalk is implemented in C. The application runs over
Linux using the Bluetooth stack for Linux. The resources used
are: a PC equipped with two Bluetooth dongles (one for the
push mode stage and one for the listening mode) and Bluetooth
devices (cell phones, PDAs). The used technologies are
Bluetooth, hcitool package, hciconfig package and the
Bluetooth stack for Linux: blueZ
    The BlueTalk application has 3 basic modules as shown in
figure 1:
   •     Listening module
   •     Push module
   •     Synchronization module
                                                                                   Figure 1. The architecture of BlueTalk.
    BlueTalk doesn’t explicitly assign roles; every device can
be either master or slave and the application can be both at the
same time. BlueTalk can be in two different states at the same         The L2CAP is a data link layer protocol; it can offer the
time because it uses two different Bluetooth dongles. The          connection oriented services or non-oriented services to upper
application is in push mode; this means that BlueTalk will         layers. Two types of links are supported: SCO (Synchronous
detect the Bluetooth equipment in the area and then will send      Connection Oriented) and ACL (Asynchronous Connection-
the data to it. The application is in listening mode; this means   Less). The L2CAP protocol is a communication protocol that
the application allows other devices to discover it and then it    sends individual datagram of a fixed maximum dimension.
will accept data from them.                                        The protocol has three transmitting/confirming schemes for
                                                                   the unconfirmed message re-transmission module. The first
    BlueTalk has 3 layers; each module on a superior layer will    one forces the application never to retransmit a message. The
interact with one from an inferior layer.                          second one is the implicit way and it configures the
  1) 2.1. Layer 1                                                  application to retransmit a message until the connection is
                                                                   stopped. The last protocol configures the application to
    This layer is responsible for finding the devices with which   abandon a message if it hasn’t been confirmed for a specific
to communicate and then with establishing the connection.          time (this protocol is useful when data must be transferred in a
This layer is also in charge with authentication proceedings if    specific order).
necessary. Layer 1 is responsible with connection control and           The RFCOMM is a simple transfer protocol used over the
with all security problems that might appear. Just like the        L2CAP protocol that supports maximum 60 simultaneous
physic layer from the OSI stack, layer 1 is in charge with         connections between two Bluetooth devices. The RFCOMM
synchronization, with transferring the data and with error         protocol initially establishes a connection between the client
correction.                                                        and the server, that will remain active all the time during the
     In the physical layer the network interface cards are         transfer. If portions of data are not transferred in a specified
characterized in a unique way by the MAC. In the same way          time interval, then the connection will be stopped and an error
there is a unique 48 bit address for Bluetooth chips named         will be returned.
Bluetooth address or device address. These addresses play the           BlueTalk uses ACL links because they can support “best
role of base address for Bluetooth programming and will be         effort” traffic.
used in all Bluetooth communication layers. Bluetooth devices
can have a presentation name which will be shown in the              3) 2.3. Layer 3
identification process instead of the 48 bit address. The name
can be configured by the user without any rule for most of the          In order for two nodes to be connected via Bluetooth, one
devices. For this reason, there can be more than one device        of them must run a search for other devices, while the other
with the same name. The client program is responsible with         must be in a discoverable state. Because BlueTalk does not
transitioning between the shown name for a device and its          explicitly assign any roles, any device may be either master or
Bluetooth address.                                                 slave. The computers will use 2 Bluetooth dongles, one for
  2) 2.2. Layer 2                                                  discovering Bluetooth devices in the area and file sending and
                                                                   the other one for listening and receiving files. The Bluetooth
    From the moment that the client device determines the          dongle used in listening mode that will be able to receive data,
server device’s address, it must determine what layer 2            has its name set to SOA and will represent the primary
protocols to use. BlueTalk application uses two layer 2            module. The Bluetooth dongle used to send the files is set to
protocols, each for a particular stage of the application:         inquiry mode.
RFCOMM and L2CAP.
                 III. IMPLEMENTATION DETAILS
    BlueTalk is a file transfer application for devices that use
the Bluetooth technology. The application is implemented in C
and uses the linux Bluetooth stack BlueZ. Another option was
to implement it in python but there are little chances that the
python environment can be integrated in the chosen device.
The application’s strict requirements regarding dimension,
speed and memory used for integrated programs doesn’t
recommend the use of an interpreted language. Even more, the
Bluetooth stack for python PyBluez doesn’t facilitate fine                        Figure 2 Inquiry and send - Push procedure example
tuning over the local Bluetooth adapter.                                 The application alternates inquiry mode with data sending
    The Bluetooth stack for C used for our project is called         mode. BlueTalk uses the standard neighbor discovery in order
BlueZ [1]. The stack represents a Bluetooth communication            to find devices in its active area. The Bluetooth technology
stack over Linux, used for exploiting all local Bluetooth            defines a symmetric neighbor discovery mode, where inquiry
resources with maximum effect. BlueZ stack offers support for        procedures are periodically executed.
all Bluetooth layers and protocols. The stack is very flexible          3.1.1. Inquiry Mode
and efficient and uses a modular implementation. The BlueZ
stack offers multi-thread processing facilities over data and           This mode is set by configuring the inquiry length (T inq)
support for more Bluetooth devices and a standard interface for      and the sending time (Tsend) (see Figure 2). In each round, a
sockets for all layers. The BlueZ modules, libraries and utilities   node alternates an inquiry state, immediately followed by
work on many Linux distributions, on multi-processor                 sending files state. The length of an inquiry is fixed to Tw inq,
platforms or hyper-threading systems. Also the BlueZ stack           and the length of an inquiry scan state is randomly chosen over
behaves as specified on many Linux distributions.                    [Tinq min − Tw inq, Tinq max − Tw inq] in order to avoid
                                                                     synchronization.
    The data exchange is made using the OBEX (OBject
EXchange) [2] protocol. OBEX is a communication protocol                  The inquiry procedure is blocking. The function returns the
that facilitates binary object transfer between devices. Object      list of inquiry responses received during the inquiry period
Exchange is a set of protocols allowing objects such as vCard        (i.e., 1.28s*Tw inq). The obvious disadvantage is that we have
contact information and vCalendar schedule entries to be             to wait for the entire period. For mobile applications, non-
exchanged using either IrDA or Bluetooth.                            blocking inquiry is preferable because the received inquiry
                                                                     responses can be read immediately via event polling;
    BlueTalk is a file-sharing application over Bluetooth i.e. a     consequently, we can reduce the average discovery latency.
computer that uses the BlueTalk application will be capable of       The events of interests are EVTINQUIRYRESULT and
transmitting or receiving data to and from any other Bluetooth       EVTINQUIRYCOMPLETE. The inquiry procedure can be
device in the area. In order to do this, the application uses the    cancelled at any time by sending an HCI inquiry cancel
Bluetooth stack from Linux BlueZ and the transfer protocol           command. The non-blocking inquiry procedure allows us to
OBEX. This includes the application restriction to computers         have an arbitrary length of inquiry window size, instead of a
that have Linux operating system and Bluetooth devices that          multiple of 1.28s. The length of inquiry scan state is
support the OBEX protocol.                                           determined by setting [Tinq min, Tinq max]. The minimum
     The BlueTalk application implements two states: the             value must be carefully chosen, in that it should be larger than
listening state, in which the computer allows other devices to       the discovery time for one phone since the first scan starts after
discover it and then receives data from them, and the push state     Tinq scan, instead of starting immediately. In addition, the
in which the computer scans the area for Bluetooth devices and       difference between those two values should be greater than
then sends files to them. The computer can use a single              zero. Otherwise, the process becomes deterministic – two
Bluetooth dongle; in this case, the computer will only be in         nodes may never be able to discover each other.
listening mode. If the computer has two or more Bluetooth                BlueTalk uses an algorithm in order to adjust the interval
dongles, then it will also be able to send files. In order to        between inquiries when the number of discovered devices
realize this, one dongle will be used to find Bluetooth devices      increases/decreases abruptly. Each round Tinq min and Tinq
and then for sending files, and the second dongle will be            max are chosen by taken into consideration the number of
responsible with the listening function described above.             devices discovered in the inquiry stage.
   3.1. Push Mode                                                       3.1.2. Sending the data
    In the push mode BlueTalk searches, the area for nearby                    The second stage in push mode is the sending data
Bluetooth devices and then sends them the data. This mode has        module.
two stages. In the first one, the application scans the area for
new devices and them holds a list with all new devices found;            BlueTalk shares contents by using file swarming, mainly
this stage is called inquiry mode. In the second stage, BlueTalk     due to the limited bandwidth and the short contact duration.
sends data to devices in the list. The same data is send only        The Bluetooth channel tends to be error-prone in the urban
once to a particular device.                                         streets due to multi-path, WiFi interference etc. In addition, the
                                                                     short communication range and mobility of users result in short
link/contact duration. For example, two peers moving in             adequate scanning period influences the discovery latency.
opposite directions with 1m/s have 10 seconds of link duration.     Moreover, we show how the total time for information sending
Assuming that the peer discovery and connection take 4              influences the dimension of the pieces in which we divided the
seconds, the maximum data size that they can symmetrically          sent data. Pieces of data of different dimension will increase or
transfer is 286KB with DM5 mode. Therefore, it is infeasible        decrease the total transmission time and this will increase or
for mobile Bluetooth nodes to share a relatively large file         decrease the application performance.
without using file swarming.
    The size of a piece should be carefully selected based on
the characteristics of the Bluetooth bandwidth and mobility
patterns. If the block is too big, peers cannot download a single
block during their contact duration. A block can be divided into
very small sub-blocks. However, this costs additional
bandwidth and computation overhead for sub-block level
reconciliation. Evaluation shows that the best balance between
file dimension and bandwidth is obtained by using blocks of
4096B dimension.                                                                             Figure 3.Reachability

    The Tsend period is very important. If a phone that enters         In the end, we identify the way to set the configuration
the active area is not discovered in an inquiry stage, BlueTalk     parameters for minimizing the neighbor discovery latency
will discover it after a sending stage. If Tsend is too large       without exaggerating the time for sending the data.
BlueTalk will discover the phone too late and won’t be able to
                                                                        We consider the results obtained by [3]. In order to evaluate
send any information. If the sending period is too small, the
                                                                    the connectivity environment in a real public transit-centric
BlueTalk application won’t be able to send all the information
                                                                    network, they collected real-world data using small wireless
required by a device in a single sending period. This will result
                                                                    sensor nodes that contain a Bluetooth radio. “The devices are
in latency in receiving information for all devices connected to
                                                                    Intel iMotes, which contain an ARM core as well as a
BlueTalk.
                                                                    Bluetooth radio stack. The motes run a simple Bluetooth
    After evaluating the system, we found that the best sending     inquiry program. Every 2 minutes, the device does an inquiry
period is of 10 seconds.                                            for 5 seconds. All devices detected during this inquiry period
                                                                    are noted. In Figure 3(a), we can see how many devices are
    3.2. Listening Mode                                             seen throughout the entire bus system, per hour. Over the
    In the listening mode, the BlueTalk application allows other    course of the day, we see anywhere from 18 to 32 external
devices to discover it and then receive data form them.             devices per hour. These are most likely conservative estimates,
Classical Bluetooth applications assume predefined roles for        given that it is likely for a number of mobile devices to exist
individual devices, which at the same time leads to predefined      that still have Bluetooth disabled”. Figure 3(b) shows us a
neighbor discovery roles. For example, in an access point           different point of view. In this figure, we see how many
scenario it is usually the mobile device that tries to discover     devices could potentially had been served as time progresses.
access points by using the inquiry procedure, while access          There is a steady increase in the number of devices met, as the
points make themselves discoverable by periodically turning         day progresses, and through the course of the day, about 200
on the inquiry scan mode. In the listening mode, the computer       devices are served in total.
plays the role of the slave and the mobile Bluetooth devices are
                                                                       4.1 Sending time
masters. BlueTalk uses a different dongle for receiving data
from other mobile devices.                                              In order to send files to the discovered Bluetooth devices,
                                                                    we need to split the files into pieces. The dimension of the
    The listening module is used by BlueTalk for receiving          blocks must be carefully chosen. If the block is too big, peers
notifications from the devices in order to resend the data          cannot download a single block during their contact duration.
previously provided. This is required in the case that the user     A block can be divided into very small sub-blocks. However,
accidentally deletes the received information. The listening        this costs additional bandwidth.
module has two important stages: receiving the device’s v-card
and then receiving the notifications. A different Bluetooth             We will now analyze the maximum size of the files to send.
dongle is in charge of the listening stage, so the push mode is     BlueTalk must be able to send the whole file in one sending
in no way affected by this module.                                  stage. We suppose one person that walks with 1m/s will have
                                                                    20 seconds of link duration. Assuming that peer discovery and
                        IV. EVALUATION                              connection take 12 seconds, we have 8 seconds left for the
                                                                    sending stage.
   Firstly we test the way that the BlueTalk application
behaves from the point of view of the discovery time (i.e. how        We choose the block size of 4096B. This means that the
long does it take until BlueTalk application discovers a new        maximum dimension for the file is 120 KB.
mobile device that enters the dongle coverage zone)
   BlueTalk application alternates the device scanning period
with the sending data period. We show that choosing the
   File         Block size    Number of     Download time
                                                                     case 10, the total discovery time would be 18 seconds. The
dimension                      blocks                                inquiry period of 10 seconds suggested above still stands.
                                                                         According to the results presented above, BlueTalk uses an
      kB              B                            seconds
                                                                     inquiry stage of 8 to 10 seconds, making the worst case
70             5120          14             4,97                     discovery time 18 seconds and the best case discovery time 8
                                                                     seconds.
100            5120          20             6,56
                                                                                               V. RELATED WORK
120            5120          24             7,02
                                                                         A paper related to ours is [5]. In this paper, the authors
70             4096          17,5           4,96                     propose a file-sharing application over Bluetooth. Also, the
                                                                     authors offer an analysis of the applications parameters in order
100            4096          25             6,53                     to minimize the inquiry time. Their application uses a single
                                                                     Bluetooth connector so that the paper focuses on how to pick
120            4096          30             7,05
                                                                     the inquiry scan time and the period in which other devices
70             3072          23,4           6,84
                                                                     may discover the application. Furthermore, the application
                                                                     doesn’t take into consideration the download time of the files,
100            3072          33,4           7,18                     nor the delay induced in the total discovery time for a new
                                                                     phone entering the active area.
120            3072          40             9,20
                                                                         We argue that our application takes more parameters into
   The total time of the sending stage must be at least 8            consideration, being more feasible for any day to day
seconds in order to send a whole file to a single user. As we        situations. By using Bluetooth, people can receive data while
expect to be able to satisfy the demand of at least 2 phones that    traveling to work, for entertainment purposes or just to get
request the maximum file size, we will set the maximum               useful information. The application showed good results in
sending stage at 10 second and the maximum file size at              various scenarios with different number of contacts during a
100KB.                                                               day.
      4.2. Inquiry time
                                                                                    VI. CONCLUSIONS AND FUTURE WORK
    In order to see how fast BlueTalk discovers mobile devices
that enter the active area, we tested our applications using 3           In this paper, we have outlined the design of BlueTalk, a
mobile phones. We tested the application in 3 scenarios:             file-sharing application that is accessible via Bluetooth
                                                                     connectivity. The system used delay tolerant networking
   •     All phones are and in the area in the moment the            operation and multiple interfaces to provide data to the public
application starts.                                                  so that they can make opportunistic use of travel time to
                                                                     retrieve information or send messages.
      •    All phones enter the area in the same time.
                                                                         In the future, we wish to improve the discovery time and
      •    The phones enter the area at different times.
                                                                     the device’s total waiting time until it receives all the requested
    For the first scenario the application started and found all     information. We plan to obtain better results by separating the
phones in the area. The discovery time was 8 seconds. This           push mode into two different stages, that use two different
means that in 10 seconds BlueTalk found all 3 phones and             dongles. One dongle will be responsible with the inquiry mode
started sending the files. When we tested the same scenario but      and the second dongle will be responsible with the sending
with 2 phones, the discovery time was not much bigger, 9.2           mode. We also plan to parallelize the sending stage, in order to
seconds. This scenario suggested us to use an inquiry period of      decrease the latency in the push process.
10 seconds.
                                                                         By using BlueTalk data can be sent to devices in the
    The second scenario started the application and then             discovery area either for useful or for entertainment purposes.
brought all 3 phones in the range of BlueTalk. In the worst case     Due to the discovery algorithm implemented, the application
if the phones entered the area exactly when the application          behaves well in scenarios with a low density for devices but
started its sending stage, we got 18 seconds discovery time. In      also in scenarios where the number of devices is fluctuating.
the best case, we got the same time as before, 8 seconds. The
inquiry period of 8 to 10 seconds suggested above still stands.                                   REFERENCES
    In the third scenario the phones entered the area at different   [1]   BLUEZ - http://www.bluez.org/
times. In the best case all the phones entered in the same           [2]   OBEX -
inquiry stage, so that the total time of scan was Tinq. If a phone   [3]   Bluetooth Content Distribution Stations on Public Transit - Jason
entered too late to be discovered in the same inquiry mode it              LeBrun, ChenNee Chuah
waited until BlueTalk entered another inquiry stage. So for this     [4]   www.bluetooth.com
“late phone” the discovery time would be Tsend + discovery           [5]   BlueTorrent: Cooperative Content Sharing for Bluetooth Users -
time. The discovery average was 8 seconds. Therefore, the                  Sewook Jung, Uichin Lee, Alexander Chang, Dae-Ki Cho, and Mario
discovery time would be Tsend + 8. As Tsend was in the worst               Gerla
[6]   WLAN and Bluetooth Update: Beyond the Hype - L. Godell, M.
      Nordan, T. Lapolla, and M. Mend

						
Related docs
Other docs by ashrafp
08juneex
Views: 8  |  Downloads: 0
Blogger (DOC)
Views: 61  |  Downloads: 0
Todd_A_Eaton
Views: 163  |  Downloads: 0
169010
Views: 0  |  Downloads: 0
12-17-2009
Views: 1  |  Downloads: 0
AN ADDRESS READ AT THE PART II OF DAAD
Views: 15  |  Downloads: 0
13259-Stuart-Automatic-Flow-Switch-Datasheet
Views: 32  |  Downloads: 0
ManuelAntonioCostaRica
Views: 2  |  Downloads: 0