{"action":"created","comment":{"url":"https://api.github.com/repos/OpenLightingProject/ola/pulls/comments/39998640","id":39998640,"diff_hunk":"@@ -0,0 +1,202 @@\n+/*\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU Library General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program; if not, write to the Free Software\n+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n+ *\n+ * JaRuleWidgetPort.h\n+ * A Ja Rule widget port.\n+ * Copyright (C) 2015 Simon Newton\n+ */\n+\n+#ifndef PLUGINS_USBDMX_JARULEWIDGETPORT_H_\n+#define PLUGINS_USBDMX_JARULEWIDGETPORT_H_\n+\n+#include <libusb.h>\n+#include <ola/Callback.h>\n+#include <ola/io/ByteString.h>\n+#include <ola/thread/ExecutorInterface.h>\n+#include <ola/thread/Mutex.h>\n+#include <ola/util/SequenceNumber.h>\n+\n+#include <map>\n+#include <queue>\n+\n+#include \"plugins/usbdmx/JaRulePortHandle.h\"\n+#include \"plugins/usbdmx/LibUsbAdaptor.h\"\n+#include \"plugins/usbdmx/JaRuleWidget.h\"\n+\n+namespace ola {\n+namespace plugin {\n+namespace usbdmx {\n+namespace jarule {\n+\n+/**\n+ * @brief The internal model of a port on a JaRule device.\n+ *\n+ * Each port has its own libusb transfers as well as a command queue. This\n+ * avoids slow commands on one port blocking another.\n+ */\n+class JaRuleWidgetPort {\n+ public:\n+  /**\n+   * @brief Create a new JaRuleWidgetPort.\n+   * @param executor The Executor to run the callbacks on.\n+   * @param adaptor The LibUsbAdaptor to use.\n+   * @param usb_handle the libusb_device_handle for the Ja Rule widget.\n+   * @param endpoint_number The endpoint to use for transfers.\n+   * @param uid The device's UID.\n+   * @param physical_port The physical port index.\n+   */\n+  JaRuleWidgetPort(ola::thread::ExecutorInterface *executor,\n+                   ola::plugin::usbdmx::LibUsbAdaptor *adaptor,\n+                   libusb_device_handle *usb_handle,\n+                   uint8_t endpoint_number,\n+                   const ola::rdm::UID &uid,\n+                   uint8_t physical_port);\n+\n+  /**\n+   * @brief Destructor\n+   */\n+  ~JaRuleWidgetPort();\n+\n+  /**\n+   * @brief Claim the handle to this port.\n+   * @returns a port handle, ownership is not transferred. Will return NULL if\n+   *   the port is already claimed.\n+   */\n+  JaRulePortHandle* ClaimPort();\n+\n+  /**\n+   * @brief Release a handle to a port.\n+   * @returns a port handle, ownership is not transferred.\n+   */\n+  void ReleasePort();\n+\n+  /**\n+   * @brief Cancel all commands for this port.\n+   */\n+  void CancelAll();\n+\n+  /**\n+   * @brief Send a command on this port.\n+   * @param command the Command type.\n+   * @param data the payload data. The data is copied and can be freed once the\n+   *   method returns.\n+   * @param size the payload size.\n+   * @param callback The callback to run when the message operation completes.\n+   * This may be run immediately in some conditions.\n+   *\n+   * SendMessage can be called from any thread, and messages will be queued.","path":"plugins/usbdmx/JaRuleWidgetPort.h","position":99,"original_position":99,"commit_id":"0408f890a14dfaca8c148f56fcf8022f48fee935","original_commit_id":"0408f890a14dfaca8c148f56fcf8022f48fee935","user":{"login":"peternewman","id":6216436,"avatar_url":"https://avatars.githubusercontent.com/u/6216436?v=3","gravatar_id":"","url":"https://api.github.com/users/peternewman","html_url":"https://github.com/peternewman","followers_url":"https://api.github.com/users/peternewman/followers","following_url":"https://api.github.com/users/peternewman/following{/other_user}","gists_url":"https://api.github.com/users/peternewman/gists{/gist_id}","starred_url":"https://api.github.com/users/peternewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peternewman/subscriptions","organizations_url":"https://api.github.com/users/peternewman/orgs","repos_url":"https://api.github.com/users/peternewman/repos","events_url":"https://api.github.com/users/peternewman/events{/privacy}","received_events_url":"https://api.github.com/users/peternewman/received_events","type":"User","site_admin":false},"body":"SendCommand again, also can we remove the Doxygen duplication, given it should inherit I believe.","created_at":"2015-09-21T17:24:13Z","updated_at":"2015-09-21T17:24:13Z","html_url":"https://github.com/OpenLightingProject/ola/pull/902#discussion_r39998640","pull_request_url":"https://api.github.com/repos/OpenLightingProject/ola/pulls/902","_links":{"self":{"href":"https://api.github.com/repos/OpenLightingProject/ola/pulls/comments/39998640"},"html":{"href":"https://github.com/OpenLightingProject/ola/pull/902#discussion_r39998640"},"pull_request":{"href":"https://api.github.com/repos/OpenLightingProject/ola/pulls/902"}}},"pull_request":{"url":"https://api.github.com/repos/OpenLightingProject/ola/pulls/902","id":45490724,"html_url":"https://github.com/OpenLightingProject/ola/pull/902","diff_url":"https://github.com/OpenLightingProject/ola/pull/902.diff","patch_url":"https://github.com/OpenLightingProject/ola/pull/902.patch","issue_url":"https://api.github.com/repos/OpenLightingProject/ola/issues/902","number":902,"state":"open","locked":false,"title":"Ja Rule changes, Part 3","user":{"login":"nomis52","id":4355332,"avatar_url":"https://avatars.githubusercontent.com/u/4355332?v=3","gravatar_id":"","url":"https://api.github.com/users/nomis52","html_url":"https://github.com/nomis52","followers_url":"https://api.github.com/users/nomis52/followers","following_url":"https://api.github.com/users/nomis52/following{/other_user}","gists_url":"https://api.github.com/users/nomis52/gists{/gist_id}","starred_url":"https://api.github.com/users/nomis52/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nomis52/subscriptions","organizations_url":"https://api.github.com/users/nomis52/orgs","repos_url":"https://api.github.com/users/nomis52/repos","events_url":"https://api.github.com/users/nomis52/events{/privacy}","received_events_url":"https://api.github.com/users/nomis52/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-20T06:14:16Z","updated_at":"2015-09-21T17:24:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d40d17f31d385879ab7263cbed95c9974606a1a9","assignee":{"login":"peternewman","id":6216436,"avatar_url":"https://avatars.githubusercontent.com/u/6216436?v=3","gravatar_id":"","url":"https://api.github.com/users/peternewman","html_url":"https://github.com/peternewman","followers_url":"https://api.github.com/users/peternewman/followers","following_url":"https://api.github.com/users/peternewman/following{/other_user}","gists_url":"https://api.github.com/users/peternewman/gists{/gist_id}","starred_url":"https://api.github.com/users/peternewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peternewman/subscriptions","organizations_url":"https://api.github.com/users/peternewman/orgs","repos_url":"https://api.github.com/users/peternewman/repos","events_url":"https://api.github.com/users/peternewman/events{/privacy}","received_events_url":"https://api.github.com/users/peternewman/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/OpenLightingProject/ola/pulls/902/commits","review_comments_url":"https://api.github.com/repos/OpenLightingProject/ola/pulls/902/comments","review_comment_url":"https://api.github.com/repos/OpenLightingProject/ola/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenLightingProject/ola/issues/902/comments","statuses_url":"https://api.github.com/repos/OpenLightingProject/ola/statuses/0408f890a14dfaca8c148f56fcf8022f48fee935","head":{"label":"nomis52:ja-rule3","ref":"ja-rule3","sha":"0408f890a14dfaca8c148f56fcf8022f48fee935","user":{"login":"nomis52","id":4355332,"avatar_url":"https://avatars.githubusercontent.com/u/4355332?v=3","gravatar_id":"","url":"https://api.github.com/users/nomis52","html_url":"https://github.com/nomis52","followers_url":"https://api.github.com/users/nomis52/followers","following_url":"https://api.github.com/users/nomis52/following{/other_user}","gists_url":"https://api.github.com/users/nomis52/gists{/gist_id}","starred_url":"https://api.github.com/users/nomis52/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nomis52/subscriptions","organizations_url":"https://api.github.com/users/nomis52/orgs","repos_url":"https://api.github.com/users/nomis52/repos","events_url":"https://api.github.com/users/nomis52/events{/privacy}","received_events_url":"https://api.github.com/users/nomis52/received_events","type":"User","site_admin":false},"repo":{"id":15822023,"name":"ola","full_name":"nomis52/ola","owner":{"login":"nomis52","id":4355332,"avatar_url":"https://avatars.githubusercontent.com/u/4355332?v=3","gravatar_id":"","url":"https://api.github.com/users/nomis52","html_url":"https://github.com/nomis52","followers_url":"https://api.github.com/users/nomis52/followers","following_url":"https://api.github.com/users/nomis52/following{/other_user}","gists_url":"https://api.github.com/users/nomis52/gists{/gist_id}","starred_url":"https://api.github.com/users/nomis52/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nomis52/subscriptions","organizations_url":"https://api.github.com/users/nomis52/orgs","repos_url":"https://api.github.com/users/nomis52/repos","events_url":"https://api.github.com/users/nomis52/events{/privacy}","received_events_url":"https://api.github.com/users/nomis52/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nomis52/ola","description":"The Open Lighting Architecture","fork":true,"url":"https://api.github.com/repos/nomis52/ola","forks_url":"https://api.github.com/repos/nomis52/ola/forks","keys_url":"https://api.github.com/repos/nomis52/ola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nomis52/ola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nomis52/ola/teams","hooks_url":"https://api.github.com/repos/nomis52/ola/hooks","issue_events_url":"https://api.github.com/repos/nomis52/ola/issues/events{/number}","events_url":"https://api.github.com/repos/nomis52/ola/events","assignees_url":"https://api.github.com/repos/nomis52/ola/assignees{/user}","branches_url":"https://api.github.com/repos/nomis52/ola/branches{/branch}","tags_url":"https://api.github.com/repos/nomis52/ola/tags","blobs_url":"https://api.github.com/repos/nomis52/ola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nomis52/ola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nomis52/ola/git/refs{/sha}","trees_url":"https://api.github.com/repos/nomis52/ola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nomis52/ola/statuses/{sha}","languages_url":"https://api.github.com/repos/nomis52/ola/languages","stargazers_url":"https://api.github.com/repos/nomis52/ola/stargazers","contributors_url":"https://api.github.com/repos/nomis52/ola/contributors","subscribers_url":"https://api.github.com/repos/nomis52/ola/subscribers","subscription_url":"https://api.github.com/repos/nomis52/ola/subscription","commits_url":"https://api.github.com/repos/nomis52/ola/commits{/sha}","git_commits_url":"https://api.github.com/repos/nomis52/ola/git/commits{/sha}","comments_url":"https://api.github.com/repos/nomis52/ola/comments{/number}","issue_comment_url":"https://api.github.com/repos/nomis52/ola/issues/comments{/number}","contents_url":"https://api.github.com/repos/nomis52/ola/contents/{+path}","compare_url":"https://api.github.com/repos/nomis52/ola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nomis52/ola/merges","archive_url":"https://api.github.com/repos/nomis52/ola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nomis52/ola/downloads","issues_url":"https://api.github.com/repos/nomis52/ola/issues{/number}","pulls_url":"https://api.github.com/repos/nomis52/ola/pulls{/number}","milestones_url":"https://api.github.com/repos/nomis52/ola/milestones{/number}","notifications_url":"https://api.github.com/repos/nomis52/ola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nomis52/ola/labels{/name}","releases_url":"https://api.github.com/repos/nomis52/ola/releases{/id}","created_at":"2014-01-11T12:21:27Z","updated_at":"2015-09-01T19:01:31Z","pushed_at":"2015-09-21T14:57:42Z","git_url":"git://github.com/nomis52/ola.git","ssh_url":"git@github.com:nomis52/ola.git","clone_url":"https://github.com/nomis52/ola.git","svn_url":"https://github.com/nomis52/ola","homepage":null,"size":19462,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"OpenLightingProject:master","ref":"master","sha":"5eda4b865493084e886b756c4c7fcdc65287790b","user":{"login":"OpenLightingProject","id":6199314,"avatar_url":"https://avatars.githubusercontent.com/u/6199314?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenLightingProject","html_url":"https://github.com/OpenLightingProject","followers_url":"https://api.github.com/users/OpenLightingProject/followers","following_url":"https://api.github.com/users/OpenLightingProject/following{/other_user}","gists_url":"https://api.github.com/users/OpenLightingProject/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenLightingProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenLightingProject/subscriptions","organizations_url":"https://api.github.com/users/OpenLightingProject/orgs","repos_url":"https://api.github.com/users/OpenLightingProject/repos","events_url":"https://api.github.com/users/OpenLightingProject/events{/privacy}","received_events_url":"https://api.github.com/users/OpenLightingProject/received_events","type":"Organization","site_admin":false},"repo":{"id":15233168,"name":"ola","full_name":"OpenLightingProject/ola","owner":{"login":"OpenLightingProject","id":6199314,"avatar_url":"https://avatars.githubusercontent.com/u/6199314?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenLightingProject","html_url":"https://github.com/OpenLightingProject","followers_url":"https://api.github.com/users/OpenLightingProject/followers","following_url":"https://api.github.com/users/OpenLightingProject/following{/other_user}","gists_url":"https://api.github.com/users/OpenLightingProject/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenLightingProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenLightingProject/subscriptions","organizations_url":"https://api.github.com/users/OpenLightingProject/orgs","repos_url":"https://api.github.com/users/OpenLightingProject/repos","events_url":"https://api.github.com/users/OpenLightingProject/events{/privacy}","received_events_url":"https://api.github.com/users/OpenLightingProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenLightingProject/ola","description":"The Open Lighting Architecture","fork":false,"url":"https://api.github.com/repos/OpenLightingProject/ola","forks_url":"https://api.github.com/repos/OpenLightingProject/ola/forks","keys_url":"https://api.github.com/repos/OpenLightingProject/ola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenLightingProject/ola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenLightingProject/ola/teams","hooks_url":"https://api.github.com/repos/OpenLightingProject/ola/hooks","issue_events_url":"https://api.github.com/repos/OpenLightingProject/ola/issues/events{/number}","events_url":"https://api.github.com/repos/OpenLightingProject/ola/events","assignees_url":"https://api.github.com/repos/OpenLightingProject/ola/assignees{/user}","branches_url":"https://api.github.com/repos/OpenLightingProject/ola/branches{/branch}","tags_url":"https://api.github.com/repos/OpenLightingProject/ola/tags","blobs_url":"https://api.github.com/repos/OpenLightingProject/ola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenLightingProject/ola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenLightingProject/ola/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenLightingProject/ola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenLightingProject/ola/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenLightingProject/ola/languages","stargazers_url":"https://api.github.com/repos/OpenLightingProject/ola/stargazers","contributors_url":"https://api.github.com/repos/OpenLightingProject/ola/contributors","subscribers_url":"https://api.github.com/repos/OpenLightingProject/ola/subscribers","subscription_url":"https://api.github.com/repos/OpenLightingProject/ola/subscription","commits_url":"https://api.github.com/repos/OpenLightingProject/ola/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenLightingProject/ola/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenLightingProject/ola/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenLightingProject/ola/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenLightingProject/ola/contents/{+path}","compare_url":"https://api.github.com/repos/OpenLightingProject/ola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenLightingProject/ola/merges","archive_url":"https://api.github.com/repos/OpenLightingProject/ola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenLightingProject/ola/downloads","issues_url":"https://api.github.com/repos/OpenLightingProject/ola/issues{/number}","pulls_url":"https://api.github.com/repos/OpenLightingProject/ola/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenLightingProject/ola/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenLightingProject/ola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenLightingProject/ola/labels{/name}","releases_url":"https://api.github.com/repos/OpenLightingProject/ola/releases{/id}","created_at":"2013-12-16T18:06:52Z","updated_at":"2015-09-14T14:15:35Z","pushed_at":"2015-09-21T14:57:43Z","git_url":"git://github.com/OpenLightingProject/ola.git","ssh_url":"git@github.com:OpenLightingProject/ola.git","clone_url":"https://github.com/OpenLightingProject/ola.git","svn_url":"https://github.com/OpenLightingProject/ola","homepage":"https://www.openlighting.org/ola/","size":23609,"stargazers_count":101,"watchers_count":101,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":100,"forks":58,"open_issues":100,"watchers":101,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenLightingProject/ola/pulls/902"},"html":{"href":"https://github.com/OpenLightingProject/ola/pull/902"},"issue":{"href":"https://api.github.com/repos/OpenLightingProject/ola/issues/902"},"comments":{"href":"https://api.github.com/repos/OpenLightingProject/ola/issues/902/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenLightingProject/ola/pulls/902/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenLightingProject/ola/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenLightingProject/ola/pulls/902/commits"},"statuses":{"href":"https://api.github.com/repos/OpenLightingProject/ola/statuses/0408f890a14dfaca8c148f56fcf8022f48fee935"}}}}