Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - normf

Pages: [1]
1
Python / Python-bluez (pybluez)
« on: October 26, 2005, 07:46:06 am »
My my! The silence is deafening!  

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: [Select]
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: [Select]
#!/usr/bin/python
# Auth: Albert Huang
# 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: [Select]
00:02:C7:3C:44:F3 - )Pimp Daddy
  Computer
  services:
    capturing
    audio

Norm

2
Python / Datetime Module - Where Can I Get It?
« on: October 26, 2005, 07:27:19 am »
So...

I added the update for pysqlite2 to my Zee from the 3.5.3 Upgrades folder.

python-pysqlite2_2.0.beta1-ml1_arm.ipk

I then ran a simple script to run the tests.

Code: [Select]
#!/usr/bin/python
from pysqlite2 import test

test.test()

And I get these errors.

Code: [Select]
Traceback (most recent call last):
 Â File "./test2.py", line 2, in ?
 Â   from pysqlite2 import test
 Â File "/home/hrw/zaurus/oe/build/353/tmp/work/python-pysqlite2-2.0.beta1-ml1/image//usr/lib/python2.4/site-packages/pysqlite2/test/__init__.py", line 25, in ?
 Â File "/home/hrw/zaurus/oe/build/353/tmp/work/python-pysqlite2-2.0.beta1-ml1/image//usr/lib/python2.4/site-packages/pysqlite2/test/dbapi.py", line 25, in ?
 Â File "/home/hrw/zaurus/oe/build/353/tmp/work/python-pysqlite2-2.0.beta1-ml1/image//usr/lib/python2.4/site-packages/pysqlite2/dbapi2.py", line 32, in ?
ImportError: No module named datetime

Seems like the datetime module that came in at 2.3 is missing from Python. Any ideas where I might get this to run on my Zee? I have checked the Cheese Shop and no sign of it there. Have also checked python.org. I can see it in the source tarball for the whole of python-2.4.2 but I wanted it in the format where I could just run

Code: [Select]
python setup.py install
 I am running OZ 3.5.3 (Collie) on my SL5500.

Thanks in advance.

Norm

3
Python / Python-bluez (pybluez)
« on: October 13, 2005, 08:11:13 am »
Does anybody know where I might find an *.ipk of the python-bluez module?

Thanks in advance.

Norm

Pages: [1]