{"action":"created","comment":{"url":"https://api.github.com/repos/BrainTech/openbci/pulls/comments/59695523","id":59695523,"diff_hunk":"@@ -8,52 +8,111 @@\n \n from obci.drivers.etr import etr_amplifier\n from obci.configs import settings, variables_pb2\n+from multiplexer.multiplexer_constants import peers, types\n \n from ws4py.client.threadedclient import WebSocketClient\n \n class EtrWebSocketClient(WebSocketClient):\n-    def __init__(self, peer):\n-        super(EtrWebSocketClient, self).__init__()\n+    '''\n+    Modification to EtrWebSocketClient, which lets to capture more data\n+    than x and y gaze position.\n+    '''\n+    def __init__(self, url, peer,  samples_per_packet = 4):\n+        super(EtrWebSocketClient, self).__init__(url,)\n         self.peer = peer\n-\n+        self.samples_per_packet = samples_per_packet\n+        self.msg_vector = variables_pb2.SampleVector()\n+        \n     def opened(self):\n-        print(\"Opened\")\n-\n+        self.peer.logger.info(\"Opened\")\n+        \n     def closed(self, code, reason):\n-        print((\"Closed down\", code, reason))\n+        self.peer.logger.info((\"Closed down\", code, reason))\n         self.peer.end_the_loop = True\n-\n+        \n     def received_message(self, m):\n+            \n+        msg = json.loads(str(m))\n+        timestamp = float(msg['timestamp'])\n+        sample = self.msg_vector.samples.add()\n+        sample.timestamp = timestamp\n         try:\n-            msg = json.loads(m)\n-            print(\"x = {}, y = {}\".format(m['x'], m['y']))\n+            sample.channels.extend(float(msg[i]) for i in self.peer.chs)\n+        except KeyError as e:\n+            msg = '''\n+            \n+            ERROR: UNAVAILABLE CHANNELS:\n+            {}\n+            \n             \n-            l_msg = variables_pb2.Sample2D()\n-            l_msg.x = float(m['x'])\n-            l_msg.y = float(m['y'])\n-            l_msg.timestamp = float(m['timestamp'])\n+            Channels from tracker server JSON:\n+            {}\n             \n-            self.peer.process_message(l_msg)\n-        except Exception as ex:\n-            pass\n \n+            You've tried to access channels:","path":"obci/drivers/etr/etr_amplifier_ws_peer.py","position":67,"original_position":61,"commit_id":"5f6acb5f425dd06877e0749d0e6784be2c9ad8e9","original_commit_id":"91ad6e8ac847aaad75b24946dc3aa74df1212031","user":{"login":"mdovgialo","id":6193380,"avatar_url":"https://avatars.githubusercontent.com/u/6193380?v=3","gravatar_id":"","url":"https://api.github.com/users/mdovgialo","html_url":"https://github.com/mdovgialo","followers_url":"https://api.github.com/users/mdovgialo/followers","following_url":"https://api.github.com/users/mdovgialo/following{/other_user}","gists_url":"https://api.github.com/users/mdovgialo/gists{/gist_id}","starred_url":"https://api.github.com/users/mdovgialo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdovgialo/subscriptions","organizations_url":"https://api.github.com/users/mdovgialo/orgs","repos_url":"https://api.github.com/users/mdovgialo/repos","events_url":"https://api.github.com/users/mdovgialo/events{/privacy}","received_events_url":"https://api.github.com/users/mdovgialo/received_events","type":"User","site_admin":false},"body":"Now should be better","created_at":"2016-04-14T10:38:33Z","updated_at":"2016-04-14T10:38:33Z","html_url":"https://github.com/BrainTech/openbci/pull/3#discussion_r59695523","pull_request_url":"https://api.github.com/repos/BrainTech/openbci/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/BrainTech/openbci/pulls/comments/59695523"},"html":{"href":"https://github.com/BrainTech/openbci/pull/3#discussion_r59695523"},"pull_request":{"href":"https://api.github.com/repos/BrainTech/openbci/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/BrainTech/openbci/pulls/3","id":66140319,"html_url":"https://github.com/BrainTech/openbci/pull/3","diff_url":"https://github.com/BrainTech/openbci/pull/3.diff","patch_url":"https://github.com/BrainTech/openbci/pull/3.patch","issue_url":"https://api.github.com/repos/BrainTech/openbci/issues/3","number":3,"state":"open","locked":false,"title":"Etr ws","user":{"login":"mdovgialo","id":6193380,"avatar_url":"https://avatars.githubusercontent.com/u/6193380?v=3","gravatar_id":"","url":"https://api.github.com/users/mdovgialo","html_url":"https://github.com/mdovgialo","followers_url":"https://api.github.com/users/mdovgialo/followers","following_url":"https://api.github.com/users/mdovgialo/following{/other_user}","gists_url":"https://api.github.com/users/mdovgialo/gists{/gist_id}","starred_url":"https://api.github.com/users/mdovgialo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdovgialo/subscriptions","organizations_url":"https://api.github.com/users/mdovgialo/orgs","repos_url":"https://api.github.com/users/mdovgialo/repos","events_url":"https://api.github.com/users/mdovgialo/events{/privacy}","received_events_url":"https://api.github.com/users/mdovgialo/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-12T11:19:49Z","updated_at":"2016-04-14T10:38:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81478fd87855abac7cb4193ff16793e465527739","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BrainTech/openbci/pulls/3/commits","review_comments_url":"https://api.github.com/repos/BrainTech/openbci/pulls/3/comments","review_comment_url":"https://api.github.com/repos/BrainTech/openbci/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BrainTech/openbci/issues/3/comments","statuses_url":"https://api.github.com/repos/BrainTech/openbci/statuses/5f6acb5f425dd06877e0749d0e6784be2c9ad8e9","head":{"label":"BrainTech:etr_ws","ref":"etr_ws","sha":"5f6acb5f425dd06877e0749d0e6784be2c9ad8e9","user":{"login":"BrainTech","id":8409926,"avatar_url":"https://avatars.githubusercontent.com/u/8409926?v=3","gravatar_id":"","url":"https://api.github.com/users/BrainTech","html_url":"https://github.com/BrainTech","followers_url":"https://api.github.com/users/BrainTech/followers","following_url":"https://api.github.com/users/BrainTech/following{/other_user}","gists_url":"https://api.github.com/users/BrainTech/gists{/gist_id}","starred_url":"https://api.github.com/users/BrainTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrainTech/subscriptions","organizations_url":"https://api.github.com/users/BrainTech/orgs","repos_url":"https://api.github.com/users/BrainTech/repos","events_url":"https://api.github.com/users/BrainTech/events{/privacy}","received_events_url":"https://api.github.com/users/BrainTech/received_events","type":"Organization","site_admin":false},"repo":{"id":22815770,"name":"openbci","full_name":"BrainTech/openbci","owner":{"login":"BrainTech","id":8409926,"avatar_url":"https://avatars.githubusercontent.com/u/8409926?v=3","gravatar_id":"","url":"https://api.github.com/users/BrainTech","html_url":"https://github.com/BrainTech","followers_url":"https://api.github.com/users/BrainTech/followers","following_url":"https://api.github.com/users/BrainTech/following{/other_user}","gists_url":"https://api.github.com/users/BrainTech/gists{/gist_id}","starred_url":"https://api.github.com/users/BrainTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrainTech/subscriptions","organizations_url":"https://api.github.com/users/BrainTech/orgs","repos_url":"https://api.github.com/users/BrainTech/repos","events_url":"https://api.github.com/users/BrainTech/events{/privacy}","received_events_url":"https://api.github.com/users/BrainTech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BrainTech/openbci","description":"OpenBCI Framework","fork":false,"url":"https://api.github.com/repos/BrainTech/openbci","forks_url":"https://api.github.com/repos/BrainTech/openbci/forks","keys_url":"https://api.github.com/repos/BrainTech/openbci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BrainTech/openbci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BrainTech/openbci/teams","hooks_url":"https://api.github.com/repos/BrainTech/openbci/hooks","issue_events_url":"https://api.github.com/repos/BrainTech/openbci/issues/events{/number}","events_url":"https://api.github.com/repos/BrainTech/openbci/events","assignees_url":"https://api.github.com/repos/BrainTech/openbci/assignees{/user}","branches_url":"https://api.github.com/repos/BrainTech/openbci/branches{/branch}","tags_url":"https://api.github.com/repos/BrainTech/openbci/tags","blobs_url":"https://api.github.com/repos/BrainTech/openbci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BrainTech/openbci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BrainTech/openbci/git/refs{/sha}","trees_url":"https://api.github.com/repos/BrainTech/openbci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BrainTech/openbci/statuses/{sha}","languages_url":"https://api.github.com/repos/BrainTech/openbci/languages","stargazers_url":"https://api.github.com/repos/BrainTech/openbci/stargazers","contributors_url":"https://api.github.com/repos/BrainTech/openbci/contributors","subscribers_url":"https://api.github.com/repos/BrainTech/openbci/subscribers","subscription_url":"https://api.github.com/repos/BrainTech/openbci/subscription","commits_url":"https://api.github.com/repos/BrainTech/openbci/commits{/sha}","git_commits_url":"https://api.github.com/repos/BrainTech/openbci/git/commits{/sha}","comments_url":"https://api.github.com/repos/BrainTech/openbci/comments{/number}","issue_comment_url":"https://api.github.com/repos/BrainTech/openbci/issues/comments{/number}","contents_url":"https://api.github.com/repos/BrainTech/openbci/contents/{+path}","compare_url":"https://api.github.com/repos/BrainTech/openbci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BrainTech/openbci/merges","archive_url":"https://api.github.com/repos/BrainTech/openbci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BrainTech/openbci/downloads","issues_url":"https://api.github.com/repos/BrainTech/openbci/issues{/number}","pulls_url":"https://api.github.com/repos/BrainTech/openbci/pulls{/number}","milestones_url":"https://api.github.com/repos/BrainTech/openbci/milestones{/number}","notifications_url":"https://api.github.com/repos/BrainTech/openbci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BrainTech/openbci/labels{/name}","releases_url":"https://api.github.com/repos/BrainTech/openbci/releases{/id}","deployments_url":"https://api.github.com/repos/BrainTech/openbci/deployments","created_at":"2014-08-10T18:34:59Z","updated_at":"2016-04-07T17:10:08Z","pushed_at":"2016-04-14T10:37:36Z","git_url":"git://github.com/BrainTech/openbci.git","ssh_url":"git@github.com:BrainTech/openbci.git","clone_url":"https://github.com/BrainTech/openbci.git","svn_url":"https://github.com/BrainTech/openbci","homepage":null,"size":62932,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":4,"default_branch":"master"}},"base":{"label":"BrainTech:master","ref":"master","sha":"5be262e3b16671093edd8d1809143a7cf8ae23fe","user":{"login":"BrainTech","id":8409926,"avatar_url":"https://avatars.githubusercontent.com/u/8409926?v=3","gravatar_id":"","url":"https://api.github.com/users/BrainTech","html_url":"https://github.com/BrainTech","followers_url":"https://api.github.com/users/BrainTech/followers","following_url":"https://api.github.com/users/BrainTech/following{/other_user}","gists_url":"https://api.github.com/users/BrainTech/gists{/gist_id}","starred_url":"https://api.github.com/users/BrainTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrainTech/subscriptions","organizations_url":"https://api.github.com/users/BrainTech/orgs","repos_url":"https://api.github.com/users/BrainTech/repos","events_url":"https://api.github.com/users/BrainTech/events{/privacy}","received_events_url":"https://api.github.com/users/BrainTech/received_events","type":"Organization","site_admin":false},"repo":{"id":22815770,"name":"openbci","full_name":"BrainTech/openbci","owner":{"login":"BrainTech","id":8409926,"avatar_url":"https://avatars.githubusercontent.com/u/8409926?v=3","gravatar_id":"","url":"https://api.github.com/users/BrainTech","html_url":"https://github.com/BrainTech","followers_url":"https://api.github.com/users/BrainTech/followers","following_url":"https://api.github.com/users/BrainTech/following{/other_user}","gists_url":"https://api.github.com/users/BrainTech/gists{/gist_id}","starred_url":"https://api.github.com/users/BrainTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrainTech/subscriptions","organizations_url":"https://api.github.com/users/BrainTech/orgs","repos_url":"https://api.github.com/users/BrainTech/repos","events_url":"https://api.github.com/users/BrainTech/events{/privacy}","received_events_url":"https://api.github.com/users/BrainTech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BrainTech/openbci","description":"OpenBCI Framework","fork":false,"url":"https://api.github.com/repos/BrainTech/openbci","forks_url":"https://api.github.com/repos/BrainTech/openbci/forks","keys_url":"https://api.github.com/repos/BrainTech/openbci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BrainTech/openbci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BrainTech/openbci/teams","hooks_url":"https://api.github.com/repos/BrainTech/openbci/hooks","issue_events_url":"https://api.github.com/repos/BrainTech/openbci/issues/events{/number}","events_url":"https://api.github.com/repos/BrainTech/openbci/events","assignees_url":"https://api.github.com/repos/BrainTech/openbci/assignees{/user}","branches_url":"https://api.github.com/repos/BrainTech/openbci/branches{/branch}","tags_url":"https://api.github.com/repos/BrainTech/openbci/tags","blobs_url":"https://api.github.com/repos/BrainTech/openbci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BrainTech/openbci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BrainTech/openbci/git/refs{/sha}","trees_url":"https://api.github.com/repos/BrainTech/openbci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BrainTech/openbci/statuses/{sha}","languages_url":"https://api.github.com/repos/BrainTech/openbci/languages","stargazers_url":"https://api.github.com/repos/BrainTech/openbci/stargazers","contributors_url":"https://api.github.com/repos/BrainTech/openbci/contributors","subscribers_url":"https://api.github.com/repos/BrainTech/openbci/subscribers","subscription_url":"https://api.github.com/repos/BrainTech/openbci/subscription","commits_url":"https://api.github.com/repos/BrainTech/openbci/commits{/sha}","git_commits_url":"https://api.github.com/repos/BrainTech/openbci/git/commits{/sha}","comments_url":"https://api.github.com/repos/BrainTech/openbci/comments{/number}","issue_comment_url":"https://api.github.com/repos/BrainTech/openbci/issues/comments{/number}","contents_url":"https://api.github.com/repos/BrainTech/openbci/contents/{+path}","compare_url":"https://api.github.com/repos/BrainTech/openbci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BrainTech/openbci/merges","archive_url":"https://api.github.com/repos/BrainTech/openbci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BrainTech/openbci/downloads","issues_url":"https://api.github.com/repos/BrainTech/openbci/issues{/number}","pulls_url":"https://api.github.com/repos/BrainTech/openbci/pulls{/number}","milestones_url":"https://api.github.com/repos/BrainTech/openbci/milestones{/number}","notifications_url":"https://api.github.com/repos/BrainTech/openbci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BrainTech/openbci/labels{/name}","releases_url":"https://api.github.com/repos/BrainTech/openbci/releases{/id}","deployments_url":"https://api.github.com/repos/BrainTech/openbci/deployments","created_at":"2014-08-10T18:34:59Z","updated_at":"2016-04-07T17:10:08Z","pushed_at":"2016-04-14T10:37:36Z","git_url":"git://github.com/BrainTech/openbci.git","ssh_url":"git@github.com:BrainTech/openbci.git","clone_url":"https://github.com/BrainTech/openbci.git","svn_url":"https://github.com/BrainTech/openbci","homepage":null,"size":62932,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BrainTech/openbci/pulls/3"},"html":{"href":"https://github.com/BrainTech/openbci/pull/3"},"issue":{"href":"https://api.github.com/repos/BrainTech/openbci/issues/3"},"comments":{"href":"https://api.github.com/repos/BrainTech/openbci/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/BrainTech/openbci/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/BrainTech/openbci/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BrainTech/openbci/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/BrainTech/openbci/statuses/5f6acb5f425dd06877e0749d0e6784be2c9ad8e9"}}}}