views:

570

answers:

1

I am developing a Bluetooth game in Python for S60 based Nokia devices. The Bluetooth sockets in S60 are proving to be quite tricky. For two reasons:

  1. I can't do master to multiple slave sockets in Python, heard that it can't be done in Python so I have already left this and not doing it anyway.

  2. The other part is I can't just listen to a socket in a separate thread and go away with te normal execution of my application. I tried a sample code here:

http://pastebin.com/f76189841

Notice that I use ao_callgate() while sharing sockets among threads.


The post (still unaswered :-( ) can be found here: http://discussion.forum.nokia.com/forum/showthread.php?t=162260

+1  A: 

I learned a bit about Active objects. Requests to read and write are sent to Blutooth server. But there is a limitation of only one request at a time.

I create a new thread (say t1) and call it in the context of the main thread using ao_e32.callgate(). In that I wait for the incoming message. When I want to send a mesaage over bluetooth I should stop this thread, send the message and start the thread again. But now the problem is how do I stop a thread in Python.

P.S. thread module is available in Python for S60 and threding can be installed over it using threading.py from the PC version of Python

Xolve