{"action":"created","comment":{"url":"https://api.github.com/repos/openthread/openthread/pulls/comments/177826632","pull_request_review_id":107772576,"id":177826632,"diff_hunk":"@@ -105,6 +105,83 @@ void otPlatAssertFail(const char *aFilename, int aLineNumber);\n  */\n void otPlatWakeHost(void);\n \n+/**\n+ * Enumeration of possible NCP power states.\n+ *\n+ * These are in the same order as the Spinel power state (please see `spinel_power_state_t` and spinel documentation).\n+ *\n+ * The platform code can decide how to interpret each power state. Here is the high-level expected behavior:\n+ *\n+ * POWER_STATE_OFF:        NCP is powered off (may be awakened by an external reset).\n+ * POWER_STATE_DEEP_SLEEP: NCP may be awakened via an external command or interrupt (or reset).\n+ * POWER_STATE_STANDBY:    NCP may be awakened via an internal (e.g., from the radio) event or external trigger.\n+ * POWER_STATE_LOW_POWER:  NCP is responsive (and possibly connected), but using less power.\n+ * POWER_STATE_ON:         NCP is fully powered.\n+ *\n+ */\n+typedef enum {\n+    OT_PLAT_POWER_STATE_OFF        = 0,\n+    OT_PLAT_POWER_STATE_DEEP_SLEEP = 1,\n+    OT_PLAT_POWER_STATE_STANDBY    = 2,\n+    OT_PLAT_POWER_STATE_LOW_POWER  = 3,\n+    OT_PLAT_POWER_STATE_ON         = 4,\n+} otPlatPowerState;\n+\n+/**\n+ * This function set the desired NCP power state to a given state.\n+ *\n+ * This is only applicable and used for NCP configuration when `OPENTHREAD_CONFIG_NCP_ENABLE_POWER_STATE_CONTROL`\n+ * is enabled.\n+ *\n+ * @note The NCP is not required to immediately enter the given power-state. The power-state is the desired power state\n+ * of NCP when the underlying platform's operating system enters idle mode (i.e., all active tasks/events are processed\n+ * and the MCU can potentially enter a low-power state).\n+ *\n+ * @param[in] aInstance      A pointer to OpenThread instance.\n+ * @param[in] aState         The new power state.\n+ *\n+ * @retval OT_ERROR_NONE     The power state updated successfully.\n+ * @retval OT_ERROR_FAILED   The given power state is not supported by the platform.\n+ *\n+ */\n+otError otPlatPowerStateSet(otInstance *aInstance, otPlatPowerState aState);\n+\n+/**\n+ * This function gets the current desired power state.\n+ *\n+ * This is only applicable and used for NCP configuration when `OPENTHREAD_CONFIG_NCP_ENABLE_POWER_STATE_CONTROL`\n+ * is enabled.\n+ *\n+ * @note The power-state is desired power state of NCP when the underlying platform's operating system enters idle mode\n+ * (i.e., all active tasks/events are processed and the MCU can potentially enter low-power state).\n+ *\n+ * After a reset or NCP wake-up, the power state MUST return `OT_PLAT_POWER_STATE_ON`.","path":"include/openthread/platform/misc.h","position":54,"original_position":54,"commit_id":"3ffcf33e0109eaa4555c44a59d8723113d7af7b6","original_commit_id":"3ffcf33e0109eaa4555c44a59d8723113d7af7b6","user":{"login":"abtink","id":17729664,"avatar_url":"https://avatars3.githubusercontent.com/u/17729664?v=4","gravatar_id":"","url":"https://api.github.com/users/abtink","html_url":"https://github.com/abtink","followers_url":"https://api.github.com/users/abtink/followers","following_url":"https://api.github.com/users/abtink/following{/other_user}","gists_url":"https://api.github.com/users/abtink/gists{/gist_id}","starred_url":"https://api.github.com/users/abtink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abtink/subscriptions","organizations_url":"https://api.github.com/users/abtink/orgs","repos_url":"https://api.github.com/users/abtink/repos","events_url":"https://api.github.com/users/abtink/events{/privacy}","received_events_url":"https://api.github.com/users/abtink/received_events","type":"User","site_admin":false},"body":"We can consider this but I like the simplicity of it always being `POWER_STATE_ON`.\r\nHost/user can then choose to set it to `LOW_POWER` if desired (particularly since `LOW_POWER` may be interpreted differently on different platforms).","created_at":"2018-03-28T17:23:12Z","updated_at":"2018-03-28T17:23:12Z","html_url":"https://github.com/openthread/openthread/pull/2635#discussion_r177826632","pull_request_url":"https://api.github.com/repos/openthread/openthread/pulls/2635","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/openthread/openthread/pulls/comments/177826632"},"html":{"href":"https://github.com/openthread/openthread/pull/2635#discussion_r177826632"},"pull_request":{"href":"https://api.github.com/repos/openthread/openthread/pulls/2635"}},"in_reply_to_id":177804251},"pull_request":{"url":"https://api.github.com/repos/openthread/openthread/pulls/2635","id":176657956,"html_url":"https://github.com/openthread/openthread/pull/2635","diff_url":"https://github.com/openthread/openthread/pull/2635.diff","patch_url":"https://github.com/openthread/openthread/pull/2635.patch","issue_url":"https://api.github.com/repos/openthread/openthread/issues/2635","number":2635,"state":"open","locked":false,"title":"[ncp] add support for NCP power state change","user":{"login":"abtink","id":17729664,"avatar_url":"https://avatars3.githubusercontent.com/u/17729664?v=4","gravatar_id":"","url":"https://api.github.com/users/abtink","html_url":"https://github.com/abtink","followers_url":"https://api.github.com/users/abtink/followers","following_url":"https://api.github.com/users/abtink/following{/other_user}","gists_url":"https://api.github.com/users/abtink/gists{/gist_id}","starred_url":"https://api.github.com/users/abtink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abtink/subscriptions","organizations_url":"https://api.github.com/users/abtink/orgs","repos_url":"https://api.github.com/users/abtink/repos","events_url":"https://api.github.com/users/abtink/events{/privacy}","received_events_url":"https://api.github.com/users/abtink/received_events","type":"User","site_admin":false},"body":"This commit adds a configuration option to enable NCP power state\r\ncontrol. When enabled spinel property `SPINEL_PROP_POWER_STATE` can be\r\nused to get/set the desired NCP power state. The get/set handlers for\r\nthis property can be  specified using newly added config options\r\n`NCP_PLAT_GET_POWER_STATE_FUNC` and `NCP_PLAT_SET_POWER_STATE_FUNC`.","created_at":"2018-03-22T02:16:20Z","updated_at":"2018-03-28T17:23:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fe465a32474c5a26f04248904c0678d361ffeba","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":380297891,"url":"https://api.github.com/repos/openthread/openthread/labels/NCP","name":"NCP","color":"c2e0c6","default":false},{"id":397568980,"url":"https://api.github.com/repos/openthread/openthread/labels/P4","name":"P4","color":"AFDF00","default":false},{"id":355043113,"url":"https://api.github.com/repos/openthread/openthread/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/openthread/openthread/pulls/2635/commits","review_comments_url":"https://api.github.com/repos/openthread/openthread/pulls/2635/comments","review_comment_url":"https://api.github.com/repos/openthread/openthread/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openthread/openthread/issues/2635/comments","statuses_url":"https://api.github.com/repos/openthread/openthread/statuses/3ffcf33e0109eaa4555c44a59d8723113d7af7b6","head":{"label":"abtink:pr/ncp-power-state-fn","ref":"pr/ncp-power-state-fn","sha":"3ffcf33e0109eaa4555c44a59d8723113d7af7b6","user":{"login":"abtink","id":17729664,"avatar_url":"https://avatars3.githubusercontent.com/u/17729664?v=4","gravatar_id":"","url":"https://api.github.com/users/abtink","html_url":"https://github.com/abtink","followers_url":"https://api.github.com/users/abtink/followers","following_url":"https://api.github.com/users/abtink/following{/other_user}","gists_url":"https://api.github.com/users/abtink/gists{/gist_id}","starred_url":"https://api.github.com/users/abtink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abtink/subscriptions","organizations_url":"https://api.github.com/users/abtink/orgs","repos_url":"https://api.github.com/users/abtink/repos","events_url":"https://api.github.com/users/abtink/events{/privacy}","received_events_url":"https://api.github.com/users/abtink/received_events","type":"User","site_admin":false},"repo":{"id":60545666,"name":"openthread","full_name":"abtink/openthread","owner":{"login":"abtink","id":17729664,"avatar_url":"https://avatars3.githubusercontent.com/u/17729664?v=4","gravatar_id":"","url":"https://api.github.com/users/abtink","html_url":"https://github.com/abtink","followers_url":"https://api.github.com/users/abtink/followers","following_url":"https://api.github.com/users/abtink/following{/other_user}","gists_url":"https://api.github.com/users/abtink/gists{/gist_id}","starred_url":"https://api.github.com/users/abtink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abtink/subscriptions","organizations_url":"https://api.github.com/users/abtink/orgs","repos_url":"https://api.github.com/users/abtink/repos","events_url":"https://api.github.com/users/abtink/events{/privacy}","received_events_url":"https://api.github.com/users/abtink/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abtink/openthread","description":"OpenThread released by Nest is an open-source implementation of the Thread networking protocol","fork":true,"url":"https://api.github.com/repos/abtink/openthread","forks_url":"https://api.github.com/repos/abtink/openthread/forks","keys_url":"https://api.github.com/repos/abtink/openthread/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abtink/openthread/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abtink/openthread/teams","hooks_url":"https://api.github.com/repos/abtink/openthread/hooks","issue_events_url":"https://api.github.com/repos/abtink/openthread/issues/events{/number}","events_url":"https://api.github.com/repos/abtink/openthread/events","assignees_url":"https://api.github.com/repos/abtink/openthread/assignees{/user}","branches_url":"https://api.github.com/repos/abtink/openthread/branches{/branch}","tags_url":"https://api.github.com/repos/abtink/openthread/tags","blobs_url":"https://api.github.com/repos/abtink/openthread/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abtink/openthread/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abtink/openthread/git/refs{/sha}","trees_url":"https://api.github.com/repos/abtink/openthread/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abtink/openthread/statuses/{sha}","languages_url":"https://api.github.com/repos/abtink/openthread/languages","stargazers_url":"https://api.github.com/repos/abtink/openthread/stargazers","contributors_url":"https://api.github.com/repos/abtink/openthread/contributors","subscribers_url":"https://api.github.com/repos/abtink/openthread/subscribers","subscription_url":"https://api.github.com/repos/abtink/openthread/subscription","commits_url":"https://api.github.com/repos/abtink/openthread/commits{/sha}","git_commits_url":"https://api.github.com/repos/abtink/openthread/git/commits{/sha}","comments_url":"https://api.github.com/repos/abtink/openthread/comments{/number}","issue_comment_url":"https://api.github.com/repos/abtink/openthread/issues/comments{/number}","contents_url":"https://api.github.com/repos/abtink/openthread/contents/{+path}","compare_url":"https://api.github.com/repos/abtink/openthread/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abtink/openthread/merges","archive_url":"https://api.github.com/repos/abtink/openthread/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abtink/openthread/downloads","issues_url":"https://api.github.com/repos/abtink/openthread/issues{/number}","pulls_url":"https://api.github.com/repos/abtink/openthread/pulls{/number}","milestones_url":"https://api.github.com/repos/abtink/openthread/milestones{/number}","notifications_url":"https://api.github.com/repos/abtink/openthread/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abtink/openthread/labels{/name}","releases_url":"https://api.github.com/repos/abtink/openthread/releases{/id}","deployments_url":"https://api.github.com/repos/abtink/openthread/deployments","created_at":"2016-06-06T17:04:09Z","updated_at":"2018-03-28T17:15:16Z","pushed_at":"2018-03-28T17:15:14Z","git_url":"git://github.com/abtink/openthread.git","ssh_url":"git@github.com:abtink/openthread.git","clone_url":"https://github.com/abtink/openthread.git","svn_url":"https://github.com/abtink/openthread","homepage":"","size":115474,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"openthread:master","ref":"master","sha":"cb2a7800d7cc5fb71f2e28dd8d0d3d74f8e2ba6d","user":{"login":"openthread","id":16142269,"avatar_url":"https://avatars2.githubusercontent.com/u/16142269?v=4","gravatar_id":"","url":"https://api.github.com/users/openthread","html_url":"https://github.com/openthread","followers_url":"https://api.github.com/users/openthread/followers","following_url":"https://api.github.com/users/openthread/following{/other_user}","gists_url":"https://api.github.com/users/openthread/gists{/gist_id}","starred_url":"https://api.github.com/users/openthread/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openthread/subscriptions","organizations_url":"https://api.github.com/users/openthread/orgs","repos_url":"https://api.github.com/users/openthread/repos","events_url":"https://api.github.com/users/openthread/events{/privacy}","received_events_url":"https://api.github.com/users/openthread/received_events","type":"Organization","site_admin":false},"repo":{"id":55808787,"name":"openthread","full_name":"openthread/openthread","owner":{"login":"openthread","id":16142269,"avatar_url":"https://avatars2.githubusercontent.com/u/16142269?v=4","gravatar_id":"","url":"https://api.github.com/users/openthread","html_url":"https://github.com/openthread","followers_url":"https://api.github.com/users/openthread/followers","following_url":"https://api.github.com/users/openthread/following{/other_user}","gists_url":"https://api.github.com/users/openthread/gists{/gist_id}","starred_url":"https://api.github.com/users/openthread/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openthread/subscriptions","organizations_url":"https://api.github.com/users/openthread/orgs","repos_url":"https://api.github.com/users/openthread/repos","events_url":"https://api.github.com/users/openthread/events{/privacy}","received_events_url":"https://api.github.com/users/openthread/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openthread/openthread","description":"OpenThread released by Nest is an open-source implementation of the Thread networking protocol","fork":false,"url":"https://api.github.com/repos/openthread/openthread","forks_url":"https://api.github.com/repos/openthread/openthread/forks","keys_url":"https://api.github.com/repos/openthread/openthread/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openthread/openthread/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openthread/openthread/teams","hooks_url":"https://api.github.com/repos/openthread/openthread/hooks","issue_events_url":"https://api.github.com/repos/openthread/openthread/issues/events{/number}","events_url":"https://api.github.com/repos/openthread/openthread/events","assignees_url":"https://api.github.com/repos/openthread/openthread/assignees{/user}","branches_url":"https://api.github.com/repos/openthread/openthread/branches{/branch}","tags_url":"https://api.github.com/repos/openthread/openthread/tags","blobs_url":"https://api.github.com/repos/openthread/openthread/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openthread/openthread/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openthread/openthread/git/refs{/sha}","trees_url":"https://api.github.com/repos/openthread/openthread/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openthread/openthread/statuses/{sha}","languages_url":"https://api.github.com/repos/openthread/openthread/languages","stargazers_url":"https://api.github.com/repos/openthread/openthread/stargazers","contributors_url":"https://api.github.com/repos/openthread/openthread/contributors","subscribers_url":"https://api.github.com/repos/openthread/openthread/subscribers","subscription_url":"https://api.github.com/repos/openthread/openthread/subscription","commits_url":"https://api.github.com/repos/openthread/openthread/commits{/sha}","git_commits_url":"https://api.github.com/repos/openthread/openthread/git/commits{/sha}","comments_url":"https://api.github.com/repos/openthread/openthread/comments{/number}","issue_comment_url":"https://api.github.com/repos/openthread/openthread/issues/comments{/number}","contents_url":"https://api.github.com/repos/openthread/openthread/contents/{+path}","compare_url":"https://api.github.com/repos/openthread/openthread/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openthread/openthread/merges","archive_url":"https://api.github.com/repos/openthread/openthread/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openthread/openthread/downloads","issues_url":"https://api.github.com/repos/openthread/openthread/issues{/number}","pulls_url":"https://api.github.com/repos/openthread/openthread/pulls{/number}","milestones_url":"https://api.github.com/repos/openthread/openthread/milestones{/number}","notifications_url":"https://api.github.com/repos/openthread/openthread/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openthread/openthread/labels{/name}","releases_url":"https://api.github.com/repos/openthread/openthread/releases{/id}","deployments_url":"https://api.github.com/repos/openthread/openthread/deployments","created_at":"2016-04-08T20:47:41Z","updated_at":"2018-03-28T15:46:16Z","pushed_at":"2018-03-28T15:46:12Z","git_url":"git://github.com/openthread/openthread.git","ssh_url":"git@github.com:openthread/openthread.git","clone_url":"https://github.com/openthread/openthread.git","svn_url":"https://github.com/openthread/openthread","homepage":"","size":46707,"stargazers_count":1476,"watchers_count":1476,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":429,"mirror_url":null,"archived":false,"open_issues_count":47,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":429,"open_issues":47,"watchers":1476,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openthread/openthread/pulls/2635"},"html":{"href":"https://github.com/openthread/openthread/pull/2635"},"issue":{"href":"https://api.github.com/repos/openthread/openthread/issues/2635"},"comments":{"href":"https://api.github.com/repos/openthread/openthread/issues/2635/comments"},"review_comments":{"href":"https://api.github.com/repos/openthread/openthread/pulls/2635/comments"},"review_comment":{"href":"https://api.github.com/repos/openthread/openthread/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openthread/openthread/pulls/2635/commits"},"statuses":{"href":"https://api.github.com/repos/openthread/openthread/statuses/3ffcf33e0109eaa4555c44a59d8723113d7af7b6"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"abtink"}}