Skip to content

Commit 9200834

Browse files
More cleanup, add metadata
1 parent f569077 commit 9200834

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

Controllers/NanoleafController/NanoleafController.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@
1010
#include "LogManager.h"
1111
#include "httplib.h"
1212

13-
std::size_t WriteMemoryCallback(const char* in, std::size_t size, std::size_t num, std::string* out)
14-
{
15-
const std::size_t totalBytes(size * num);
16-
out->append(in, totalBytes);
17-
return totalBytes;
18-
}
19-
2013
long APIRequest(std::string method, std::string location, std::string URI, json* request_data = nullptr, json* response_data = nullptr)
2114
{
22-
const std::string url("http://"+location);
15+
/*-------------------------------------------------------------*\
16+
| Append http:// to the location field to create the URL |
17+
\*-------------------------------------------------------------*/
18+
const std::string url("http://" + location);
2319

2420
/*-------------------------------------------------------------*\
2521
| Create httplib Client and variables to hold result |
@@ -28,6 +24,9 @@ long APIRequest(std::string method, std::string location, std::string URI, json*
2824
int status = 0;
2925
std::string body = "";
3026

27+
/*-------------------------------------------------------------*\
28+
| Perform the appropriate call for the given method |
29+
\*-------------------------------------------------------------*/
3130
if(method == "GET")
3231
{
3332
httplib::Result result = client.Get(URI.c_str());
@@ -67,8 +66,9 @@ long APIRequest(std::string method, std::string location, std::string URI, json*
6766
body = result->body;
6867
}
6968

70-
LOG_DEBUG("[Nanoleaf] Result %d %s", status, body.c_str());
71-
69+
/*-------------------------------------------------------------*\
70+
| If status is in the 200 range the request was successful |
71+
\*-------------------------------------------------------------*/
7272
if((status / 100) == 2)
7373
{
7474
if(response_data)

Controllers/NanoleafController/RGBController_Nanoleaf.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
#include "RGBController.h"
1111
#include "NanoleafController.h"
1212

13+
/**------------------------------------------------------------------*\
14+
@name Nanoleaf
15+
@type Network
16+
@save :x:
17+
@direct :white_check_mark:
18+
@effects :white_check_mark:
19+
@detectors DetectNanoleafControllers
20+
@comment
21+
\*-------------------------------------------------------------------*/
22+
1323
class RGBController_Nanoleaf : public RGBController
1424
{
1525

0 commit comments

Comments
 (0)