Bluetooth Technology
@ SAKSHI | Tuesday, Mar 23, 2021 | 5 minutes read | Update at Tuesday, Mar 23, 2021

Bluetooth technology is used for sharing media but this is a network-based technology. By networking we mean, a network like our social media network, or a network in which all laptops are connected in a local area. Let us not define everything in bookish language. Let us keep aside these LAN, MAN, WAN, and CAN and similar sorts of vocabulary. What we should think about is how Bluetooth works?

1

Bluetooth is managed using RF topology and star topology, a piconet(small Bluetooth network) is formed when devices are connected. Those who have not heard topology can think it of as a layout of the network. RF topology is a radio frequency topology and star topology is a network layout in which devices are connected such that a star pattern forms. Let’s not dive deep into these basics. We have to swim in the entire depth of Bluetooth technology.

Bluetooth technology works as on the master-slave rule. Senders are considered as masters and receivers as slaves. One master can have up to seven slaves with other slaves not participating in-network. A random Bluetooth-enabled device can be a part of one or more piconets either as a master or as a slave. The wireless link is subdivided into time slots. Data is transmitted between Bluetooth-enabled devices in packets that are transferred in these slots.

Due to sudden advancements in technology, Bluetooth is nowadays the last option preferred for data transfer. New generation kids are unaware of its theory. But Bluetooth has established itself not only in media sharing but in headphones, health check-up devices, internet tethering etcetera. Let us see how Bluetooth works,

In our devices, we have a class BLUETOOTH ADAPTER which checks Bluetooth is enabled or not and it returns true if enabled else returns null. There is a function with a name like is Enabled() it checks Bluetooth is on or off. If off, then another function is called with a name like StartActivityForResult() and passes a dialog box through a function with the name as Action_Request_Enable() asking for denial and allow for Bluetooth usage. There are two states ON and OFF. After this process, devices are searched for connecting using BLUETOOTH ADAPTER.

2

It scans for other Bluetooth-enabled devices. It finds a device with an ON state, and it queries it for pairing. A method getBondedDevices() also runs in the background, it returns all the Bluetooth devices which were connected to our device before. Else it starts discovery and has a separate method for this purpose.

Once the devices are connected, data sharing can be done. Devices are paired after accepting pairing requests. This is a kinda bonding process where they exchange their security keys. Devices cache this key for later use. Devices unlink once the sharing is done. So till this point, I think you have suggested that there is so much to learn in Bluetooth’s functioning. We can call this master-slave relationship a server-client relationship

How connections are established in Bluetooth? Just like every device has an IMEI code and IP address there is a MAC (Medium access control) address in each device. When two devices are connected via Bluetooth they exchange the MAC addresses of each other and save them for future use. Another is UUID, which is a Universally Unique identifier (128 bit). It uniquely identifies services with which it wants to connect with any device. UUIDs must match in order for the connection to be accepted.

3

Bluetooth Server Socket

It is a class in which listens for incoming requests and plays the most important role in file sharing.

Classes in Bluetooth

There are numerous classes but I can share the name of some important classes,

  • BLUETOOTH ADAPTER The entry point for interaction, it discovers the device and calls BLUETOOTH SERVER SOCKET.
  • BLUETOOTH DEVICE It connects with a remote devices through Bluetooth Socket or Query device information (its state, address, name, class, etc.)
  • BLUETOOTH SOCKET It is a connection point, it allows data exchange using input and output stream.
  • BLUETOOTH SERVER SOCKET It listens to incoming requests and allows sharing.
  • BLUETOOTH CLASS It contains the characteristics of a Bluetooth device. Its content is read-only.

How Bluetooth knows what to share and what not to?

Yes, Bluetooth technology is enough smart that it does not transfer your browser history, call logs, cache to other devices by itself. It is very obedient so that it asks you each time and restricts for some particular file types. Bluetooth has a class for Bluetooth Profiles. These Bluetooth profiles enable different devices to communicate over Bluetooth links.

Examples of some profiles,

  • A2DP – Advanced audio distribution profile
  • BIP – Basic imaging profile
  • BPP - Basic printing profile
  • CIP – Common ISDN Access Profile
  • CTP – Cordless telephony profile
  • DUN – Dial-up network profile
  • VDP – Video distribution profile
  • HSP – Headset profile
  • DIP – Device id profile
  • 1SAP – SIM access profile

How a device uses Bluetooth technology depends on its Bluetooth profile capabilities.

4

Object-oriented programming concepts in Bluetooth technology

  • Class and objects
  • Inheritance is used.
  • Encapsulation
  • Polymorphism
  • Abstraction, dominates among all OOP features
  • Data hiding

Application of Bluetooth technology

  • Media sharing
  • Wireless headphones
  • Health devices
  • Speakers
  • Internet tethering
  • Wireless mouse, keyboards, etc

Social Links