views:

404

answers:

2

hai guyz,

how can i send AT-command through bluetooth from a python application?

OS:fedora 8

Any one please healp me with the code?

which package i need to import?

from where can i download it?

A: 

To get a connection over bluetooth to your IP modem, you want to use the bluetooth rfcomm driver:

michael@challenger:~> cat /etc/bluetooth/rfcomm.conf  
rfcomm0 {
        # Automatically bind the device at startup
        bind yes;
        # Bluetooth address of the device
        device 00:1C:CC:XX:XX:XX;
        # RFCOMM channel for the connection
        channel 1;
        # Description of the connection
        comment "Blackberry";
}

This is the setup I use for mine - YMMV.

michael@challenger:~> cu -l /dev/rfcomm0
Connected.
ATI
Research in Motion BlackBerry IP Modem

OK

Once you have the rfcomm0 port, you treat the port as a standard serial port and you're good to go.

MikeyB
A: 

I think this is better.......

import bluetooth 
sockfd = bluetooth.BluetoothSocket(bluetooth.RFCOMM) 
sockfd.connect(('00:24:7E:9E:55:0D', 1)) # BT Address 
sockfd.send('ATZ\r') 
time.sleep(1) 
sockfd.send(chr(26)) 
sockfd.close()
RSK