Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
Basic Concept: The Piconet
The physical links are created on the basis of masters/slaves (function of the type point to multiple point), a master can control up to seven slaves in his zone. These form a small network called Piconet.
The master is simply the first apparatus connected and is the one that sets the clock, the frequency jumping sequence and the access code for the link. All the Bluetooth modules of the same Piconet use the same frequency jumping sequence and are synchronised with the masters clock.
Whatever happens, the machine's role (master or slave) is invisible to the user. Also, one apparatus can participate in several piconets, being the slave in one and master in another. The interlacing of several piconets forms what is called a Scatternet. Thanks to the frequency jumping, 10 independent piconets (or up to 80 apparatus) can transmit at maximum output. Above that, the network becomes saturated
The transmission diagram of the centre of one piconet is based on the principle of Time Division Duplex (TDD). At first it is the master who sends a packet at a frequency f(k), the slave to whom this packet is addressed (and only this one) has the right to reply to it in the time interval following the arrival of the master packet. The reply from the slave is then given on the frequency channel f(k+1).
On reception of a master packet, a synchronisation word on the top of it enables the slave to re-synchronises his clock.
Different types of physical channels
Two types of connections are possible : Synchronous Connection Orientated (SCO), or Asynchronous Connection Less (ACL).
The SCO (Synchronous Connection Oriented) channels are used for voice transfer by reserving slots, they are symmetric between the master and a slave. There is a maximum of three in a piconet, a slave being able to control two originating from different masters. One can use the voice packets or the mixed voice/data packets.
An ACL (Asynchronous Connection Less) channel supplies an asynchronous access between master and slave (a single channel per couple), with the slot as base. The data packets only are used. In addition, a slave can only transmit after having received a packet from the master (the following slot). For this purpose, the master can send polling packets to the slaves (when there is nothing more asynchronous to transmit).
The low consumption management modes
One of Bluetooth's specific characteristics is the low consumption management modes. We will describe here the different modes provided in the Bluetooth norm and how they are used in the case of the bar code reader developed by baracoda.
In this mode, the Bluetooth module participates actively on the transmission channel. The master regularly sends a packet to the slaves (polling) to enable the slaves to be able to send a packet to the master and re-synchronise themselves. In this type of mode, the consumption of a Bluetooth module (in transmission) is around 40mA to 50mA (depending on the transmission output).
This is a low consumption mode. A Bluetooth module in the Sniff mode stays synchronised in the piconet. It listens to the piconet at regular intervals (Tsniff) for a short instant. This enables it to re-synchronise itself with the piconet and to be able to make use of this Sniff window to send or receive data. The consumption is as low as the Tsniff is large (compared to the Sniff window). If Tsniff is in the region of a second and the duration of Sniff (Twin) is in the region of several ms, the consumption will be about 1 to 5% of the maximum transmission consumption. (average consumption of 1mA to 5mA approximately). The Baracoda reader generally maintains the connection between 2 consecutive scans. However, for reasons of consumption, the scanner puts itself into the Sniffmode; Tsniff is regularly re-negotiated between the scanner and the terminal in such a way that the Tsniff increases as the time without a scan passes. The advantage of a large Tsniff is the low consumption and the inconvenience is the delay in sending the bar code. The algorithm developed by Baracoda allows the definition of the best Tsniff, a compromise between low consumption and short delay. This compromise adapts itself to the user (scan statistic). The advantage in maintaining the connection is to avoid a Paging / Create Connection phase which is responsible for high energy consumption.
The module remains synchronised. This is lower consumption mode than the Sniff mode. Only the counter on the Bluetooth chip in hold mode is active. At the end of the Hold period, the Bluetooth module returns to the active mode.
A Bluetooth module in this mode is no longer an active member of the piconet. However, it remains synchronised with the master and can listen to a broadcast channel (Beacon Channel).
Bluetooth's security system
The Bluetooth protocol allows the authentication and encryption of a link at the same time. The security is controlled by the lower layers of the Bluetooth protocol. A first security level is assured by the fact that each Bluetooth module has a unique address MAC (48-bits). In this way, when the Baracoda scanner connects itself to a terminal with which it is twinned, the bar code is transmitted to this equipment only.
To achieve a real level of security, the system, the Bluetooth system necessitates 2 secret keys (authentication key and encryption key) as well as a random number (generated regularly)
1st stage : Authentication. The scanner sends a challenge to the terminal with which it wishes to connect itself and sends the decoded bar code. The terminal has to reply to the challenge by returning a link key shared between the scanner and the terminal.
2nd stage : Encryption. When the authentication has been carried out between the 2 devices, the link can be encrypted.
Bluetooth protocol stack profiles
The profiles correspond to the use of Bluetooth in certain types of well-specified uses. They guarantee the inter operability between several products integrating the same profile.
Some examples of profiles : Headset Profile (wireless headphones), Serial Port Profile (replacement of serial cable), Dial-up Networking Profile (DUN), LAN Access Profile (to access a LAN via an access point).
For bar code reading, we use a certain number of profiles such as the Serial Port Profile, DUN and HID (Human Interface Device), in the course of standardisation.