<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://theeyetribe.com/forum/feed.php?f=26&amp;t=252" />

<title>The Eye Tribe</title>
<subtitle>Developer Forum</subtitle>
<link href="http://theeyetribe.com/forum/index.php" />
<updated>2014-08-12T01:56:40+02:00</updated>

<author><name><![CDATA[The Eye Tribe]]></name></author>
<id>http://theeyetribe.com/forum/feed.php?f=26&amp;t=252</id>
<entry>
<author><name><![CDATA[esdalmaijer]]></name></author>
<updated>2014-08-12T01:56:40+02:00</updated>
<published>2014-08-12T01:56:40+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1256#p1256</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1256#p1256"/>
<title type="html"><![CDATA[Re: Python wrapper]]></title>

<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1256#p1256"><![CDATA[
Thanks for the very good input on the response handling! I've used the tips in the newest version of my wrapper (can be found here: <a href="https://github.com/esdalmaijer/PyTribe" class="postlink">https://github.com/esdalmaijer/PyTribe</a>), which is now integrated in PyGaze (<a href="https://github.com/esdalmaijer/PyGaze" class="postlink">https://github.com/esdalmaijer/PyGaze</a>, see for the specific module: <a href="https://github.com/esdalmaijer/PyGaze/blob/master/pygaze/_eyetracker/libeyetribe.py" class="postlink">https://github.com/esdalmaijer/PyGaze/blob/master/pygaze/_eyetracker/libeyetribe.py</a>).<br /><br />Cheers!<br />Edwin<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=3107">skataesdalmaijer</a> — 12 Aug 2014, 01:56</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MSchulte]]></name></author>
<updated>2014-08-05T10:46:50+02:00</updated>
<published>2014-08-05T10:46:50+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1214#p1214</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1214#p1214"/>
<title type="html"><![CDATA[Re: Python wrapper]]></title>

<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1214#p1214"><![CDATA[
I actually changed the way I was doing things to make use of python's new-style classes and property decorators, which turned out to be quite handy. I also implemented a different way of dealing with command-reply matching: a custom Queue object. It inherits from Queue.LifoQueue, overrides the get() method to return an error, and adds a get_item() method that searches through the Queue and returns an item matching your request (and values if you pass those in as an argument, to distinguish between multiple request: get and request: set commands). <br /><br />I'm not sure that I really NEED the lock anymore because of the changes I have made. I only have one thread ever recv-ing from the socket, but multiple functions that could send. It depends on if socket.send is inherently thread-safe, and I'm not prepared to assume that, so I am leaving in the lock for now.<br /><br />I'll post my whole wrapper some time before next Wednesday <img src="http://theeyetribe.com/forum/images/smilies/icon_e_smile.gif" alt=":)" title="Smile" />.<br /><br />Cheers,<br />Daniel Smedema<br /><br />p.s. MSchulte is actually my boss, if anyone is curious why my name and username are so different.<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=2297">skataMSchulte</a> — 05 Aug 2014, 10:46</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[esdalmaijer]]></name></author>
<updated>2014-07-28T21:16:30+02:00</updated>
<published>2014-07-28T21:16:30+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1174#p1174</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1174#p1174"/>
<title type="html"><![CDATA[Re: Python wrapper]]></title>

<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1174#p1174"><![CDATA[
That's a very good question, and your solution seems more elegant. It's pretty much the result of building on a proof-of-principle script; there was no real design choice behind it.<br /><br />On the Lock: this is something that I still need to implement, but purely due to the hypothetical possibility of receiving the wrong kind of response. I haven't actually had problems with this yet, presumably due to a lower heartbeat frequency.<br /><br />Thanks for the suggestions!<br /><br />EDIT (30-Jul-2014): added the suggested Threading Lock yesterday. Immediately noticed the need for one, as it started raining replies to different commands (currently working on a command-reply matching strategy). Thanks again!<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=3107">skataesdalmaijer</a> — 28 Jul 2014, 21:16</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MSchulte]]></name></author>
<updated>2014-07-04T14:11:36+02:00</updated>
<published>2014-07-04T14:11:36+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1082#p1082</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1082#p1082"/>
<title type="html"><![CDATA[Re: Python wrapper]]></title>

