Python for S60:在独立线程中监听套接字

发布于 2024-07-15 12:34:24 字数 600 浏览 5 评论 0原文

我正在用 Python 为基于 S60 的诺基亚设备开发蓝牙游戏。 事实证明,S60 中的蓝牙插座相当棘手。 有两个原因:

  1. 我无法在 Python 中对多个从属套接字进行主控,听说它无法在 Python 中完成,所以我已经离开了这个,无论如何也不做。

  2. 另一部分是我不能只在单独的线程中侦听套接字并继续正常执行我的应用程序。 我在这里尝试了一个示例代码:

http://pastebin.com/f76189841

请注意,我使用 ao_callgate() 而在线程之间共享套接字。


该帖子(仍未得到答复:-( )可以在这里找到: http://discussion.forum.nokia.com/forum/showthread。 php?t=162260

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫性小仙女 2024-07-22 12:34:24

我了解了一些有关 Active 对象的知识。 读写请求被发送到蓝牙服务器。 但一次只能发出一个请求。

我创建一个新线程(例如 t1),并使用 ao_e32.callgate() 在主线程上下文中调用它。 我在那里等待传入的消息。 当我想通过蓝牙发送消息时,我应该停止该线程,发送消息并再次启动该线程。 但现在的问题是如何在 Python 中停止线程。

PS 线程模块在适用于 S60 的 Python 中可用,并且可以使用 PC 版本 Python 中的 threading.py 在其上安装线程

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文