Added API: display_cache, moods_list, rfid_list, rfid_list_ext,

stories_list.
This commit is contained in:
Olivier Bagot 2013-11-26 18:33:35 +01:00
parent f84fc56f85
commit 7e8979d41e
2 changed files with 80 additions and 0 deletions

View File

@ -81,6 +81,7 @@ function homepage(res, req) {
+ '<ul>'
+ '<li><a target="results" href="/cgi-bin/voice_list">voice_list</a></li>'
+ '<li><a target="results" href="/cgi-bin/tts?text=Hello%20World">tts</a></li>'
+ '<li><a target="results" href="/cgi-bin/display_cache">display_cache</a></li>'
+ '<li><a target="results" href="/cgi-bin/clear_cache">clear_cache</a></li>'
+ '</ul>'
+ '<h2>Photos</h2>'
@ -91,6 +92,16 @@ function homepage(res, req) {
+ '<li><a target="results" href="/cgi-bin/snapshot_get">snapshot_get</a>, <a target="results" href="/cgi-bin/snapshot_get?filename=snapshot.thumb.gif">snapshot_get(thumbnail)</a></li>'
+ '<li><a target="results" href="/cgi-bin/clear_snapshots">clear_snapshots</a></li>'
+ '</ul>'
+ '<h2>RFID</h2>'
+ '<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>'
+ '</ul>'
+ '<h2>Misc.</h2>'
+ '<ul>'
+ '<li><a target="results" href="/cgi-bin/moods_list">moods_list</a></li>'
+ '<li><a target="results" href="/cgi-bin/stories_list">stories_list</a></li>'
+ '</ul>'
+ '<h2>Apps</h2>'
+ '<ul>'
+ '<li><a target="results" href="/cgi-bin/apps/clock">clock</a>, <a target="results" href="/cgi-bin/apps/clock?hour=12">clock(12)</a></li>'
@ -565,6 +576,16 @@ function clear_cache(res, req) {
}
exports.clear_cache = clear_cache;
function display_cache(res, req) {
log.trace('display_cache: begin');
var data = '{"cache":[{"id":"6fcfe1b9dfc7fe6d3df40872d36f43ac","text":"bonjour lapin","voice":"margaux"}],"return":"0"}';
sendResponse(res, data);
log.trace('display_cache: end');
}
exports.display_cache = display_cache;
function clear_snapshots(res, req) {
log.trace('clear_snapshots: begin');
@ -575,6 +596,32 @@ function clear_snapshots(res, req) {
}
exports.clear_snapshots = clear_snapshots;
function rfid_list(res, req) {
log.trace('rfid_list: begin');
var data = '{"tags":['
+ '{"id":"D0021A35038F0CD2","type":"1","color":"4","cmd":"0","var":"-1","name":"" },'
+ '{ "id":"D0021A3506196568","type":"1","color":"3","cmd":"3","var":"-1","name":"Radio"}'
+ '],"return":"0"}';
sendResponse(res, data);
log.trace('rfid_list: end');
}
exports.rfid_list = rfid_list;
function rfid_list_ext(res, req) {
log.trace('rfid_list_ext: begin');
var data = '{"tags":['
+ '{"id":"D0021A35038F0CD2","type":"1","type_name":"FLATANOZ","color":"4","color_name":"JAUNE"},'
+ '{"id":"D0021A3506196568","type":"1","type_name":"FLATANOZ","color":"3","color_name":"VERT"}'
+ '],"return":"0"}';
sendResponse(res, data);
log.trace('rfid_list_ext: end');
}
exports.rfid_list_ext = rfid_list_ext;
function clock(res, req) {
log.trace('clock: begin');
@ -618,3 +665,31 @@ function moods(res, req) {
log.trace('moods: end');
}
exports.moods = moods;
function moods_list(res, req) {
log.trace('moods_list: begin');
// Only the first 5
var data = '{"moods":['
+ '{"id":"1","text":"Ronflements"},'
+ '{"id":"2","text":"B&acirc;illement"},'
+ '{"id":"3","text":"Eternuement Pardon !"},'
+ '{"id":"4","text":"Arracher les orties."},'
+ '{"id":"5","text":"Bonjour ! Je suis un lapin, je suis gentil. Ha ha ha ha&hellip;"}'
+ '],"return":"0"}';
sendResponse(res, data);
log.trace('moods_list: end');
}
exports.moods_list = moods_list;
function stories_list(res, req) {
log.trace('stories_list: begin');
var data = '{"stories":[],"return":"0"}';
sendResponse(res, data);
log.trace('stories_list: end');
}
exports.stories_list = stories_list;

View File

@ -39,6 +39,7 @@ handle['/cgi-bin'] = handlers.homepage;
// API
handle['/cgi-bin/clear_cache'] = handlers.clear_cache;
handle['/cgi-bin/clear_snapshots'] = handlers.clear_snapshots;
handle['/cgi-bin/display_cache'] = handlers.display_cache;
handle['/cgi-bin/ears'] = handlers.ears;
handle['/cgi-bin/ears_mode'] = handlers.ears_mode;
handle['/cgi-bin/ears_random'] = handlers.ears_random;
@ -46,9 +47,12 @@ handle['/cgi-bin/ears_reset'] = handlers.ears_reset;
handle['/cgi-bin/get_free_space'] = handlers.get_free_space;
handle['/cgi-bin/get_version'] = handlers.get_version;
handle['/cgi-bin/leds'] = handlers.leds;
handle['/cgi-bin/moods_list'] = handlers.moods_list;
handle['/cgi-bin/radios_list'] = handlers.radios_list;
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/sleep'] = handlers.sleep;
handle['/cgi-bin/snapshot'] = handlers.snapshot;
handle['/cgi-bin/snapshot_ftp'] = handlers.snapshot_ftp;
@ -58,6 +62,7 @@ handle['/cgi-bin/sound'] = handlers.sound;
handle['/cgi-bin/sound_control'] = handlers.sound_control;
handle['/cgi-bin/sound_list'] = handlers.sound_list;
handle['/cgi-bin/status'] = handlers.status;
handle['/cgi-bin/stories_list'] = handlers.stories_list;
handle['/cgi-bin/tts'] = handlers.tts;
handle['/cgi-bin/voice_list'] = handlers.voice_list;
handle['/cgi-bin/wakeup'] = handlers.wakeup;