View Single Post
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#63
Originally Posted by WhitP View Post
Can anyone point me towards some python documentation that might help (or share any existing script)?
That should help:

Code:
import dbus

bus = dbus.SystemBus()

bluez = bus.get_object('org.bluez', '/')
adapter_path = bluez.ListAdapters(
    dbus_interface='org.bluez.Manager')[0]
adapter = bus.get_object('org.bluez', adapter_path)
powered = adapter.GetProperties(
    dbus_interface='org.bluez.Adapter')['Powered']

if powered:
    print 'Bluetooth on'
else:
    print 'Bluetooth off'
You need to install (using apt-get install as root) the following packages: python python-dbus

Last edited by thp; 2012-12-21 at 09:34.
 

The Following User Says Thank You to thp For This Useful Post: