{"action":"created","comment":{"url":"https://api.github.com/repos/Samsung/iotjs/pulls/comments/90579211","pull_request_review_id":11097876,"id":90579211,"diff_hunk":"@@ -0,0 +1,119 @@\n+/* Copyright 2016 Samsung Electronics Co., Ltd.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+var EventEmitter = require('events').EventEmitter;\n+var util = require('util');\n+var assert  = require('assert');\n+\n+var uart = process.binding(process.binding.uart);\n+\n+//  VALIDATION ARRAYS\n+var DATABITS = [5, 6, 7, 8];\n+var STOPBITS = [1, 1.5, 2];\n+var PARITY = ['none', 'even', 'mark', 'odd', 'space'];\n+var FLOWCONTROLS = ['xon', 'xoff', 'xany', 'rtscts'];\n+\n+var defaultSettings = {\n+  autoOpen: true,\n+  baudRate: 9600,\n+  dataBits: 8,\n+  hupcl: true,\n+  lock: true,\n+  parity: 'none',\n+  rtscts: false,\n+  stopBits: 1,\n+  xany: false,\n+  xoff: false,\n+  xon: false,\n+  highWaterMark: 16 * 1024,\n+}\n+\n+function UART(path, options, callback) { //constructor\n+  if (!(this instanceof UART)) {\n+    return new UART(path, options, callback);\n+  }\n+\n+  if (typeof options === 'function') {\n+    callback = options;\n+    options = {};\n+  }\n+\n+  if (util.isUndefined(options)) {\n+    options = {};\n+  }\n+\n+  var settings = defaultSettings;\n+  for (var propname in options) {\n+    settings[propname] = options[propname];\n+  }\n+\n+  EventEmitter.call(this);\n+\n+  if (!path) {\n+    throw new TypeError('No path specified');\n+  }\n+\n+  if (typeof settings.baudRate !== 'number') {\n+    throw new TypeError(\"'baudRate' must be a number\");\n+  }\n+\n+  if (DATABITS.indexOf(settings.dataBits) === -1) {\n+    throw new TypeError(\"Invalid 'databits': \" + settings.dataBits);\n+  }\n+\n+  if (STOPBITS.indexOf(settings.stopBits) === -1) {\n+    throw new TypeError(\"Invalid 'stopbits': \" + settings.stopbits);\n+  }\n+\n+  if (PARITY.indexOf(settings.parity) === -1) {\n+    throw new TypeError(\"Invalid 'parity': \" + settings.parity);\n+  }\n+\n+  FLOWCONTROLS.forEach(function(control) {\n+    if (typeof settings[control] !== 'boolean') {","path":"src/js/uart.js","position":85,"original_position":85,"commit_id":"cd10df302e3d76df546d5ce8d932589d32fa57b0","original_commit_id":"cd10df302e3d76df546d5ce8d932589d32fa57b0","user":{"login":"nova0821","id":18200689,"avatar_url":"https://avatars.githubusercontent.com/u/18200689?v=3","gravatar_id":"","url":"https://api.github.com/users/nova0821","html_url":"https://github.com/nova0821","followers_url":"https://api.github.com/users/nova0821/followers","following_url":"https://api.github.com/users/nova0821/following{/other_user}","gists_url":"https://api.github.com/users/nova0821/gists{/gist_id}","starred_url":"https://api.github.com/users/nova0821/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nova0821/subscriptions","organizations_url":"https://api.github.com/users/nova0821/orgs","repos_url":"https://api.github.com/users/nova0821/repos","events_url":"https://api.github.com/users/nova0821/events{/privacy}","received_events_url":"https://api.github.com/users/nova0821/received_events","type":"User","site_admin":false},"body":"Prefer to use ``util.isBoolean()``.","created_at":"2016-12-02T02:45:33Z","updated_at":"2016-12-02T02:45:40Z","html_url":"https://github.com/Samsung/iotjs/pull/570#discussion_r90579211","pull_request_url":"https://api.github.com/repos/Samsung/iotjs/pulls/570","_links":{"self":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/comments/90579211"},"html":{"href":"https://github.com/Samsung/iotjs/pull/570#discussion_r90579211"},"pull_request":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/570"}}},"pull_request":{"url":"https://api.github.com/repos/Samsung/iotjs/pulls/570","id":96107801,"html_url":"https://github.com/Samsung/iotjs/pull/570","diff_url":"https://github.com/Samsung/iotjs/pull/570.diff","patch_url":"https://github.com/Samsung/iotjs/pull/570.patch","issue_url":"https://api.github.com/repos/Samsung/iotjs/issues/570","number":570,"state":"open","locked":false,"title":"Implement UART for linux (#409)","user":{"login":"sae-bom","id":11533579,"avatar_url":"https://avatars.githubusercontent.com/u/11533579?v=3","gravatar_id":"","url":"https://api.github.com/users/sae-bom","html_url":"https://github.com/sae-bom","followers_url":"https://api.github.com/users/sae-bom/followers","following_url":"https://api.github.com/users/sae-bom/following{/other_user}","gists_url":"https://api.github.com/users/sae-bom/gists{/gist_id}","starred_url":"https://api.github.com/users/sae-bom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sae-bom/subscriptions","organizations_url":"https://api.github.com/users/sae-bom/orgs","repos_url":"https://api.github.com/users/sae-bom/repos","events_url":"https://api.github.com/users/sae-bom/events{/privacy}","received_events_url":"https://api.github.com/users/sae-bom/received_events","type":"User","site_admin":false},"body":"* UART API on JS\r\n  * constructor\r\n  * open\r\n  * write\r\n  * on('data')\r\n* x86 linux dummy\r\n* arm-linux on Raspberry Pi\r\n\r\nIoT.js-DCO-1.0-Signed-off-by: Saebom Kim sae-bom.kim@samsung.com","created_at":"2016-12-01T15:18:12Z","updated_at":"2016-12-02T02:55:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95fb49be47e2be98f073ac717a3934533519ea9e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Samsung/iotjs/pulls/570/commits","review_comments_url":"https://api.github.com/repos/Samsung/iotjs/pulls/570/comments","review_comment_url":"https://api.github.com/repos/Samsung/iotjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Samsung/iotjs/issues/570/comments","statuses_url":"https://api.github.com/repos/Samsung/iotjs/statuses/cd10df302e3d76df546d5ce8d932589d32fa57b0","head":{"label":"sae-bom:master","ref":"master","sha":"cd10df302e3d76df546d5ce8d932589d32fa57b0","user":{"login":"sae-bom","id":11533579,"avatar_url":"https://avatars.githubusercontent.com/u/11533579?v=3","gravatar_id":"","url":"https://api.github.com/users/sae-bom","html_url":"https://github.com/sae-bom","followers_url":"https://api.github.com/users/sae-bom/followers","following_url":"https://api.github.com/users/sae-bom/following{/other_user}","gists_url":"https://api.github.com/users/sae-bom/gists{/gist_id}","starred_url":"https://api.github.com/users/sae-bom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sae-bom/subscriptions","organizations_url":"https://api.github.com/users/sae-bom/orgs","repos_url":"https://api.github.com/users/sae-bom/repos","events_url":"https://api.github.com/users/sae-bom/events{/privacy}","received_events_url":"https://api.github.com/users/sae-bom/received_events","type":"User","site_admin":false},"repo":{"id":68583697,"name":"iotjs","full_name":"sae-bom/iotjs","owner":{"login":"sae-bom","id":11533579,"avatar_url":"https://avatars.githubusercontent.com/u/11533579?v=3","gravatar_id":"","url":"https://api.github.com/users/sae-bom","html_url":"https://github.com/sae-bom","followers_url":"https://api.github.com/users/sae-bom/followers","following_url":"https://api.github.com/users/sae-bom/following{/other_user}","gists_url":"https://api.github.com/users/sae-bom/gists{/gist_id}","starred_url":"https://api.github.com/users/sae-bom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sae-bom/subscriptions","organizations_url":"https://api.github.com/users/sae-bom/orgs","repos_url":"https://api.github.com/users/sae-bom/repos","events_url":"https://api.github.com/users/sae-bom/events{/privacy}","received_events_url":"https://api.github.com/users/sae-bom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sae-bom/iotjs","description":"Platform for Internet of Things with JavaScript http://www.iotjs.net ","fork":true,"url":"https://api.github.com/repos/sae-bom/iotjs","forks_url":"https://api.github.com/repos/sae-bom/iotjs/forks","keys_url":"https://api.github.com/repos/sae-bom/iotjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sae-bom/iotjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sae-bom/iotjs/teams","hooks_url":"https://api.github.com/repos/sae-bom/iotjs/hooks","issue_events_url":"https://api.github.com/repos/sae-bom/iotjs/issues/events{/number}","events_url":"https://api.github.com/repos/sae-bom/iotjs/events","assignees_url":"https://api.github.com/repos/sae-bom/iotjs/assignees{/user}","branches_url":"https://api.github.com/repos/sae-bom/iotjs/branches{/branch}","tags_url":"https://api.github.com/repos/sae-bom/iotjs/tags","blobs_url":"https://api.github.com/repos/sae-bom/iotjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sae-bom/iotjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sae-bom/iotjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/sae-bom/iotjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sae-bom/iotjs/statuses/{sha}","languages_url":"https://api.github.com/repos/sae-bom/iotjs/languages","stargazers_url":"https://api.github.com/repos/sae-bom/iotjs/stargazers","contributors_url":"https://api.github.com/repos/sae-bom/iotjs/contributors","subscribers_url":"https://api.github.com/repos/sae-bom/iotjs/subscribers","subscription_url":"https://api.github.com/repos/sae-bom/iotjs/subscription","commits_url":"https://api.github.com/repos/sae-bom/iotjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/sae-bom/iotjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/sae-bom/iotjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/sae-bom/iotjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/sae-bom/iotjs/contents/{+path}","compare_url":"https://api.github.com/repos/sae-bom/iotjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sae-bom/iotjs/merges","archive_url":"https://api.github.com/repos/sae-bom/iotjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sae-bom/iotjs/downloads","issues_url":"https://api.github.com/repos/sae-bom/iotjs/issues{/number}","pulls_url":"https://api.github.com/repos/sae-bom/iotjs/pulls{/number}","milestones_url":"https://api.github.com/repos/sae-bom/iotjs/milestones{/number}","notifications_url":"https://api.github.com/repos/sae-bom/iotjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sae-bom/iotjs/labels{/name}","releases_url":"https://api.github.com/repos/sae-bom/iotjs/releases{/id}","deployments_url":"https://api.github.com/repos/sae-bom/iotjs/deployments","created_at":"2016-09-19T08:10:33Z","updated_at":"2016-11-28T04:19:05Z","pushed_at":"2016-12-02T02:02:47Z","git_url":"git://github.com/sae-bom/iotjs.git","ssh_url":"git@github.com:sae-bom/iotjs.git","clone_url":"https://github.com/sae-bom/iotjs.git","svn_url":"https://github.com/sae-bom/iotjs","homepage":"","size":2226,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Samsung:master","ref":"master","sha":"6c4fa3f21cd2975a90fad320b74806deb5c44977","user":{"login":"Samsung","id":6210390,"avatar_url":"https://avatars.githubusercontent.com/u/6210390?v=3","gravatar_id":"","url":"https://api.github.com/users/Samsung","html_url":"https://github.com/Samsung","followers_url":"https://api.github.com/users/Samsung/followers","following_url":"https://api.github.com/users/Samsung/following{/other_user}","gists_url":"https://api.github.com/users/Samsung/gists{/gist_id}","starred_url":"https://api.github.com/users/Samsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Samsung/subscriptions","organizations_url":"https://api.github.com/users/Samsung/orgs","repos_url":"https://api.github.com/users/Samsung/repos","events_url":"https://api.github.com/users/Samsung/events{/privacy}","received_events_url":"https://api.github.com/users/Samsung/received_events","type":"Organization","site_admin":false},"repo":{"id":33589470,"name":"iotjs","full_name":"Samsung/iotjs","owner":{"login":"Samsung","id":6210390,"avatar_url":"https://avatars.githubusercontent.com/u/6210390?v=3","gravatar_id":"","url":"https://api.github.com/users/Samsung","html_url":"https://github.com/Samsung","followers_url":"https://api.github.com/users/Samsung/followers","following_url":"https://api.github.com/users/Samsung/following{/other_user}","gists_url":"https://api.github.com/users/Samsung/gists{/gist_id}","starred_url":"https://api.github.com/users/Samsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Samsung/subscriptions","organizations_url":"https://api.github.com/users/Samsung/orgs","repos_url":"https://api.github.com/users/Samsung/repos","events_url":"https://api.github.com/users/Samsung/events{/privacy}","received_events_url":"https://api.github.com/users/Samsung/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Samsung/iotjs","description":"Platform for Internet of Things with JavaScript http://www.iotjs.net ","fork":false,"url":"https://api.github.com/repos/Samsung/iotjs","forks_url":"https://api.github.com/repos/Samsung/iotjs/forks","keys_url":"https://api.github.com/repos/Samsung/iotjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Samsung/iotjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Samsung/iotjs/teams","hooks_url":"https://api.github.com/repos/Samsung/iotjs/hooks","issue_events_url":"https://api.github.com/repos/Samsung/iotjs/issues/events{/number}","events_url":"https://api.github.com/repos/Samsung/iotjs/events","assignees_url":"https://api.github.com/repos/Samsung/iotjs/assignees{/user}","branches_url":"https://api.github.com/repos/Samsung/iotjs/branches{/branch}","tags_url":"https://api.github.com/repos/Samsung/iotjs/tags","blobs_url":"https://api.github.com/repos/Samsung/iotjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Samsung/iotjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Samsung/iotjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Samsung/iotjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Samsung/iotjs/statuses/{sha}","languages_url":"https://api.github.com/repos/Samsung/iotjs/languages","stargazers_url":"https://api.github.com/repos/Samsung/iotjs/stargazers","contributors_url":"https://api.github.com/repos/Samsung/iotjs/contributors","subscribers_url":"https://api.github.com/repos/Samsung/iotjs/subscribers","subscription_url":"https://api.github.com/repos/Samsung/iotjs/subscription","commits_url":"https://api.github.com/repos/Samsung/iotjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Samsung/iotjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Samsung/iotjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Samsung/iotjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Samsung/iotjs/contents/{+path}","compare_url":"https://api.github.com/repos/Samsung/iotjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Samsung/iotjs/merges","archive_url":"https://api.github.com/repos/Samsung/iotjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Samsung/iotjs/downloads","issues_url":"https://api.github.com/repos/Samsung/iotjs/issues{/number}","pulls_url":"https://api.github.com/repos/Samsung/iotjs/pulls{/number}","milestones_url":"https://api.github.com/repos/Samsung/iotjs/milestones{/number}","notifications_url":"https://api.github.com/repos/Samsung/iotjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Samsung/iotjs/labels{/name}","releases_url":"https://api.github.com/repos/Samsung/iotjs/releases{/id}","deployments_url":"https://api.github.com/repos/Samsung/iotjs/deployments","created_at":"2015-04-08T06:41:39Z","updated_at":"2016-12-01T15:38:34Z","pushed_at":"2016-12-02T02:02:48Z","git_url":"git://github.com/Samsung/iotjs.git","ssh_url":"git@github.com:Samsung/iotjs.git","clone_url":"https://github.com/Samsung/iotjs.git","svn_url":"https://github.com/Samsung/iotjs","homepage":"","size":2496,"stargazers_count":1119,"watchers_count":1119,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":176,"mirror_url":null,"open_issues_count":26,"forks":176,"open_issues":26,"watchers":1119,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/570"},"html":{"href":"https://github.com/Samsung/iotjs/pull/570"},"issue":{"href":"https://api.github.com/repos/Samsung/iotjs/issues/570"},"comments":{"href":"https://api.github.com/repos/Samsung/iotjs/issues/570/comments"},"review_comments":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/570/comments"},"review_comment":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Samsung/iotjs/pulls/570/commits"},"statuses":{"href":"https://api.github.com/repos/Samsung/iotjs/statuses/cd10df302e3d76df546d5ce8d932589d32fa57b0"}}}}
{"actor":{"display_login":"nova0821"}}