{"action":"created","comment":{"url":"https://api.github.com/repos/foglamp/FogLAMP/pulls/comments/203638552","pull_request_review_id":138566121,"id":203638552,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzYzODU1Mg==","diff_hunk":"@@ -0,0 +1,110 @@\n+/*\n+ * FogLAMP south plugin.\n+ *\n+ * Copyright (c) 2018 OSisoft, LLC\n+ *\n+ * Released under the Apache 2.0 Licence\n+ *\n+ * Author: Mark Riddoch\n+ */\n+#include <dht11.h>\n+#include <plugin_api.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <strings.h>\n+#include <string>\n+#include <logger.h>\n+#include <plugin_exception.h>\n+#include <config_category.h>\n+#include <rapidjson/document.h>\n+\n+using namespace std;\n+\n+/**\n+ * Default configuration\n+ */\n+#define CONFIG  \"{\\\"plugin\\\" : { \\\"description\\\" : \\\"DHT11 plugin\\\", \" \\\n+                        \"\\\"type\\\" : \\\"string\\\", \\\"default\\\" : \\\"foglamp-dht11\\\" }, \" \\\n+                \"\\\"asset\\\" : { \\\"description\\\" : \\\"Asset name\\\", \"\\\n+                        \"\\\"type\\\" : \\\"string\\\", \\\"default\\\" : \\\"dht11\\\" }, \" \\\n+                \"\\\"pin\\\" : { \\\"description\\\" : \\\"RPi pin to which DHT11 is attached\\\", \" \\\n+                        \"\\\"type\\\" : \\\"integer\\\", \\\"default\\\" : \\\"7\\\" } \"\\\n+                \"}\"\n+\n+\n+/**\n+ * The DHT11 plugin interface\n+ */\n+extern \"C\" {\n+\n+/**\n+ * The plugin information structure\n+ */\n+static PLUGIN_INFORMATION info = {\n+\t\"DHT11\",                  // Name\n+\t\"1.0.0\",                  // Version\n+\t0,    \t\t\t  // Flags\n+\tPLUGIN_TYPE_SOUTH,        // Type\n+\t\"1.0.0\",                  // Interface version\n+\tCONFIG                    // Default configuration\n+};\n+\n+/**\n+ * Return the information about this plugin\n+ */\n+PLUGIN_INFORMATION *plugin_info()\n+{\n+\treturn &info;\n+}\n+\n+/**\n+ * Initialise the plugin, called to get the plugin handle\n+ */\n+PLUGIN_HANDLE plugin_init(ConfigCategory *config)\n+{\n+\tunsigned int pin=7;\n+\n+\tif (config->itemExists(\"pin\"))\n+        {\n+                pin = stoul(config->getValue(\"pin\"), nullptr, 0);\n+        }\n+\t\n+\t//Logger::getLogger()->info(\"DHT11 C++ plugin_init: config='%s' \", config->toJSON().c_str());\n+\n+\tDHT11 *dht11= new DHT11(pin);\n+\treturn (PLUGIN_HANDLE)dht11;\n+}\n+\n+/**\n+ * Start the Async handling for the plugin\n+ */\n+void plugin_start(PLUGIN_HANDLE *handle)\n+{\n+}\n+\n+/**\n+ * Poll for a plugin reading\n+ */\n+Reading plugin_poll(PLUGIN_HANDLE *handle)\n+{\n+\tDHT11 *dht11 = (DHT11*)handle;\n+\treturn dht11->takeReading();\n+}\n+\n+/**\n+ * Reconfigure the plugin\n+ */\n+void plugin_reconfigure(PLUGIN_HANDLE *handle, string& newConfig)\n+{","path":"C/plugins/south/dht11/plugin.cpp","position":104,"original_position":98,"commit_id":"695d5cfb81afdbec7b6729251d2b6f16226e6466","original_commit_id":"a673546b5368fe9bc9837d5d15f531bcda409675","user":{"login":"AmandeepArora","id":40791522,"node_id":"MDQ6VXNlcjQwNzkxNTIy","avatar_url":"https://avatars3.githubusercontent.com/u/40791522?v=4","gravatar_id":"","url":"https://api.github.com/users/AmandeepArora","html_url":"https://github.com/AmandeepArora","followers_url":"https://api.github.com/users/AmandeepArora/followers","following_url":"https://api.github.com/users/AmandeepArora/following{/other_user}","gists_url":"https://api.github.com/users/AmandeepArora/gists{/gist_id}","starred_url":"https://api.github.com/users/AmandeepArora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmandeepArora/subscriptions","organizations_url":"https://api.github.com/users/AmandeepArora/orgs","repos_url":"https://api.github.com/users/AmandeepArora/repos","events_url":"https://api.github.com/users/AmandeepArora/events{/privacy}","received_events_url":"https://api.github.com/users/AmandeepArora/received_events","type":"User","site_admin":false},"body":"To start using a new GPIO pin to get data from the sensor, it is probably better to shutdown Pi or atleast the sensor and then plug it back in using the new GPIO pin. It would be better to power reset the sensor before changing the GPIO pin it is connected to. So dynamic (runtime) configuration change is probably not required. So even if I don't add logic to the reconfigure function, I think pin configuration change would still be stored into DB and would be used the next time dht11 plugin is started.\r\n\r\nShould I add code to handle \"asset name\" change?","created_at":"2018-07-19T08:19:36Z","updated_at":"2018-07-19T08:19:37Z","html_url":"https://github.com/foglamp/FogLAMP/pull/937#discussion_r203638552","pull_request_url":"https://api.github.com/repos/foglamp/FogLAMP/pulls/937","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/foglamp/FogLAMP/pulls/comments/203638552"},"html":{"href":"https://github.com/foglamp/FogLAMP/pull/937#discussion_r203638552"},"pull_request":{"href":"https://api.github.com/repos/foglamp/FogLAMP/pulls/937"}},"in_reply_to_id":203384076},"pull_request":{"url":"https://api.github.com/repos/foglamp/FogLAMP/pulls/937","id":202250142,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMjUwMTQy","html_url":"https://github.com/foglamp/FogLAMP/pull/937","diff_url":"https://github.com/foglamp/FogLAMP/pull/937.diff","patch_url":"https://github.com/foglamp/FogLAMP/pull/937.patch","issue_url":"https://api.github.com/repos/foglamp/FogLAMP/issues/937","number":937,"state":"open","locked":false,"title":"FOGL-1548: DHT11 plugin for C++ south service","user":{"login":"AmandeepArora","id":40791522,"node_id":"MDQ6VXNlcjQwNzkxNTIy","avatar_url":"https://avatars3.githubusercontent.com/u/40791522?v=4","gravatar_id":"","url":"https://api.github.com/users/AmandeepArora","html_url":"https://github.com/AmandeepArora","followers_url":"https://api.github.com/users/AmandeepArora/followers","following_url":"https://api.github.com/users/AmandeepArora/following{/other_user}","gists_url":"https://api.github.com/users/AmandeepArora/gists{/gist_id}","starred_url":"https://api.github.com/users/AmandeepArora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmandeepArora/subscriptions","organizations_url":"https://api.github.com/users/AmandeepArora/orgs","repos_url":"https://api.github.com/users/AmandeepArora/repos","events_url":"https://api.github.com/users/AmandeepArora/events{/privacy}","received_events_url":"https://api.github.com/users/AmandeepArora/received_events","type":"User","site_admin":false},"body":"Added DHT11 C/C++ plugin support. Usage instructions are in plugins/south/dht11/README.rst.","created_at":"2018-07-18T13:18:16Z","updated_at":"2018-07-19T08:19:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b08b2b766f44ccdc2ab8e3ef92f189f4a43c4ad","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/foglamp/FogLAMP/pulls/937/commits","review_comments_url":"https://api.github.com/repos/foglamp/FogLAMP/pulls/937/comments","review_comment_url":"https://api.github.com/repos/foglamp/FogLAMP/pulls/comments{/number}","comments_url":"https://api.github.com/repos/foglamp/FogLAMP/issues/937/comments","statuses_url":"https://api.github.com/repos/foglamp/FogLAMP/statuses/695d5cfb81afdbec7b6729251d2b6f16226e6466","head":{"label":"foglamp:FOGL-1548","ref":"FOGL-1548","sha":"695d5cfb81afdbec7b6729251d2b6f16226e6466","user":{"login":"foglamp","id":27822234,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3ODIyMjM0","avatar_url":"https://avatars0.githubusercontent.com/u/27822234?v=4","gravatar_id":"","url":"https://api.github.com/users/foglamp","html_url":"https://github.com/foglamp","followers_url":"https://api.github.com/users/foglamp/followers","following_url":"https://api.github.com/users/foglamp/following{/other_user}","gists_url":"https://api.github.com/users/foglamp/gists{/gist_id}","starred_url":"https://api.github.com/users/foglamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foglamp/subscriptions","organizations_url":"https://api.github.com/users/foglamp/orgs","repos_url":"https://api.github.com/users/foglamp/repos","events_url":"https://api.github.com/users/foglamp/events{/privacy}","received_events_url":"https://api.github.com/users/foglamp/received_events","type":"Organization","site_admin":false},"repo":{"id":88887957,"node_id":"MDEwOlJlcG9zaXRvcnk4ODg4Nzk1Nw==","name":"FogLAMP","full_name":"foglamp/FogLAMP","owner":{"login":"foglamp","id":27822234,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3ODIyMjM0","avatar_url":"https://avatars0.githubusercontent.com/u/27822234?v=4","gravatar_id":"","url":"https://api.github.com/users/foglamp","html_url":"https://github.com/foglamp","followers_url":"https://api.github.com/users/foglamp/followers","following_url":"https://api.github.com/users/foglamp/following{/other_user}","gists_url":"https://api.github.com/users/foglamp/gists{/gist_id}","starred_url":"https://api.github.com/users/foglamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foglamp/subscriptions","organizations_url":"https://api.github.com/users/foglamp/orgs","repos_url":"https://api.github.com/users/foglamp/repos","events_url":"https://api.github.com/users/foglamp/events{/privacy}","received_events_url":"https://api.github.com/users/foglamp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/foglamp/FogLAMP","description":"An open source platform for the Internet of Things, it acts as an edge gateway between sensor devices and cloud storage systems","fork":false,"url":"https://api.github.com/repos/foglamp/FogLAMP","forks_url":"https://api.github.com/repos/foglamp/FogLAMP/forks","keys_url":"https://api.github.com/repos/foglamp/FogLAMP/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foglamp/FogLAMP/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foglamp/FogLAMP/teams","hooks_url":"https://api.github.com/repos/foglamp/FogLAMP/hooks","issue_events_url":"https://api.github.com/repos/foglamp/FogLAMP/issues/events{/number}","events_url":"https://api.github.com/repos/foglamp/FogLAMP/events","assignees_url":"https://api.github.com/repos/foglamp/FogLAMP/assignees{/user}","branches_url":"https://api.github.com/repos/foglamp/FogLAMP/branches{/branch}","tags_url":"https://api.github.com/repos/foglamp/FogLAMP/tags","blobs_url":"https://api.github.com/repos/foglamp/FogLAMP/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foglamp/FogLAMP/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foglamp/FogLAMP/git/refs{/sha}","trees_url":"https://api.github.com/repos/foglamp/FogLAMP/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foglamp/FogLAMP/statuses/{sha}","languages_url":"https://api.github.com/repos/foglamp/FogLAMP/languages","stargazers_url":"https://api.github.com/repos/foglamp/FogLAMP/stargazers","contributors_url":"https://api.github.com/repos/foglamp/FogLAMP/contributors","subscribers_url":"https://api.github.com/repos/foglamp/FogLAMP/subscribers","subscription_url":"https://api.github.com/repos/foglamp/FogLAMP/subscription","commits_url":"https://api.github.com/repos/foglamp/FogLAMP/commits{/sha}","git_commits_url":"https://api.github.com/repos/foglamp/FogLAMP/git/commits{/sha}","comments_url":"https://api.github.com/repos/foglamp/FogLAMP/comments{/number}","issue_comment_url":"https://api.github.com/repos/foglamp/FogLAMP/issues/comments{/number}","contents_url":"https://api.github.com/repos/foglamp/FogLAMP/contents/{+path}","compare_url":"https://api.github.com/repos/foglamp/FogLAMP/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foglamp/FogLAMP/merges","archive_url":"https://api.github.com/repos/foglamp/FogLAMP/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foglamp/FogLAMP/downloads","issues_url":"https://api.github.com/repos/foglamp/FogLAMP/issues{/number}","pulls_url":"https://api.github.com/repos/foglamp/FogLAMP/pulls{/number}","milestones_url":"https://api.github.com/repos/foglamp/FogLAMP/milestones{/number}","notifications_url":"https://api.github.com/repos/foglamp/FogLAMP/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foglamp/FogLAMP/labels{/name}","releases_url":"https://api.github.com/repos/foglamp/FogLAMP/releases{/id}","deployments_url":"https://api.github.com/repos/foglamp/FogLAMP/deployments","created_at":"2017-04-20T16:35:27Z","updated_at":"2018-07-13T18:00:22Z","pushed_at":"2018-07-19T08:16:26Z","git_url":"git://github.com/foglamp/FogLAMP.git","ssh_url":"git@github.com:foglamp/FogLAMP.git","clone_url":"https://github.com/foglamp/FogLAMP.git","svn_url":"https://github.com/foglamp/FogLAMP","homepage":"http://foglamp.readthedocs.io/","size":13502,"stargazers_count":25,"watchers_count":25,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":19,"open_issues":6,"watchers":25,"default_branch":"develop"}},"base":{"label":"foglamp:develop","ref":"develop","sha":"9f527b68bdf2dd3ba5cd9d8e017e4e51da247548","user":{"login":"foglamp","id":27822234,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3ODIyMjM0","avatar_url":"https://avatars0.githubusercontent.com/u/27822234?v=4","gravatar_id":"","url":"https://api.github.com/users/foglamp","html_url":"https://github.com/foglamp","followers_url":"https://api.github.com/users/foglamp/followers","following_url":"https://api.github.com/users/foglamp/following{/other_user}","gists_url":"https://api.github.com/users/foglamp/gists{/gist_id}","starred_url":"https://api.github.com/users/foglamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foglamp/subscriptions","organizations_url":"https://api.github.com/users/foglamp/orgs","repos_url":"https://api.github.com/users/foglamp/repos","events_url":"https://api.github.com/users/foglamp/events{/privacy}","received_events_url":"https://api.github.com/users/foglamp/received_events","type":"Organization","site_admin":false},"repo":{"id":88887957,"node_id":"MDEwOlJlcG9zaXRvcnk4ODg4Nzk1Nw==","name":"FogLAMP","full_name":"foglamp/FogLAMP","owner":{"login":"foglamp","id":27822234,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3ODIyMjM0","avatar_url":"https://avatars0.githubusercontent.com/u/27822234?v=4","gravatar_id":"","url":"https://api.github.com/users/foglamp","html_url":"https://github.com/foglamp","followers_url":"https://api.github.com/users/foglamp/followers","following_url":"https://api.github.com/users/foglamp/following{/other_user}","gists_url":"https://api.github.com/users/foglamp/gists{/gist_id}","starred_url":"https://api.github.com/users/foglamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foglamp/subscriptions","organizations_url":"https://api.github.com/users/foglamp/orgs","repos_url":"https://api.github.com/users/foglamp/repos","events_url":"https://api.github.com/users/foglamp/events{/privacy}","received_events_url":"https://api.github.com/users/foglamp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/foglamp/FogLAMP","description":"An open source platform for the Internet of Things, it acts as an edge gateway between sensor devices and cloud storage systems","fork":false,"url":"https://api.github.com/repos/foglamp/FogLAMP","forks_url":"https://api.github.com/repos/foglamp/FogLAMP/forks","keys_url":"https://api.github.com/repos/foglamp/FogLAMP/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foglamp/FogLAMP/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foglamp/FogLAMP/teams","hooks_url":"https://api.github.com/repos/foglamp/FogLAMP/hooks","issue_events_url":"https://api.github.com/repos/foglamp/FogLAMP/issues/events{/number}","events_url":"https://api.github.com/repos/foglamp/FogLAMP/events","assignees_url":"https://api.github.com/repos/foglamp/FogLAMP/assignees{/user}","branches_url":"https://api.github.com/repos/foglamp/FogLAMP/branches{/branch}","tags_url":"https://api.github.com/repos/foglamp/FogLAMP/tags","blobs_url":"https://api.github.com/repos/foglamp/FogLAMP/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foglamp/FogLAMP/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foglamp/FogLAMP/git/refs{/sha}","trees_url":"https://api.github.com/repos/foglamp/FogLAMP/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foglamp/FogLAMP/statuses/{sha}","languages_url":"https://api.github.com/repos/foglamp/FogLAMP/languages","stargazers_url":"https://api.github.com/repos/foglamp/FogLAMP/stargazers","contributors_url":"https://api.github.com/repos/foglamp/FogLAMP/contributors","subscribers_url":"https://api.github.com/repos/foglamp/FogLAMP/subscribers","subscription_url":"https://api.github.com/repos/foglamp/FogLAMP/subscription","commits_url":"https://api.github.com/repos/foglamp/FogLAMP/commits{/sha}","git_commits_url":"https://api.github.com/repos/foglamp/FogLAMP/git/commits{/sha}","comments_url":"https://api.github.com/repos/foglamp/FogLAMP/comments{/number}","issue_comment_url":"https://api.github.com/repos/foglamp/FogLAMP/issues/comments{/number}","contents_url":"https://api.github.com/repos/foglamp/FogLAMP/contents/{+path}","compare_url":"https://api.github.com/repos/foglamp/FogLAMP/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foglamp/FogLAMP/merges","archive_url":"https://api.github.com/repos/foglamp/FogLAMP/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foglamp/FogLAMP/downloads","issues_url":"https://api.github.com/repos/foglamp/FogLAMP/issues{/number}","pulls_url":"https://api.github.com/repos/foglamp/FogLAMP/pulls{/number}","milestones_url":"https://api.github.com/repos/foglamp/FogLAMP/milestones{/number}","notifications_url":"https://api.github.com/repos/foglamp/FogLAMP/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foglamp/FogLAMP/labels{/name}","releases_url":"https://api.github.com/repos/foglamp/FogLAMP/releases{/id}","deployments_url":"https://api.github.com/repos/foglamp/FogLAMP/deployments","created_at":"2017-04-20T16:35:27Z","updated_at":"2018-07-13T18:00:22Z","pushed_at":"2018-07-19T08:16:26Z","git_url":"git://github.com/foglamp/FogLAMP.git","ssh_url":"git@github.com:foglamp/FogLAMP.git","clone_url":"https://github.com/foglamp/FogLAMP.git","svn_url":"https://github.com/foglamp/FogLAMP","homepage":"http://foglamp.readthedocs.io/","size":13502,"stargazers_count":25,"watchers_count":25,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":19,"open_issues":6,"watchers":25,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/foglamp/FogLAMP/pulls/937"},"html":{"href":"https://github.com/foglamp/FogLAMP/pull/937"},"issue":{"href":"https://api.github.com/repos/foglamp/FogLAMP/issues/937"},"comments":{"href":"https://api.github.com/repos/foglamp/FogLAMP/issues/937/comments"},"review_comments":{"href":"https://api.github.com/repos/foglamp/FogLAMP/pulls/937/comments"},"review_comment":{"href":"https://api.github.com/repos/foglamp/FogLAMP/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/foglamp/FogLAMP/pulls/937/commits"},"statuses":{"href":"https://api.github.com/repos/foglamp/FogLAMP/statuses/695d5cfb81afdbec7b6729251d2b6f16226e6466"}},"author_association":"NONE"}}
{"actor":{"display_login":"AmandeepArora"}}