OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Python-bluez (pybluez), Using Bluetooth in Python
normf
post Oct 13 2005, 04:11 AM
Post #1





Group: Members
Posts: 3
Joined: 5-October 05
Member No.: 8,254



Does anybody know where I might find an *.ipk of the python-bluez module?

Thanks in advance.

Norm
Go to the top of the page
 
+Quote Post
normf
post Oct 26 2005, 03:46 AM
Post #2





Group: Members
Posts: 3
Joined: 5-October 05
Member No.: 8,254



My my! The silence is deafening! dry.gif

Managed to sort this one out for myself in case anyone else wants to know.

Firstly install zgcc on your Zee. I got mine from Zaurus Onboard Development Tools

Next get Debian Package for Version 0.3 from the Project's homepage.

Upload the Debian package onto your Zee and use dpkg to unpack it.

cd to the directory created by unpacking the debian package and then cd to the src directory inside it.

run

CODE
python setup.py install


This will add PyBluez to your site-packages.

Now test it works by plugging in your CF Bluetooth card and running this script.


CODE
#!/usr/bin/python
# Auth: Albert Huang <albert@csail.mit.edu>
# desc: demonstration of how to do asynchronous device discovery by subclassing
#       the DeviceDiscoverer class
# $Id: asynchronous-inquiry.py,v 1.2 2005/04/04 05:02:13 albert Exp $

import bluetooth
import select

class MyDiscoverer(bluetooth.DeviceDiscoverer):

   def pre_inquiry(self):
       self.done = False

   def device_discovered(self, address, device_class, name):
       print "%s - %s" % (address, name)

       # get some information out of the device class and display it.
       # voodoo magic specified at:
       #
       # https://www.bluetooth.org/foundry/assignnumb/document/baseband

       major_classes = ( "Miscellaneous",
                         "Computer",
                         "Phone",
                         "LAN/Network Access point",
                         "Audio/Video",
                         "Peripheral",
                         "Imaging" )
       major_class = (device_class >> 8) & 0xf
       if major_class < 7:
           print "  %s" % major_classes[major_class]
       else:
           print "  Uncategorized"

       print "  services:"
       service_classes = ( (16, "positioning"),
                           (17, "networking"),
                           (18, "rendering"),
                           (19, "capturing"),
                           (20, "object transfer"),
                           (21, "audio"),
                           (22, "telephony"),
                           (23, "information"))

       for bitpos, classname in service_classes:
           if device_class & (1 << (bitpos-1)):
               print "    %s" % classname

   def inquiry_complete(self):
       self.done = True

d = MyDiscoverer()
d.find_devices(lookup_names = True)

readfiles = [ d, ]

while True:
   rfds = select.select( readfiles, [], [] )[0]

   if d in rfds:
       d.process_event()

   if d.done: break


If all is working OK, you should see the output of a scan for all Bluetooth devices in the area.
CODE
00:02:C7:3C:44:F3 - )Pimp Daddy
 Computer
 services:
   capturing
   audio


Norm
Go to the top of the page
 
+Quote Post
bam
post May 29 2006, 11:08 AM
Post #3





Group: Members
Posts: 1,213
Joined: 9-June 05
From: Gobi Desert, Mongolia
Member No.: 7,306



any chance in providing the files?
Go to the top of the page
 
+Quote Post
nilch
post May 29 2006, 06:38 PM
Post #4





Group: Members
Posts: 668
Joined: 3-December 03
From: US
Member No.: 1,034



Thanks to you for providing this useful addition to the Python repository for the Zaurus.

It would be great to get just the phython-blueZ file by itself so that it can be added to the Kopsis (or the Mickyl) python package by hand.
Go to the top of the page
 
+Quote Post
bam
post May 29 2006, 10:19 PM
Post #5





Group: Members
Posts: 1,213
Joined: 9-June 05
From: Gobi Desert, Mongolia
Member No.: 7,306



cant seem to get it compiled with meanies cramfs of gcc, keeps giving an error and exit code 1...
Go to the top of the page
 
+Quote Post
Serge_RUS
post Aug 16 2006, 04:31 AM
Post #6





Group: Members
Posts: 2
Joined: 13-August 06
Member No.: 10,785



Where can I get complete python-bluez for Z?
Go to the top of the page
 
+Quote Post
bam
post Aug 16 2006, 11:07 AM
Post #7





Group: Members
Posts: 1,213
Joined: 9-June 05
From: Gobi Desert, Mongolia
Member No.: 7,306



I did get it to compile, although I am not sure if it works fully, may be limited in functionality. Basically couldnt get some of the examples to work. Maybe I should try compiling 0.3 instead of 0.5 or was that 0.6?
Go to the top of the page
 
+Quote Post
Serge_RUS
post Aug 16 2006, 11:23 AM
Post #8





Group: Members
Posts: 2
Joined: 13-August 06
Member No.: 10,785



You see than you do.
I m kettle in this work.
PLease, when you will complete your work with pybluez, put them in this topic. Okay?

Sorry for my bad English smile.gif.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 24th October 2014 - 02:18 AM