{"action":"created","comment":{"url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/comments/33619820","id":33619820,"diff_hunk":"@@ -0,0 +1,242 @@\n+#!/usr/bin/env python\n+import piksi_tools.serial_link as sl\n+from sbp.client.handler import Handler\n+from sbp.logging import SBP_MSG_PRINT\n+from sbp.tracking import MsgTrackingState\n+from sbp.piksi import MsgMaskSatellite, SBP_MSG_RESET\n+from sbp.system import SBP_MSG_HEARTBEAT\n+from sbp.table import dispatch\n+\n+import time\n+import sys\n+import random\n+import threading\n+\n+DEFAULT_POLL_INTERVAL = 60 # Seconds\n+DEFAULT_MIN_SATS = 5 # min satellites to try and retain\n+\n+\n+class LoopTimer(object):\n+  \"\"\" Interval timer (emulated from from stack overflow)\n+  This should get re-used on other actions during the log\n+  http://stackoverflow.com/questions/12435211/python-threading-timer-repeat-function-every-n-seconds\n+  \"\"\"\n+  def __init__(self, interval, hfunction):\n+    self.interval = interval\n+    self.hfunction = hfunction\n+    self.thread = threading.Timer(self.interval, self.handle_function)\n+\n+  def handle_function(self):\n+    self.hfunction()\n+    self.thread = threading.Timer(self.interval, self.handle_function)\n+    self.thread.start()\n+\n+  def start(self):\n+    self.thread.start()\n+\n+  def cancel(self):\n+    self.thread.cancel()\n+\n+\n+\n+class TestState(object):\n+  \"\"\"Super class for representing state-based actions during logging\n+  Parameters\n+  ----------\n+  handler: sbp.client.handler.Handler\n+      handler for SBP transfer to/from Piksi.\n+  filename : string\n+    File to log to.\n+  \"\"\"\n+  def __init__(self, handler):\n+    self.init_time = time.time()\n+    self.handler = handler\n+  def process_message(self, msg):\n+    \"\"\"Method to process messages from device\n+    \"\"\"\n+    raise NotImplementedError(\"process_message not implemented!\")\n+  def action(self):\n+    \"\"\"Stub for communicating with device","path":"piksi_tools/action_logger.py","position":59,"original_position":59,"commit_id":"d1730177d59a093ee1a33ef898b4e466e5934402","original_commit_id":"d1730177d59a093ee1a33ef898b4e466e5934402","user":{"login":"cbeighley","id":502385,"avatar_url":"https://avatars.githubusercontent.com/u/502385?v=3","gravatar_id":"","url":"https://api.github.com/users/cbeighley","html_url":"https://github.com/cbeighley","followers_url":"https://api.github.com/users/cbeighley/followers","following_url":"https://api.github.com/users/cbeighley/following{/other_user}","gists_url":"https://api.github.com/users/cbeighley/gists{/gist_id}","starred_url":"https://api.github.com/users/cbeighley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbeighley/subscriptions","organizations_url":"https://api.github.com/users/cbeighley/orgs","repos_url":"https://api.github.com/users/cbeighley/repos","events_url":"https://api.github.com/users/cbeighley/events{/privacy}","received_events_url":"https://api.github.com/users/cbeighley/received_events","type":"User","site_admin":false},"body":"Nit: `\"\"\" Stub for communicating with device. Should be overloaded in subclass. \"\"\"`","created_at":"2015-06-30T20:29:28Z","updated_at":"2015-06-30T20:29:28Z","html_url":"https://github.com/swift-nav/piksi_tools/pull/97#discussion_r33619820","pull_request_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/comments/33619820"},"html":{"href":"https://github.com/swift-nav/piksi_tools/pull/97#discussion_r33619820"},"pull_request":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/97","id":38899731,"html_url":"https://github.com/swift-nav/piksi_tools/pull/97","diff_url":"https://github.com/swift-nav/piksi_tools/pull/97.diff","patch_url":"https://github.com/swift-nav/piksi_tools/pull/97.patch","issue_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues/97","number":97,"state":"open","locked":false,"title":"add action logger (clone of serial link with possibility of talking to device)","user":{"login":"denniszollo","id":11276774,"avatar_url":"https://avatars.githubusercontent.com/u/11276774?v=3","gravatar_id":"","url":"https://api.github.com/users/denniszollo","html_url":"https://github.com/denniszollo","followers_url":"https://api.github.com/users/denniszollo/followers","following_url":"https://api.github.com/users/denniszollo/following{/other_user}","gists_url":"https://api.github.com/users/denniszollo/gists{/gist_id}","starred_url":"https://api.github.com/users/denniszollo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denniszollo/subscriptions","organizations_url":"https://api.github.com/users/denniszollo/orgs","repos_url":"https://api.github.com/users/denniszollo/repos","events_url":"https://api.github.com/users/denniszollo/events{/privacy}","received_events_url":"https://api.github.com/users/denniszollo/received_events","type":"User","site_admin":false},"body":"this version drops sats but framework extends for other state-based device communication during logging\r\nbreak up argparseing from serial link as to re-use in other serial code\r\n\r\ncc @cbeighley ","created_at":"2015-06-30T16:50:53Z","updated_at":"2015-06-30T20:29:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"85513a5cc8664f2ee52c1623d4627c85cbd88671","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/97/commits","review_comments_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/97/comments","review_comment_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues/97/comments","statuses_url":"https://api.github.com/repos/swift-nav/piksi_tools/statuses/d1730177d59a093ee1a33ef898b4e466e5934402","head":{"label":"denniszollo:action_logger","ref":"action_logger","sha":"d1730177d59a093ee1a33ef898b4e466e5934402","user":{"login":"denniszollo","id":11276774,"avatar_url":"https://avatars.githubusercontent.com/u/11276774?v=3","gravatar_id":"","url":"https://api.github.com/users/denniszollo","html_url":"https://github.com/denniszollo","followers_url":"https://api.github.com/users/denniszollo/followers","following_url":"https://api.github.com/users/denniszollo/following{/other_user}","gists_url":"https://api.github.com/users/denniszollo/gists{/gist_id}","starred_url":"https://api.github.com/users/denniszollo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denniszollo/subscriptions","organizations_url":"https://api.github.com/users/denniszollo/orgs","repos_url":"https://api.github.com/users/denniszollo/repos","events_url":"https://api.github.com/users/denniszollo/events{/privacy}","received_events_url":"https://api.github.com/users/denniszollo/received_events","type":"User","site_admin":false},"repo":{"id":33337777,"name":"piksi_tools","full_name":"denniszollo/piksi_tools","owner":{"login":"denniszollo","id":11276774,"avatar_url":"https://avatars.githubusercontent.com/u/11276774?v=3","gravatar_id":"","url":"https://api.github.com/users/denniszollo","html_url":"https://github.com/denniszollo","followers_url":"https://api.github.com/users/denniszollo/followers","following_url":"https://api.github.com/users/denniszollo/following{/other_user}","gists_url":"https://api.github.com/users/denniszollo/gists{/gist_id}","starred_url":"https://api.github.com/users/denniszollo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denniszollo/subscriptions","organizations_url":"https://api.github.com/users/denniszollo/orgs","repos_url":"https://api.github.com/users/denniszollo/repos","events_url":"https://api.github.com/users/denniszollo/events{/privacy}","received_events_url":"https://api.github.com/users/denniszollo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/denniszollo/piksi_tools","description":"Tools for the Piksi GNSS receiver.","fork":true,"url":"https://api.github.com/repos/denniszollo/piksi_tools","forks_url":"https://api.github.com/repos/denniszollo/piksi_tools/forks","keys_url":"https://api.github.com/repos/denniszollo/piksi_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/denniszollo/piksi_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/denniszollo/piksi_tools/teams","hooks_url":"https://api.github.com/repos/denniszollo/piksi_tools/hooks","issue_events_url":"https://api.github.com/repos/denniszollo/piksi_tools/issues/events{/number}","events_url":"https://api.github.com/repos/denniszollo/piksi_tools/events","assignees_url":"https://api.github.com/repos/denniszollo/piksi_tools/assignees{/user}","branches_url":"https://api.github.com/repos/denniszollo/piksi_tools/branches{/branch}","tags_url":"https://api.github.com/repos/denniszollo/piksi_tools/tags","blobs_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/denniszollo/piksi_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/denniszollo/piksi_tools/languages","stargazers_url":"https://api.github.com/repos/denniszollo/piksi_tools/stargazers","contributors_url":"https://api.github.com/repos/denniszollo/piksi_tools/contributors","subscribers_url":"https://api.github.com/repos/denniszollo/piksi_tools/subscribers","subscription_url":"https://api.github.com/repos/denniszollo/piksi_tools/subscription","commits_url":"https://api.github.com/repos/denniszollo/piksi_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/denniszollo/piksi_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/denniszollo/piksi_tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/denniszollo/piksi_tools/contents/{+path}","compare_url":"https://api.github.com/repos/denniszollo/piksi_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/denniszollo/piksi_tools/merges","archive_url":"https://api.github.com/repos/denniszollo/piksi_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/denniszollo/piksi_tools/downloads","issues_url":"https://api.github.com/repos/denniszollo/piksi_tools/issues{/number}","pulls_url":"https://api.github.com/repos/denniszollo/piksi_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/denniszollo/piksi_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/denniszollo/piksi_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/denniszollo/piksi_tools/labels{/name}","releases_url":"https://api.github.com/repos/denniszollo/piksi_tools/releases{/id}","created_at":"2015-04-03T00:05:20Z","updated_at":"2015-04-03T00:05:23Z","pushed_at":"2015-06-30T16:49:31Z","git_url":"git://github.com/denniszollo/piksi_tools.git","ssh_url":"git@github.com:denniszollo/piksi_tools.git","clone_url":"https://github.com/denniszollo/piksi_tools.git","svn_url":"https://github.com/denniszollo/piksi_tools","homepage":null,"size":1070,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"swift-nav:master","ref":"master","sha":"8d72be24d87aadb82760d18e0653c8e1a20cf8a2","user":{"login":"swift-nav","id":1069835,"avatar_url":"https://avatars.githubusercontent.com/u/1069835?v=3","gravatar_id":"","url":"https://api.github.com/users/swift-nav","html_url":"https://github.com/swift-nav","followers_url":"https://api.github.com/users/swift-nav/followers","following_url":"https://api.github.com/users/swift-nav/following{/other_user}","gists_url":"https://api.github.com/users/swift-nav/gists{/gist_id}","starred_url":"https://api.github.com/users/swift-nav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swift-nav/subscriptions","organizations_url":"https://api.github.com/users/swift-nav/orgs","repos_url":"https://api.github.com/users/swift-nav/repos","events_url":"https://api.github.com/users/swift-nav/events{/privacy}","received_events_url":"https://api.github.com/users/swift-nav/received_events","type":"Organization","site_admin":false},"repo":{"id":33265971,"name":"piksi_tools","full_name":"swift-nav/piksi_tools","owner":{"login":"swift-nav","id":1069835,"avatar_url":"https://avatars.githubusercontent.com/u/1069835?v=3","gravatar_id":"","url":"https://api.github.com/users/swift-nav","html_url":"https://github.com/swift-nav","followers_url":"https://api.github.com/users/swift-nav/followers","following_url":"https://api.github.com/users/swift-nav/following{/other_user}","gists_url":"https://api.github.com/users/swift-nav/gists{/gist_id}","starred_url":"https://api.github.com/users/swift-nav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swift-nav/subscriptions","organizations_url":"https://api.github.com/users/swift-nav/orgs","repos_url":"https://api.github.com/users/swift-nav/repos","events_url":"https://api.github.com/users/swift-nav/events{/privacy}","received_events_url":"https://api.github.com/users/swift-nav/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/swift-nav/piksi_tools","description":"Tools for the Piksi GNSS receiver.","fork":false,"url":"https://api.github.com/repos/swift-nav/piksi_tools","forks_url":"https://api.github.com/repos/swift-nav/piksi_tools/forks","keys_url":"https://api.github.com/repos/swift-nav/piksi_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swift-nav/piksi_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swift-nav/piksi_tools/teams","hooks_url":"https://api.github.com/repos/swift-nav/piksi_tools/hooks","issue_events_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues/events{/number}","events_url":"https://api.github.com/repos/swift-nav/piksi_tools/events","assignees_url":"https://api.github.com/repos/swift-nav/piksi_tools/assignees{/user}","branches_url":"https://api.github.com/repos/swift-nav/piksi_tools/branches{/branch}","tags_url":"https://api.github.com/repos/swift-nav/piksi_tools/tags","blobs_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swift-nav/piksi_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/swift-nav/piksi_tools/languages","stargazers_url":"https://api.github.com/repos/swift-nav/piksi_tools/stargazers","contributors_url":"https://api.github.com/repos/swift-nav/piksi_tools/contributors","subscribers_url":"https://api.github.com/repos/swift-nav/piksi_tools/subscribers","subscription_url":"https://api.github.com/repos/swift-nav/piksi_tools/subscription","commits_url":"https://api.github.com/repos/swift-nav/piksi_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/swift-nav/piksi_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/swift-nav/piksi_tools/contents/{+path}","compare_url":"https://api.github.com/repos/swift-nav/piksi_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swift-nav/piksi_tools/merges","archive_url":"https://api.github.com/repos/swift-nav/piksi_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swift-nav/piksi_tools/downloads","issues_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues{/number}","pulls_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/swift-nav/piksi_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/swift-nav/piksi_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swift-nav/piksi_tools/labels{/name}","releases_url":"https://api.github.com/repos/swift-nav/piksi_tools/releases{/id}","created_at":"2015-04-01T18:47:25Z","updated_at":"2015-06-23T22:06:42Z","pushed_at":"2015-06-30T19:04:37Z","git_url":"git://github.com/swift-nav/piksi_tools.git","ssh_url":"git@github.com:swift-nav/piksi_tools.git","clone_url":"https://github.com/swift-nav/piksi_tools.git","svn_url":"https://github.com/swift-nav/piksi_tools","homepage":null,"size":2007,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":48,"forks":13,"open_issues":48,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/97"},"html":{"href":"https://github.com/swift-nav/piksi_tools/pull/97"},"issue":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/issues/97"},"comments":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/statuses/d1730177d59a093ee1a33ef898b4e466e5934402"}}}}