Python
  Home arrow Python arrow Page 2 - Bluetooth Programming using Python
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 using Python
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 12
    2007-09-10


    Table of Contents:
  • Bluetooth Programming using Python
  • Bluetooth and Python: the Whys and Wherefores
  • Bluetooth Programming, Step by Step
  • Bluetooth Programming 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 using Python - Bluetooth and Python: the Whys and Wherefores
    ( Page 2 of 4 )

    According to its definition, Bluetooth is "a radio standard and communications protocol primarily designed for low power consumption, with a short range (power-class-dependent: 1 meter, 10 meters, 100 m) based on low-cost transceiver microchips in each device." In other words, Bluetooth is a standard and protocol that uses short-range frequencies to create a wireless connection between two compatible (Bluetooth enabled) devices. Since a radio communication system is used, there is no "line of sight" problem that is common with infrared-based devices. As long as the devices are in range, they can communicate with each other even if one device is in one room and the other device is in a separate room. Bluetooth-enabled devices are categorized into three classes, which are:

    1. Class 1
    2. Class 2
    3. Class 3

    The classification is based on the range in which the devices can communicate. The ordering is from the longest range to the shortest one.

    Class 1 devices have the longest range. The range is up to 100 meters, approximately. Devices of this class consume the highest amount of power of all three classes. They consume 100 mW of power.

    Class 2 devices can be considered medium range. The range in which they can communicate is up to 10 meters. With respect to power consumption, they require 2.5 mW.

    Class 3 devices cannot communicate beyond one meter. The power requirement also is the least for devices of this class. They require only 1 mW.

    If you observe closely the power requirement decreases with the decrease in communication range. That was a bird's eye view of Bluetooth. Next we will look at how a device provides services to other devices using Bluetooth. Each device provides certain services based on a specification known as the Wireless Interface Specification. A set of such services forms a profile. Sometimes the profile contains only one service, such as streaming of sound from an audio file, or it can contain a set of different services such as capturing a live video and streaming it. There are 27 standard profiles that are currently used by different devices. Some of the common profiles are:

    1. Basic Imaging Profile - for sending, receiving and resizing images.
    2. Basic Printing Profile - for using certain vCards, text, e-mail etc. to send to the printer from the device.
    3. File Transfer Profile - for accessing the file system of another device.
    4. Headset Profile - provides support for Bluetooth headsets to work with Bluetooth-enabled mobile phones for wireless audio; one of the most common profiles.
    5. Serial Port Profile - emulates serial cable connectivity and communication. It uses RFCOMM protocol.

    Writing a program for a Bluetooth device, in reality, means programming for the profiles or accessing the functionalities of the profile. For programming, the BlueZ library is commonly used. It provides access to the Bluetooth stack in an object-oriented and modular manner. The Python wrapper for the BlueZ is PyBlueZ.

    The wrapper targets the Microsoft Bluetooth stack on Windows and BlueZ stack on GNU/Linux. Using PyBlueZ, one can easily create a connection between traditional systems such as laptops, desktops and mobile devices and program the basic profiles such as File Transfer, network communication, and so forth. Now that the library that supports programming for Bluetooth has been introduced, we can look at the steps required to program Bluetooth devices using Python.



     
     
    >>> 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 4 Hosted by Hostway
    Stay green...Green IT