Added API: rfid_start_record, rfid_stop_record.
This commit is contained in:
parent
7e8979d41e
commit
98e690ec2c
28
handlers.js
28
handlers.js
@ -96,6 +96,8 @@ function homepage(res, req) {
|
||||
+ '<ul>'
|
||||
+ '<li><a target="results" href="/cgi-bin/rfid_list">rfid_list</a></li>'
|
||||
+ '<li><a target="results" href="/cgi-bin/rfid_list_ext">rfid_list_ext</a></li>'
|
||||
+ '<li><a target="results" href="/cgi-bin/rfid_start_record">rfid_start_record</a></li>'
|
||||
+ '<li><a target="results" href="/cgi-bin/rfid_stop_record">rfid_stop_record</a></li>'
|
||||
+ '</ul>'
|
||||
+ '<h2>Misc.</h2>'
|
||||
+ '<ul>'
|
||||
@ -356,11 +358,11 @@ function sound(res, req) {
|
||||
data = '{"return":"1","msg":"Unable to perform action, rabbit is sleeping."}';
|
||||
} else {
|
||||
var id = getParameter(req, "id");
|
||||
var url = getParameter(req, "url");
|
||||
var uri = getParameter(req, "url");
|
||||
|
||||
if (id && url) {
|
||||
if (id && uri) {
|
||||
data = '{"return":"1","msg":"You cannot use ID and URL parameters at the same time."}';
|
||||
} else if ((id === undefined) && (url === undefined)) {
|
||||
} else if ((id === undefined) && (uri === undefined)) {
|
||||
data = '{"return":"1","msg":"No sound to play."}';
|
||||
} else if (id) {
|
||||
data = '{"return":"0"}';
|
||||
@ -622,6 +624,26 @@ function rfid_list_ext(res, req) {
|
||||
}
|
||||
exports.rfid_list_ext = rfid_list_ext;
|
||||
|
||||
function rfid_start_record(res, req) {
|
||||
log.trace('rfid_start_record: begin');
|
||||
|
||||
var data = '{"return":"0"}';
|
||||
|
||||
sendResponse(res, data);
|
||||
log.trace('rfid_start_record: end');
|
||||
}
|
||||
exports.rfid_start_record = rfid_start_record;
|
||||
|
||||
function rfid_stop_record(res, req) {
|
||||
log.trace('rfid_stop_record: begin');
|
||||
|
||||
var data = '{"return":"0"}';
|
||||
|
||||
sendResponse(res, data);
|
||||
log.trace('rfid_stop_record: end');
|
||||
}
|
||||
exports.rfid_stop_record = rfid_stop_record;
|
||||
|
||||
function clock(res, req) {
|
||||
log.trace('clock: begin');
|
||||
|
||||
|
2
index.js
2
index.js
@ -53,6 +53,8 @@ handle['/cgi-bin/reboot'] = handlers.reboot;
|
||||
handle['/cgi-bin/reset_install_flag'] = handlers.reset_install_flag;
|
||||
handle['/cgi-bin/rfid_list'] = handlers.rfid_list;
|
||||
handle['/cgi-bin/rfid_list_ext'] = handlers.rfid_list_ext;
|
||||
handle['/cgi-bin/rfid_start_record'] = handlers.rfid_start_record;
|
||||
handle['/cgi-bin/rfid_stop_record'] = handlers.rfid_stop_record;
|
||||
handle['/cgi-bin/sleep'] = handlers.sleep;
|
||||
handle['/cgi-bin/snapshot'] = handlers.snapshot;
|
||||
handle['/cgi-bin/snapshot_ftp'] = handlers.snapshot_ftp;
|
||||
|
@ -87,7 +87,7 @@ function sleep() {
|
||||
sleeping = true;
|
||||
sleepTime = Math.floor(new Date().getTime() / 1000);
|
||||
return sleeping;
|
||||
};
|
||||
}
|
||||
exports.sleep = sleep;
|
||||
|
||||
function wakeup() {
|
||||
@ -95,14 +95,14 @@ function wakeup() {
|
||||
sleeping = false;
|
||||
sleepTime = 0;
|
||||
return sleeping;
|
||||
};
|
||||
}
|
||||
exports.wakeup = wakeup;
|
||||
|
||||
function reboot() {
|
||||
log.info("Karotz reboot");
|
||||
wakeup();
|
||||
return sleeping;
|
||||
};
|
||||
}
|
||||
exports.reboot = reboot;
|
||||
|
||||
function leds(color1, color2, pulse, speed) {
|
||||
|
14
router.js
14
router.js
@ -35,14 +35,14 @@ function route(pathname, handle, res, req) {
|
||||
|
||||
if (typeof handle[pathname] === 'function') {
|
||||
return handle[pathname](res, req);
|
||||
} else {
|
||||
log.failure('No request handler found for ' + pathname);
|
||||
res.writeHead(404, {
|
||||
'Content-Type' : 'text/plain'
|
||||
});
|
||||
res.write('404 Not Found');
|
||||
res.end();
|
||||
}
|
||||
|
||||
log.failure('No request handler found for ' + pathname);
|
||||
res.writeHead(404, {
|
||||
'Content-Type' : 'text/plain'
|
||||
});
|
||||
res.write('404 Not Found');
|
||||
res.end();
|
||||
}
|
||||
|
||||
exports.route = route;
|
||||
|
Loading…
x
Reference in New Issue
Block a user