I want to have simultaneous Bluetooth and GPRS sessions. My understanding is that the current s60 Python doesn't support that, but that I can use the PDIS sockets to accomplish the same end.
I have a few questions about how to use the PDIS code. On the BT side, I want to do the connection and just read data off the socket. As best as I can figure out, I want to use test_ntvsock_bt.py as my template. Is that correct, or is there another piece of documentation/code snippet I should be looking at?
Assuming I'm looking at the right thing, what's the purpose of the AoSocketServ class? Is it multiplexing and demultiplexing the traffic? And how does AoLoop work?
Before deciding which code snippets to look at, the question to ask is
whether you want to go with an event-based or multi-threaded design.
In the former case, test_ntvsock_bt_*.py and test_native_socket_tcp.py
might serve as examples, but not necessarily as templates to use in a
proper application, as not all the test-programs behave nicely in
error situations, for instance. symbian_async_socket.py provides a
slightly higher-level event-based API, and test_tcp_asyncsock.py
demonstrates its use.
If one instead wanted to use blocking sockets and multiple threads,
say so as to accept connections with one thread and have clients
serviced in other threads, one could use the pdis.net.abstract_socket
API. PDIS itself uses this approach, although there is some overhead
involved. test_mgsock_bt.py is a small example of using the API.
Note that some of the test-programs may be out of date due to frequent
API changes in the PDIS socket library, and the API being such a
moving target kind of speaks in favor of using the builtin socket API
An AoSocketServ just wraps a handle to a Symbian socket server
session. Such a session is required (typically one is enough) for
creating sockets, and the session must stay alive for as long as the
sockets are being used.
An AoLoop, when start()ed, runs an event loop until stop() is called,
after which the call to start() returns. You could do something very
similar with e32.Ao_lock.