diff --git a/logs/app.log b/logs/app.log index 492d20e..e90d06f 100644 --- a/logs/app.log +++ b/logs/app.log @@ -1472,3 +1472,1826 @@ [April 1st 2016, 2:02:56 pm] Authenticating... [April 1st 2016, 2:02:56 pm] Found 1 valid users [April 1st 2016, 2:02:56 pm] Userid: new +[April 5th 2016, 8:31:56 am] Listening server on port 8080 +[April 5th 2016, 8:31:56 am] GET /api/lights +[April 5th 2016, 8:31:56 am] Authenticating... +[April 5th 2016, 8:31:56 am] Found 1 valid users +[April 5th 2016, 8:31:56 am] Userid: MOEDER +[April 5th 2016, 8:31:56 am] GET /api/light/yorick/off +[April 5th 2016, 8:31:56 am] Authenticating... +[April 5th 2016, 8:31:56 am] Found 1 valid users +[April 5th 2016, 8:31:56 am] Userid: MOEDER +[April 5th 2016, 8:31:56 am] SYSEXEC: +[April 5th 2016, 8:31:56 am] GET /api/light/yorick/on +[April 5th 2016, 8:31:56 am] Authenticating... +[April 5th 2016, 8:31:56 am] Found 1 valid users +[April 5th 2016, 8:31:56 am] Userid: MOEDER +[April 5th 2016, 8:31:56 am] SYSEXEC: +[April 5th 2016, 8:40:21 am] Listening server on port 8080 +[April 5th 2016, 8:40:21 am] DELETE /api/light/Janco +[April 5th 2016, 8:40:21 am] Authenticating... +[April 5th 2016, 8:40:21 am] Found 1 valid users +[April 5th 2016, 8:40:21 am] Userid: kenneth +[April 5th 2016, 8:41:52 am] Listening server on port 8080 +[April 5th 2016, 8:41:52 am] DELETE /api/light/Janco +[April 5th 2016, 8:41:52 am] Authenticating... +[April 5th 2016, 8:41:52 am] Found 1 valid users +[April 5th 2016, 8:41:52 am] Userid: kenneth +[April 5th 2016, 8:41:52 am] Error: SQLITE_ERROR: no such table: ligth + at Error (native) +[April 5th 2016, 8:42:32 am] Listening server on port 8080 +[April 5th 2016, 8:42:32 am] DELETE /api/light/Janco +[April 5th 2016, 8:42:32 am] Authenticating... +[April 5th 2016, 8:42:32 am] Found 1 valid users +[April 5th 2016, 8:42:32 am] Userid: kenneth +[April 5th 2016, 8:42:32 am] GET /api/lights +[April 5th 2016, 8:42:32 am] Authenticating... +[April 5th 2016, 8:42:32 am] Found 1 valid users +[April 5th 2016, 8:42:32 am] Userid: kenneth +[April 5th 2016, 8:57:33 am] Listening server on port 8080 +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/light/yorick/off +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/light/kenneth/off +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] SYSEXEC: +[April 5th 2016, 8:57:33 am] SYSEXEC: +[April 5th 2016, 8:57:33 am] PUT /api/light +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/light/yorick/on +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] GET /api/light/kenneth/on +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 8:57:33 am] SYSEXEC: +[April 5th 2016, 8:57:33 am] SYSEXEC: +[April 5th 2016, 8:57:33 am] GET /api/lights +[April 5th 2016, 8:57:33 am] Authenticating... +[April 5th 2016, 8:57:33 am] Found 1 valid users +[April 5th 2016, 8:57:33 am] Userid: MOEDER +[April 5th 2016, 9:05:35 am] Listening server on port 8080 +[April 5th 2016, 9:05:54 am] Listening server on port 8080 +[April 5th 2016, 9:05:54 am] GET /api/lights +[April 5th 2016, 9:05:54 am] Authenticating... +[April 5th 2016, 9:05:54 am] Found 1 valid users +[April 5th 2016, 9:05:54 am] Userid: MOEDER +[April 5th 2016, 9:05:54 am] GET /api/lights +[April 5th 2016, 9:05:54 am] Authenticating... +[April 5th 2016, 9:05:54 am] Found 1 valid users +[April 5th 2016, 9:05:54 am] Userid: MOEDER +[April 5th 2016, 9:05:54 am] GET /api/light/yorick/off +[April 5th 2016, 9:05:54 am] Authenticating... +[April 5th 2016, 9:05:54 am] Found 1 valid users +[April 5th 2016, 9:05:54 am] Userid: MOEDER +[April 5th 2016, 9:05:54 am] GET /api/light/kenneth/off +[April 5th 2016, 9:05:54 am] Authenticating... +[April 5th 2016, 9:05:54 am] Found 1 valid users +[April 5th 2016, 9:05:54 am] Userid: MOEDER +[April 5th 2016, 9:05:54 am] SYSEXEC: +[April 5th 2016, 9:05:54 am] SYSEXEC: +[April 5th 2016, 9:05:54 am] PUT /api/light +[April 5th 2016, 9:05:54 am] Authenticating... +[April 5th 2016, 9:05:54 am] Found 1 valid users +[April 5th 2016, 9:05:54 am] Userid: MOEDER +[April 5th 2016, 9:05:54 am] GET /api/light/kenneth/on +[April 5th 2016, 9:05:54 am] Authenticating... +[April 5th 2016, 9:05:54 am] Found 1 valid users +[April 5th 2016, 9:05:54 am] Userid: MOEDER +[April 5th 2016, 9:05:54 am] GET /api/light/yorick/on +[April 5th 2016, 9:05:54 am] Authenticating... +[April 5th 2016, 9:05:54 am] Found 1 valid users +[April 5th 2016, 9:05:54 am] Userid: MOEDER +[April 5th 2016, 9:05:54 am] SYSEXEC: +[April 5th 2016, 9:05:54 am] SYSEXEC: +[April 5th 2016, 9:05:54 am] GET /api/lights +[April 5th 2016, 9:05:54 am] Authenticating... +[April 5th 2016, 9:05:54 am] Found 1 valid users +[April 5th 2016, 9:05:54 am] Userid: MOEDER +[April 5th 2016, 9:08:15 am] Listening server on port 8080 +[April 5th 2016, 9:11:17 am] Listening server on port 8080 +[April 5th 2016, 9:13:23 am] Error: listen EADDRINUSE :::8080 + at Object.exports._errnoException (util.js:874:11) + at exports._exceptionWithHostPort (util.js:897:20) + at Server._listen2 (net.js:1234:14) + at listen (net.js:1270:10) + at Server.listen (net.js:1366:5) + at EventEmitter.listen (/home/pi/miniproject/node_modules/express/lib/application.js:617:24) + at Object. (/home/pi/miniproject/app.js:71:18) + at Module._compile (module.js:435:26) + at Object.Module._extensions..js (module.js:442:10) + at Module.load (module.js:356:32) +[April 5th 2016, 9:13:46 am] Listening server on port 8080 +[April 5th 2016, 9:13:46 am] GET /api/lights +[April 5th 2016, 9:13:46 am] Authenticating... +[April 5th 2016, 9:13:46 am] Found 1 valid users +[April 5th 2016, 9:13:46 am] Userid: MOEDER +[April 5th 2016, 9:13:46 am] GET /api/lights +[April 5th 2016, 9:13:46 am] Authenticating... +[April 5th 2016, 9:13:46 am] Found 1 valid users +[April 5th 2016, 9:13:46 am] Userid: MOEDER +[April 5th 2016, 9:13:46 am] PUT /api/light +[April 5th 2016, 9:13:46 am] Authenticating... +[April 5th 2016, 9:13:46 am] Found 1 valid users +[April 5th 2016, 9:13:46 am] Userid: MOEDER +[April 5th 2016, 9:13:46 am] GET /api/lights +[April 5th 2016, 9:13:46 am] Authenticating... +[April 5th 2016, 9:13:46 am] Found 1 valid users +[April 5th 2016, 9:13:46 am] Userid: MOEDER +[April 5th 2016, 9:24:56 am] Listening server on port 8080 +[April 5th 2016, 9:24:56 am] GET /api/lights +[April 5th 2016, 9:24:56 am] Authenticating... +[April 5th 2016, 9:24:56 am] Found 1 valid users +[April 5th 2016, 9:24:56 am] Userid: MOEDER +[April 5th 2016, 9:24:56 am] PUT /api/light +[April 5th 2016, 9:24:56 am] Authenticating... +[April 5th 2016, 9:24:56 am] Found 1 valid users +[April 5th 2016, 9:24:56 am] Userid: MOEDER +[April 5th 2016, 9:24:56 am] GET /api/lights +[April 5th 2016, 9:24:56 am] Authenticating... +[April 5th 2016, 9:24:56 am] Found 1 valid users +[April 5th 2016, 9:24:56 am] Userid: MOEDER +[April 5th 2016, 9:27:32 am] Listening server on port 8080 +[April 5th 2016, 9:28:36 am] Listening server on port 8080 +[April 5th 2016, 9:28:36 am] GPIO CHANGED: 1 +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] GPIO CHANGED: 0 +[April 5th 2016, 9:28:36 am] GPIO CHANGED: 1 +[April 5th 2016, 9:28:36 am] GPIO CHANGED: 0 +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] GPIO CHANGED: 1 +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] SYSEXEC: +[April 5th 2016, 9:28:36 am] GPIO CHANGED: 0 +[April 5th 2016, 9:30:10 am] Listening server on port 8080 +[April 5th 2016, 9:30:10 am] GPIO CHANGED: 1 +[April 5th 2016, 9:30:10 am] Turning off M - 14 +[April 5th 2016, 9:30:10 am] Turning off M - 13 +[April 5th 2016, 9:30:10 am] Turning off M - 14 +[April 5th 2016, 9:30:10 am] Turning off Y - 1 +[April 5th 2016, 9:30:10 am] GPIO CHANGED: 0 +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: kenneth +[April 5th 2016, 9:30:10 am] GET /api/light/yorick/off +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/light/yorick/on +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: kenneth +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GPIO CHANGED: 1 +[April 5th 2016, 9:30:10 am] Turning off M - 14 +[April 5th 2016, 9:30:10 am] Turning off M - 13 +[April 5th 2016, 9:30:10 am] Turning off M - 14 +[April 5th 2016, 9:30:10 am] Turning off Y - 1 +[April 5th 2016, 9:30:10 am] GPIO CHANGED: 0 +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] PUT /api/light +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: kenneth +[April 5th 2016, 9:30:10 am] GET /api/light/kenneth/off +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/light/kenneth/on +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] DELETE /api/light/test +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: kenneth +[April 5th 2016, 9:30:10 am] PUT /api/light +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: kenneth +[April 5th 2016, 9:30:10 am] GET /api/light/yorick/on +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/light/kenneth/on +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/lights +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GPIO CHANGED: 1 +[April 5th 2016, 9:30:10 am] Turning off M - 14 +[April 5th 2016, 9:30:10 am] Turning off M - 12 +[April 5th 2016, 9:30:10 am] Turning off Y - 1 +[April 5th 2016, 9:30:10 am] GPIO CHANGED: 0 +[April 5th 2016, 9:30:10 am] GET /api/light/yorick/off +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:30:10 am] GET /api/light/yorick/on +[April 5th 2016, 9:30:10 am] Authenticating... +[April 5th 2016, 9:30:10 am] Found 1 valid users +[April 5th 2016, 9:30:10 am] Userid: MOEDER +[April 5th 2016, 9:34:58 am] Listening server on port 8080 +[April 5th 2016, 9:34:58 am] GPIO CHANGED: 1 +[April 5th 2016, 9:34:58 am] Turning off M - 14 +[April 5th 2016, 9:34:58 am] Turning off M - 12 +[April 5th 2016, 9:34:58 am] Turning off Y - 1 +[April 5th 2016, 9:34:58 am] Executing a command +[April 5th 2016, 9:34:58 am] Executing a command +[April 5th 2016, 9:34:58 am] Executing a command +[April 5th 2016, 9:34:58 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Listening server on port 8080 +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 1 +[April 5th 2016, 9:38:06 am] Turning off M - 14 +[April 5th 2016, 9:38:06 am] Turning off M - 12 +[April 5th 2016, 9:38:06 am] Turning off Y - 1 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/light/yorick/on +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/light/yorick/on +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GET /api/light/kenneth/on +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/light/hoi/on +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 1 +[April 5th 2016, 9:38:06 am] Turning off M - 14 +[April 5th 2016, 9:38:06 am] Turning off M - 12 +[April 5th 2016, 9:38:06 am] Turning off Y - 1 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 1 +[April 5th 2016, 9:38:06 am] Turning off M - 14 +[April 5th 2016, 9:38:06 am] Turning off M - 12 +[April 5th 2016, 9:38:06 am] Turning off Y - 1 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GET /api/light/kenneth/on +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: kenneth +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 1 +[April 5th 2016, 9:38:06 am] Turning off M - 14 +[April 5th 2016, 9:38:06 am] Turning off M - 12 +[April 5th 2016, 9:38:06 am] Turning off Y - 1 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] PUT /api/light +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] PUT /api/light +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] POST /api/light +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Authorization failed: Token not set +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] PUT /api/light +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] POST /api/light +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: MOEDER +[April 5th 2016, 9:38:06 am] GET /api/lights +[April 5th 2016, 9:38:06 am] Authenticating... +[April 5th 2016, 9:38:06 am] Found 1 valid users +[April 5th 2016, 9:38:06 am] Userid: kenneth +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 1 +[April 5th 2016, 9:38:06 am] Turning off M - 14 +[April 5th 2016, 9:38:06 am] Turning off M - 12 +[April 5th 2016, 9:38:06 am] Turning off K - 1 +[April 5th 2016, 9:38:06 am] Turning off G - 1337 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 1 +[April 5th 2016, 9:38:06 am] Turning off M - 14 +[April 5th 2016, 9:38:06 am] Turning off M - 12 +[April 5th 2016, 9:38:06 am] Turning off K - 1 +[April 5th 2016, 9:38:06 am] Turning off G - 1337 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 1 +[April 5th 2016, 9:38:06 am] Turning off M - 14 +[April 5th 2016, 9:38:06 am] Turning off M - 12 +[April 5th 2016, 9:38:06 am] Turning off K - 1 +[April 5th 2016, 9:38:06 am] Turning off G - 1337 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 1 +[April 5th 2016, 9:38:06 am] Turning off M - 14 +[April 5th 2016, 9:38:06 am] Turning off M - 12 +[April 5th 2016, 9:38:06 am] Turning off K - 1 +[April 5th 2016, 9:38:06 am] Turning off G - 1337 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] GPIO CHANGED: 0 +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:38:06 am] Executing a command +[April 5th 2016, 9:49:56 am] Listening server on port 8080 +[April 5th 2016, 9:49:56 am] GET /api/light/kenneth/on +[April 5th 2016, 9:49:56 am] Authenticating... +[April 5th 2016, 9:49:56 am] Found 1 valid users +[April 5th 2016, 9:49:56 am] Userid: kenneth +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] GET /api/light/kenneth/off +[April 5th 2016, 9:49:56 am] Authenticating... +[April 5th 2016, 9:49:56 am] Found 1 valid users +[April 5th 2016, 9:49:56 am] Userid: kenneth +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] GET /api/light/kenneth/on +[April 5th 2016, 9:49:56 am] Authenticating... +[April 5th 2016, 9:49:56 am] Found 1 valid users +[April 5th 2016, 9:49:56 am] Userid: kenneth +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] GET /api/light/yorick/on +[April 5th 2016, 9:49:56 am] Authenticating... +[April 5th 2016, 9:49:56 am] Found 1 valid users +[April 5th 2016, 9:49:56 am] Userid: kenneth +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] GET /api/lights +[April 5th 2016, 9:49:56 am] Authenticating... +[April 5th 2016, 9:49:56 am] Found 1 valid users +[April 5th 2016, 9:49:56 am] Userid: kenneth +[April 5th 2016, 9:49:56 am] GPIO CHANGED: 1 +[April 5th 2016, 9:49:56 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 9:49:56 am] Turning off M - 12 (sleep:1) +[April 5th 2016, 9:49:56 am] Turning off K - 1 (sleep:2) +[April 5th 2016, 9:49:56 am] Turning off G - 1337 (sleep:3) +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] GPIO CHANGED: 0 +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] GET /api/light/kenneth/on +[April 5th 2016, 9:49:56 am] Authenticating... +[April 5th 2016, 9:49:56 am] Found 1 valid users +[April 5th 2016, 9:49:56 am] Userid: kenneth +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] GET /api/light/kenneth/off +[April 5th 2016, 9:49:56 am] Authenticating... +[April 5th 2016, 9:49:56 am] Found 1 valid users +[April 5th 2016, 9:49:56 am] Userid: kenneth +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:49:56 am] GET /api/light/kenneth/on +[April 5th 2016, 9:49:56 am] Authenticating... +[April 5th 2016, 9:49:56 am] Found 1 valid users +[April 5th 2016, 9:49:56 am] Userid: kenneth +[April 5th 2016, 9:49:56 am] Executing a command +[April 5th 2016, 9:52:04 am] Listening server on port 8080 +[April 5th 2016, 9:52:04 am] GET /api/light/kenneth/on +[April 5th 2016, 9:52:04 am] Authenticating... +[April 5th 2016, 9:52:04 am] Found 1 valid users +[April 5th 2016, 9:52:04 am] Userid: kenneth +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:52:04 am] GET /api/light/yorick/on +[April 5th 2016, 9:52:04 am] Authenticating... +[April 5th 2016, 9:52:04 am] Found 1 valid users +[April 5th 2016, 9:52:04 am] Userid: kenneth +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:52:04 am] GET /api/lights +[April 5th 2016, 9:52:04 am] Authenticating... +[April 5th 2016, 9:52:04 am] Found 1 valid users +[April 5th 2016, 9:52:04 am] Userid: kenneth +[April 5th 2016, 9:52:04 am] GPIO CHANGED: 1 +[April 5th 2016, 9:52:04 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 9:52:04 am] Turning off M - 12 (sleep:2) +[April 5th 2016, 9:52:04 am] Turning off K - 1 (sleep:4) +[April 5th 2016, 9:52:04 am] Turning off G - 1337 (sleep:6) +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:52:04 am] GPIO CHANGED: 0 +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:52:04 am] GET /api/lights +[April 5th 2016, 9:52:04 am] Authenticating... +[April 5th 2016, 9:52:04 am] Found 1 valid users +[April 5th 2016, 9:52:04 am] Userid: MOEDER +[April 5th 2016, 9:52:04 am] DELETE /api/light/Daniel +[April 5th 2016, 9:52:04 am] Authenticating... +[April 5th 2016, 9:52:04 am] Found 1 valid users +[April 5th 2016, 9:52:04 am] Userid: kenneth +[April 5th 2016, 9:52:04 am] GET /api/lights +[April 5th 2016, 9:52:04 am] Authenticating... +[April 5th 2016, 9:52:04 am] Found 1 valid users +[April 5th 2016, 9:52:04 am] Userid: kenneth +[April 5th 2016, 9:52:04 am] GPIO CHANGED: 1 +[April 5th 2016, 9:52:04 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 9:52:04 am] Turning off M - 12 (sleep:2) +[April 5th 2016, 9:52:04 am] Turning off K - 1 (sleep:4) +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:52:04 am] GPIO CHANGED: 0 +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:52:04 am] Executing a command +[April 5th 2016, 9:54:21 am] Listening server on port 8080 +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GET /api/light/yorick/on +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: kenneth +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: kenneth +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 1 +[April 5th 2016, 9:54:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 9:54:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 9:54:21 am] Turning off K - 1 (sleep:6) +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 0 +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GET /api/light/kenneth/on +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: kenneth +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GET /api/light/yorick/on +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: kenneth +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 1 +[April 5th 2016, 9:54:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 9:54:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 9:54:21 am] Turning off K - 1 (sleep:6) +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 0 +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GET /api/light/yorick/on +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: kenneth +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: kenneth +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 1 +[April 5th 2016, 9:54:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 9:54:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 9:54:21 am] Turning off K - 1 (sleep:6) +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 0 +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] POST /api/light +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 1 +[April 5th 2016, 9:54:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 9:54:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 9:54:21 am] Turning off K - 1 (sleep:6) +[April 5th 2016, 9:54:21 am] Turning off T - W (sleep:9) +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 0 +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] PUT /api/light +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] PUT /api/light +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GET /api/light/yorick/off +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] GET /api/light/yorick/on +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 1 +[April 5th 2016, 9:54:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 9:54:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 9:54:21 am] Turning off K - 1 (sleep:6) +[April 5th 2016, 9:54:21 am] Turning off T - W (sleep:9) +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GPIO CHANGED: 0 +[April 5th 2016, 9:54:21 am] Executing a command +[April 5th 2016, 9:54:21 am] GET /api/lights +[April 5th 2016, 9:54:21 am] Authenticating... +[April 5th 2016, 9:54:21 am] Found 1 valid users +[April 5th 2016, 9:54:21 am] Userid: MOEDER +[April 5th 2016, 10:14:26 am] Listening server on port 8080 +[April 5th 2016, 10:14:26 am] GET /api/lights +[April 5th 2016, 10:14:26 am] Authenticating... +[April 5th 2016, 10:14:26 am] Error: SQLITE_ERROR: no such table: user + at Error (native) +--> in Database#get('SELECT COUNT(username) AS num FROM user WHERE access=\'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNT0VERVIiLCJleHAiOjE0NTk1MjUwODY4NDB9.iPqhvwNdR8we53h6wQiJ_Q-5xJbDH7PHRJhtvAJFTDA\' AND username=\'MOEDER\';', [Function]) + at /home/pi/miniproject/routes_api.js:35:10 + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at next (/home/pi/miniproject/node_modules/express/lib/router/route.js:131:13) + at Route.dispatch (/home/pi/miniproject/node_modules/express/lib/router/route.js:112:3) + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at /home/pi/miniproject/node_modules/express/lib/router/index.js:277:22 + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:349:14) + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:365:14) + at Function.process_params (/home/pi/miniproject/node_modules/express/lib/router/index.js:410:3) +[April 5th 2016, 10:14:26 am] GET /api/lights +[April 5th 2016, 10:14:26 am] Authenticating... +[April 5th 2016, 10:14:26 am] Error: SQLITE_ERROR: no such table: user + at Error (native) +--> in Database#get('SELECT COUNT(username) AS num FROM user WHERE access=\'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNT0VERVIiLCJleHAiOjE0NTk1MjUwODY4NDB9.iPqhvwNdR8we53h6wQiJ_Q-5xJbDH7PHRJhtvAJFTDA\' AND username=\'MOEDER\';', [Function]) + at /home/pi/miniproject/routes_api.js:35:10 + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at next (/home/pi/miniproject/node_modules/express/lib/router/route.js:131:13) + at Route.dispatch (/home/pi/miniproject/node_modules/express/lib/router/route.js:112:3) + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at /home/pi/miniproject/node_modules/express/lib/router/index.js:277:22 + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:349:14) + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:365:14) + at Function.process_params (/home/pi/miniproject/node_modules/express/lib/router/index.js:410:3) +[April 5th 2016, 10:16:52 am] Error: listen EADDRINUSE :::8080 + at Object.exports._errnoException (util.js:874:11) + at exports._exceptionWithHostPort (util.js:897:20) + at Server._listen2 (net.js:1234:14) + at listen (net.js:1270:10) + at Server.listen (net.js:1366:5) + at EventEmitter.listen (/home/pi/miniproject/node_modules/express/lib/application.js:617:24) + at Object. (/home/pi/miniproject/app.js:71:18) + at Module._compile (module.js:435:26) + at Object.Module._extensions..js (module.js:442:10) + at Module.load (module.js:356:32) +[April 5th 2016, 10:17:20 am] Listening server on port 8080 +[April 5th 2016, 10:17:20 am] GET /api/lights +[April 5th 2016, 10:17:20 am] Authenticating... +[April 5th 2016, 10:17:20 am] Error: SQLITE_ERROR: no such table: user + at Error (native) +--> in Database#get('SELECT COUNT(username) AS num FROM user WHERE access=\'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNT0VERVIiLCJleHAiOjE0NTk1MjUwODY4NDB9.iPqhvwNdR8we53h6wQiJ_Q-5xJbDH7PHRJhtvAJFTDA\' AND username=\'MOEDER\';', [Function]) + at /home/pi/miniproject/routes_api.js:35:10 + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at next (/home/pi/miniproject/node_modules/express/lib/router/route.js:131:13) + at Route.dispatch (/home/pi/miniproject/node_modules/express/lib/router/route.js:112:3) + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at /home/pi/miniproject/node_modules/express/lib/router/index.js:277:22 + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:349:14) + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:365:14) + at Function.process_params (/home/pi/miniproject/node_modules/express/lib/router/index.js:410:3) +[April 5th 2016, 10:18:55 am] Listening server on port 8080 +[April 5th 2016, 10:18:55 am] GET /api/lights +[April 5th 2016, 10:18:55 am] Authenticating... +[April 5th 2016, 10:18:55 am] Error: SQLITE_ERROR: no such table: user + at Error (native) +--> in Database#get('SELECT COUNT(username) AS num FROM user WHERE access=\'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNT0VERVIiLCJleHAiOjE0NTk1MjUwODY4NDB9.iPqhvwNdR8we53h6wQiJ_Q-5xJbDH7PHRJhtvAJFTDA\' AND username=\'MOEDER\';', [Function]) + at /home/pi/miniproject/routes_api.js:35:10 + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at next (/home/pi/miniproject/node_modules/express/lib/router/route.js:131:13) + at Route.dispatch (/home/pi/miniproject/node_modules/express/lib/router/route.js:112:3) + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at /home/pi/miniproject/node_modules/express/lib/router/index.js:277:22 + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:349:14) + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:365:14) + at Function.process_params (/home/pi/miniproject/node_modules/express/lib/router/index.js:410:3) +[April 5th 2016, 10:18:55 am] GET /api/lights +[April 5th 2016, 10:18:55 am] Authenticating... +[April 5th 2016, 10:18:55 am] Error: SQLITE_ERROR: no such table: user + at Error (native) +--> in Database#get('SELECT COUNT(username) AS num FROM user WHERE access=\'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNT0VERVIiLCJleHAiOjE0NTk1MjUwODY4NDB9.iPqhvwNdR8we53h6wQiJ_Q-5xJbDH7PHRJhtvAJFTDA\' AND username=\'MOEDER\';', [Function]) + at /home/pi/miniproject/routes_api.js:35:10 + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at next (/home/pi/miniproject/node_modules/express/lib/router/route.js:131:13) + at Route.dispatch (/home/pi/miniproject/node_modules/express/lib/router/route.js:112:3) + at Layer.handle [as handle_request] (/home/pi/miniproject/node_modules/express/lib/router/layer.js:95:5) + at /home/pi/miniproject/node_modules/express/lib/router/index.js:277:22 + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:349:14) + at param (/home/pi/miniproject/node_modules/express/lib/router/index.js:365:14) + at Function.process_params (/home/pi/miniproject/node_modules/express/lib/router/index.js:410:3) +[April 5th 2016, 10:20:21 am] Listening server on port 8080 +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/light/yorick/off +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GET /api/light/yorick/on +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: kenneth +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GPIO CHANGED: 1 +[April 5th 2016, 10:20:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:20:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:20:21 am] Turning off K - 1 (sleep:6) +[April 5th 2016, 10:20:21 am] Turning off T - W (sleep:9) +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GPIO CHANGED: 0 +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] PUT /api/light +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GPIO CHANGED: 1 +[April 5th 2016, 10:20:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:20:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:20:21 am] Turning off K - 1 (sleep:6) +[April 5th 2016, 10:20:21 am] Turning off T - 6 (sleep:9) +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GPIO CHANGED: 0 +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] DELETE /api/light/Test +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] DELETE /api/light/hoi +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] POST /api/light +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] POST /api/light +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] POST /api/light +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] POST /api/light +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] POST /api/light +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/lights +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/light/yorick/on +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/light/kenneth/on +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GPIO CHANGED: 1 +[April 5th 2016, 10:20:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:20:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:20:21 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:20:21 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:20:21 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:20:21 am] Turning off E - 6 (sleep:15) +[April 5th 2016, 10:20:21 am] Turning off W - 8 (sleep:18) +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GPIO CHANGED: 0 +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GET /api/light/yorick/on +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GET /api/light/yorick/on +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] DELETE /api/light/Hoer +[April 5th 2016, 10:20:21 am] Authenticating... +[April 5th 2016, 10:20:21 am] Found 1 valid users +[April 5th 2016, 10:20:21 am] Userid: MOEDER +[April 5th 2016, 10:20:21 am] GPIO CHANGED: 1 +[April 5th 2016, 10:20:21 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:20:21 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:20:21 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:20:21 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:20:21 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:20:21 am] Turning off E - 6 (sleep:15) +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:20:21 am] GPIO CHANGED: 0 +[April 5th 2016, 10:20:21 am] Executing a command +[April 5th 2016, 10:49:10 am] Listening server on port 8080 +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] GET /api/light/yorick/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] DELETE /api/light/Een +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] POST /api/register +[April 5th 2016, 10:49:10 am] POST /api/login +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:49:10 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:49:10 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:49:10 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:49:10 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:49:10 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:49:10 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:49:10 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:49:10 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:49:10 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:49:10 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] POST /api/register +[April 5th 2016, 10:49:10 am] POST /api/register +[April 5th 2016, 10:49:10 am] POST /api/login +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/yorick/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:49:10 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:49:10 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Turning off A - 4 (sleep:6) +[April 5th 2016, 10:49:10 am] Turning off B - 7 (sleep:9) +[April 5th 2016, 10:49:10 am] Turning off T - 5 (sleep:12) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] DELETE /api/light/kenneth +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] DELETE /api/light/Moeder +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] DELETE /api/light/yorick +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] DELETE /api/light/Je +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] DELETE /api/light/Is +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] POST /api/light +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/yorick/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/yorick/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/yorick/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/yorick/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] POST /api/light +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] PUT /api/light +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off Z - 32 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] PUT /api/light +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off N - 32 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] PUT /api/light +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off N - 16 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] PUT /api/light +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: kenny +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Listening server on port 8080 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET / +[April 5th 2016, 10:49:10 am] GET /favicon.ico +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET / +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/lights +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/yorick/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/on +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GET /api/light/kenneth/off +[April 5th 2016, 10:49:10 am] Authenticating... +[April 5th 2016, 10:49:10 am] Found 1 valid users +[April 5th 2016, 10:49:10 am] Userid: MOEDER +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GET / +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 1 +[April 5th 2016, 10:49:10 am] Turning off M - 14 (sleep:0) +[April 5th 2016, 10:49:10 am] Turning off M - 12 (sleep:3) +[April 5th 2016, 10:49:10 am] Executing a command +[April 5th 2016, 10:49:10 am] GPIO CHANGED: 0 diff --git a/miniproject.db b/miniproject.db index 088fbf5..dfaeda6 100644 Binary files a/miniproject.db and b/miniproject.db differ diff --git a/node_modules/gpio/.npmignore b/node_modules/gpio/.npmignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/node_modules/gpio/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/gpio/LICENSE b/node_modules/gpio/LICENSE new file mode 100644 index 0000000..289fd0e --- /dev/null +++ b/node_modules/gpio/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2012 Dominick Pham (dominick@dph.am) + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gpio/README.md b/node_modules/gpio/README.md new file mode 100644 index 0000000..54175c2 --- /dev/null +++ b/node_modules/gpio/README.md @@ -0,0 +1,155 @@ +# gpio - talk to your Raspberry Pi's gpio headers + +* demo using LED: http://www.youtube.com/watch?v=2Juo-CJ6eu4 +* demo using RC car: http://www.youtube.com/watch?v=klQdX8-YVaI + + +## Important note +I haven't maintained this project for a while now, and it's unlikely I will provide any updates going forward given other more mature gpio libraries out there. If you're looking for a reliable way to communicate with the raspberry pi in JavaScript, check out the [wiring-pi JavaScript library](https://www.npmjs.com/package/wiring-pi). It provides direct bindings to the fully-featured [Wiring Pi C library](http://wiringpi.com/). + +--- + +##Installation +##### Get node.js on your Raspberry Pi +On Raspbian, you can simply run `apt-get install nodejs`, +otherwise, [compile it](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) + +## Usage + +This library is an npm package, just define "gpio" in your package.json dependencies or +```js +npm install gpio +``` + +##### Note: you must be running as root or have the proper priviledges to access the gpio headers + +##### Standard setup + +```js +var gpio = require("gpio"); + +// Calling export with a pin number will export that header and return a gpio header instance +var gpio4 = gpio.export(4, { + // When you export a pin, the default direction is out. This allows you to set + // the pin value to either LOW or HIGH (3.3V) from your program. + direction: 'out', + + // set the time interval (ms) between each read when watching for value changes + // note: this is default to 100, setting value too low will cause high CPU usage + interval: 200, + + // Due to the asynchronous nature of exporting a header, you may not be able to + // read or write to the header right away. Place your logic in this ready + // function to guarantee everything will get fired properly + ready: function() { + } +}); +``` + +##### Header direction "in" +If you plan to set the header voltage externally, use direction `in` and read value from your program. +```js +var gpio = require("gpio"); +var gpio4 = gpio.export(4, { + direction: "in", + ready: function() { + } +}); +``` + +##### API Methods + +```js +// sets pin to high +gpio4.set(); +``` +```js +// sets pin to low (can also call gpio4.reset()) +gpio4.set(0); +``` +```js +// Since setting a value happens asynchronously, this method also takes a +// callback argument which will get fired after the value is set +gpio4.set(function() { + console.log(gpio4.value); // should log 1 +}); +gpio4.set(0, function() { + console.log(gpio4.value); // should log 0 +}); +``` +```js +// unexport program when done +gpio4.unexport(); +``` + +##### EventEmitter +This library uses node's [EventEmitter](http://nodejs.org/api/events.html) which allows you to watch +for value changes and fire a callback. +```js +// bind to the "change" event +gpio4.on("change", function(val) { + // value will report either 1 or 0 (number) when the value changes + console.log(val) +}); + +// you can bind multiple events +var processPin4 = function(val) { console.log(val); }; +gpio4.on("change", processPin4); + +// unbind a particular callback from the "change" event +gpio4.removeListener("change", processPin4); + +// unbind all callbacks from the "change" event +gpio4.removeAllListeners("change"); + +// you can also manually change the direction anytime after instantiation +gpio4.setDirection("out"); +gpio4.setDirection("in"); +``` + +## Example +##### Cycle voltage every half a second +```js +var gpio = require("gpio"); +var gpio22, gpio4, intervalTimer; + +// Flashing lights if LED connected to GPIO22 +gpio22 = gpio.export(22, { + ready: function() { + intervalTimer = setInterval(function() { + gpio22.set(); + setTimeout(function() { gpio22.reset(); }, 500); + }, 1000); + } +}); + +// Lets assume a different LED is hooked up to pin 4, the following code +// will make that LED blink inversely with LED from pin 22 +gpio4 = gpio.export(4, { + ready: function() { + // bind to gpio22's change event + gpio22.on("change", function(val) { + gpio4.set(1 - val); // set gpio4 to the opposite value + }); + } +}); + +// reset the headers and unexport after 10 seconds +setTimeout(function() { + clearInterval(intervalTimer); // stops the voltage cycling + gpio22.removeAllListeners('change'); // unbinds change event + gpio22.reset(); // sets header to low + gpio22.unexport(); // unexport the header + + gpio4.reset(); + gpio4.unexport(function() { + // unexport takes a callback which gets fired as soon as unexporting is done + process.exit(); // exits your node program + }); +}, 10000) +``` + + +##### Controlling an RC car +Source code here: https://github.com/EnotionZ/node-rc + diff --git a/node_modules/gpio/lib/gpio.js b/node_modules/gpio/lib/gpio.js new file mode 100644 index 0000000..0460836 --- /dev/null +++ b/node_modules/gpio/lib/gpio.js @@ -0,0 +1,246 @@ +var fs = require('fs'); +var util = require('util'); +var path = require('path'); +var EventEmitter = require('events').EventEmitter; +var exists = fs.exists || path.exists; + +var gpiopath = '/sys/class/gpio/'; + +var logError = function(e) { if(e) console.log(e.code, e.action, e.path); }; +var logMessage = function() { if (exports.logging) console.log.apply(console, arguments); }; + +var _write = function(str, file, fn, override) { + if(typeof fn !== "function") fn = logError; + fs.writeFile(file, str, function(err) { + if(err && !override) { + err.path = file; + err.action = 'write'; + logError(err); + } else { + if(typeof fn === "function") fn(); + } + }); +}; +var _read = function(file, fn) { + fs.readFile(file, "utf-8", function(err, data) { + if(err) { + err.path = file; + err.action = 'read'; + logError(err); + } else { + if(typeof fn === "function") fn(data); + else logMessage("value: ", data); + } + }); +}; + +var _unexport = function(number, fn) { + _write(number, gpiopath + 'unexport', function(err) { + if(err) return logError(err); + if(typeof fn === 'function') fn(); + }, 1); +}; +var _export = function(n, fn) { + if(exists(gpiopath + 'gpio'+n)) { + // already exported, unexport and export again + logMessage('Header already exported'); + _unexport(n, function() { _export(n, fn); }); + } else { + logMessage('Exporting gpio' + n); + _write(n, gpiopath + 'export', function(err) { + // if there's an error when exporting, unexport and repeat + if(err) _unexport(n, function() { _export(n, fn); }); + else if(typeof fn === 'function') fn(); + }, 1); + } +}; +var _testwrite = function(file, fn) { + fs.open(file, 'w', function(err, fd) { + if (err) { + fn(false, err); + return; + } + fs.close(fd, function(err){ + fn(true, null); + }); + }); +}; + +// fs.watch doesn't get fired because the file never +// gets 'accessed' when setting header via hardware +// manually watching value changes +var FileWatcher = function(path, interval, fn) { + if(typeof fn === 'undefined') { + fn = interval; + interval = 100; + } + if(typeof interval !== 'number') return false; + if(typeof fn !== 'function') return false; + + var value; + var readTimer = setInterval(function() { + _read(path, function(val) { + if(value !== val) { + if(typeof value !== 'undefined') fn(val); + value = val; + } + }); + }, interval); + + this.stop = function() { clearInterval(readTimer); }; +}; + + +var GPIO = function(headerNum, opts) { + opts = opts || {}; + + var self = this; + var dir = opts.direction; + var interval = opts.interval; + if(typeof interval !== 'number') interval = 100; + this.interval = interval; + + this.headerNum = headerNum; + this.value = 0; + + this.PATH = {}; + this.PATH.PIN = gpiopath + 'gpio' + headerNum + '/'; + this.PATH.VALUE = this.PATH.PIN + 'value'; + this.PATH.DIRECTION = this.PATH.PIN + 'direction'; + + this.export(function() { + var onSuccess = function() { + self.setDirection(dir, function () { + if(typeof opts.ready === 'function') opts.ready.call(self); + }); + }; + var attempts = 0; + var makeAttempt = function() { + attempts += 1; + _testwrite(self.PATH.DIRECTION, function(success, err){ + if (success) { + onSuccess(); + } else { + logMessage('Could not write to pin: ' + err.code); + if (attempts <= 5) { + logMessage('Trying again in 100ms'); + setTimeout(makeAttempt, 100); + } else { + logMessage('Failed to access pin after 5 attempts. Giving up.'); + } + } + }); + }; + makeAttempt(); + }); +}; + +util.inherits(GPIO, EventEmitter); + + +/** + * Export and unexport gpio#, takes callback which fires when operation is completed + */ +GPIO.prototype.export = function(fn) { _export(this.headerNum, fn); }; +GPIO.prototype.unexport = function(fn) { + if(this.valueWatcher) this.valueWatcher.stop(); + _unexport(this.headerNum, fn); +}; + + +/** + * Sets direction, default is "out" + */ +GPIO.prototype.setDirection = function(dir, fn) { + var self = this, path = this.PATH.DIRECTION; + if(typeof dir !== "string" || dir !== "in") dir = "out"; + this.direction = dir; + + logMessage('Setting direction "' + dir + '" on gpio' + this.headerNum); + + function watch () { + if(dir === 'in') { + if (!self.valueWatcher) { + // watch for value changes only for direction "in" + // since we manually trigger event for "out" direction when setting value + self.valueWatcher = new FileWatcher(self.PATH.VALUE, self.interval, function(val) { + val = parseInt(val, 10); + self.value = val; + self.emit("valueChange", val); + self.emit("change", val); + }); + } + } else { + // if direction is "out", try to clear the valueWatcher + if(self.valueWatcher) { + self.valueWatcher.stop(); + self.valueWatcher = null; + } + } + } + _read(path, function(currDir) { + var changedDirection = false; + if(currDir.indexOf(dir) !== -1) { + logMessage('Current direction is already ' + dir); + logMessage('Attempting to set direction anyway.'); + } else { + changedDirection = true; + } + _write(dir, path, function() { + watch(); + + if(typeof fn === 'function') fn(); + if (changedDirection) { + self.emit('directionChange', dir); + } + }, 1); + + }); +}; + +/** + * Internal getter, stores value + */ +GPIO.prototype._get = function(fn) { + var self = this, currVal = this.value; + + if(this.direction === 'out') return currVal; + + _read(this.PATH.VALUE, function(val) { + val = parseInt(val, 10); + if(val !== currVal) { + self.value = val; + if(typeof fn === "function") fn.call(this, self.value); + } + }); +}; + +/** + * Sets the value. If v is specified as 0 or '0', reset will be called + */ +GPIO.prototype.set = function(v, fn) { + var self = this; + var callback = typeof v === 'function' ? v : fn; + if(typeof v !== "number" || v !== 0) v = 1; + + // if direction is out, just emit change event since we can reliably predict + // if the value has changed; we don't have to rely on watching a file + if(this.direction === 'out') { + if(this.value !== v) { + _write(v, this.PATH.VALUE, function() { + self.value = v; + self.emit('valueChange', v); + self.emit('change', v); + if(typeof callback === 'function') callback(self.value, true); + }); + } else { + if(typeof callback === 'function') callback(this.value, false); + } + } +}; +GPIO.prototype.reset = function(fn) { this.set(0, fn); }; + +exports.logging = false; +exports.export = function(headerNum, direction) { return new GPIO(headerNum, direction); }; +exports.unexport = _unexport; + diff --git a/node_modules/gpio/package.json b/node_modules/gpio/package.json new file mode 100644 index 0000000..46c2798 --- /dev/null +++ b/node_modules/gpio/package.json @@ -0,0 +1,56 @@ +{ + "name": "gpio", + "version": "0.2.7", + "author": { + "name": "Dominick Pham", + "email": "dominick@dph.am", + "url": "http://dph.am" + }, + "description": "Talk to your Raspberry PI's general purpose inputs and outputs", + "keywords": [ + "gpio", + "raspberry", + "pi" + ], + "main": "./lib/gpio.js", + "repository": { + "type": "git", + "url": "git://github.com/EnotionZ/GpiO.git" + }, + "devDependencies": { + "sinon": "*" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://raw.github.com/EnotionZ/GpiO/master/LICENSE" + } + ], + "gitHead": "a8e3f5c72df067462b25343918af2718712cda17", + "bugs": { + "url": "https://github.com/EnotionZ/GpiO/issues" + }, + "homepage": "https://github.com/EnotionZ/GpiO", + "_id": "gpio@0.2.7", + "scripts": {}, + "_shasum": "bf386c88961efd0a4f6a0ff7167ac0ff3997eab9", + "_from": "gpio@*", + "_npmVersion": "2.5.1", + "_nodeVersion": "1.2.0", + "_npmUser": { + "name": "dph", + "email": "dominick@dph.am" + }, + "maintainers": [ + { + "name": "dph", + "email": "dominick@dph.am" + } + ], + "dist": { + "shasum": "bf386c88961efd0a4f6a0ff7167ac0ff3997eab9", + "tarball": "https://registry.npmjs.org/gpio/-/gpio-0.2.7.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/gpio/-/gpio-0.2.7.tgz" +} diff --git a/node_modules/gpio/test/tests.js b/node_modules/gpio/test/tests.js new file mode 100644 index 0000000..4d3b02d --- /dev/null +++ b/node_modules/gpio/test/tests.js @@ -0,0 +1,135 @@ +var fs = require('fs'); +var assert = require('assert'); +var sinon = require('sinon'); +var gpio = require('../lib/gpio'); + +function read(file, fn) { + fs.readFile(file, "utf-8", function(err, data) { + if(!err && typeof fn === "function") fn(data); + }); +} + +// remove whitespace +function rmws(str) { + return str.replace(/\s+/g, ''); +} + +describe('GPIO', function() { + + var gpio4; + + before(function(done) { + gpio4 = gpio.export(4, { + direction: 'out', + ready: done + }); + }); + + after(function() { + gpio4.unexport(); + }); + + describe('Header Direction Out', function() { + + describe('initializing', function() { + it('should open specified header', function(done) { + read('/sys/class/gpio/gpio4/direction', function(val) { + assert.equal(rmws(val), 'out'); + done(); + }); + }); + }); + + describe('#set', function() { + it('should set header value to high', function(done) { + gpio4.set(function() { + read('/sys/class/gpio/gpio4/value', function(val) { + assert.equal(rmws(val), '1'); + done(); + }); + }); + }); + }); + + describe('#reset', function() { + it('should set header value to low', function(done) { + gpio4.reset(function() { + read('/sys/class/gpio/gpio4/value', function(val) { + assert.equal(rmws(val), '0'); + done(); + }); + }); + }); + }); + + describe('#on :change', function() { + it('should fire callback when value changes', function(done) { + var callback = sinon.spy(); + gpio4.on('change', callback); + + // set, then reset + gpio4.set(function() { gpio4.reset(); }); + + // set and reset is async, wait some time before running assertions + setTimeout(function() { + assert.ok(callback.calledTwice); + done(); + gpio4.removeListener('change', callback); + }, 10); + }); + }); + }); + + // For these tests, make sure header 4 is connected to header 25 + // header 25 is exported with direction "out" and header 4 is used + // to simulate a hardware interrupt + describe('Header Direction In', function() { + + var gpio25; + + before(function(done) { + gpio25 = gpio.export(25, { + direction: 'in', + ready: done + }); + }); + after(function() { + gpio25.unexport(); + }); + + describe('#on :change', function() { + it('should respond to hardware set', function(done) { + var callback = sinon.spy(); + gpio25.on('change', callback); + + // wait a little before setting + setTimeout(function() { gpio4.set(); }, 500); + + // filewatcher has default interval of 100ms + setTimeout(function() { + assert.equal(gpio25.value, 1); + assert.ok(callback.calledOnce); + gpio25.removeListener('change', callback); + done(); + }, 600); + }); + + it('should respond to hardware reset', function(done) { + var callback = sinon.spy(); + gpio25.on('change', callback); + + // wait a little before setting + setTimeout(function() { gpio4.reset(); }, 500); + + // filewatcher has default interval of 100ms + setTimeout(function() { + assert.equal(gpio25.value, 0); + assert.ok(callback.calledOnce); + gpio25.removeListener('change', callback); + done(); + }, 600); + }); + }); + }); + +}); diff --git a/node_modules/sleep/.npmignore b/node_modules/sleep/.npmignore new file mode 100644 index 0000000..e3fbd98 --- /dev/null +++ b/node_modules/sleep/.npmignore @@ -0,0 +1,2 @@ +build +node_modules diff --git a/node_modules/sleep/LICENSE.txt b/node_modules/sleep/LICENSE.txt new file mode 100644 index 0000000..44fadf2 --- /dev/null +++ b/node_modules/sleep/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Erik Dubbelboer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/sleep/README.md b/node_modules/sleep/README.md new file mode 100644 index 0000000..b49c952 --- /dev/null +++ b/node_modules/sleep/README.md @@ -0,0 +1,20 @@ +sleep +===== + +Add [`sleep()`][1] and [`usleep()`][2] to Node.js, via a C++ binding. + +This is mainly useful for debugging. + +**These calls will block execution of all JavaScript by halting Node.js' event loop!** + +Usage +----- + + var sleep = require('sleep'); + +* `sleep.sleep(n)`: sleep for `n` seconds +* `sleep.usleep(n)`: sleep for `n` microseconds (1 second is 1000000 microseconds) + + +[1]: http://linux.die.net/man/3/sleep +[2]: http://linux.die.net/man/3/usleep diff --git a/node_modules/sleep/binding.gyp b/node_modules/sleep/binding.gyp new file mode 100644 index 0000000..2b9b2d0 --- /dev/null +++ b/node_modules/sleep/binding.gyp @@ -0,0 +1,11 @@ +{ + 'targets': [ + { + 'target_name': 'node_sleep', + 'sources': [ + 'sleep.cc', + ], + "include_dirs": ["> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = rm -rf "$@" && cp -af "$<" "$@" + +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) + +# We support two kinds of shared objects (.so): +# 1) shared_library, which is just bundling together many dependent libraries +# into a link line. +# 2) loadable_module, which is generating a module intended for dlopen(). +# +# They differ only slightly: +# In the former case, we want to package all dependent code into the .so. +# In the latter case, we want to package just the API exposed by the +# outermost module. +# This means shared_library uses --whole-archive, while loadable_module doesn't. +# (Note that --whole-archive is incompatible with the --start-group used in +# normal linking.) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 1,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,node_sleep.target.mk)))),) + include node_sleep.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/pi/miniproject/node_modules/sleep/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/pi/.node-gyp/4.2.1/include/node/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/pi/.node-gyp/4.2.1" "-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=node.lib" "-Dmodule_root_dir=/home/pi/miniproject/node_modules/sleep" binding.gyp +Makefile: $(srcdir)/../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../.node-gyp/4.2.1/include/node/common.gypi + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/node_modules/sleep/build/Release/.deps/Release/node_sleep.node.d b/node_modules/sleep/build/Release/.deps/Release/node_sleep.node.d new file mode 100644 index 0000000..939cfb3 --- /dev/null +++ b/node_modules/sleep/build/Release/.deps/Release/node_sleep.node.d @@ -0,0 +1 @@ +cmd_Release/node_sleep.node := rm -rf "Release/node_sleep.node" && cp -af "Release/obj.target/node_sleep.node" "Release/node_sleep.node" diff --git a/node_modules/sleep/build/Release/.deps/Release/obj.target/node_sleep.node.d b/node_modules/sleep/build/Release/.deps/Release/obj.target/node_sleep.node.d new file mode 100644 index 0000000..f571949 --- /dev/null +++ b/node_modules/sleep/build/Release/.deps/Release/obj.target/node_sleep.node.d @@ -0,0 +1 @@ +cmd_Release/obj.target/node_sleep.node := g++ -shared -pthread -rdynamic -Wl,-soname=node_sleep.node -o Release/obj.target/node_sleep.node -Wl,--start-group Release/obj.target/node_sleep/sleep.o -Wl,--end-group diff --git a/node_modules/sleep/build/Release/.deps/Release/obj.target/node_sleep/sleep.o.d b/node_modules/sleep/build/Release/.deps/Release/obj.target/node_sleep/sleep.o.d new file mode 100644 index 0000000..d1388d0 --- /dev/null +++ b/node_modules/sleep/build/Release/.deps/Release/obj.target/node_sleep/sleep.o.d @@ -0,0 +1,56 @@ +cmd_Release/obj.target/node_sleep/sleep.o := g++ '-DNODE_GYP_MODULE_NAME=node_sleep' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/pi/.node-gyp/4.2.1/include/node -I/home/pi/.node-gyp/4.2.1/src -I/home/pi/.node-gyp/4.2.1/deps/uv/include -I/home/pi/.node-gyp/4.2.1/deps/v8/include -I../node_modules/nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF ./Release/.deps/Release/obj.target/node_sleep/sleep.o.d.raw -c -o Release/obj.target/node_sleep/sleep.o ../sleep.cc +Release/obj.target/node_sleep/sleep.o: ../sleep.cc \ + ../node_modules/nan/nan.h \ + /home/pi/.node-gyp/4.2.1/include/node/node_version.h \ + /home/pi/.node-gyp/4.2.1/include/node/uv.h \ + /home/pi/.node-gyp/4.2.1/include/node/uv-errno.h \ + /home/pi/.node-gyp/4.2.1/include/node/uv-version.h \ + /home/pi/.node-gyp/4.2.1/include/node/uv-unix.h \ + /home/pi/.node-gyp/4.2.1/include/node/uv-threadpool.h \ + /home/pi/.node-gyp/4.2.1/include/node/uv-linux.h \ + /home/pi/.node-gyp/4.2.1/include/node/node.h \ + /home/pi/.node-gyp/4.2.1/include/node/v8.h \ + /home/pi/.node-gyp/4.2.1/include/node/v8-version.h \ + /home/pi/.node-gyp/4.2.1/include/node/v8config.h \ + /home/pi/.node-gyp/4.2.1/include/node/node_version.h \ + /home/pi/.node-gyp/4.2.1/include/node/node_buffer.h \ + /home/pi/.node-gyp/4.2.1/include/node/node.h \ + /home/pi/.node-gyp/4.2.1/include/node/node_object_wrap.h \ + ../node_modules/nan/nan_callbacks.h \ + ../node_modules/nan/nan_callbacks_12_inl.h \ + ../node_modules/nan/nan_maybe_43_inl.h \ + ../node_modules/nan/nan_converters.h \ + ../node_modules/nan/nan_converters_43_inl.h \ + ../node_modules/nan/nan_new.h \ + ../node_modules/nan/nan_implementation_12_inl.h \ + ../node_modules/nan/nan_persistent_12_inl.h \ + ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h \ + ../node_modules/nan/nan_typedarray_contents.h +../sleep.cc: +../node_modules/nan/nan.h: +/home/pi/.node-gyp/4.2.1/include/node/node_version.h: +/home/pi/.node-gyp/4.2.1/include/node/uv.h: +/home/pi/.node-gyp/4.2.1/include/node/uv-errno.h: +/home/pi/.node-gyp/4.2.1/include/node/uv-version.h: +/home/pi/.node-gyp/4.2.1/include/node/uv-unix.h: +/home/pi/.node-gyp/4.2.1/include/node/uv-threadpool.h: +/home/pi/.node-gyp/4.2.1/include/node/uv-linux.h: +/home/pi/.node-gyp/4.2.1/include/node/node.h: +/home/pi/.node-gyp/4.2.1/include/node/v8.h: +/home/pi/.node-gyp/4.2.1/include/node/v8-version.h: +/home/pi/.node-gyp/4.2.1/include/node/v8config.h: +/home/pi/.node-gyp/4.2.1/include/node/node_version.h: +/home/pi/.node-gyp/4.2.1/include/node/node_buffer.h: +/home/pi/.node-gyp/4.2.1/include/node/node.h: +/home/pi/.node-gyp/4.2.1/include/node/node_object_wrap.h: +../node_modules/nan/nan_callbacks.h: +../node_modules/nan/nan_callbacks_12_inl.h: +../node_modules/nan/nan_maybe_43_inl.h: +../node_modules/nan/nan_converters.h: +../node_modules/nan/nan_converters_43_inl.h: +../node_modules/nan/nan_new.h: +../node_modules/nan/nan_implementation_12_inl.h: +../node_modules/nan/nan_persistent_12_inl.h: +../node_modules/nan/nan_weak.h: +../node_modules/nan/nan_object_wrap.h: +../node_modules/nan/nan_typedarray_contents.h: diff --git a/node_modules/sleep/build/Release/node_sleep.node b/node_modules/sleep/build/Release/node_sleep.node new file mode 100755 index 0000000..b011adf Binary files /dev/null and b/node_modules/sleep/build/Release/node_sleep.node differ diff --git a/node_modules/sleep/build/Release/obj.target/node_sleep.node b/node_modules/sleep/build/Release/obj.target/node_sleep.node new file mode 100755 index 0000000..b011adf Binary files /dev/null and b/node_modules/sleep/build/Release/obj.target/node_sleep.node differ diff --git a/node_modules/sleep/build/Release/obj.target/node_sleep/sleep.o b/node_modules/sleep/build/Release/obj.target/node_sleep/sleep.o new file mode 100644 index 0000000..2a51358 Binary files /dev/null and b/node_modules/sleep/build/Release/obj.target/node_sleep/sleep.o differ diff --git a/node_modules/sleep/build/binding.Makefile b/node_modules/sleep/build/binding.Makefile new file mode 100644 index 0000000..d8c55ce --- /dev/null +++ b/node_modules/sleep/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) node_sleep diff --git a/node_modules/sleep/build/config.gypi b/node_modules/sleep/build/config.gypi new file mode 100644 index 0000000..1819d5e --- /dev/null +++ b/node_modules/sleep/build/config.gypi @@ -0,0 +1,135 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "arm_float_abi": "hard", + "arm_fpu": "vfpv2", + "arm_thumb": 0, + "arm_version": "6", + "asan": 0, + "gas_version": "2.25", + "host_arch": "arm", + "icu_small": "false", + "node_byteorder": "little", + "node_install_npm": "true", + "node_prefix": "/usr/local", + "node_release_urlbase": "", + "node_shared_http_parser": "false", + "node_shared_libuv": "false", + "node_shared_openssl": "false", + "node_shared_zlib": "false", + "node_tag": "", + "node_use_dtrace": "false", + "node_use_etw": "false", + "node_use_lttng": "false", + "node_use_openssl": "true", + "node_use_perfctr": "false", + "openssl_fips": "", + "openssl_no_asm": 0, + "python": "/usr/bin/python", + "target_arch": "arm", + "uv_parent_path": "/deps/uv/", + "uv_use_dtrace": "false", + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 0, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 0, + "v8_random_seed": 0, + "v8_use_snapshot": 1, + "want_separate_host_toolset": 0, + "nodedir": "/home/pi/.node-gyp/4.2.1", + "copy_dev_lib": "true", + "standalone_static_library": 1, + "cache_lock_stale": "60000", + "sign_git_tag": "", + "user_agent": "npm/2.14.7 node/v4.2.1 linux arm", + "always_auth": "", + "bin_links": "true", + "key": "", + "description": "true", + "fetch_retries": "2", + "heading": "npm", + "if_present": "", + "init_version": "1.0.0", + "user": "", + "force": "", + "cache_min": "10", + "init_license": "ISC", + "editor": "vi", + "rollback": "true", + "tag_version_prefix": "v", + "cache_max": "Infinity", + "userconfig": "/home/pi/.npmrc", + "engine_strict": "", + "init_author_name": "", + "init_author_url": "", + "tmp": "/tmp", + "depth": "Infinity", + "save_dev": "", + "usage": "", + "cafile": "", + "https_proxy": "", + "onload_script": "", + "rebuild_bundle": "true", + "save_bundle": "", + "shell": "/bin/bash", + "prefix": "/usr/local", + "browser": "", + "cache_lock_wait": "10000", + "registry": "https://registry.npmjs.org/", + "save_optional": "", + "scope": "", + "searchopts": "", + "versions": "", + "cache": "/home/pi/.npm", + "ignore_scripts": "", + "searchsort": "name", + "version": "", + "local_address": "", + "viewer": "man", + "color": "true", + "fetch_retry_mintimeout": "10000", + "umask": "0022", + "fetch_retry_maxtimeout": "60000", + "message": "%s", + "ca": "", + "cert": "", + "global": "", + "link": "", + "access": "", + "save": "", + "unicode": "true", + "long": "", + "production": "", + "unsafe_perm": "true", + "node_version": "4.2.1", + "tag": "latest", + "git_tag_version": "true", + "shrinkwrap": "true", + "fetch_retry_factor": "10", + "npat": "", + "proprietary_attribs": "true", + "save_exact": "", + "strict_ssl": "true", + "dev": "", + "globalconfig": "/usr/local/etc/npmrc", + "init_module": "/home/pi/.npm-init.js", + "parseable": "", + "globalignorefile": "/usr/local/etc/npmignore", + "cache_lock_retries": "10", + "save_prefix": "^", + "group": "1000", + "init_author_email": "", + "searchexclude": "", + "git": "git", + "optional": "true", + "json": "", + "spin": "true" + } +} diff --git a/node_modules/sleep/build/node_sleep.target.mk b/node_modules/sleep/build/node_sleep.target.mk new file mode 100644 index 0000000..270d6f4 --- /dev/null +++ b/node_modules/sleep/build/node_sleep.target.mk @@ -0,0 +1,134 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := node_sleep +DEFS_Debug := \ + '-DNODE_GYP_MODULE_NAME=node_sleep' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' \ + '-DDEBUG' \ + '-D_DEBUG' + +# Flags passed to all source files. +CFLAGS_Debug := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -g \ + -O0 + +# Flags passed to only C files. +CFLAGS_C_Debug := + +# Flags passed to only C++ files. +CFLAGS_CC_Debug := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++0x + +INCS_Debug := \ + -I/home/pi/.node-gyp/4.2.1/include/node \ + -I/home/pi/.node-gyp/4.2.1/src \ + -I/home/pi/.node-gyp/4.2.1/deps/uv/include \ + -I/home/pi/.node-gyp/4.2.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +DEFS_Release := \ + '-DNODE_GYP_MODULE_NAME=node_sleep' \ + '-D_LARGEFILE_SOURCE' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DBUILDING_NODE_EXTENSION' + +# Flags passed to all source files. +CFLAGS_Release := \ + -fPIC \ + -pthread \ + -Wall \ + -Wextra \ + -Wno-unused-parameter \ + -O3 \ + -ffunction-sections \ + -fdata-sections \ + -fno-omit-frame-pointer + +# Flags passed to only C files. +CFLAGS_C_Release := + +# Flags passed to only C++ files. +CFLAGS_CC_Release := \ + -fno-rtti \ + -fno-exceptions \ + -std=gnu++0x + +INCS_Release := \ + -I/home/pi/.node-gyp/4.2.1/include/node \ + -I/home/pi/.node-gyp/4.2.1/src \ + -I/home/pi/.node-gyp/4.2.1/deps/uv/include \ + -I/home/pi/.node-gyp/4.2.1/deps/v8/include \ + -I$(srcdir)/node_modules/nan + +OBJS := \ + $(obj).target/$(TARGET)/sleep.o + +# Add to the list of files we specially track dependencies for. +all_deps += $(OBJS) + +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual. +$(OBJS): TOOLSET := $(TOOLSET) +$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) +$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) + +# Suffix rules, putting all outputs into $(obj). + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# Try building from generated source, too. + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) + +# End of this set of suffix rules +### Rules for final target. +LDFLAGS_Debug := \ + -pthread \ + -rdynamic + +LDFLAGS_Release := \ + -pthread \ + -rdynamic + +LIBS := + +$(obj).target/node_sleep.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) +$(obj).target/node_sleep.node: LIBS := $(LIBS) +$(obj).target/node_sleep.node: TOOLSET := $(TOOLSET) +$(obj).target/node_sleep.node: $(OBJS) FORCE_DO_CMD + $(call do_cmd,solink_module) + +all_deps += $(obj).target/node_sleep.node +# Add target alias +.PHONY: node_sleep +node_sleep: $(builddir)/node_sleep.node + +# Copy this to the executable output path. +$(builddir)/node_sleep.node: TOOLSET := $(TOOLSET) +$(builddir)/node_sleep.node: $(obj).target/node_sleep.node FORCE_DO_CMD + $(call do_cmd,copy) + +all_deps += $(builddir)/node_sleep.node +# Short alias for building this executable. +.PHONY: node_sleep.node +node_sleep.node: $(obj).target/node_sleep.node $(builddir)/node_sleep.node + +# Add executable to "all" target. +.PHONY: all +all: $(builddir)/node_sleep.node + diff --git a/node_modules/sleep/index.js b/node_modules/sleep/index.js new file mode 100644 index 0000000..5ba6486 --- /dev/null +++ b/node_modules/sleep/index.js @@ -0,0 +1,25 @@ + +try { + module.exports = require('./build/Release/node_sleep.node'); +} catch (e) { + console.error('sleep: using busy loop fallback'); + + module.exports = { + sleep: function(s) { + var e = new Date().getTime() + (s * 1000); + + while (new Date().getTime() <= e) { + ; + } + }, + + usleep: function(s) { + var e = new Date().getTime() + (s / 1000); + + while (new Date().getTime() <= e) { + ; + } + } + }; +} + diff --git a/node_modules/sleep/node_modules/nan/.dntrc b/node_modules/sleep/node_modules/nan/.dntrc new file mode 100644 index 0000000..47971da --- /dev/null +++ b/node_modules/sleep/node_modules/nan/.dntrc @@ -0,0 +1,30 @@ +## DNT config file +## see https://github.com/rvagg/dnt + +NODE_VERSIONS="\ + master \ + v0.11.13 \ + v0.10.30 \ + v0.10.29 \ + v0.10.28 \ + v0.10.26 \ + v0.10.25 \ + v0.10.24 \ + v0.10.23 \ + v0.10.22 \ + v0.10.21 \ + v0.10.20 \ + v0.10.19 \ + v0.8.28 \ + v0.8.27 \ + v0.8.26 \ + v0.8.24 \ +" +OUTPUT_PREFIX="nan-" +TEST_CMD=" \ + cd /dnt/ && \ + npm install && \ + node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ + node_modules/.bin/tap --gc test/js/*-test.js \ +" + diff --git a/node_modules/sleep/node_modules/nan/CHANGELOG.md b/node_modules/sleep/node_modules/nan/CHANGELOG.md new file mode 100644 index 0000000..ebefd8b --- /dev/null +++ b/node_modules/sleep/node_modules/nan/CHANGELOG.md @@ -0,0 +1,396 @@ +# NAN ChangeLog + +**Version 2.2.1: current Node 5.9.1, Node 12: 0.12.12, Node 10: 0.10.43, iojs: 3.3.1** + +### 2.2.1 Mar 29 2016 + + - Bugfix: Use NewFromUnsigned in ReturnValue::Set(uint32_t i) for pre_12 3a18f9bdce29826e0e4c217854bc476918241a58 + - Performance: Remove unneeeded nullptr checks b715ef44887931c94f0d1605b3b1a4156eebece9 + +### 2.2.0 Jan 9 2016 + + - Feature: Add Function::Call wrapper 4c157474dacf284d125c324177b45aa5dabc08c6 + - Feature: Rename GC*logueCallback to GCCallback for > 4.0 3603435109f981606d300eb88004ca101283acec + - Bugfix: Fix Global::Pass for old versions 367e82a60fbaa52716232cc89db1cc3f685d77d9 + - Bugfix: Remove weird MaybeLocal wrapping of what already is a MaybeLocal 23b4590db10c2ba66aee2338aebe9751c4cb190b + +### 2.1.0 Oct 8 2015 + + - Deprecation: Deprecate NanErrnoException in favor of ErrnoException 0af1ca4cf8b3f0f65ed31bc63a663ab3319da55c + - Feature: added helper class for accessing contents of typedarrays 17b51294c801e534479d5463697a73462d0ca555 + - Feature: [Maybe types] Add MakeMaybe(...) 48d7b53d9702b0c7a060e69ea10fea8fb48d814d + - Feature: new: allow utf16 string with length 66ac6e65c8ab9394ef588adfc59131b3b9d8347b + - Feature: Introduce SetCallHandler and SetCallAsFunctionHandler 7764a9a115d60ba10dc24d86feb0fbc9b4f75537 + - Bugfix: Enable creating Locals from Globals under Node 0.10. 9bf9b8b190821af889790fdc18ace57257e4f9ff + - Bugfix: Fix issue #462 where PropertyCallbackInfo data is not stored safely. 55f50adedd543098526c7b9f4fffd607d3f9861f + +### 2.0.9 Sep 8 2015 + + - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 + +### 2.0.8 Aug 28 2015 + + - Work around duplicate linking bug in clang 11902da + +### 2.0.7 Aug 26 2015 + + - Build: Repackage + +### 2.0.6 Aug 26 2015 + + - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 + - Bugfix: Remove unused static std::map instances 525bddc + - Bugfix: Make better use of maybe versions of APIs bfba85b + - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d + +### 2.0.5 Aug 10 2015 + + - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 + - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d + +### 2.0.4 Aug 6 2015 + + - Build: Repackage + +### 2.0.3 Aug 6 2015 + + - Bugfix: Don't use clang++ / g++ syntax extension. 231450e + +### 2.0.2 Aug 6 2015 + + - Build: Repackage + +### 2.0.1 Aug 6 2015 + + - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 + - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 + - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f + - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed + +### 2.0.0 Jul 31 2015 + + - Change: Renamed identifiers with leading underscores b5932b4 + - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 + - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 + - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 + - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 + - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d + - Change: Remove Nan prefix from all names 72d1f67 + - Change: Update Buffer API for new upstream changes d5d3291 + - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a + - Change: Get rid of Handles e6c0daf + - Feature: Support io.js 3 with V8 4.4 + - Feature: Introduce NanPersistent 7fed696 + - Feature: Introduce NanGlobal 4408da1 + - Feature: Added NanTryCatch 10f1ca4 + - Feature: Update for V8 v4.3 4b6404a + - Feature: Introduce NanNewOneByteString c543d32 + - Feature: Introduce namespace Nan 67ed1b1 + - Removal: Remove NanLocker and NanUnlocker dd6e401 + - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 + - Removal: Remove NanReturn* macros d90a25c + - Removal: Remove HasInstance e8f84fe + + +### 1.9.0 Jul 31 2015 + + - Feature: Added `NanFatalException` 81d4a2c + - Feature: Added more error types 4265f06 + - Feature: Added dereference and function call operators to NanCallback c4b2ed0 + - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c + - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 + - Feature: Added NanErrnoException dd87d9e + - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 + - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c + - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b + +### 1.8.4 Apr 26 2015 + + - Build: Repackage + +### 1.8.3 Apr 26 2015 + + - Bugfix: Include missing header 1af8648 + +### 1.8.2 Apr 23 2015 + + - Build: Repackage + +### 1.8.1 Apr 23 2015 + + - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 + +### 1.8.0 Apr 23 2015 + + - Feature: Allow primitives with NanReturnValue 2e4475e + - Feature: Added comparison operators to NanCallback 55b075e + - Feature: Backport thread local storage 15bb7fa + - Removal: Remove support for signatures with arguments 8a2069d + - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 + +### 1.7.0 Feb 28 2015 + + - Feature: Made NanCallback::Call accept optional target 8d54da7 + - Feature: Support atom-shell 0.21 0b7f1bb + +### 1.6.2 Feb 6 2015 + + - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 + +### 1.6.1 Jan 23 2015 + + - Build: version bump + +### 1.5.3 Jan 23 2015 + + - Build: repackage + +### 1.6.0 Jan 23 2015 + + - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af + - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 + - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 + +### 1.5.2 Jan 23 2015 + + - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 + - Bugfix: Readded missing String constructors 18d828f + - Bugfix: Add overload handling NanNew(..) 5ef813b + - Bugfix: Fix uv_work_cb versioning 997e4ae + - Bugfix: Add function factory and test 4eca89c + - Bugfix: Add object template factory and test cdcb951 + - Correctness: Lifted an io.js related typedef c9490be + - Correctness: Make explicit downcasts of String lengths 00074e6 + - Windows: Limit the scope of disabled warning C4530 83d7deb + +### 1.5.1 Jan 15 2015 + + - Build: version bump + +### 1.4.3 Jan 15 2015 + + - Build: version bump + +### 1.4.2 Jan 15 2015 + + - Feature: Support io.js 0dbc5e8 + +### 1.5.0 Jan 14 2015 + + - Feature: Support io.js b003843 + - Correctness: Improved NanNew internals 9cd4f6a + - Feature: Implement progress to NanAsyncWorker 8d6a160 + +### 1.4.1 Nov 8 2014 + + - Bugfix: Handle DEBUG definition correctly + - Bugfix: Accept int as Boolean + +### 1.4.0 Nov 1 2014 + + - Feature: Added NAN_GC_CALLBACK 6a5c245 + - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 + - Correctness: Added constness to references in NanHasInstance 02c61cd + - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 + - Windoze: Shut Visual Studio up when compiling 8d558c1 + - License: Switch to plain MIT from custom hacked MIT license 11de983 + - Build: Added test target to Makefile e232e46 + - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 + - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 + - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 + +### 1.3.0 Aug 2 2014 + + - Added NanNew(std::string) + - Added NanNew(std::string&) + - Added NanAsciiString helper class + - Added NanUtf8String helper class + - Added NanUcs2String helper class + - Deprecated NanRawString() + - Deprecated NanCString() + - Added NanGetIsolateData(v8::Isolate *isolate) + - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) + - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) + - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + +### 1.2.0 Jun 5 2014 + + - Add NanSetPrototypeTemplate + - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, + introduced _NanWeakCallbackDispatcher + - Removed -Wno-unused-local-typedefs from test builds + - Made test builds Windows compatible ('Sleep()') + +### 1.1.2 May 28 2014 + + - Release to fix more stuff-ups in 1.1.1 + +### 1.1.1 May 28 2014 + + - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 + +### 1.1.0 May 25 2014 + + - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead + - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), + (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, + v8::String::ExternalAsciiStringResource* + - Deprecate NanSymbol() + - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker + +### 1.0.0 May 4 2014 + + - Heavy API changes for V8 3.25 / Node 0.11.13 + - Use cpplint.py + - Removed NanInitPersistent + - Removed NanPersistentToLocal + - Removed NanFromV8String + - Removed NanMakeWeak + - Removed NanNewLocal + - Removed NAN_WEAK_CALLBACK_OBJECT + - Removed NAN_WEAK_CALLBACK_DATA + - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions + - Introduce NanUndefined, NanNull, NanTrue and NanFalse + - Introduce NanEscapableScope and NanEscapeScope + - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) + - Introduce NanMakeCallback for node::MakeCallback + - Introduce NanSetTemplate + - Introduce NanGetCurrentContext + - Introduce NanCompileScript and NanRunScript + - Introduce NanAdjustExternalMemory + - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback + - Introduce NanGetHeapStatistics + - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() + +### 0.8.0 Jan 9 2014 + + - NanDispose -> NanDisposePersistent, deprecate NanDispose + - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() + +### 0.7.1 Jan 9 2014 + + - Fixes to work against debug builds of Node + - Safer NanPersistentToLocal (avoid reinterpret_cast) + - Speed up common NanRawString case by only extracting flattened string when necessary + +### 0.7.0 Dec 17 2013 + + - New no-arg form of NanCallback() constructor. + - NanCallback#Call takes Handle rather than Local + - Removed deprecated NanCallback#Run method, use NanCallback#Call instead + - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS + - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() + - Introduce NanRawString() for char* (or appropriate void*) from v8::String + (replacement for NanFromV8String) + - Introduce NanCString() for null-terminated char* from v8::String + +### 0.6.0 Nov 21 2013 + + - Introduce NanNewLocal(v8::Handle value) for use in place of + v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 + +### 0.5.2 Nov 16 2013 + + - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public + +### 0.5.1 Nov 12 2013 + + - Use node::MakeCallback() instead of direct v8::Function::Call() + +### 0.5.0 Nov 11 2013 + + - Added @TooTallNate as collaborator + - New, much simpler, "include_dirs" for binding.gyp + - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros + +### 0.4.4 Nov 2 2013 + + - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ + +### 0.4.3 Nov 2 2013 + + - Include node_object_wrap.h, removed from node.h for Node 0.11.8. + +### 0.4.2 Nov 2 2013 + + - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for + Node 0.11.8 release. + +### 0.4.1 Sep 16 2013 + + - Added explicit `#include ` as it was removed from node.h for v0.11.8 + +### 0.4.0 Sep 2 2013 + + - Added NAN_INLINE and NAN_DEPRECATED and made use of them + - Added NanError, NanTypeError and NanRangeError + - Cleaned up code + +### 0.3.2 Aug 30 2013 + + - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent + in NanAsyncWorker + +### 0.3.1 Aug 20 2013 + + - fix "not all control paths return a value" compile warning on some platforms + +### 0.3.0 Aug 19 2013 + + - Made NAN work with NPM + - Lots of fixes to NanFromV8String, pulling in features from new Node core + - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API + - Added optional error number argument for NanThrowError() + - Added NanInitPersistent() + - Added NanReturnNull() and NanReturnEmptyString() + - Added NanLocker and NanUnlocker + - Added missing scopes + - Made sure to clear disposed Persistent handles + - Changed NanAsyncWorker to allocate error messages on the heap + - Changed NanThrowError(Local) to NanThrowError(Handle) + - Fixed leak in NanAsyncWorker when errmsg is used + +### 0.2.2 Aug 5 2013 + + - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() + +### 0.2.1 Aug 5 2013 + + - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for + NanFromV8String() + +### 0.2.0 Aug 5 2013 + + - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, + NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY + - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, + _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, + _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, + _NAN_PROPERTY_QUERY_ARGS + - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer + - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, + NAN_WEAK_CALLBACK_DATA, NanMakeWeak + - Renamed THROW_ERROR to _NAN_THROW_ERROR + - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) + - Added NanBufferUse(char*, uint32_t) + - Added NanNewContextHandle(v8::ExtensionConfiguration*, + v8::Handle, v8::Handle) + - Fixed broken NanCallback#GetFunction() + - Added optional encoding and size arguments to NanFromV8String() + - Added NanGetPointerSafe() and NanSetPointerSafe() + - Added initial test suite (to be expanded) + - Allow NanUInt32OptionValue to convert any Number object + +### 0.1.0 Jul 21 2013 + + - Added `NAN_GETTER`, `NAN_SETTER` + - Added `NanThrowError` with single Local argument + - Added `NanNewBufferHandle` with single uint32_t argument + - Added `NanHasInstance(Persistent&, Handle)` + - Added `Local NanCallback#GetFunction()` + - Added `NanCallback#Call(int, Local[])` + - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/sleep/node_modules/nan/LICENSE.md b/node_modules/sleep/node_modules/nan/LICENSE.md new file mode 100644 index 0000000..e4fc412 --- /dev/null +++ b/node_modules/sleep/node_modules/nan/LICENSE.md @@ -0,0 +1,13 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2016 NAN contributors +----------------------------------- + +*NAN contributors listed at * + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/sleep/node_modules/nan/appveyor.yml b/node_modules/sleep/node_modules/nan/appveyor.yml new file mode 100644 index 0000000..055379f --- /dev/null +++ b/node_modules/sleep/node_modules/nan/appveyor.yml @@ -0,0 +1,38 @@ +# http://www.appveyor.com/docs/appveyor-yml + +# Test against these versions of Io.js and Node.js. +environment: + matrix: + # node.js + - nodejs_version: "0.8" + - nodejs_version: "0.10" + - nodejs_version: "0.12" + - nodejs_version: "3" + - nodejs_version: "4" + - nodejs_version: "5" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node 0.STABLE.latest + - ps: Install-Product node $env:nodejs_version + - IF %nodejs_version% EQU 0.8 npm -g install npm@2 + - IF %nodejs_version% EQU 0.8 set PATH=%APPDATA%\npm;%PATH% + - npm -g install npm + - IF %nodejs_version% NEQ 0.8 set PATH=%APPDATA%\npm;%PATH% + # Typical npm stuff. + - npm install + - npm run rebuild-tests + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - IF %nodejs_version% LSS 1 (npm test) ELSE (IF %nodejs_version% LSS 4 (iojs node_modules\tap\bin\tap.js --gc test/js/*-test.js) ELSE (node node_modules\tap\bin\tap.js --gc test/js/*-test.js)) + +# Don't actually build. +build: off + +# Set build version format here instead of in the admin panel. +version: "{build}" diff --git a/node_modules/sleep/node_modules/nan/doc/.build.sh b/node_modules/sleep/node_modules/nan/doc/.build.sh new file mode 100755 index 0000000..72cd743 --- /dev/null +++ b/node_modules/sleep/node_modules/nan/doc/.build.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +files=" \ + methods.md \ + scopes.md \ + persistent.md \ + new.md \ + converters.md \ + maybe_types.md \ + script.md \ + errors.md \ + buffers.md \ + callback.md \ + asyncworker.md \ + string_bytes.md \ + object_wrappers.md \ + v8_internals.md \ + v8_misc.md \ + node_misc.md \ +" + +__dirname=$(dirname "${BASH_SOURCE[0]}") +head=$(perl -e 'while (<>) { if (!$en){print;} if ($_=~/ NanNew("foo").ToLocalChecked() */ + if (arguments[groups[3][0]] === 'NanNew') { + return [arguments[0], '.ToLocalChecked()'].join(''); + } + + /* insert warning for removed functions as comment on new line above */ + switch (arguments[groups[4][0]]) { + case 'GetIndexedPropertiesExternalArrayData': + case 'GetIndexedPropertiesExternalArrayDataLength': + case 'GetIndexedPropertiesExternalArrayDataType': + case 'GetIndexedPropertiesPixelData': + case 'GetIndexedPropertiesPixelDataLength': + case 'HasIndexedPropertiesInExternalArrayData': + case 'HasIndexedPropertiesInPixelData': + case 'SetIndexedPropertiesToExternalArrayData': + case 'SetIndexedPropertiesToPixelData': + return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); + default: + } + + /* remove unnecessary NanScope() */ + switch (arguments[groups[5][0]]) { + case 'NAN_GETTER': + case 'NAN_METHOD': + case 'NAN_SETTER': + case 'NAN_INDEX_DELETER': + case 'NAN_INDEX_ENUMERATOR': + case 'NAN_INDEX_GETTER': + case 'NAN_INDEX_QUERY': + case 'NAN_INDEX_SETTER': + case 'NAN_PROPERTY_DELETER': + case 'NAN_PROPERTY_ENUMERATOR': + case 'NAN_PROPERTY_GETTER': + case 'NAN_PROPERTY_QUERY': + case 'NAN_PROPERTY_SETTER': + return arguments[groups[5][0] - 1]; + default: + } + + /* Value converstion */ + switch (arguments[groups[6][0]]) { + case 'Boolean': + case 'Int32': + case 'Integer': + case 'Number': + case 'Object': + case 'String': + case 'Uint32': + return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); + default: + } + + /* other value conversion */ + switch (arguments[groups[7][0]]) { + case 'BooleanValue': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'Int32Value': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'IntegerValue': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'Uint32Value': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + default: + } + + /* NAN_WEAK_CALLBACK */ + if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { + return ['template\nvoid ', + arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); + } + + /* use methods on NAN classes instead */ + switch (arguments[groups[9][0]]) { + case 'NanDisposePersistent': + return [arguments[groups[9][0] + 1], '.Reset('].join(''); + case 'NanObjectWrapHandle': + return [arguments[groups[9][0] + 1], '->handle('].join(''); + default: + } + + /* use method on NanPersistent instead */ + if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { + return arguments[groups[10][0] + 1] + '.SetWeak('; + } + + /* These return Maybes, the upper ones take no arguments */ + switch (arguments[groups[11][0]]) { + case 'GetEndColumn': + case 'GetFunction': + case 'GetLineNumber': + case 'GetOwnPropertyNames': + case 'GetPropertyNames': + case 'GetSourceLine': + case 'GetStartColumn': + case 'NewInstance': + case 'ObjectProtoToString': + case 'ToArrayIndex': + case 'ToDetailString': + return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); + case 'CallAsConstructor': + case 'CallAsFunction': + case 'CloneElementAt': + case 'Delete': + case 'ForceSet': + case 'Get': + case 'GetPropertyAttributes': + case 'GetRealNamedProperty': + case 'GetRealNamedPropertyInPrototypeChain': + case 'Has': + case 'HasOwnProperty': + case 'HasRealIndexedProperty': + case 'HasRealNamedCallbackProperty': + case 'HasRealNamedProperty': + case 'Set': + case 'SetAccessor': + case 'SetIndexedPropertyHandler': + case 'SetNamedPropertyHandler': + case 'SetPrototype': + return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); + default: + } + + /* Automatic ToLocalChecked(), take it or leave it */ + switch (arguments[groups[12][0]]) { + case 'Date': + case 'String': + case 'RegExp': + return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); + default: + } + + /* NanEquals is now required for uniformity */ + if (arguments[groups[13][0]] === 'Equals') { + return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); + } + + /* use method on replacement class instead */ + if (arguments[groups[14][0]] === 'NanAssignPersistent') { + return [arguments[groups[14][0] + 1], '.Reset('].join(''); + } + + /* args --> info */ + if (arguments[groups[15][0]] === 'args') { + return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); + } + + /* ObjectWrap --> NanObjectWrap */ + if (arguments[groups[16][0]] === 'ObjectWrap') { + return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); + } + + /* Persistent --> NanPersistent */ + if (arguments[groups[17][0]] === 'Persistent') { + return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); + } + + /* This should not happen. A switch is probably missing a case if it does. */ + throw 'Unhandled match: ' + arguments[0]; +} + +/* reads a file, runs replacement and writes it back */ +function processFile(file) { + fs.readFile(file, {encoding: 'utf8'}, function (err, data) { + if (err) { + throw err; + } + + /* run replacement twice, might need more runs */ + fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { + if (err) { + throw err; + } + }); + }); +} + +/* process file names from command line and process the identified files */ +for (i = 2, length = process.argv.length; i < length; i++) { + glob(process.argv[i], function (err, matches) { + if (err) { + throw err; + } + matches.forEach(processFile); + }); +} diff --git a/node_modules/sleep/node_modules/nan/tools/README.md b/node_modules/sleep/node_modules/nan/tools/README.md new file mode 100644 index 0000000..7f07e4b --- /dev/null +++ b/node_modules/sleep/node_modules/nan/tools/README.md @@ -0,0 +1,14 @@ +1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, +false positives and missed opportunities. The input files are rewritten in place. Make sure that +you have backups. You will have to manually review the changes afterwards and do some touchups. + +```sh +$ tools/1to2.js + + Usage: 1to2 [options] + + Options: + + -h, --help output usage information + -V, --version output the version number +``` diff --git a/node_modules/sleep/node_modules/nan/tools/package.json b/node_modules/sleep/node_modules/nan/tools/package.json new file mode 100644 index 0000000..2dcdd78 --- /dev/null +++ b/node_modules/sleep/node_modules/nan/tools/package.json @@ -0,0 +1,19 @@ +{ + "name": "1to2", + "version": "1.0.0", + "description": "NAN 1 -> 2 Migration Script", + "main": "1to2.js", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/nan.git" + }, + "contributors": [ + "Benjamin Byholm (https://github.com/kkoopa/)", + "Mathias Küsel (https://github.com/mathiask88/)" + ], + "dependencies": { + "glob": "~5.0.10", + "commander": "~2.8.1" + }, + "license": "MIT" +} diff --git a/node_modules/sleep/package.json b/node_modules/sleep/package.json new file mode 100644 index 0000000..b3ee76c --- /dev/null +++ b/node_modules/sleep/package.json @@ -0,0 +1,59 @@ +{ + "name": "sleep", + "version": "3.0.1", + "main": "index.js", + "description": "Add sleep() and usleep() to nodejs", + "homepage": "http://github.com/ErikDubbelboer/node-sleep", + "author": { + "name": "Erik Dubbelboer", + "email": "erik@dubbelboer.com" + }, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + }, + "keywords": [ + "sleep", + "usleep" + ], + "repository": { + "type": "git", + "url": "https://github.com/ErikDubbelboer/node-sleep.git" + }, + "dependencies": { + "nan": ">=2.0.0" + }, + "gypfile": true, + "scripts": { + "install": "node-gyp rebuild" + }, + "gitHead": "d4824c0466f893d0142c6715acd36c47bf87fac9", + "bugs": { + "url": "https://github.com/ErikDubbelboer/node-sleep/issues" + }, + "_id": "sleep@3.0.1", + "_shasum": "be4d17c579360e07e04ed8172ba2b10a69054df3", + "_from": "sleep@*", + "_npmVersion": "2.14.12", + "_nodeVersion": "4.2.4", + "_npmUser": { + "name": "erikdubbelboer", + "email": "erik@dubbelboer.com" + }, + "maintainers": [ + { + "name": "erikdubbelboer", + "email": "erik@dubbelboer.com" + } + ], + "dist": { + "shasum": "be4d17c579360e07e04ed8172ba2b10a69054df3", + "tarball": "https://registry.npmjs.org/sleep/-/sleep-3.0.1.tgz" + }, + "_npmOperationalInternal": { + "host": "packages-6-west.internal.npmjs.com", + "tmp": "tmp/sleep-3.0.1.tgz_1454489151975_0.026494406163692474" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/sleep/-/sleep-3.0.1.tgz" +} diff --git a/node_modules/sleep/sleep.cc b/node_modules/sleep/sleep.cc new file mode 100644 index 0000000..a81830c --- /dev/null +++ b/node_modules/sleep/sleep.cc @@ -0,0 +1,69 @@ + +#include + + +using v8::FunctionTemplate; +using v8::Handle; +using v8::Object; +using v8::String; + + +#if defined _WIN32 || defined _WIN64 +unsigned int sleep(unsigned int seconds) +{ + Sleep(seconds * 1000); + return 0; +} +int usleep(unsigned __int64 usec) +{ + LARGE_INTEGER li; + li.QuadPart = -10 * usec; // negative values for relative time + + HANDLE timer = CreateWaitableTimer(NULL, TRUE, NULL); + if(!timer) return -1; + + SetWaitableTimer(timer, &li, 0, NULL, NULL, 0); + WaitForSingleObject(timer, INFINITE); + CloseHandle(timer); + return 0; +} +#else +# include +#endif + + +NAN_METHOD(Sleep) { + Nan::HandleScope scope; + + if (info.Length() < 1 || !info[0]->IsUint32()) { + return Nan::ThrowError("Expected number of seconds"); + } + + sleep(info[0]->Uint32Value()); + + info.GetReturnValue().SetUndefined(); +} + +NAN_METHOD(USleep) { + Nan::HandleScope scope; + + if (info.Length() < 1 || !info[0]->IsUint32()) { + return Nan::ThrowError("Expected number of microseconds"); + } + + usleep(info[0]->Uint32Value()); + + info.GetReturnValue().SetUndefined(); +} + + +NAN_MODULE_INIT(init) { + Nan::Set(target, Nan::New("sleep").ToLocalChecked(), + Nan::New(Sleep)->GetFunction()); + Nan::Set(target, Nan::New("usleep").ToLocalChecked(), + Nan::New(USleep)->GetFunction()); +} + + +NODE_MODULE(node_sleep, init) + diff --git a/node_modules/sleep/test.js b/node_modules/sleep/test.js new file mode 100644 index 0000000..e0735ad --- /dev/null +++ b/node_modules/sleep/test.js @@ -0,0 +1,12 @@ + +var sleep = require('./'); + +console.log('sleeping for 1 seconds...'); +sleep.sleep(1); +console.log('done'); + + +console.log('sleeping for 2000000 microseconds (2 seconds)'); +sleep.usleep(2000000); +console.log('done'); + diff --git a/routes_api.js b/routes_api.js index 4d82d26..3d92125 100755 --- a/routes_api.js +++ b/routes_api.js @@ -1,403 +1,450 @@ -// fmon version 2 - (Mains Frequency Monitoring API) -var express = require('express'); -var crypto = require('crypto'); -var router = express.Router(); -var jwt = require('jwt-simple'); -var sqlite3 = require('sqlite3').verbose(); -var path = require('path'); - -var dbfile = "miniproject.db"; -var db = new sqlite3.Database(dbfile); - -var sys= require('sys'); -var exec= require('child_process').exec; - -function puts(error, stdout, stderr) { console.log("SYSEXEC: " + stdout) }; - -router.all( new RegExp("[^(\/login|\/register)]"), function (req, res, next) { - - console.log("Authenticating..."); - - var token = (req.header('X-Access-Token')) || ''; - if (token) { - try { - var decoded = jwt.decode(token, req.app.get('secretkey')); - - var query = "SELECT COUNT(username) AS num FROM user WHERE access='" + token + "' AND username='" + decoded.iss + "';"; - db.get(query, function (err, row) { - if(err) throw err; - - console.log("Found " + row.num + " valid users"); - - if (row.num == 1) { - req.app.set("userid", decoded.iss); - console.log("Userid: " + req.app.get('userid')); - return next(); - } - else { - res.status(401); - res.json({ - "status": 401, "message": "unknown userid, bye" - }); - return; - } - - }); - } - catch (err) { - console.log("Authorization failed: " + err); - res.status(401); - res.json({ - "status": 401, "message": "unknown userid, bye" - }); - } - } - else - { - console.log("Authorization failed: Token not set"); - res.status(401); - res.json({ - "status": 401, "message": "token not set" - }); - } -}); - -// Restfull register -router.post('/register', function (req, res) { - - var username = req.body.username || ''; - var password = req.body.password || ''; - - // Check for empy body - if (username == '' || password == '') { - res.status(401); - res.json({ - "status": 401, - "message": "Body is empty" - }); - return; - } - - var query = "SELECT COUNT(*) AS num FROM user WHERE username='" + username + "';"; - db.get(query, function(err, row){ - if(err) throw err; - - if(row.num >= 1) - { - var results = []; - res.status(400); - results.push({ - success:false, - msg: "Username already exists" - }); - res.json(results); - return; - } - else - { - // db lookup - var query = "INSERT INTO user VALUES('" + username + "', '" + password + "', 'null');"; - db.run(query); - - var results = []; - res.status(200); - results.push({ - success:true, - username: username, - password: password - }); - - res.json(results); - } - }); - - -}); - -// Restfull login -router.post('/login', function (req, res) { - - var username = req.body.username || ''; - var password = req.body.password || ''; - - // Check for empy body - if (username == '' || password == '') { - res.status(401); - res.json({ - "status": 401, - "message": "Body is empty" - }); - return; - } - - var query = "SELECT COUNT(*) AS num FROM user WHERE username='" + username + "' AND password='" + password + "';"; - db.get(query, function (err, row) { - if(err) throw err; - - // Check for valid user/passwd combo - if (row.num == 1) { - var now = new Date(); - var expires = now.setHours(now.getDay() + 10); - var token = jwt.encode({ - iss: username, - exp: expires - }, req.app.get('secretkey')); - - var query = "UPDATE user SET access='" + token + "' WHERE username='" + username + "';"; - db.run(query); - - res.status(200); - res.json({ - status: true, - token: token, - expires: expires, - user: username - }); - } - else { - res.status(401); - res.json({ - "status": 401, - "status": false, - "message": "Invalid username or password" - }); - } - - }); -}); - -// Restfull logout -router.post('/logout', function (req, res) { - - var token = (req.header('X-Access-Token')) || ''; - - var query = "UPDATE user SET access='' WHERE access='" + token + "';"; - - db.run(query); - - var results = []; - res.status(200); - results.push({ - success:true, - msg: "Logged out" - }); - - res.json(results); -}); - -//Turn on or of a light -router.get('/light/:group/:num/:state', function (req, res) { - var group = req.params.group; - var num = req.params.num; - var state = req.params.state; - - var results = []; - res.status(200); - results.push({ - success:true, - group: group, - number:num, - state:state - }); - - exec('sudo ./kaku ' + group + ' ' + num + ' ' + state, puts); - res.json(results); -}); - -//Turn on or off a light in the database -router.get('/light/:name/:state', function (req, res) { - var name = req.params.name; - var state = req.params.state; - - var group; - var num; - - var query = "SELECT class, channel FROM light WHERE name='" + name + "';"; - db.get(query, function (err, row) { - if(err) throw err; - - group = row.class; - num = row.channel; - - var results = []; - res.status(200); - results.push({ - success:true, - name: name, - group: group, - num: num, - state: state - }); - - exec('sudo ./kaku ' + group + ' ' + num + ' ' + state, puts); - res.json(results); - - }); -}); - -//Add a new light to the database -router.post('/light', function (req, res) { - var name = req.body.name || ''; - var group = req.body.group || ''; - var channel = req.body.channel || ''; - - // Check for empy body - if (name == '' || group == '' || channel == '') { - res.status(401); - res.json({ - "status": 401, - "message": "Body is empty" - }); - return; - } - - var query = "SELECT COUNT(*) AS num FROM light WHERE name='" + name + "';"; - db.get(query, function(err, row){ - if(err) throw err; - - if(row.num >= 1) - { - var results = []; - res.status(400); - results.push({ - success:false, - msg: "Name already in use" - }); - res.json(results); - return; - } - else - { - // db lookup - var query = "INSERT INTO light VALUES('" + name + "', '" + group + "', '" + channel + "');"; - db.run(query); - - var results = []; - res.status(200); - results.push({ - success:true, - group: group, - channel: channel - }); - - res.json(results); - } - }); -}); - - -//Update a light in the database -router.put('/light', function (req, res) { - var name = req.body.name || ''; - var group = req.body.group || ''; - var channel = req.body.channel || ''; - - // Check for empy body - if (name == '' || group == '' || channel == '') { - res.status(401); - res.json({ - "status": 401, - "message": "Body is empty" - }); - return; - } - - // db lookup - var query = "UPDATE light SET class='" + group + "', channel='" + channel + "' WHERE name='" + name + "';"; - db.run(query); - - var results = []; - res.status(200); - results.push({ - success:true, - name: name, - group: group, - channel: channel - }); - - res.json(results); -}); - -//Get all the users in the database (Testing purposes only) -router.get('/user', function (req, res) { - - var token = (req.header('X-Access-Token')) || ''; - - // db lookup - var query = "SELECT username FROM user WHERE access='" + token + "';"; - db.get(query, function (err, rows) { - if(err) throw err; - var results = []; - results.push({ - username: item.username - }); - res.json(results); - }); - res.status(200); -}); - -//Get all the users in the database (Testing purposes only) -router.get('/users', function (req, res) { - - // db lookup - var query = "SELECT username, password, access FROM user WHERE 1;"; - db.all(query, function (err, rows) { - if(err) throw err; - var results = []; - var users = []; - rows.forEach(function(item){ - users.push({ - username: item.username, - password: item.password, - access: item.access - }); - }); - results.push({users: users}); - res.json(results); - }); - res.status(200); -}); - -//Get all the lights in te database -router.get('/lights', function (req, res) { - - // db lookup - var query = "SELECT name, class, channel FROM light WHERE 1;"; - db.all(query, function (err, rows) { - if(err) throw err; - var results = []; - var lights = []; - rows.forEach(function(item){ - lights.push({ - name: item.name, - group: item.class, - channel: item.channel - }); - }); - results.push({lights: lights}); - res.json(results); - }); - res.status(200); -}); - -//Fall back, display an error -router.get('/light*', function (req, res) { - var results = []; - res.status(400); - results.push({ - success:false, - message:'Params required' - }); - res.json(results); -}); - -// Fall back, display some info -router.get('/', function (req, res) { - res.status(200); - res.json({ - "description": "Project X API version 2. Welcome" - }); -}); - - -module.exports = router; +// fmon version 2 - (Mains Frequency Monitoring API) +var express = require('express'); +var crypto = require('crypto'); +var router = express.Router(); +var jwt = require('jwt-simple'); +var sqlite3 = require('sqlite3').verbose(); +var path = require('path'); +var gpio = require('gpio'); +var sleep = require('sleep'); + +var gpio0 = gpio.export(17, { + direction: "in", + ready: function() { + } +}); + +var dbfile = "miniproject.db"; +var db = new sqlite3.Database(dbfile); + +var sys= require('sys'); +var exec= require('child_process').exec; + +function puts(error, stdout, stderr) { console.log("Executing a command"); /* nope */ }; + +router.all( new RegExp("[^(\/login|\/register)]"), function (req, res, next) { + + console.log("Authenticating..."); + + var token = (req.header('X-Access-Token')) || ''; + if (token) { + try { + var decoded = jwt.decode(token, req.app.get('secretkey')); + + var query = "SELECT COUNT(username) AS num FROM user WHERE access='" + token + "' AND username='" + decoded.iss + "';"; + db.get(query, function (err, row) { + if(err) throw err; + + console.log("Found " + row.num + " valid users"); + + if (row.num == 1) { + req.app.set("userid", decoded.iss); + console.log("Userid: " + req.app.get('userid')); + return next(); + } + else { + res.status(401); + res.json({ + "status": 401, "message": "unknown userid, bye" + }); + return; + } + + }); + } + catch (err) { + console.log("Authorization failed: " + err); + res.status(401); + res.json({ + "status": 401, "message": "unknown userid, bye" + }); + } + } + else + { + console.log("Authorization failed: Token not set"); + res.status(401); + res.json({ + "status": 401, "message": "token not set" + }); + } +}); + +// Restfull register +router.post('/register', function (req, res) { + + var username = req.body.username || ''; + var password = req.body.password || ''; + + // Check for empy body + if (username == '' || password == '') { + res.status(401); + res.json({ + "status": 401, + "message": "Body is empty" + }); + return; + } + + var query = "SELECT COUNT(*) AS num FROM user WHERE username='" + username + "';"; + db.get(query, function(err, row){ + if(err) throw err; + + if(row.num >= 1) + { + var results = []; + res.status(400); + results.push({ + success:false, + msg: "Username already exists" + }); + res.json(results); + return; + } + else + { + // db lookup + var query = "INSERT INTO user VALUES('" + username + "', '" + password + "', 'null');"; + db.run(query); + + var results = []; + res.status(200); + results.push({ + success:true, + username: username, + password: password + }); + + res.json(results); + } + }); + + +}); + +// Restfull login +router.post('/login', function (req, res) { + + var username = req.body.username || ''; + var password = req.body.password || ''; + + // Check for empy body + if (username == '' || password == '') { + res.status(401); + res.json({ + "status": 401, + "message": "Body is empty" + }); + return; + } + + var query = "SELECT COUNT(*) AS num FROM user WHERE username='" + username + "' AND password='" + password + "';"; + db.get(query, function (err, row) { + if(err) throw err; + + // Check for valid user/passwd combo + if (row.num == 1) { + var now = new Date(); + var expires = now.setHours(now.getDay() + 10); + var token = jwt.encode({ + iss: username, + exp: expires + }, req.app.get('secretkey')); + + var query = "UPDATE user SET access='" + token + "' WHERE username='" + username + "';"; + db.run(query); + + res.status(200); + res.json({ + status: true, + token: token, + expires: expires, + user: username + }); + } + else { + res.status(401); + res.json({ + "status": 401, + "status": false, + "message": "Invalid username or password" + }); + } + + }); +}); + +// Restfull logout +router.post('/logout', function (req, res) { + + var token = (req.header('X-Access-Token')) || ''; + + var query = "UPDATE user SET access='' WHERE access='" + token + "';"; + + db.run(query); + + var results = []; + res.status(200); + results.push({ + success:true, + msg: "Logged out" + }); + + res.json(results); +}); + +//Turn on or of a light +router.get('/light/:group/:num/:state', function (req, res) { + var group = req.params.group; + var num = req.params.num; + var state = req.params.state; + + var results = []; + res.status(200); + results.push({ + success:true, + group: group, + number:num, + state:state + }); + + exec('sudo ./kaku ' + group + ' ' + num + ' ' + state, puts); + res.json(results); +}); + +//Turn on or off a light in the database +router.get('/light/:name/:state', function (req, res) { + var name = req.params.name; + var state = req.params.state; + + var group; + var num; + + var query = "SELECT class, channel FROM light WHERE name='" + name + "';"; + db.get(query, function (err, row) { + if(err) throw err; + + group = row.class; + num = row.channel; + + var results = []; + res.status(200); + results.push({ + success:true, + name: name, + group: group, + num: num, + state: state + }); + + exec('sudo ./kaku ' + group + ' ' + num + ' ' + state, puts); + res.json(results); + + }); +}); + +//Turn on or off a light in the database +router.delete('/light/:name', function (req, res) { + var name = req.params.name; + + var query = "DELETE FROM light WHERE name='" + name + "';"; + db.run(query); + + var results = []; + res.status(200); + results.push({ + success:true, + name: name + }); + + res.json(results); +}); + +//Add a new light to the database +router.post('/light', function (req, res) { + var name = req.body.name || ''; + var group = req.body.group || ''; + var channel = req.body.channel || ''; + + // Check for empy body + if (name == '' || group == '' || channel == '') { + res.status(401); + res.json({ + "status": 401, + "message": "Body is empty" + }); + return; + } + + var query = "SELECT COUNT(*) AS num FROM light WHERE name='" + name + "';"; + db.get(query, function(err, row){ + if(err) throw err; + + if(row.num >= 1) + { + var results = []; + res.status(400); + results.push({ + success:false, + msg: "Name already in use" + }); + res.json(results); + return; + } + else + { + // db lookup + var query = "INSERT INTO light VALUES('" + name + "', '" + group + "', '" + channel + "');"; + db.run(query); + + var results = []; + res.status(200); + results.push({ + success:true, + group: group, + channel: channel + }); + + res.json(results); + } + }); +}); + + +//Update a light in the database +router.put('/light', function (req, res) { + var name = req.body.name || ''; + var group = req.body.group || ''; + var channel = req.body.channel || ''; + + // Check for empy body + if (name == '' || group == '' || channel == '') { + res.status(401); + res.json({ + "status": 401, + "message": "Body is empty" + }); + return; + } + + // db lookup + var query = "UPDATE light SET class='" + group + "', channel='" + channel + "' WHERE name='" + name + "';"; + db.run(query); + + var results = []; + res.status(200); + results.push({ + success:true, + name: name, + group: group, + channel: channel + }); + + res.json(results); +}); + +//Get all the users in the database (Testing purposes only) +router.get('/user', function (req, res) { + + var token = (req.header('X-Access-Token')) || ''; + + // db lookup + var query = "SELECT username FROM user WHERE access='" + token + "';"; + db.get(query, function (err, rows) { + if(err) throw err; + var results = []; + results.push({ + username: item.username + }); + res.json(results); + }); + res.status(200); +}); + +//Get all the users in the database (Testing purposes only) +router.get('/users', function (req, res) { + + // db lookup + var query = "SELECT username, password, access FROM user WHERE 1;"; + db.all(query, function (err, rows) { + if(err) throw err; + var results = []; + var users = []; + rows.forEach(function(item){ + users.push({ + username: item.username, + password: item.password, + access: item.access + }); + }); + results.push({users: users}); + res.json(results); + }); + res.status(200); +}); + +//Get all the lights in te database +router.get('/lights', function (req, res) { + + // db lookup + var query = "SELECT name, class, channel FROM light WHERE 1;"; + db.all(query, function (err, rows) { + if(err) throw err; + var results = []; + var lights = []; + rows.forEach(function(item){ + lights.push({ + name: item.name, + group: item.class, + channel: item.channel + }); + }); + results.push({lights: lights}); + res.json(results); + }); + res.status(200); +}); + +//Fall back, display an error +router.get('/light*', function (req, res) { + var results = []; + res.status(400); + results.push({ + success:false, + message:'Params required' + }); + res.json(results); +}); + +// Fall back, display some info +router.get('/', function (req, res) { + res.status(200); + res.json({ + "description": "Project X API version 2. Welcome" + }); +}); + +// bind to the "change" event +gpio0.on("change", function(val) { + // value will report either 1 or 0 (number) when the value changes + console.log("GPIO CHANGED: " + val); + + if(val == 0) + return; + + var query = "SELECT class, channel FROM light WHERE 1;"; + db.all(query, function (err, rows) { + if(err) throw err; + + var count = 0; + + rows.forEach(function(item){ + sleep.sleep(count); + console.log("Turning off " + item.class + " - " + item.channel + " (sleep:" + count + ")"); + exec('sudo ./kaku ' + item.class + ' ' + item.channel + ' off', puts); + count += 3; + }); + }); +}); + +module.exports = router;