<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1082#p1082"><![CDATA[
Looks quite nice!<br /><br />I've been working on something similar, though I have been focusing more on getting the specific things I need for my project working and not on creating a complete wrapper like you have. I did things a bit differently--I created classes HeartThread and ListenerThread, for example, instead of functions that need to be called as the target of a thread.<br /><br />I've been sort of hacking this code together with no regard for style guidelines, but in the next few weeks I intend to clean it up and post it here.<br /><br />In the mean time, I'm curious--why don't you use the json.dumps function in your connection.create_json method? I have this function, for example:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>def send_message(self, category, request=None, values=None):<br />    '''returns the reply in a dict'''<br />        <br />    to_send = {}<br />    to_send&#91;u'category'&#93; = category<br />    if request is not None: <br />        to_send&#91;u'request'&#93; = request<br />    if values is not None:<br />        to_send&#91;u'values'&#93; = values<br />    to_send = json.dumps(to_send)<br />    with self.lock:<br />        self.socket.send(to_send)<br />        reply = self.socket.recv(BUFSIZE)<br />    return json.loads(reply)<br /></code></dd></dl><br /><br />I'm also using a threading.Lock() object, which is self.lock in the code above, for thread safety. I kept receiving heartbeat replies when I was trying to retrieve frame data before I added that. here's my HeartThread class (excuse the lack of documentation--will add it soon):<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>class HeartThread(threading.Thread):<br />    <br />    <br />    def __init__(self, et_socket, socket_lock):<br />        super(HeartThread, self).__init__()<br />        self._stop = threading.Event()<br />        self.socket = et_socket<br />        self.lock = socket_lock<br />        <br />    def stop(self):<br />        self._stop.set()<br />        <br />    def run(self, interval=0.250):<br />        while not self._stop.is_set():<br />            with self.lock:<br />                self.socket.send('{&quot;category&quot;:&quot;heartbeat&quot;}')<br />                logging.debug('Heartbeat reply: {}'.format(self.socket.recv(BUFSIZE)))<br />            sleep(interval)<br /><br /># example call<br />heart_thr = HeartThread(self.socket, self.lock)<br />heart_thr.run()<br /></code></dd></dl><p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=2297">skataMSchulte</a> — 04 Jul 2014, 14:11</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[esdalmaijer]]></name></author>
<updated>2014-07-01T02:33:44+02:00</updated>
<published>2014-07-01T02:33:44+02:00</published>
<id>http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1067#p1067</id>
<link href="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1067#p1067"/>
<title type="html"><![CDATA[Python wrapper]]></title>

<content type="html" xml:base="http://theeyetribe.com/forum/viewtopic.php?t=252&amp;p=1067#p1067"><![CDATA[
Hi guys,<br /><br /><!-- m --><a class="postlink" href="https://github.com/esdalmaijer/PyTribe">https://github.com/esdalmaijer/PyTribe</a><!-- m --> is a first attempt at creating a decent Python wrapper. The current classes are for simple communication with the eye tracker by using methods, which saves you from continuously having to send and parse JSON messages.<br /><br />I plan to write an EyeTribe class on top of this soon, with higher level methods (e.g. 'calibrate', 'validate', 'drift_check', 'start_recording', 'stop_recording' etc., much like these: <!-- m --><a class="postlink" href="https://github.com/esdalmaijer/PyGaze/tree/master/pygaze/_eyetracker">https://github.com/esdalmaijer/PyGaze/t ... eyetracker</a><!-- m -->). But please do have a go at testing the current classes; any feedback is welcome!<br /><br />Best,<br />Edwin<p>Statistics: Posted by <a href="http://theeyetribe.com/forum/memberlist.php?mode=viewprofile&amp;u=3107">skataesdalmaijer</a> — 01 Jul 2014, 02:33</p><hr />
]]></content>
</entry>
</feed>