Created
August 23, 2013 22:34
-
-
Save nsmith/6324655 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// =FACTORY=AGENT============================================================== // | |
const projectName = "Pivot Power Genius" | |
// Factory IMP Device Code | |
// ---------------------------------------------------------------------------- // | |
const MAJOR_VER = 0; // Major Version of this Release | |
const MINOR_VER = 1; // Minor Version of this Release | |
const RELEASE = 0; // Release Number of this Version | |
// ---------------------------------------------------------------------------- // | |
// Revision History | |
// V0.1.0 - <_G> Initial Release | |
// ============================================================================ // | |
mac <- false | |
impeeid <- false | |
device.on("register", function(params) { | |
mac = params.mac | |
impeeid = params.impeeid | |
}); | |
function mywebserver(request,res) | |
{ | |
server.log("Got HTTP Request."); | |
local request_body = http.jsondecode(request.body) | |
foreach(idx,param in request_body) { | |
if (param == "impee_id"){ | |
res.send(200, http.jsonencode({impee_id = impeeid, mac = mac})); | |
} | |
} | |
res.send(200, "OK") | |
} | |
http.onrequest(mywebserver); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment