Open GoogleCodeExporter opened 8 years ago
Hi. Any luck with that?
I'll take this opportunity to introduce something I'm working on:
http://code.google.com/p/open-zb-home/
(before I try make it more public..)
Please feel free to check it out and let me know what you think.
I've got a little work-around that I'm suing in the meantime:
{{{
def getFromXBeeThread():
while True:
response = xbee.wait_read_frame()
if response ["id"]=="rx":
print response["rf_data"],
threads.deferToThread(getFromXBeeThread).addCallback(dispatchTCP)
return response["rf_data"]
}}}
you just have to call it once to start it, then it will loop itself.
Original comment by ruZ...@gmail.com
on 12 Aug 2011 at 11:02
I have done this twisted protocol:
http://pastebin.com/fUcuexHW
An implementation example:
http://pastebin.com/pLdVV4gn
Original comment by wsart...@gmail.com
on 12 Aug 2011 at 7:23
Hi all,
Sorry for responding so late; it slipped my mind a while back.
I'm not sure I quite understand what you asking, wsartori. Do you want to make
a whole new XBee library for Twisted?
Now, I don't know much about Twisted and how it does things; would it be
possible to get the functionality you want by making a package within the
helpers package of python-xbee? If all you need is to wrap an XBee instance
such that Twisted can access it, then checking it in here would ensure that you
get the latest fixes/updates/etc. without regularly pulling from upstream.
What do you think?
Thanks,
~Paul Malmsten
Original comment by pmalms...@gmail.com
on 13 Aug 2011 at 8:44
Thanks wsartori. I've implemented your snippets and it's working well. I was
using the defereToThread before but it was blocking the shutdown..
daemonizing..etc.. you solved it:)
Paul, Twisted is a "network-engine", it's a bunch of tools that simplify doing
loads of things like creating web servers, tcp servers, clients, etc. It's
completely asynchronous and non-blocking and works best when the rest of the
code is too.
Your library has asynchronous calls in it that also defer but I didnt get
around to trying it out.
This is only relevant to receiving since sending is asynchronous anyway...
Original comment by ruZ...@gmail.com
on 14 Aug 2011 at 1:28
I decided to make it a separated project to don't add a dependency to twisted
on python-xbee.
I made the package and it's available on pypi:
http://pypi.python.org/pypi/txXBee/
source: https://github.com/trunet/txXBee
you can close this issue.
Original comment by wsart...@gmail.com
on 3 Oct 2011 at 1:37
Original issue reported on code.google.com by
wsart...@gmail.com
on 23 Jun 2011 at 9:04