In this article, I will focus on creating networked based application using RFCOMM. The first section will be about the whys and wherefores of RFCOMM. In the second, third, and fourth sections, I will enumerate the steps necessary to create a client-server based application using RFCOMM. In the last section, a single-threaded server will be developed that uses RFCOMM to provide a file transfer service. That's the outline for this discussion. RFCOMM: The Whys and Wherefores The term or abbreviation RFCOMM comes from the term "radio frequency" or RF. RFCOMM involves emulation of serial port communication using radio frequency, hence the name RFCOMM. The serial port emulated by RFCOMM is RS-232 which has 9 circuits. RFCOMM uses the baseband of Bluetooth to provide reliable and in-sequence delivery of a data stream. The main attributes of RFCOMM are:
RFCOMM divides devices into two major classes. They are Type I and Type II. The division is based on whether the port is physically present or emulated. I explain the details below. Type I devices have emulated serial ports. Emulated ports are entities used to map system-specific services and their API to the RFCOMM services. Therefore, whenever applications are built for RFCOMM, Type I devices are used. In other words, Type I devices enable programmers to use serial port even if there is no physical serial port. Type II devices have physical serial ports. They act as intermediate devices. In other words, they are proxies for relaying transmissions from RFCOMM to an external RS-232 interface that may be linked with other devices. As I have said before, RFCOMM provides a client-server based paradigm. In the case of PyBluez, the client-server is based on sockets. And the steps to create them are similar to the steps that one would follow in creating TCP/IP or UDP- based sockets. The next section explains those steps. Let's get started.
blog comments powered by Disqus |