{"action":"created","comment":{"url":"https://api.github.com/repos/pioneers/PieCentral/pulls/comments/86672633","pull_request_review_id":7321180,"id":86672633,"diff_hunk":"@@ -1,55 +1,74 @@\n from __future__ import print_function\n # Rewritten because Python.__version__ != 3\n-import serial\n import struct\n import pdb\n+import os\n+import json\n+\n+config_file = open(os.path.join(os.path.dirname(__file__), 'hibikeDevices.json'), 'r')\n+devices = json.load(config_file)\n+#devices = {device[\"id\"]: device for device in devices}\n+paramMap = {device[\"id\"]: {param[\"name\"]: (param[\"number\"], param[\"type\"]) for param in device[\"params\"]} for device in devices}\n+\n+\"\"\"\n+structure of devices\n+{0: \n+    {\"id\": 0, \"name\": \"LimitSwitch\", \"params\": [\n+                                               {\"number\": 0, \"name\": \"switch0\", \"type\": \"bool\", \"read\": True, \"write\": False}\n+                                               ]\n+    }\n+}\n+\n+\"\"\"\n+\n+# Dictionary mapping param types to python struct format characters\n+paramTypes = {\n+  \"bool\" : \"?\",\n+  \"uint8_t\": \"B\",\n+  \"int8_t\": \"b\", \n+  \"uint16_t\": \"H\",\n+  \"int16_t\": \"h\", \n+  \"uint32_t\": \"I\",\n+  \"int32_t\": \"i\", \n+  \"uint64_t\": \"Q\",\n+  \"int64_t\": \"q\", \n+  \"float\": \"f\",\n+  \"double\": \"d\"\n+}\n+\n # Dictionary of message types: message id\n messageTypes = {\n-  \"SubscriptionRequest\" :  0x00,\n-  \"SubscriptionResponse\" : 0x01,\n-  \"DataUpdate\" :           0x02,\n-  \"DeviceUpdate\" :         0x03,\n-  \"DeviceStatus\" :         0x04,\n-  \"DeviceResponse\" :       0x05,\n-  \"Ping\" :                 0x06,\n-  \"DescriptionRequest\" :   0x08,\n-  \"DescriptionResponse\" :  0x09,\n-  \"Error\" :                0xff\n+  \"Ping\" :                 0x10,\n+  \"SubscriptionRequest\" :  0x11,\n+  \"SubscriptionResponse\" : 0x12,\n+  \"DeviceRead\" :           0x13,\n+  \"DeviceWrite\" :          0x14,\n+  \"DeviceData\" :           0x15,\n+  \"Error\" :                0xFF\n }\n \n # Dictionary of device types: enumeration\n deviceTypes = {\n-  \"Limit Switch\" :         0x00,\n-  \"Line Follower\" :        0x01,\n-  \"Potentiometer\" :        0x02,\n-  \"Encoder\" :              0x03,\n-  \"Battery Buzzer\" :       0x04,\n-  \"Team Flag\" :            0x05,\n-  \"Grizzly\" :              0x06,\n-  \"Servo Control\" :        0x07,\n-  \"Linear Actuator\" :      0x08\n-}\n-\n-\n-# Dictionary of message types: payload length\n-messagePayloadLengths = {\n-  messageTypes[\"SubscriptionRequest\"] :  2,\n-  messageTypes[\"SubscriptionResponse\"] : 13,\n-  # TODO: find a clean way to not hardcode this\n-  messageTypes[\"DataUpdate\"] :           1,\n-  messageTypes[\"DeviceUpdate\"] :         5,\n-  messageTypes[\"DeviceStatus\"] :         5,\n-  messageTypes[\"DeviceResponse\"] :       5,\n-  messageTypes[\"Error\"] :                1\n+  \"LimitSwitch\"   :       0x00,","path":"hibike/hibike_message.py","position":85,"original_position":85,"commit_id":"3ade04043f74df815140ffab1037c096897dfde8","original_commit_id":"0c821e61a677cd38a8228fcd5304fa312bb00ac3","user":{"login":"karthik-shanmugam","id":7821859,"avatar_url":"https://avatars.githubusercontent.com/u/7821859?v=3","gravatar_id":"","url":"https://api.github.com/users/karthik-shanmugam","html_url":"https://github.com/karthik-shanmugam","followers_url":"https://api.github.com/users/karthik-shanmugam/followers","following_url":"https://api.github.com/users/karthik-shanmugam/following{/other_user}","gists_url":"https://api.github.com/users/karthik-shanmugam/gists{/gist_id}","starred_url":"https://api.github.com/users/karthik-shanmugam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karthik-shanmugam/subscriptions","organizations_url":"https://api.github.com/users/karthik-shanmugam/orgs","repos_url":"https://api.github.com/users/karthik-shanmugam/repos","events_url":"https://api.github.com/users/karthik-shanmugam/events{/privacy}","received_events_url":"https://api.github.com/users/karthik-shanmugam/received_events","type":"User","site_admin":false},"body":"There was no reason; they've been removed now","created_at":"2016-11-05T20:26:21Z","updated_at":"2016-11-05T20:26:21Z","html_url":"https://github.com/pioneers/PieCentral/pull/64#discussion_r86672633","pull_request_url":"https://api.github.com/repos/pioneers/PieCentral/pulls/64","_links":{"self":{"href":"https://api.github.com/repos/pioneers/PieCentral/pulls/comments/86672633"},"html":{"href":"https://github.com/pioneers/PieCentral/pull/64#discussion_r86672633"},"pull_request":{"href":"https://api.github.com/repos/pioneers/PieCentral/pulls/64"}}},"pull_request":{"url":"https://api.github.com/repos/pioneers/PieCentral/pulls/64","id":91715888,"html_url":"https://github.com/pioneers/PieCentral/pull/64","diff_url":"https://github.com/pioneers/PieCentral/pull/64.diff","patch_url":"https://github.com/pioneers/PieCentral/pull/64.patch","issue_url":"https://api.github.com/repos/pioneers/PieCentral/issues/64","number":64,"state":"open","locked":false,"title":"[HIBIKE] create hibike simulator for runtime integration","user":{"login":"karthik-shanmugam","id":7821859,"avatar_url":"https://avatars.githubusercontent.com/u/7821859?v=3","gravatar_id":"","url":"https://api.github.com/users/karthik-shanmugam","html_url":"https://github.com/karthik-shanmugam","followers_url":"https://api.github.com/users/karthik-shanmugam/followers","following_url":"https://api.github.com/users/karthik-shanmugam/following{/other_user}","gists_url":"https://api.github.com/users/karthik-shanmugam/gists{/gist_id}","starred_url":"https://api.github.com/users/karthik-shanmugam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karthik-shanmugam/subscriptions","organizations_url":"https://api.github.com/users/karthik-shanmugam/orgs","repos_url":"https://api.github.com/users/karthik-shanmugam/repos","events_url":"https://api.github.com/users/karthik-shanmugam/events{/privacy}","received_events_url":"https://api.github.com/users/karthik-shanmugam/received_events","type":"User","site_admin":false},"body":"- rewrite `hibike_simulator.py` and add a function `hibike_process`, which takes in various Queues and Pipes and simulates the behavior described in `ATALANDA_INTEGRATION.md`\r\n\r\n- rewrite `README.md`, `hibikeDevices.json`, and `hibike_message.py` with protocol changes\r\n\r\n- add an `__init__.py` so hibike can be imported from runtime","created_at":"2016-11-01T00:32:42Z","updated_at":"2016-11-05T20:26:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b4cb7a4f3454cd3360821e24cf4f753e5a5a0bef","assignee":{"login":"nikitakit","id":252225,"avatar_url":"https://avatars.githubusercontent.com/u/252225?v=3","gravatar_id":"","url":"https://api.github.com/users/nikitakit","html_url":"https://github.com/nikitakit","followers_url":"https://api.github.com/users/nikitakit/followers","following_url":"https://api.github.com/users/nikitakit/following{/other_user}","gists_url":"https://api.github.com/users/nikitakit/gists{/gist_id}","starred_url":"https://api.github.com/users/nikitakit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikitakit/subscriptions","organizations_url":"https://api.github.com/users/nikitakit/orgs","repos_url":"https://api.github.com/users/nikitakit/repos","events_url":"https://api.github.com/users/nikitakit/events{/privacy}","received_events_url":"https://api.github.com/users/nikitakit/received_events","type":"User","site_admin":false},"assignees":[{"login":"nikitakit","id":252225,"avatar_url":"https://avatars.githubusercontent.com/u/252225?v=3","gravatar_id":"","url":"https://api.github.com/users/nikitakit","html_url":"https://github.com/nikitakit","followers_url":"https://api.github.com/users/nikitakit/followers","following_url":"https://api.github.com/users/nikitakit/following{/other_user}","gists_url":"https://api.github.com/users/nikitakit/gists{/gist_id}","starred_url":"https://api.github.com/users/nikitakit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikitakit/subscriptions","organizations_url":"https://api.github.com/users/nikitakit/orgs","repos_url":"https://api.github.com/users/nikitakit/repos","events_url":"https://api.github.com/users/nikitakit/events{/privacy}","received_events_url":"https://api.github.com/users/nikitakit/received_events","type":"User","site_admin":false},{"login":"bodiddles","id":6416584,"avatar_url":"https://avatars.githubusercontent.com/u/6416584?v=3","gravatar_id":"","url":"https://api.github.com/users/bodiddles","html_url":"https://github.com/bodiddles","followers_url":"https://api.github.com/users/bodiddles/followers","following_url":"https://api.github.com/users/bodiddles/following{/other_user}","gists_url":"https://api.github.com/users/bodiddles/gists{/gist_id}","starred_url":"https://api.github.com/users/bodiddles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bodiddles/subscriptions","organizations_url":"https://api.github.com/users/bodiddles/orgs","repos_url":"https://api.github.com/users/bodiddles/repos","events_url":"https://api.github.com/users/bodiddles/events{/privacy}","received_events_url":"https://api.github.com/users/bodiddles/received_events","type":"User","site_admin":false},{"login":"yizow","id":7284555,"avatar_url":"https://avatars.githubusercontent.com/u/7284555?v=3","gravatar_id":"","url":"https://api.github.com/users/yizow","html_url":"https://github.com/yizow","followers_url":"https://api.github.com/users/yizow/followers","following_url":"https://api.github.com/users/yizow/following{/other_user}","gists_url":"https://api.github.com/users/yizow/gists{/gist_id}","starred_url":"https://api.github.com/users/yizow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yizow/subscriptions","organizations_url":"https://api.github.com/users/yizow/orgs","repos_url":"https://api.github.com/users/yizow/repos","events_url":"https://api.github.com/users/yizow/events{/privacy}","received_events_url":"https://api.github.com/users/yizow/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pioneers/PieCentral/pulls/64/commits","review_comments_url":"https://api.github.com/repos/pioneers/PieCentral/pulls/64/comments","review_comment_url":"https://api.github.com/repos/pioneers/PieCentral/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pioneers/PieCentral/issues/64/comments","statuses_url":"https://api.github.com/repos/pioneers/PieCentral/statuses/3ade04043f74df815140ffab1037c096897dfde8","head":{"label":"pioneers:hibike/integration","ref":"hibike/integration","sha":"3ade04043f74df815140ffab1037c096897dfde8","user":{"login":"pioneers","id":5135404,"avatar_url":"https://avatars.githubusercontent.com/u/5135404?v=3","gravatar_id":"","url":"https://api.github.com/users/pioneers","html_url":"https://github.com/pioneers","followers_url":"https://api.github.com/users/pioneers/followers","following_url":"https://api.github.com/users/pioneers/following{/other_user}","gists_url":"https://api.github.com/users/pioneers/gists{/gist_id}","starred_url":"https://api.github.com/users/pioneers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pioneers/subscriptions","organizations_url":"https://api.github.com/users/pioneers/orgs","repos_url":"https://api.github.com/users/pioneers/repos","events_url":"https://api.github.com/users/pioneers/events{/privacy}","received_events_url":"https://api.github.com/users/pioneers/received_events","type":"Organization","site_admin":false},"repo":{"id":67092938,"name":"PieCentral","full_name":"pioneers/PieCentral","owner":{"login":"pioneers","id":5135404,"avatar_url":"https://avatars.githubusercontent.com/u/5135404?v=3","gravatar_id":"","url":"https://api.github.com/users/pioneers","html_url":"https://github.com/pioneers","followers_url":"https://api.github.com/users/pioneers/followers","following_url":"https://api.github.com/users/pioneers/following{/other_user}","gists_url":"https://api.github.com/users/pioneers/gists{/gist_id}","starred_url":"https://api.github.com/users/pioneers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pioneers/subscriptions","organizations_url":"https://api.github.com/users/pioneers/orgs","repos_url":"https://api.github.com/users/pioneers/repos","events_url":"https://api.github.com/users/pioneers/events{/privacy}","received_events_url":"https://api.github.com/users/pioneers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pioneers/PieCentral","description":null,"fork":false,"url":"https://api.github.com/repos/pioneers/PieCentral","forks_url":"https://api.github.com/repos/pioneers/PieCentral/forks","keys_url":"https://api.github.com/repos/pioneers/PieCentral/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pioneers/PieCentral/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pioneers/PieCentral/teams","hooks_url":"https://api.github.com/repos/pioneers/PieCentral/hooks","issue_events_url":"https://api.github.com/repos/pioneers/PieCentral/issues/events{/number}","events_url":"https://api.github.com/repos/pioneers/PieCentral/events","assignees_url":"https://api.github.com/repos/pioneers/PieCentral/assignees{/user}","branches_url":"https://api.github.com/repos/pioneers/PieCentral/branches{/branch}","tags_url":"https://api.github.com/repos/pioneers/PieCentral/tags","blobs_url":"https://api.github.com/repos/pioneers/PieCentral/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pioneers/PieCentral/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pioneers/PieCentral/git/refs{/sha}","trees_url":"https://api.github.com/repos/pioneers/PieCentral/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pioneers/PieCentral/statuses/{sha}","languages_url":"https://api.github.com/repos/pioneers/PieCentral/languages","stargazers_url":"https://api.github.com/repos/pioneers/PieCentral/stargazers","contributors_url":"https://api.github.com/repos/pioneers/PieCentral/contributors","subscribers_url":"https://api.github.com/repos/pioneers/PieCentral/subscribers","subscription_url":"https://api.github.com/repos/pioneers/PieCentral/subscription","commits_url":"https://api.github.com/repos/pioneers/PieCentral/commits{/sha}","git_commits_url":"https://api.github.com/repos/pioneers/PieCentral/git/commits{/sha}","comments_url":"https://api.github.com/repos/pioneers/PieCentral/comments{/number}","issue_comment_url":"https://api.github.com/repos/pioneers/PieCentral/issues/comments{/number}","contents_url":"https://api.github.com/repos/pioneers/PieCentral/contents/{+path}","compare_url":"https://api.github.com/repos/pioneers/PieCentral/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pioneers/PieCentral/merges","archive_url":"https://api.github.com/repos/pioneers/PieCentral/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pioneers/PieCentral/downloads","issues_url":"https://api.github.com/repos/pioneers/PieCentral/issues{/number}","pulls_url":"https://api.github.com/repos/pioneers/PieCentral/pulls{/number}","milestones_url":"https://api.github.com/repos/pioneers/PieCentral/milestones{/number}","notifications_url":"https://api.github.com/repos/pioneers/PieCentral/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pioneers/PieCentral/labels{/name}","releases_url":"https://api.github.com/repos/pioneers/PieCentral/releases{/id}","deployments_url":"https://api.github.com/repos/pioneers/PieCentral/deployments","created_at":"2016-09-01T03:00:13Z","updated_at":"2016-10-24T23:22:07Z","pushed_at":"2016-11-05T20:25:32Z","git_url":"git://github.com/pioneers/PieCentral.git","ssh_url":"git@github.com:pioneers/PieCentral.git","clone_url":"https://github.com/pioneers/PieCentral.git","svn_url":"https://github.com/pioneers/PieCentral","homepage":null,"size":3602,"stargazers_count":2,"watchers_count":2,"language":"Makefile","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":16,"forks":1,"open_issues":16,"watchers":2,"default_branch":"master"}},"base":{"label":"pioneers:master","ref":"master","sha":"3833449441f1a994fb808a682f7da160c692f446","user":{"login":"pioneers","id":5135404,"avatar_url":"https://avatars.githubusercontent.com/u/5135404?v=3","gravatar_id":"","url":"https://api.github.com/users/pioneers","html_url":"https://github.com/pioneers","followers_url":"https://api.github.com/users/pioneers/followers","following_url":"https://api.github.com/users/pioneers/following{/other_user}","gists_url":"https://api.github.com/users/pioneers/gists{/gist_id}","starred_url":"https://api.github.com/users/pioneers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pioneers/subscriptions","organizations_url":"https://api.github.com/users/pioneers/orgs","repos_url":"https://api.github.com/users/pioneers/repos","events_url":"https://api.github.com/users/pioneers/events{/privacy}","received_events_url":"https://api.github.com/users/pioneers/received_events","type":"Organization","site_admin":false},"repo":{"id":67092938,"name":"PieCentral","full_name":"pioneers/PieCentral","owner":{"login":"pioneers","id":5135404,"avatar_url":"https://avatars.githubusercontent.com/u/5135404?v=3","gravatar_id":"","url":"https://api.github.com/users/pioneers","html_url":"https://github.com/pioneers","followers_url":"https://api.github.com/users/pioneers/followers","following_url":"https://api.github.com/users/pioneers/following{/other_user}","gists_url":"https://api.github.com/users/pioneers/gists{/gist_id}","starred_url":"https://api.github.com/users/pioneers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pioneers/subscriptions","organizations_url":"https://api.github.com/users/pioneers/orgs","repos_url":"https://api.github.com/users/pioneers/repos","events_url":"https://api.github.com/users/pioneers/events{/privacy}","received_events_url":"https://api.github.com/users/pioneers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pioneers/PieCentral","description":null,"fork":false,"url":"https://api.github.com/repos/pioneers/PieCentral","forks_url":"https://api.github.com/repos/pioneers/PieCentral/forks","keys_url":"https://api.github.com/repos/pioneers/PieCentral/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pioneers/PieCentral/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pioneers/PieCentral/teams","hooks_url":"https://api.github.com/repos/pioneers/PieCentral/hooks","issue_events_url":"https://api.github.com/repos/pioneers/PieCentral/issues/events{/number}","events_url":"https://api.github.com/repos/pioneers/PieCentral/events","assignees_url":"https://api.github.com/repos/pioneers/PieCentral/assignees{/user}","branches_url":"https://api.github.com/repos/pioneers/PieCentral/branches{/branch}","tags_url":"https://api.github.com/repos/pioneers/PieCentral/tags","blobs_url":"https://api.github.com/repos/pioneers/PieCentral/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pioneers/PieCentral/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pioneers/PieCentral/git/refs{/sha}","trees_url":"https://api.github.com/repos/pioneers/PieCentral/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pioneers/PieCentral/statuses/{sha}","languages_url":"https://api.github.com/repos/pioneers/PieCentral/languages","stargazers_url":"https://api.github.com/repos/pioneers/PieCentral/stargazers","contributors_url":"https://api.github.com/repos/pioneers/PieCentral/contributors","subscribers_url":"https://api.github.com/repos/pioneers/PieCentral/subscribers","subscription_url":"https://api.github.com/repos/pioneers/PieCentral/subscription","commits_url":"https://api.github.com/repos/pioneers/PieCentral/commits{/sha}","git_commits_url":"https://api.github.com/repos/pioneers/PieCentral/git/commits{/sha}","comments_url":"https://api.github.com/repos/pioneers/PieCentral/comments{/number}","issue_comment_url":"https://api.github.com/repos/pioneers/PieCentral/issues/comments{/number}","contents_url":"https://api.github.com/repos/pioneers/PieCentral/contents/{+path}","compare_url":"https://api.github.com/repos/pioneers/PieCentral/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pioneers/PieCentral/merges","archive_url":"https://api.github.com/repos/pioneers/PieCentral/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pioneers/PieCentral/downloads","issues_url":"https://api.github.com/repos/pioneers/PieCentral/issues{/number}","pulls_url":"https://api.github.com/repos/pioneers/PieCentral/pulls{/number}","milestones_url":"https://api.github.com/repos/pioneers/PieCentral/milestones{/number}","notifications_url":"https://api.github.com/repos/pioneers/PieCentral/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pioneers/PieCentral/labels{/name}","releases_url":"https://api.github.com/repos/pioneers/PieCentral/releases{/id}","deployments_url":"https://api.github.com/repos/pioneers/PieCentral/deployments","created_at":"2016-09-01T03:00:13Z","updated_at":"2016-10-24T23:22:07Z","pushed_at":"2016-11-05T20:25:32Z","git_url":"git://github.com/pioneers/PieCentral.git","ssh_url":"git@github.com:pioneers/PieCentral.git","clone_url":"https://github.com/pioneers/PieCentral.git","svn_url":"https://github.com/pioneers/PieCentral","homepage":null,"size":3602,"stargazers_count":2,"watchers_count":2,"language":"Makefile","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":16,"forks":1,"open_issues":16,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pioneers/PieCentral/pulls/64"},"html":{"href":"https://github.com/pioneers/PieCentral/pull/64"},"issue":{"href":"https://api.github.com/repos/pioneers/PieCentral/issues/64"},"comments":{"href":"https://api.github.com/repos/pioneers/PieCentral/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/pioneers/PieCentral/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/pioneers/PieCentral/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pioneers/PieCentral/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/pioneers/PieCentral/statuses/3ade04043f74df815140ffab1037c096897dfde8"}}}}
{"actor":{"display_login":"karthik-shanmugam"}}