{"action":"created","comment":{"url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/comments/25858007","id":25858007,"diff_hunk":"@@ -292,9 +292,40 @@ protected SensePhoneState(Context context) {\n         alarmReceiver = new PeriodicPollAlarmReceiver(this);\n     }\n \n+    private void checkCallState() {\n+        int state = telMgr.getCallState();\n+\n+        JSONObject json = new JSONObject();\n+        try {\n+            switch (state) {\n+            case TelephonyManager.CALL_STATE_IDLE:\n+                json.put(\"state\", \"idle\");\n+                break;\n+            case TelephonyManager.CALL_STATE_OFFHOOK:\n+                json.put(\"state\", \"calling\");\n+                break;\n+            case TelephonyManager.CALL_STATE_RINGING:\n+                json.put(\"state\", \"ringing\");\n+                break;\n+            default:\n+                Log.e(TAG, \"Unexpected call state: \" + state);\n+                return;\n+            }\n+        } catch (JSONException e) {\n+            Log.e(TAG, \"JSONException in onCallChanged\", e);\n+            return;\n+        }\n+\n+        Log.v(TAG, \"sample call state\" + json.toString());\n+        // immediately send data point\n+        sendDataPoint(SensorNames.CALL_STATE, json.toString(), SenseDataTypes.JSON);\n+\n+    }\n+\n     @Override\n     public void doSample() {\n        //Log.v(TAG, \"Do sample\");\n+        checkCallState();","path":"sense-android-library/src/nl/sense_os/service/phonestate/SensePhoneState.java","position":37,"original_position":37,"commit_id":"74f364fb1323327540db73e3288b64946e98d2e8","original_commit_id":"74f364fb1323327540db73e3288b64946e98d2e8","user":{"login":"orhan89","id":3124136,"avatar_url":"https://avatars.githubusercontent.com/u/3124136?v=3","gravatar_id":"","url":"https://api.github.com/users/orhan89","html_url":"https://github.com/orhan89","followers_url":"https://api.github.com/users/orhan89/followers","following_url":"https://api.github.com/users/orhan89/following{/other_user}","gists_url":"https://api.github.com/users/orhan89/gists{/gist_id}","starred_url":"https://api.github.com/users/orhan89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orhan89/subscriptions","organizations_url":"https://api.github.com/users/orhan89/orgs","repos_url":"https://api.github.com/users/orhan89/repos","events_url":"https://api.github.com/users/orhan89/events{/privacy}","received_events_url":"https://api.github.com/users/orhan89/received_events","type":"User","site_admin":false},"body":"i though the goal of this card were to increase reliability of event-based sensor by making it hybrid, because there is possibility that we missed the state change from the event, and the state value become wrong until next event.","created_at":"2015-03-05T11:51:37Z","updated_at":"2015-03-05T11:51:37Z","html_url":"https://github.com/senseobservationsystems/sense-android-library/pull/143#discussion_r25858007","pull_request_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/143","_links":{"self":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/comments/25858007"},"html":{"href":"https://github.com/senseobservationsystems/sense-android-library/pull/143#discussion_r25858007"},"pull_request":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/143"}}},"pull_request":{"url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/143","id":30536349,"html_url":"https://github.com/senseobservationsystems/sense-android-library/pull/143","diff_url":"https://github.com/senseobservationsystems/sense-android-library/pull/143.diff","patch_url":"https://github.com/senseobservationsystems/sense-android-library/pull/143.patch","issue_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues/143","number":143,"state":"open","locked":false,"title":"Feature/hybrid state sensor","user":{"login":"orhan89","id":3124136,"avatar_url":"https://avatars.githubusercontent.com/u/3124136?v=3","gravatar_id":"","url":"https://api.github.com/users/orhan89","html_url":"https://github.com/orhan89","followers_url":"https://api.github.com/users/orhan89/followers","following_url":"https://api.github.com/users/orhan89/following{/other_user}","gists_url":"https://api.github.com/users/orhan89/gists{/gist_id}","starred_url":"https://api.github.com/users/orhan89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orhan89/subscriptions","organizations_url":"https://api.github.com/users/orhan89/orgs","repos_url":"https://api.github.com/users/orhan89/repos","events_url":"https://api.github.com/users/orhan89/events{/privacy}","received_events_url":"https://api.github.com/users/orhan89/received_events","type":"User","site_admin":false},"body":"@tedschmidt could you check for this one if you have time? it might not fully completed yet, but i want to make sure that i'm writing the sensor in the right direction.","created_at":"2015-03-05T07:47:34Z","updated_at":"2015-03-05T11:51:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc98c742db76fb879e07ff9a3c90b4ef91218b2f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/143/commits","review_comments_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/143/comments","review_comment_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/comments{/number}","comments_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues/143/comments","statuses_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/statuses/74f364fb1323327540db73e3288b64946e98d2e8","head":{"label":"senseobservationsystems:feature/hybrid_state_sensor","ref":"feature/hybrid_state_sensor","sha":"74f364fb1323327540db73e3288b64946e98d2e8","user":{"login":"senseobservationsystems","id":2070814,"avatar_url":"https://avatars.githubusercontent.com/u/2070814?v=3","gravatar_id":"","url":"https://api.github.com/users/senseobservationsystems","html_url":"https://github.com/senseobservationsystems","followers_url":"https://api.github.com/users/senseobservationsystems/followers","following_url":"https://api.github.com/users/senseobservationsystems/following{/other_user}","gists_url":"https://api.github.com/users/senseobservationsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/senseobservationsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senseobservationsystems/subscriptions","organizations_url":"https://api.github.com/users/senseobservationsystems/orgs","repos_url":"https://api.github.com/users/senseobservationsystems/repos","events_url":"https://api.github.com/users/senseobservationsystems/events{/privacy}","received_events_url":"https://api.github.com/users/senseobservationsystems/received_events","type":"Organization","site_admin":false},"repo":{"id":5245876,"name":"sense-android-library","full_name":"senseobservationsystems/sense-android-library","owner":{"login":"senseobservationsystems","id":2070814,"avatar_url":"https://avatars.githubusercontent.com/u/2070814?v=3","gravatar_id":"","url":"https://api.github.com/users/senseobservationsystems","html_url":"https://github.com/senseobservationsystems","followers_url":"https://api.github.com/users/senseobservationsystems/followers","following_url":"https://api.github.com/users/senseobservationsystems/following{/other_user}","gists_url":"https://api.github.com/users/senseobservationsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/senseobservationsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senseobservationsystems/subscriptions","organizations_url":"https://api.github.com/users/senseobservationsystems/orgs","repos_url":"https://api.github.com/users/senseobservationsystems/repos","events_url":"https://api.github.com/users/senseobservationsystems/events{/privacy}","received_events_url":"https://api.github.com/users/senseobservationsystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/senseobservationsystems/sense-android-library","description":"Sense Platform library for Android","fork":false,"url":"https://api.github.com/repos/senseobservationsystems/sense-android-library","forks_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/forks","keys_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/teams","hooks_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/hooks","issue_events_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues/events{/number}","events_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/events","assignees_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/assignees{/user}","branches_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/branches{/branch}","tags_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/tags","blobs_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/statuses/{sha}","languages_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/languages","stargazers_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/stargazers","contributors_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/contributors","subscribers_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/subscribers","subscription_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/subscription","commits_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/contents/{+path}","compare_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/merges","archive_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/downloads","issues_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues{/number}","pulls_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls{/number}","milestones_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/milestones{/number}","notifications_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/labels{/name}","releases_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/releases{/id}","created_at":"2012-07-31T13:05:59Z","updated_at":"2015-03-04T10:41:27Z","pushed_at":"2015-03-05T10:34:16Z","git_url":"git://github.com/senseobservationsystems/sense-android-library.git","ssh_url":"git@github.com:senseobservationsystems/sense-android-library.git","clone_url":"https://github.com/senseobservationsystems/sense-android-library.git","svn_url":"https://github.com/senseobservationsystems/sense-android-library","homepage":null,"size":29629,"stargazers_count":8,"watchers_count":8,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":12,"forks":9,"open_issues":12,"watchers":8,"default_branch":"master"}},"base":{"label":"senseobservationsystems:develop","ref":"develop","sha":"7ba627fa777bf03fa12b9fdede72b2d7c19cda99","user":{"login":"senseobservationsystems","id":2070814,"avatar_url":"https://avatars.githubusercontent.com/u/2070814?v=3","gravatar_id":"","url":"https://api.github.com/users/senseobservationsystems","html_url":"https://github.com/senseobservationsystems","followers_url":"https://api.github.com/users/senseobservationsystems/followers","following_url":"https://api.github.com/users/senseobservationsystems/following{/other_user}","gists_url":"https://api.github.com/users/senseobservationsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/senseobservationsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senseobservationsystems/subscriptions","organizations_url":"https://api.github.com/users/senseobservationsystems/orgs","repos_url":"https://api.github.com/users/senseobservationsystems/repos","events_url":"https://api.github.com/users/senseobservationsystems/events{/privacy}","received_events_url":"https://api.github.com/users/senseobservationsystems/received_events","type":"Organization","site_admin":false},"repo":{"id":5245876,"name":"sense-android-library","full_name":"senseobservationsystems/sense-android-library","owner":{"login":"senseobservationsystems","id":2070814,"avatar_url":"https://avatars.githubusercontent.com/u/2070814?v=3","gravatar_id":"","url":"https://api.github.com/users/senseobservationsystems","html_url":"https://github.com/senseobservationsystems","followers_url":"https://api.github.com/users/senseobservationsystems/followers","following_url":"https://api.github.com/users/senseobservationsystems/following{/other_user}","gists_url":"https://api.github.com/users/senseobservationsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/senseobservationsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senseobservationsystems/subscriptions","organizations_url":"https://api.github.com/users/senseobservationsystems/orgs","repos_url":"https://api.github.com/users/senseobservationsystems/repos","events_url":"https://api.github.com/users/senseobservationsystems/events{/privacy}","received_events_url":"https://api.github.com/users/senseobservationsystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/senseobservationsystems/sense-android-library","description":"Sense Platform library for Android","fork":false,"url":"https://api.github.com/repos/senseobservationsystems/sense-android-library","forks_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/forks","keys_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/teams","hooks_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/hooks","issue_events_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues/events{/number}","events_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/events","assignees_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/assignees{/user}","branches_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/branches{/branch}","tags_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/tags","blobs_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/statuses/{sha}","languages_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/languages","stargazers_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/stargazers","contributors_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/contributors","subscribers_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/subscribers","subscription_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/subscription","commits_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/contents/{+path}","compare_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/merges","archive_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/downloads","issues_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues{/number}","pulls_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls{/number}","milestones_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/milestones{/number}","notifications_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/labels{/name}","releases_url":"https://api.github.com/repos/senseobservationsystems/sense-android-library/releases{/id}","created_at":"2012-07-31T13:05:59Z","updated_at":"2015-03-04T10:41:27Z","pushed_at":"2015-03-05T10:34:16Z","git_url":"git://github.com/senseobservationsystems/sense-android-library.git","ssh_url":"git@github.com:senseobservationsystems/sense-android-library.git","clone_url":"https://github.com/senseobservationsystems/sense-android-library.git","svn_url":"https://github.com/senseobservationsystems/sense-android-library","homepage":null,"size":29629,"stargazers_count":8,"watchers_count":8,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":12,"forks":9,"open_issues":12,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/143"},"html":{"href":"https://github.com/senseobservationsystems/sense-android-library/pull/143"},"issue":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues/143"},"comments":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/issues/143/comments"},"review_comments":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/143/comments"},"review_comment":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/pulls/143/commits"},"statuses":{"href":"https://api.github.com/repos/senseobservationsystems/sense-android-library/statuses/74f364fb1323327540db73e3288b64946e98d2e8"}}}}