{"action":"created","comment":{"url":"https://api.github.com/repos/acquaman/acquaman/pulls/comments/35703890","id":35703890,"diff_hunk":"@@ -0,0 +1,85 @@\n+#include \"AMGCS2AsyncCommand.h\"\n+#include <QTimerEvent>\n+#include \"../AMPIC887Controller.h\"\n+AMGCS2AsyncCommand::AMGCS2AsyncCommand(qint64 timeoutMs) :\n+\tQObject(0), AMGCS2Command()\n+{\n+\ttimeoutMs_ = timeoutMs;\n+\tcommandType_ = Asynchronous;\n+}\n+\n+void AMGCS2AsyncCommand::run()\n+{\n+\tstartTime_ = QTime::currentTime();\n+\ttimerId_ = startTimer(TIMER_CHECK_INTERVAL_MS);\n+\n+\t// We make a switch to the running state here, even if the command fails to\n+\t// eventually be run on the controller (eg. if the valiation of arguments fails)\n+\t// This ensures that no async command can fail or succeed without being started.\n+\trunningState_ = Running;\n+\temit started(this);\n+\n+\tif(!controller_) {\n+\t\tlastError_ = \"Could not run command: No controller\";\n+\t\trunningState_ = Failed;\n+\t\temit failed(this);\n+\t} else if(controller_->id() < 0) {\n+\t\tlastError_ = QString(\"Could not run command: Connection not yet established with controller\");\n+\t\trunningState_ = Failed;\n+\t\temit failed(this);\n+\t} else if(controller_->isBusy()) {\n+\t\tlastError_ = QString(\"Could not run command: Controller is busy\");\n+\t\trunningState_ = Failed;\n+\t\temit failed(this);\n+\t} else if(validateArguments()) {\n+\t\tif(!runImplementation()) {\n+\t\t\trunningState_ = Failed;\n+\t\t\temit failed(this);\n+\t\t}\n+\t} else {\n+\t\tlastError_ = QString(\"Could not run command: Validation of arguments failed with message - '%1'\").arg(lastError_);\n+\t\trunningState_ = Failed;\n+\t\temit failed(this);\n+\t}\n+\n+}\n+\n+void AMGCS2AsyncCommand::timerEvent(QTimerEvent *)\n+{\n+\t// Can't perform checks when controller is busy.\n+\tif(controller_->isBusy()) {\n+\t\treturn;\n+\t}\n+\n+\tif(startTime_.msecsTo(QTime::currentTime()) >= timeoutMs_) {\n+\t\trunningState_ = Failed;\n+\t\tlastError_ = \"Async command timer timed out\";\n+\t\tkillTimer(timerId_);\n+\t\temit failed(this);\n+\t} else {\n+\t\tisFinishedImplementation();","path":"source/application/AMPIC887DriverServer/GCS2Commands/AMGCS2AsyncCommand.cpp","position":60,"original_position":60,"commit_id":"cba4c3e5f766f79fd67561595d091cf9d314f539","original_commit_id":"cba4c3e5f766f79fd67561595d091cf9d314f539","user":{"login":"dretrex","id":602741,"avatar_url":"https://avatars.githubusercontent.com/u/602741?v=3","gravatar_id":"","url":"https://api.github.com/users/dretrex","html_url":"https://github.com/dretrex","followers_url":"https://api.github.com/users/dretrex/followers","following_url":"https://api.github.com/users/dretrex/following{/other_user}","gists_url":"https://api.github.com/users/dretrex/gists{/gist_id}","starred_url":"https://api.github.com/users/dretrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dretrex/subscriptions","organizations_url":"https://api.github.com/users/dretrex/orgs","repos_url":"https://api.github.com/users/dretrex/repos","events_url":"https://api.github.com/users/dretrex/events{/privacy}","received_events_url":"https://api.github.com/users/dretrex/received_events","type":"User","site_admin":false},"body":"Is it okay for you to be calling `isFinishedImplementation()` here even though you could still be running?","created_at":"2015-07-28T21:31:31Z","updated_at":"2015-07-28T21:31:31Z","html_url":"https://github.com/acquaman/acquaman/pull/1472#discussion_r35703890","pull_request_url":"https://api.github.com/repos/acquaman/acquaman/pulls/1472","_links":{"self":{"href":"https://api.github.com/repos/acquaman/acquaman/pulls/comments/35703890"},"html":{"href":"https://github.com/acquaman/acquaman/pull/1472#discussion_r35703890"},"pull_request":{"href":"https://api.github.com/repos/acquaman/acquaman/pulls/1472"}}},"pull_request":{"url":"https://api.github.com/repos/acquaman/acquaman/pulls/1472","id":39298622,"html_url":"https://github.com/acquaman/acquaman/pull/1472","diff_url":"https://github.com/acquaman/acquaman/pull/1472.diff","patch_url":"https://github.com/acquaman/acquaman/pull/1472.patch","issue_url":"https://api.github.com/repos/acquaman/acquaman/issues/1472","number":1472,"state":"open","locked":false,"title":"Pull Request for Issue1461: Hexapod driver controller abstraction","user":{"login":"iainworkman","id":7461599,"avatar_url":"https://avatars.githubusercontent.com/u/7461599?v=3","gravatar_id":"","url":"https://api.github.com/users/iainworkman","html_url":"https://github.com/iainworkman","followers_url":"https://api.github.com/users/iainworkman/followers","following_url":"https://api.github.com/users/iainworkman/following{/other_user}","gists_url":"https://api.github.com/users/iainworkman/gists{/gist_id}","starred_url":"https://api.github.com/users/iainworkman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iainworkman/subscriptions","organizations_url":"https://api.github.com/users/iainworkman/orgs","repos_url":"https://api.github.com/users/iainworkman/repos","events_url":"https://api.github.com/users/iainworkman/events{/privacy}","received_events_url":"https://api.github.com/users/iainworkman/received_events","type":"User","site_admin":false},"body":"Currently this pull request includes the following:\r\n- Implementation of asynchronous commands (Move, MoveRelative and ReferenceMove)\r\n  - Includes  a change in the state machine of the command classes, from a simple wasSuccessful flag to a NotStarted, Running, Successful and Failed system). Only async commands are ever in the Running state, and also emit signals for started(), succeeded() and failed().\r\n  - The error clearing system has been altered, so that it is now the job of the controller class to clear its error message, and set an isBusy_ flag while doing so. Commands will not run on the controller while this process is under way, and async commands will pause checking their done status.\r\n- Change to how commands are obtained from the console (Now the parser interprets them all and emits signals. The application class catches these signals and runs the required function on the controller)\r\n- Implemented caching for all the data of the controller. This is initialized on start up, and then updated whenever a command is issued which alters the state of the controller \r\n- The system through which the asynchronous move commands update the movement statuses of the axes in the cache has been implemented. This is done by means of a type of semaphore system, which counts the number of moves issued vs failed/succeeded.\r\n- The command factory class has been deprecated (will be removed)\r\n- Functions for all commands has been added to the controller class.\r\n\r\n@dretrex This is now ready for review. \r\nEstimate: 8","created_at":"2015-07-06T18:52:18Z","updated_at":"2015-07-28T21:31:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c5042d2fa7bc825d2950e239944751df7749b77","assignee":null,"milestone":{"url":"https://api.github.com/repos/acquaman/acquaman/milestones/11","html_url":"https://github.com/acquaman/acquaman/milestones/SGM%20Upgrade%20-%20Hexapod","labels_url":"https://api.github.com/repos/acquaman/acquaman/milestones/11/labels","id":1145165,"number":11,"title":"SGM Upgrade - Hexapod","description":"A means for users to command and monitor the state of the hexapod on the SGM beamline is required. This can be broken down into three major areas:\r\n - Creating a stand alone driver application which will communicate with the hexapod controller.\r\n - Establishing communication from the main SGM Acquaman application with the hexapod controller driver.\r\n - Visualizing the available commands and state of the hexapod to users.","creator":{"login":"iainworkman","id":7461599,"avatar_url":"https://avatars.githubusercontent.com/u/7461599?v=3","gravatar_id":"","url":"https://api.github.com/users/iainworkman","html_url":"https://github.com/iainworkman","followers_url":"https://api.github.com/users/iainworkman/followers","following_url":"https://api.github.com/users/iainworkman/following{/other_user}","gists_url":"https://api.github.com/users/iainworkman/gists{/gist_id}","starred_url":"https://api.github.com/users/iainworkman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iainworkman/subscriptions","organizations_url":"https://api.github.com/users/iainworkman/orgs","repos_url":"https://api.github.com/users/iainworkman/repos","events_url":"https://api.github.com/users/iainworkman/events{/privacy}","received_events_url":"https://api.github.com/users/iainworkman/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":5,"state":"open","created_at":"2015-06-02T14:10:24Z","updated_at":"2015-07-21T19:42:12Z","due_on":"2015-08-01T06:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/acquaman/acquaman/pulls/1472/commits","review_comments_url":"https://api.github.com/repos/acquaman/acquaman/pulls/1472/comments","review_comment_url":"https://api.github.com/repos/acquaman/acquaman/pulls/comments{/number}","comments_url":"https://api.github.com/repos/acquaman/acquaman/issues/1472/comments","statuses_url":"https://api.github.com/repos/acquaman/acquaman/statuses/cba4c3e5f766f79fd67561595d091cf9d314f539","head":{"label":"acquaman:Issue1461","ref":"Issue1461","sha":"cba4c3e5f766f79fd67561595d091cf9d314f539","user":{"login":"acquaman","id":602716,"avatar_url":"https://avatars.githubusercontent.com/u/602716?v=3","gravatar_id":"","url":"https://api.github.com/users/acquaman","html_url":"https://github.com/acquaman","followers_url":"https://api.github.com/users/acquaman/followers","following_url":"https://api.github.com/users/acquaman/following{/other_user}","gists_url":"https://api.github.com/users/acquaman/gists{/gist_id}","starred_url":"https://api.github.com/users/acquaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquaman/subscriptions","organizations_url":"https://api.github.com/users/acquaman/orgs","repos_url":"https://api.github.com/users/acquaman/repos","events_url":"https://api.github.com/users/acquaman/events{/privacy}","received_events_url":"https://api.github.com/users/acquaman/received_events","type":"Organization","site_admin":false},"repo":{"id":1333343,"name":"acquaman","full_name":"acquaman/acquaman","owner":{"login":"acquaman","id":602716,"avatar_url":"https://avatars.githubusercontent.com/u/602716?v=3","gravatar_id":"","url":"https://api.github.com/users/acquaman","html_url":"https://github.com/acquaman","followers_url":"https://api.github.com/users/acquaman/followers","following_url":"https://api.github.com/users/acquaman/following{/other_user}","gists_url":"https://api.github.com/users/acquaman/gists{/gist_id}","starred_url":"https://api.github.com/users/acquaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquaman/subscriptions","organizations_url":"https://api.github.com/users/acquaman/orgs","repos_url":"https://api.github.com/users/acquaman/repos","events_url":"https://api.github.com/users/acquaman/events{/privacy}","received_events_url":"https://api.github.com/users/acquaman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/acquaman/acquaman","description":"Acquisition and Data Management for Big Science","fork":false,"url":"https://api.github.com/repos/acquaman/acquaman","forks_url":"https://api.github.com/repos/acquaman/acquaman/forks","keys_url":"https://api.github.com/repos/acquaman/acquaman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acquaman/acquaman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acquaman/acquaman/teams","hooks_url":"https://api.github.com/repos/acquaman/acquaman/hooks","issue_events_url":"https://api.github.com/repos/acquaman/acquaman/issues/events{/number}","events_url":"https://api.github.com/repos/acquaman/acquaman/events","assignees_url":"https://api.github.com/repos/acquaman/acquaman/assignees{/user}","branches_url":"https://api.github.com/repos/acquaman/acquaman/branches{/branch}","tags_url":"https://api.github.com/repos/acquaman/acquaman/tags","blobs_url":"https://api.github.com/repos/acquaman/acquaman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acquaman/acquaman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acquaman/acquaman/git/refs{/sha}","trees_url":"https://api.github.com/repos/acquaman/acquaman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acquaman/acquaman/statuses/{sha}","languages_url":"https://api.github.com/repos/acquaman/acquaman/languages","stargazers_url":"https://api.github.com/repos/acquaman/acquaman/stargazers","contributors_url":"https://api.github.com/repos/acquaman/acquaman/contributors","subscribers_url":"https://api.github.com/repos/acquaman/acquaman/subscribers","subscription_url":"https://api.github.com/repos/acquaman/acquaman/subscription","commits_url":"https://api.github.com/repos/acquaman/acquaman/commits{/sha}","git_commits_url":"https://api.github.com/repos/acquaman/acquaman/git/commits{/sha}","comments_url":"https://api.github.com/repos/acquaman/acquaman/comments{/number}","issue_comment_url":"https://api.github.com/repos/acquaman/acquaman/issues/comments{/number}","contents_url":"https://api.github.com/repos/acquaman/acquaman/contents/{+path}","compare_url":"https://api.github.com/repos/acquaman/acquaman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acquaman/acquaman/merges","archive_url":"https://api.github.com/repos/acquaman/acquaman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acquaman/acquaman/downloads","issues_url":"https://api.github.com/repos/acquaman/acquaman/issues{/number}","pulls_url":"https://api.github.com/repos/acquaman/acquaman/pulls{/number}","milestones_url":"https://api.github.com/repos/acquaman/acquaman/milestones{/number}","notifications_url":"https://api.github.com/repos/acquaman/acquaman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acquaman/acquaman/labels{/name}","releases_url":"https://api.github.com/repos/acquaman/acquaman/releases{/id}","created_at":"2011-02-06T02:19:01Z","updated_at":"2015-05-08T18:04:51Z","pushed_at":"2015-07-28T21:29:57Z","git_url":"git://github.com/acquaman/acquaman.git","ssh_url":"git@github.com:acquaman/acquaman.git","clone_url":"https://github.com/acquaman/acquaman.git","svn_url":"https://github.com/acquaman/acquaman","homepage":"","size":145590,"stargazers_count":8,"watchers_count":8,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":149,"forks":2,"open_issues":149,"watchers":8,"default_branch":"master"}},"base":{"label":"acquaman:SGMUpgrade","ref":"SGMUpgrade","sha":"d383b0664c4b55097177b0261ea28d57e6e751ab","user":{"login":"acquaman","id":602716,"avatar_url":"https://avatars.githubusercontent.com/u/602716?v=3","gravatar_id":"","url":"https://api.github.com/users/acquaman","html_url":"https://github.com/acquaman","followers_url":"https://api.github.com/users/acquaman/followers","following_url":"https://api.github.com/users/acquaman/following{/other_user}","gists_url":"https://api.github.com/users/acquaman/gists{/gist_id}","starred_url":"https://api.github.com/users/acquaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquaman/subscriptions","organizations_url":"https://api.github.com/users/acquaman/orgs","repos_url":"https://api.github.com/users/acquaman/repos","events_url":"https://api.github.com/users/acquaman/events{/privacy}","received_events_url":"https://api.github.com/users/acquaman/received_events","type":"Organization","site_admin":false},"repo":{"id":1333343,"name":"acquaman","full_name":"acquaman/acquaman","owner":{"login":"acquaman","id":602716,"avatar_url":"https://avatars.githubusercontent.com/u/602716?v=3","gravatar_id":"","url":"https://api.github.com/users/acquaman","html_url":"https://github.com/acquaman","followers_url":"https://api.github.com/users/acquaman/followers","following_url":"https://api.github.com/users/acquaman/following{/other_user}","gists_url":"https://api.github.com/users/acquaman/gists{/gist_id}","starred_url":"https://api.github.com/users/acquaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquaman/subscriptions","organizations_url":"https://api.github.com/users/acquaman/orgs","repos_url":"https://api.github.com/users/acquaman/repos","events_url":"https://api.github.com/users/acquaman/events{/privacy}","received_events_url":"https://api.github.com/users/acquaman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/acquaman/acquaman","description":"Acquisition and Data Management for Big Science","fork":false,"url":"https://api.github.com/repos/acquaman/acquaman","forks_url":"https://api.github.com/repos/acquaman/acquaman/forks","keys_url":"https://api.github.com/repos/acquaman/acquaman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acquaman/acquaman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acquaman/acquaman/teams","hooks_url":"https://api.github.com/repos/acquaman/acquaman/hooks","issue_events_url":"https://api.github.com/repos/acquaman/acquaman/issues/events{/number}","events_url":"https://api.github.com/repos/acquaman/acquaman/events","assignees_url":"https://api.github.com/repos/acquaman/acquaman/assignees{/user}","branches_url":"https://api.github.com/repos/acquaman/acquaman/branches{/branch}","tags_url":"https://api.github.com/repos/acquaman/acquaman/tags","blobs_url":"https://api.github.com/repos/acquaman/acquaman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acquaman/acquaman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acquaman/acquaman/git/refs{/sha}","trees_url":"https://api.github.com/repos/acquaman/acquaman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acquaman/acquaman/statuses/{sha}","languages_url":"https://api.github.com/repos/acquaman/acquaman/languages","stargazers_url":"https://api.github.com/repos/acquaman/acquaman/stargazers","contributors_url":"https://api.github.com/repos/acquaman/acquaman/contributors","subscribers_url":"https://api.github.com/repos/acquaman/acquaman/subscribers","subscription_url":"https://api.github.com/repos/acquaman/acquaman/subscription","commits_url":"https://api.github.com/repos/acquaman/acquaman/commits{/sha}","git_commits_url":"https://api.github.com/repos/acquaman/acquaman/git/commits{/sha}","comments_url":"https://api.github.com/repos/acquaman/acquaman/comments{/number}","issue_comment_url":"https://api.github.com/repos/acquaman/acquaman/issues/comments{/number}","contents_url":"https://api.github.com/repos/acquaman/acquaman/contents/{+path}","compare_url":"https://api.github.com/repos/acquaman/acquaman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acquaman/acquaman/merges","archive_url":"https://api.github.com/repos/acquaman/acquaman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acquaman/acquaman/downloads","issues_url":"https://api.github.com/repos/acquaman/acquaman/issues{/number}","pulls_url":"https://api.github.com/repos/acquaman/acquaman/pulls{/number}","milestones_url":"https://api.github.com/repos/acquaman/acquaman/milestones{/number}","notifications_url":"https://api.github.com/repos/acquaman/acquaman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acquaman/acquaman/labels{/name}","releases_url":"https://api.github.com/repos/acquaman/acquaman/releases{/id}","created_at":"2011-02-06T02:19:01Z","updated_at":"2015-05-08T18:04:51Z","pushed_at":"2015-07-28T21:29:57Z","git_url":"git://github.com/acquaman/acquaman.git","ssh_url":"git@github.com:acquaman/acquaman.git","clone_url":"https://github.com/acquaman/acquaman.git","svn_url":"https://github.com/acquaman/acquaman","homepage":"","size":145590,"stargazers_count":8,"watchers_count":8,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":149,"forks":2,"open_issues":149,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/acquaman/acquaman/pulls/1472"},"html":{"href":"https://github.com/acquaman/acquaman/pull/1472"},"issue":{"href":"https://api.github.com/repos/acquaman/acquaman/issues/1472"},"comments":{"href":"https://api.github.com/repos/acquaman/acquaman/issues/1472/comments"},"review_comments":{"href":"https://api.github.com/repos/acquaman/acquaman/pulls/1472/comments"},"review_comment":{"href":"https://api.github.com/repos/acquaman/acquaman/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/acquaman/acquaman/pulls/1472/commits"},"statuses":{"href":"https://api.github.com/repos/acquaman/acquaman/statuses/cba4c3e5f766f79fd67561595d091cf9d314f539"}}}}