Friday, February 23, 2007

Asynchronous Sockets

I've looking at the pdis source directory and found an interesting module: async_socket.py

I think this might resolve our GPS thread issues as you can now perform a read in the background:

Here the python docstring:

class AsyncSocket:
"""
Defines an asynchronous socket interface. Implementors are not
required to inherit this class, but they must define the same
interface.

Note that only the thread that creates an instance of this class
may access the instance.

Note also that all the callbacks made by this object are
passed the following parameters, in the order listed:

1. event originator (an ``AsyncSocket`` handle)

2. event type (the name of the method used to make the request)

3. status (an ``Exception`` instance, or ``None`` if no error)

4. any request-specific payload (or ``None`` if none)

5. callback parameter, as specified when making the request
"""

And this is the docstring of the recieve command:

def recv(self, size, cb_func, cb_param):
"""
Makes a request to read at most ``size`` bytes from the
socket, and to call the ``cb_func`` callback function passing
the result as well as ``cb_param`` as function arguments.

The callback will not be made until the operation either
completes or fails. An empty string is returned as the
requested data to signal an EOF sent by the peer.

At most one ``recv`` request at a time may be outstanding.
"""
raise NotImplementedError

Tip of the day: Install python on the memory card

We made the fortunate decision to install python on the memory card. This has proved very beneficial since we develop a lot of python extensions that can be buggy and freeze the entire interface. If something goes wrong, simply opening up the memory card door automatically closes any applications running from it, and returns the phone to a normal state.

Tuesday, February 20, 2007

OS X with GnuBox

A Howto and another one

The incoming connection strategy doesn't seem to work - ctest.txt reports errors.

Setting up an outgoing socket in the Bluetooth/Sharing tab works, and ctest.txt confirms a positive connection status.

The problem that remains is that I get an "error -36" when I try to connect to the mac. That means that the pppd is closing the connection, more info about the error codes here. So it seems that the pppd is doing something wrong on my installation...

Thursday, February 8, 2007

Non-Caching Bluetooth Resolver

For our project, we need to scan for bluetooth beacons. The default nokia implementation caches the names of the bluetooth devices, so the update speed isn't acceptable for us.

The modified aosocketnativenew.pyd by Albert Huang does this. It doesn't cache the device list but also doesn't cache the names, but I guess we can live with that.

Tuesday, February 6, 2007

Welcome



This is a Python S60 developer's blog. From our gained experience we will post code snippets hints and tips to share for everyone.

For more info on the main project we are working on:

http://www.rex-regensburg.de/im-stadtraum/rexplorer/