Home arrow Python arrow Bluetooth Programming in Python: Network Programming using RFCOMM

Bluetooth Programming in Python: Network Programming using RFCOMM

In the last article I discussed various Bluetooth profiles. If one wants to create a client-server based application using Bluetooth, then one should program for the RFCOMM profile. RFCOMM offers a socket-based client-server paradigm for providing services.

TABLE OF CONTENTS:
  1. Bluetooth Programming in Python: Network Programming using RFCOMM
  2. Developing Applications for RFCOMM, Step by Step
  3. Listening for requests
  4. Developing the Client
  5. RFCOMM in the Real World
By: A.P.Rajshekhar
Rating: starstarstarstarstar / 10
December 12, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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:

  1. It provides multiple concurrent connections. It does this by relying on L2CAP. L2CAP can handle multiplexing over a single connection.
  2. It supports flow control on separate and individual channels.
  3. It does not provide error control. The assumption that RFCOMM makes is L2CAP provides an error-free channel. 
  4. How devices should communicate using RFCOMM is decided by the Serial Port Profile (SPP), which is one of the Bluetooth profiles.

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.



 
 
>>> More Python Articles          >>> More By A.P.Rajshekhar
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PYTHON ARTICLES

- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: