Python
  Home arrow Python arrow Bluetooth Programming in Python: Network Programming using RFCOMM
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Bluetooth Programming in Python: Network Programming using RFCOMM
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 10
    2007-12-12


    Table of Contents:
  • Bluetooth Programming in Python: Network Programming using RFCOMM
  • Developing Applications for RFCOMM, Step by Step
  • Listening for requests
  • Developing the Client
  • RFCOMM in the Real World

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Bluetooth Programming in Python: Network Programming using RFCOMM
    ( Page 1 of 5 )

    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.

    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
     

       

    PYTHON ARTICLES

    - 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
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT